Function combine::unexpected_any[][src]

pub fn unexpected_any<Input, S, T>(message: S) -> Unexpected<Input, T, S> where
    Input: Stream,
    S: for<'s> ErrorInfo<'s, Input::Token, Input::Range>, 
Expand description

Always fails with message as an unexpected error. Never consumes any input.

May have anything as the output type but must be used such that the output type can inferred. The unexpected parser can be used if the output type does not matter

let result = token('b').or(unexpected_any("token"))
    .easy_parse("a");
assert!(result.is_err());
assert!(
    result.err()
        .unwrap()
        .errors
        .iter()
        .any(|m| *m == StreamError::unexpected("token"))
);