by projct · 5y ago · 0 comments
If the code is supposed to be maintainable, you could also make something like a FromRegex trait for Input. It would be a good idea to try exercism's mentoring thing to get better at writing it the easier way the first time. The mentoring thing really is what helped me to think in ways that made this mess easier to avoid.
The really horrendous scenario was when I was trying to navigate pest iterators for parsing according to a grammar.
error[E0599]: no method named `parse` found for enum `Option<regex::Match<'_>>` in the current scope
--> src\main.rs:24:39
|
24 | min: caps.name("min").parse().unwrap(),
| ^^^^^ method not found in `Option<regex::Match<'_>>`I don't know what the structure Input looks like but I played around with your code and it seems to work with as_str()
https://play.rust-lang.org/?version=stable&mode=debug&editio...