Function bparse::hex

source ·
pub fn hex(input: &[u8]) -> Option<(&[u8], &[u8])>
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().0, b"a");
assert_eq!(hex.test(b"1").unwrap().0, b"1");
assert_eq!(hex.test(b"g"), None);