nom::character::streaming

Function bin_digit1

Source
pub fn bin_digit1<T, E: ParseError<T>>(input: T) -> IResult<T, T, E>
where T: Input, <T as Input>::Item: AsChar,
Expand description

Recognizes one or more binary characters: 0-1

Streaming version: Will return Err(nom::Err::Incomplete(_)) if there’s not enough input data, or if no terminating token is found (a non binary digit character).

§Example

assert_eq!(bin_digit1::<_, (_, ErrorKind)>("013a"), Ok(("3a", "01")));
assert_eq!(bin_digit1::<_, (_, ErrorKind)>("a013"), Err(Err::Error(("a013", ErrorKind::BinDigit))));
assert_eq!(bin_digit1::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1))));