Function any

fn any<Input, Error>(input: &mut Input) -> Result<<Input as Stream>::Token, Error>
where
    Input: StreamIsPartial + Stream,
    Error: ParserError<Input>

Matches one token

Complete version: Will return an error if there's not enough input data.

[Partial version][crate::_topic::partial]: Will return Err(winnow::error::ErrMode::Incomplete(_)) if there's not enough input data.

Effective Signature

Assuming you are parsing a &str [Stream]:

# use winnow::prelude::*;;
pub fn any(input: &mut &str) -> ModalResult<char>
# {
#     winnow::token::any.parse_next(input)
# }

Example

# use winnow::{token::any, error::ErrMode, error::ContextError};
# use winnow::prelude::*;
fn parser(input: &mut &str) -> ModalResult<char> {
    any.parse_next(input)
}

assert_eq!(parser.parse_peek("abc"), Ok(("bc",'a')));
assert!(parser.parse_peek("").is_err());
# use winnow::{token::any, error::ErrMode, error::ContextError, error::Needed};
# use winnow::prelude::*;
# use winnow::Partial;
assert_eq!(any::<_, ErrMode<ContextError>>.parse_peek(Partial::new("abc")), Ok((Partial::new("bc"),'a')));
assert_eq!(any::<_, ErrMode<ContextError>>.parse_peek(Partial::new("")), Err(ErrMode::Incomplete(Needed::new(1))));