Function combine::range::take
[−]
[src]
pub fn take<I>(n: usize) -> Take<I> where
I: RangeStream,
I::Range: Range,
Zero-copy parser which reads a range of length n
.
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());