pub fn decode_to_slice<T: AsRef<[u8]>>(
input: T,
output: &mut [u8],
) -> Result<(), FromHexError>Expand description
Decode a hex string into a mutable bytes slice.
Only lowercase characters are valid in the input string (e.g. f9b4ca).
§Errors
This function returns an error if the input is not an even number of characters long or contains invalid hex characters, or if the output slice is not exactly half the length of the input.
§Example
let mut bytes = [0u8; 4];
lowercase_hex::decode_to_slice("6b697769", &mut bytes).unwrap();
assert_eq!(&bytes, b"kiwi");
let res = lowercase_hex::decode_to_slice("6B697769", &mut bytes);
assert!(res.is_err());