Function winnow::combinator::fail

source ·
pub fn fail<Input, Output, Error>(i: &mut Input) -> PResult<Output, Error>
where Input: Stream, Error: ParserError<Input>,
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))));