Function zeros::bytes_to_hex

source ·
pub fn bytes_to_hex<B>(bytes: B) -> String
where B: AsRef<[u8]>,
Expand description

§Formats a byte slice as a hexadecimal string, in lower-case

This function uses HEX_STRS, which (at the time) was faster than format!("{:02x}", ...).

§Examples

assert_eq!(zeros::bytes_to_hex(     &[202, 254]), "cafe");
assert_eq!(zeros::bytes_to_hex(&[192, 255, 238]), "c0ffee");