Function bin_digit0

fn bin_digit0<T, E: ParseError<T>>(input: T) -> crate::internal::IResult<T, T, E>
where
    T: Input,
    <T as Input>::Item: AsChar

Recognizes zero or more binary characters: 0-1

Complete version: Will return the whole input if no terminating token is found (a non binary digit character).

Example

# use nom::{Err, error::ErrorKind, IResult, Needed};
# use nom::character::complete::bin_digit0;
fn parser(input: &str) -> IResult<&str, &str> {
    bin_digit0(input)
}

assert_eq!(parser("013a"), Ok(("3a", "01")));
assert_eq!(parser("a013"), Ok(("a013", "")));
assert_eq!(parser(""), Ok(("", "")));