Function chomp::parsers::skip_while1 [] [src]

pub fn skip_while1<I: Input, F>(i: I, f: F) -> SimpleResult<I, ()> where
    F: FnMut(I::Token) -> bool

Skips over tokens in the input until f returns false, skips at least one token and fails if f does not succeed on it.

use chomp::parse_only;
use chomp::parsers::{Error, skip_while1};

assert_eq!(parse_only(|i| skip_while1(i, |c| c == b'a'), &b"aaabc"[..]), Ok(()));
assert_eq!(parse_only(|i| skip_while1(i, |c| c == b'a'), &b"bbc"[..]), Err((&b"bbc"[..], Error::unexpected())));