[][src]Function base16::decode_byte

pub fn decode_byte(c: u8) -> Option<u8>

Decode a single character as hex.

Returns None for values outside the ASCII hex range.

Example

assert_eq!(base16::decode_byte(b'a'), Some(10));
assert_eq!(base16::decode_byte(b'B'), Some(11));
assert_eq!(base16::decode_byte(b'0'), Some(0));
assert_eq!(base16::decode_byte(b'q'), None);
assert_eq!(base16::decode_byte(b'x'), None);

Availability

This function is available whether or not the alloc feature is enabled.