Function chomp::parsers::satisfy
[−]
[src]
pub fn satisfy<I: Input, F>(i: I, f: F) -> SimpleResult<I, I::Token> where
F: FnOnce(I::Token) -> 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::prelude::{parse_only, satisfy}; assert_eq!(parse_only(|i| satisfy(i, |c| c == b'a'), b"abc"), Ok(b'a'));