Skip to content
Discussion options

You must be logged in to vote

I don't think there is a specific notion of 'consumption state' that exists as you might imagine it.

After doing some thinking, I think the correct way to solve it would be to associate an error not just with a location in the input, but a location span, which would allow us to correctly disentangle the try_map case more cleanly and hopefully satisfy both constraints. Unfortunately, this would likely have performance ramifications and would require some non-trivial changes to the guts of the crate. I'll open a long-term issue for the problem.

In the meantime, a relatively clean solution might be something like the following pseudocode:

text::int().then(just('l').or_not()).try_map(|(int, l)| 

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@zesterer
Comment options

Comment options

You must be logged in to vote
2 replies
@zesterer
Comment options

Answer selected by enklht
@enklht
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants