Function nom::combinator::not[][src]

pub fn not<I: Clone, O, E: ParseError<I>, F>(
    parser: F
) -> impl Fn(I) -> IResult<I, (), E> where
    F: Fn(I) -> IResult<I, O, E>, 

succeeds if the child parser returns an error

use nom::combinator::not;
use nom::character::complete::alpha1;

let parser = not(alpha1);

assert_eq!(parser("123"), Ok(("123", ())));
assert_eq!(parser("abcd"), Err(Err::Error(("abcd", ErrorKind::Not))));