Function nom::combinator::not
source · pub fn not<I: Clone, O, E: ParseError<I>, F>(
parser: F
) -> impl FnMut(I) -> IResult<I, (), E>where
F: Parser<I, O, E>,
Expand description
Succeeds if the child parser returns an error.
use nom::combinator::not;
use nom::character::complete::alpha1;
let mut parser = not(alpha1);
assert_eq!(parser("123"), Ok(("123", ())));
assert_eq!(parser("abcd"), Err(Err::Error(("abcd", ErrorKind::Not))));