Expand description
A parser that accepts only the given input.
The output type of this parser is C
, the input or sequence that was provided.
Examples
let question = just::<_, _, Cheap<char>>('?');
assert_eq!(question.parse("?"), Ok('?'));
assert!(question.parse("!").is_err());
// This works because parsers do not eagerly consume input, so the '!' is not parsed
assert_eq!(question.parse("?!"), Ok('?'));
// This fails because the parser expects an end to the input after the '?'
assert!(question.then(end()).parse("?!").is_err());