[−][src]Function combine::many
pub fn many<F, P>(p: P) -> Many<F, P> where
P: Parser,
F: Extend<P::Output> + Default,
Parses p
zero or more times returning a collection with the values from p
.
If the returned collection cannot be inferred type annotations must be supplied, either by
annotating the resulting type binding let collection: Vec<_> = ...
or by specializing when
calling many, many::<Vec<_>, _>(...)
.
NOTE: If p
can succeed without consuming any input this may hang forever as many
will
repeatedly use p
to parse the same location in the input every time
let result = many(digit()) .parse("123A") .map(|x| x.0); assert_eq!(result, Ok(vec!['1', '2', '3']));