pub fn peek<Input, Output, Error, ParseNext>(
parser: ParseNext,
) -> impl Parser<Input, Output, Error>
Expand description
Tries to apply its parser without consuming the input.
ยงExample
use winnow::combinator::peek;
use winnow::ascii::alpha1;
let mut parser = peek(alpha1);
assert_eq!(parser.parse_peek("abcd;"), Ok(("abcd;", "abcd")));
assert_eq!(parser.parse_peek("123;"), Err(ErrMode::Backtrack(InputError::new("123;", ErrorKind::Slice))));