Function winnow::combinator::fail

source ·
pub fn fail<I: Stream, O, E: ParserError<I>>(i: &mut I) -> PResult<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, _>.parse_peek(s), Err(ErrMode::Backtrack(InputError::new(s, ErrorKind::Fail))));