Skip to content
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

Add peeking_next_map #994

Open
ronnodas opened this issue Sep 25, 2024 · 0 comments
Open

Add peeking_next_map #994

ronnodas opened this issue Sep 25, 2024 · 0 comments

Comments

@ronnodas
Copy link
Contributor

I would like to have a method on "peekable" iterators with roughly the following signature and behavior similar to PeekingNext::peeking_next:

fn peeking_next_map(&mut self, parse: impl FnOnce(&Self::Item) -> Option<B>) -> Option<B>;

This would allow, for example, peeking for multiple kinds of opening delimiters at once and getting one back "parsed" and not just "validated".

Since such a method can be implemented in terms of a peek (or put_back) method as well, it might make sense to combine this with #679.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant