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

pub fn take_while1<I, F>(f: F) -> TakeWhile1<I, F> where
    I: RangeStream,
    I::Range: Range,
    F: FnMut(I::Item) -> bool

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

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());