nom::combinator

Function fail

Source
pub fn fail<I, O, E: ParseError<I>>() -> impl Parser<I, Output = O, Error = E>
Expand description

A parser which always fails.

use nom::combinator::fail;

let s = "string";
assert_eq!(fail::<_, &str, _>().parse(s), Err(Err::Error((s, ErrorKind::Fail))));