1 pub fn to_vec(hex: &str) -> Option<Vec<u8>> {
2 let mut out = Vec::with_capacity(hex.len() / 2);
5 for (idx, c) in hex.as_bytes().iter().enumerate() {
8 b'A'..=b'F' => b |= c - b'A' + 10,
9 b'a'..=b'f' => b |= c - b'a' + 10,
10 b'0'..=b'9' => b |= c - b'0',