Function combine::parser::byte::digit[][src]

pub fn digit<Input>() -> impl Parser<Input, Output = u8, PartialState = ()> where
    Input: Stream<Token = u8>,
    Input::Error: ParseError<Input::Token, Input::Range, Input::Position>, 
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());