Function fail
pub fn fail<Input, Output, Error>(
i: &mut Input,
) -> Result<Output, ErrMode<Error>> ⓘwhere
Input: Stream,
Error: ParserError<Input>,
Available on crate feature
dep_winnow
only.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))));