pub fn any<I, E: ParseError<I>>(input: I) -> IResult<I, <I as Stream>::Token, E>where
I: StreamIsPartial + Stream,
Expand description
Matches one token
Complete version: Will return an error if there’s not enough input data.
Partial version: Will return Err(winnow::error::ErrMode::Incomplete(_))
if there’s not enough input data.
Example
fn parser(input: &str) -> IResult<&str, char> {
any.parse_next(input)
}
assert_eq!(parser("abc"), Ok(("bc",'a')));
assert_eq!(parser(""), Err(ErrMode::Backtrack(Error::new("", ErrorKind::Token))));
assert_eq!(any::<_, Error<_>>.parse_next(Partial::new("abc")), Ok((Partial::new("bc"),'a')));
assert_eq!(any::<_, Error<_>>.parse_next(Partial::new("")), Err(ErrMode::Incomplete(Needed::new(1))));