Function winnow::combinator::fail

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

A parser which always fails.

For example, it can be used as the last alternative in alt to control the error message given.

Example

use winnow::combinator::fail;

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