nom::character::streaming

Function bin_digit0

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

Recognizes zero 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_digit0::<_, (_, ErrorKind)>("013a"), Ok(("3a", "01")));
assert_eq!(bin_digit0::<_, (_, ErrorKind)>("a013"), Ok(("a013", "")));
assert_eq!(bin_digit0::<_, (_, ErrorKind)>(""), Err(Err::Incomplete(Needed::new(1))));