Function bparse::hex

source ·
pub fn hex(input: &[u8]) -> Option<Matches<'_, 1>>
Expand description

A pattern that fails if the byte at the start of the input is not a hexadecimal character

Example

use bparse::{Pattern, hex};
assert_eq!(hex.test(b"a").unwrap().value(), b"a");
assert_eq!(hex.test(b"1").unwrap().value(), b"1");
assert_eq!(hex.test(b"g"), None);