Function nom::character::complete::anychar

source ·
pub fn anychar<T, E: ParseError<T>>(input: T) -> IResult<T, char, E>
Expand description

Matches one byte as a character. Note that the input type will accept a str, but not a &[u8], unlike many other nom parsers.

complete version: Will return an error if there’s not enough input data.

§Example

fn parser(input: &str) -> IResult<&str, char> {
    anychar(input)
}

assert_eq!(parser("abc"), Ok(("bc",'a')));
assert_eq!(parser(""), Err(Err::Error(("", ErrorKind::Eof))));