-
Hello, I'm getting started with winnow and have a question. This works for parsing:
but this:
emits an error and I'm not sure how best to proceed:
I see the compiler message to annotate the call to What do folks think about my problem? Thanks for any help! -m |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
What to do depends on what kind of error reporting you want. If you want the same error type as above, you could do use winnow::Parser;
use winnow::ascii::space1;
fn main() {
let mut input = "Game 10: foo";
let foo = (
"Game",
space1::<_, winnow::error::ContextError>,
).parse_next(&mut input).unwrap();
println!("{foo:?}");
} Tips
|
Beta Was this translation helpful? Give feedback.
PResult
is a type alias forResult
with a default parameter forE
so when you declareparse_digits
, you are specifying anE
implicitly. Since the tuple has to all have the sameE
, this lets Rust inferE
for the other parsers which are generic.What to do depends on what kind of error reporting you want. If you want the same error type as above, you could do
Tips