chomp_while0c

Function chomp_while0c 

Source
pub fn chomp_while0c<'a, F, S: Clone + 'a>(
    predicate: F,
    expecting: &'a str,
) -> impl Parser<'_, Output = (), State = S>
where F: Fn(char) -> bool + 'a,
Expand description

Chomp zero or more characters if they pass the test.

This is commonly useful for chomping whiespaces and variable names:

fn space0<'a, S: Clone + 'a>() -> impl Parser<'a, Output = (), State = S> {
  chomp_while0c(|c: char| c == ' ', "a whitespace")
}

See variable for how this can be used to chomp variable names.