Function flow_sdk::prelude::hex::decode_to_slice[][src]

pub fn decode_to_slice<T>(data: T, out: &mut [u8]) -> Result<(), FromHexError> where
    T: AsRef<[u8]>, 
Expand description

Decode a hex string into a mutable bytes slice.

Both, upper and lower case characters are valid in the input string and can even be mixed (e.g. f9b4ca, F9B4CA and f9B4Ca are all valid strings).

Example

let mut bytes = [0u8; 4];
assert_eq!(hex::decode_to_slice("6b697769", &mut bytes as &mut [u8]), Ok(()));
assert_eq!(&bytes, b"kiwi");