pub fn any<I, E: ParserError<I>>(
input: &mut I,
) -> PResult<<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_peek(input)
}
assert_eq!(parser("abc"), Ok(("bc",'a')));
assert_eq!(parser(""), Err(ErrMode::Backtrack(InputError::new("", ErrorKind::Token))));
assert_eq!(any::<_, InputError<_>>.parse_peek(Partial::new("abc")), Ok((Partial::new("bc"),'a')));
assert_eq!(any::<_, InputError<_>>.parse_peek(Partial::new("")), Err(ErrMode::Incomplete(Needed::new(1))));