Function combine::parser::range::take_while1[][src]

pub fn take_while1<Input, F>(f: F) -> TakeWhile1<Input, F> where
    Input: RangeStream,
    Input::Range: Range,
    F: FnMut(Input::Token) -> bool
Expand description

Zero-copy parser which reads a range of 1 or more tokens which satisfy f.

many1 is a non-RangeStream alternative.

let mut parser = take_while1(|c: char| c.is_digit(10));
let result = parser.parse("123abc");
assert_eq!(result, Ok(("123", "abc")));
let result = parser.parse("abc");
assert!(result.is_err());