-
Rust is requiring me to annotate types for the What I'm trying to do is match eg a version string with a variable number of digits, so fn parse_version<'s>(input: &mut &'s str) -> PResult<TextBlock<'s>> {
let version = separated(2..=3, digit1, '.')
.recognize()
.parse_next(input)?;
Ok(TextBlock::Version(version))
} but the problem is that I get
and I'm not sure how to satisfy system here as the types are quite complicated. I couldn't find anything in examples, issues or other discussions about a similar issue. Obviously I could just manually match 2/3 repetitions without using separated but I'm hoping to understand how to solve this in a way I could apply to other situations. If there's a satisfactory answer to this I thing it would be really useful to use as an example for the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
We |
Beta Was this translation helpful? Give feedback.
We
recognize()
on aAccumulate
type in several places in the docs but likely not in a place to discover it. Between the calls, we add.map(|()| ())
.