array_bytesFunction hex2bytes
Source pub fn hex2bytes<H>(hex: H) -> Result<SmallVec<[u8; 64]>>
Expand description
AsRef<[u8]>
to Vec<u8>
.
Return error if:
- length is odd
- encounter invalid hex ascii
ยงExamples
assert_eq!(
array_bytes::hex2bytes("0x4c6f7665204a616e6520466f7265766572").unwrap().into_vec(),
b"Love Jane Forever".to_vec()
);