combine

Function count

Source
pub fn count<F, P>(count: usize, parser: P) -> Count<F, P>
Expand description

Parses parser from zero up to count times.

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

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