[−][src]Function combine::parser::range::take
pub fn take<I>(n: usize) -> Take<I> where
I: RangeStream,
Zero-copy parser which reads a range of length n
.
count_min_max
is a non-RangeStream
alternative.
let mut parser = take(1); let result = parser.parse("1"); assert_eq!(result, Ok(("1", ""))); let mut parser = take(4); let result = parser.parse("123abc"); assert_eq!(result, Ok(("123a", "bc"))); let result = parser.parse("abc"); assert!(result.is_err());