Function decode
pub fn decode<T>(input: impl AsRef<[u8]>) -> Result<T, DecodeError>where
T: FromHex,Expand description
Decode compact hex into an inferred vector or fixed-size array.
Accepts either digit case, but no prefixes, whitespace, or separators. Arrays require exactly their length in decoded bytes; vectors allocate only their decoded output. Empty input is valid for an empty vector or array.
use rama_utils::hex;
let bytes: Vec<u8> = hex::decode("00abFF")?;
assert_eq!(bytes, [0x00, 0xab, 0xff]);
assert_eq!(hex::decode::<[u8; 3]>(b"00Abff")?, [0x00, 0xab, 0xff]);