Function base16::encode_byte
source ·
[−]Expand description
Encode a single character as hex, returning a tuple containing the two encoded bytes in big-endian order – the order the characters would be in when written out (e.g. the top nibble is the first item in the tuple)
Example
assert_eq!(base16::encode_byte(0xff, base16::EncodeLower), [b'f', b'f']);
assert_eq!(base16::encode_byte(0xa0, base16::EncodeUpper), [b'A', b'0']);
assert_eq!(base16::encode_byte(3, base16::EncodeUpper), [b'0', b'3']);
Availability
This function is available whether or not the alloc
feature is enabled.