Function parser_combinators::combinator::satisfy [] [src]

pub fn satisfy<I, P>(predicate: P) -> Satisfy<I, P> where
    I: Stream,
    P: FnMut(I::Item) -> bool

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('?'));