Function not

Source
pub fn not<Input, Output, Error, ParseNext>(
    parser: ParseNext,
) -> impl Parser<Input, (), Error>
where Input: Stream, Error: ParserError<Input>, ParseNext: Parser<Input, Output, Error>,
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;

fn parser<'i>(input: &mut &'i str) -> ModalResult<()> {
    not(alpha1).parse_next(input)
}

assert_eq!(parser.parse_peek("123"), Ok(("123", ())));
assert!(parser.parse_peek("abcd").is_err());