combine::parser::byte

Function hex_digit

Source
pub fn hex_digit<I>() -> HexDigit<I>
where I: Stream<Item = u8>, I::Error: ParseError<I::Item, I::Range, I::Position>,
Expand description

Parses an ASCII hexdecimal digit (accepts both uppercase and lowercase).

use combine::Parser;
use combine::parser::byte::hex_digit;
assert_eq!(hex_digit().parse(&b"F"[..]), Ok((b'F', &b""[..])));
assert!(hex_digit().parse(&b"H"[..]).is_err());