pub fn from_hex(s: &str) -> Result<Vec<u8>, String>Expand description
Decode lowercase/uppercase hex; errors on odd length or non-hex digits.
Operates on raw bytes (chunks_exact(2)), NOT &s[i..i+2] string slicing.
The guest or script controls this string, and byte-index slicing panics on a
multibyte UTF-8 codepoint that happens to make the byte length even. A
non-ASCII byte simply fails the hex-digit test and returns Err, so a
hostile input cannot take down the host thread.
ยงErrors
Returns Err if s has odd byte length or contains a non-hex digit.