pub const fn decode_array<const OUT: usize>(
encoded_data: &[u8],
) -> Result<[u8; OUT], DecodeError>Expand description
Decodes a hex string into a fixed-size array at compile time.
The generic parameter OUT is the output array length. It must be exactly
data.len() / 2 bytes long or an error panic is returned.
ยงExample
const RESULT: Result<[u8; 4], hex::DecodeError> =
hex::decode_array::<4>(b"deadbeef");
assert_eq!(RESULT.unwrap(), [0xDE, 0xAD, 0xBE, 0xEF]);