Function combine::parser::byte::digit

source ·
pub fn digit<Input>() -> impl Parser<Input, Output = u8, PartialState = ()>
where Input: Stream<Token = u8>,
Expand description

Parses a base-10 digit (0–9).

use combine::Parser;
use combine::parser::byte::digit;
assert_eq!(digit().parse(&b"9"[..]), Ok((b'9', &b""[..])));
assert!(digit().parse(&b"A"[..]).is_err());