pub fn satisfy<Input, P>(predicate: P) -> Satisfy<Input, P>
Expand description
Parses a token and succeeds depending on the result of predicate
.
let mut parser = satisfy(|c| c == '!' || c == '?');
assert_eq!(parser.parse("!").map(|x| x.0), Ok('!'));
assert_eq!(parser.parse("?").map(|x| x.0), Ok('?'));