pub fn take<Input>(n: usize) -> Take<Input> where
    Input: RangeStream
Expand description

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