pub fn encode_to_slice<T: AsRef<[u8]>>(
input: T,
output: &mut [u8],
) -> Result<(), FromHexError>
Expand description
Encodes some bytes into a mutable slice of bytes.
The output buffer, has to be able to hold at least input.len() * 2
bytes,
otherwise this function will return an error.
ยงExample
let mut bytes = [0u8; 4 * 2];
hex::encode_to_slice(b"kiwi", &mut bytes)?;
assert_eq!(&bytes, b"6b697769");