const_hex

Function encode_prefixed

Source
pub fn encode_prefixed<T: AsRef<[u8]>>(data: T) -> String
Available on crate feature alloc only.
Expand description

Encodes data as a prefixed hex string using lowercase characters.

See encode() for more details.

ยงExamples

assert_eq!(const_hex::encode_prefixed("Hello world!"), "0x48656c6c6f20776f726c6421");
assert_eq!(const_hex::encode_prefixed([1, 2, 3, 15, 16]), "0x0102030f10");