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