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 next_if and next_if_eq to PeekNth, such that it matches the functionality found in std::iter::Peekable #734

Merged
merged 4 commits into from
Oct 10, 2023

Conversation

herlev
Copy link

@herlev herlev commented Aug 21, 2023

Fixes #733 by adding support for next_if and next_if_eq

Similarly, `Peekable::next_if` does not "peek" before calling "next" either.
@Philippe-Cholet Philippe-Cholet added this to the next milestone Oct 10, 2023
@Philippe-Cholet
Copy link
Member

Philippe-Cholet commented Oct 10, 2023

Side note: I will add a quickcheck test soon.

@herlev Thanks for this pull request.

Same as `test_peek_nth_peeking_next` (copied/pasted/updated) but with `next_if[_eq]` instead of using `peeking_next` from our `itertools::PeekingNext` trait.
Copy link
Member

@Philippe-Cholet Philippe-Cholet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started by checking that core::iter::Peekable has the same function signatures.

@Philippe-Cholet Philippe-Cholet added this pull request to the merge queue Oct 10, 2023
Merged via the queue into rust-itertools:master with commit 0951795 Oct 10, 2023
8 checks passed
@jswrenn jswrenn mentioned this pull request Nov 14, 2023
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

Successfully merging this pull request may close these issues.

Support for next_if and next_if_eq on PeekNth
2 participants