Function chomp::parsers::satisfy [] [src]

pub fn satisfy<I: Copy, F>(i: Input<I>, f: F) -> SimpleResult<I, I> where F: FnOnce(I) -> bool

Matches an item using f, the item is returned if f yields true, otherwise this parser fails.

If the buffer length is 0 this parser is considered incomplete.

use chomp::{Input, satisfy};

let p = Input::new(b"abc");

assert_eq!(satisfy(p, |c| c == b'a').unwrap(), b'a');