Function combine::count_min_max[][src]

pub fn count_min_max<F, Input, P>(
    min: usize,
    max: usize,
    parser: P
) -> CountMinMax<F, P> where
    Input: Stream,
    P: Parser<Input>,
    F: Extend<P::Output> + Default
Expand description

Parses parser from min to max times (including min and max).

let mut parser = count_min_max(2, 2, token(b'a'));

let result = parser.parse(&b"aaab"[..]);
assert_eq!(result, Ok((b"aa"[..].to_owned(), &b"ab"[..])));
let result = parser.parse(&b"ab"[..]);
assert!(result.is_err());

Panics

If min > max.