-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help with reporting non-parsing errors. #319
Comments
I found |
Sorry for the noise. The Wiki example makes the code compile. |
For anyone who comes across this and doesn't quite understand fn cc<I>() -> impl Parser<I, Output = PacketType>
where
I: Stream<Token = char>,
I::Error: ParseError<I::Token, I::Range, I::Position>,
StreamErrorFor<I>: From<UnexpectedParse>,
{
digit().and_then(|cc| PacketType::try_from(cc).map_err(|_| UnexpectedParse::Unexpected))
} As opposed to what the compiler tells you to do: fn cc<I>() -> impl Parser<I, Output = PacketType>
where
I: Stream<Token = char>,
I::Error: ParseError<I::Token, I::Range, I::Position>,
- StreamErrorFor<I>: From<UnexpectedParse>,
+ <<I as StreamOnce>::Error as ParseError<
+ char,
+ <I as StreamOnce>::Range,
+ <I as StreamOnce>::Position,
+ >>::StreamError: From<UnexpectedParse>,
{
digit().and_then(|cc| PacketType::try_from(cc).map_err(|_| UnexpectedParse::Unexpected))
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've been having good, initial success using
combine
but I've reached a point where I need to report an error if an integer field is out of range. The function isThis generates errors since
ParseIntError
can't be converted to aStreamError
. I try some of the recommendations offered by the compiler but those also return errors. The project's Wiki page mentions ways of reporting errors, but it seems to be out-of-date since it mentionsStreamErrorFor::<>
which I couldn't find in the docs.Am I trying too hard? Is there a straightforward way of reporting errors that I'm missing?
Can the Wiki be brought up to date?
The text was updated successfully, but these errors were encountered: