-
-
Notifications
You must be signed in to change notification settings - Fork 157
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
Empty choice panics when trying to parse. #668
Comments
I just found out that this is already fixed on master. |
I agree, this should 'just work'. Monoid laws, etc. I'll look into backporting this over the next few days if it's a problem for you. That said, I'd recommend using 1.0 given that's where all the new dev work is happening. |
I already migrated to 1.0 yesterday. For the 0.9 users I have this little workaround. if (parsers.len()) > 0 {
choice(parsers).boxed()
} else {
empty().not().boxed()
} What do you think about just releasing a |
I'm happy to accept PRs to the 0.9 branch and perform releases for it. I wouldn't consider this to be a breaking change but a fix, too. |
Having an empty choice is reasonable and useful.
Consider having a
Vec<Option<impl Parser>>
and then using.into_iter().flatten()
.If you don't agree there should at least be an error message telling the user what went wrong.
here's the full backtrace:
The text was updated successfully, but these errors were encountered: