[−][src]Macro nom::not
not!(I -> IResult<I,O>) => I -> IResult<I, O>
returns a result only if the embedded parser returns Error or Err(Err::Incomplete)
does not consume the input
named!(not_e, do_parse!( res: tag!("abc") >> not!(char!('e')) >> (res) )); let r = not_e(&b"abcd"[..]); assert_eq!(r, Ok((&b"d"[..], &b"abc"[..]))); let r2 = not_e(&b"abce"[..]); assert_eq!(r2, Err(Err::Error(error_position!(&b"e"[..], ErrorKind::Not))));