Function winnow::combinator::not

source ·
pub fn not<I: Stream, O, E: ParserError<I>, F>(
    parser: F,
) -> impl Parser<I, (), E>
where F: Parser<I, O, E>,
Expand description

Succeeds if the child parser returns an error.

Note: This does not advance the Stream

§Example

use winnow::combinator::not;
use winnow::ascii::alpha1;

let mut parser = not(alpha1);

assert_eq!(parser.parse_peek("123"), Ok(("123", ())));
assert_eq!(parser.parse_peek("abcd"), Err(ErrMode::Backtrack(InputError::new("abcd", ErrorKind::Not))));