Function combine::parser::repeat::count[][src]

pub fn count<F, Input, P>(count: usize, parser: P) -> Count<F, Input, P> where
    <Input as StreamOnce>::Error: ParseError<<Input as StreamOnce>::Token, <Input as StreamOnce>::Range, <Input as StreamOnce>::Position>,
    Input: Stream,
    Input: Stream,
    P: Parser<Input>,
    F: Extend<P::Output> + Default
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"[..])));