Function lip::chomp_while1c

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

Chomp one or more characters if they pass the test.

This can be used to chomp digits:

fn digits<'a, S: Clone + 'a>() -> impl Parser<'a, Output = String, State = S> {
  take_chomped(chomp_while1c(
    &(| character: char | character.is_digit(10)),
    "decimal digits"
  ))
}

See digits for a more complete digits parser with leading zero checks.