nom::combinator

Function fail

Source
pub fn fail<I, O, E: ParseError<I>>(i: I) -> IResult<I, O, E>
Expand description

A parser which always fails.

use nom::combinator::fail;

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