pub fn dehexify_array_then_into<H, T, const N: usize>(hex: H) -> Result<T>
Expand description
Dehexify hex to a fixed length bytes vector then convert it to T
where T: From<[u8; N]>
.
ยงExamples
#[derive(Debug, PartialEq)]
struct Ljf([u8; 17]);
impl From<[u8; 17]> for Ljf {
fn from(array: [u8; 17]) -> Self {
Self(array)
}
}
assert_eq!(
array_bytes::dehexify_array_then_into::<_, Ljf, 17>("0x4c6f7665204a616e6520466f7265766572"),
Ok(Ljf(*b"Love Jane Forever"))
);