Function combine::range::take_while
[−]
[src]
pub fn take_while<I, F>(f: F) -> TakeWhile<I, F> where
I: RangeStream,
F: FnMut(I::Item) -> bool,
Zero-copy parser which reads a range of 0 or more tokens which satisfy f
.
let mut parser = take_while(|c: char| c.is_digit(10)); let result = parser.parse("123abc"); assert_eq!(result, Ok(("123", "abc"))); let result = parser.parse("abc"); assert_eq!(result, Ok(("", "abc")));