Function winnow::combinator::not
source · pub fn not<I: Stream, O, E: ParseError<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::character::alpha1;
let mut parser = not(alpha1);
assert_eq!(parser.parse_next("123"), Ok(("123", ())));
assert_eq!(parser.parse_next("abcd"), Err(ErrMode::Backtrack(Error::new("abcd", ErrorKind::Not))));