Function combine::many1

source ·
pub fn many1<F, Input, P>(p: P) -> Many1<F, P>
where Input: Stream, F: Extend<P::Output> + Default, P: Parser<Input>,
Expand description

Parses p one 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 many1 many1::<Vec<_>, _>(...).

NOTE: If p can succeed without consuming any input this may hang forever as many1 will repeatedly use p to parse the same location in the input every time

let result = many1::<Vec<_>, _, _>(digit())
    .parse("A123");
assert!(result.is_err());