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

Make Permutations lazy #793

Merged

Conversation

Philippe-Cholet
Copy link
Member

@Philippe-Cholet Philippe-Cholet commented Nov 3, 2023

Related to #792

To make the Permutations adaptor lazy, the operation "prefill the lazy buffer" is now done when handling the initial Start state rather than at definition.

To make the `Permutations` adaptor lazy, the operation "prefill the lazy buffer" is now done when handling the initial `Start` state rather than at definition.
Copy link
Member

@jswrenn jswrenn left a comment

Choose a reason for hiding this comment

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

This looks great! Can you just add a test to prevent us regressing on this?

For instance, create an iterator whose next call panics, then create a Permutations around it; doing so shouldn't panic.

@Philippe-Cholet
Copy link
Member Author

Philippe-Cholet commented Nov 3, 2023

@jswrenn That's what #792 is for. It helped me make a list of iterators that are not lazy yet and will ensure we don't regress on that front once merged. Make a test now would be soon a duplicate.

@jswrenn jswrenn added this pull request to the merge queue Nov 3, 2023
@jswrenn jswrenn added this to the next milestone Nov 3, 2023
Merged via the queue into rust-itertools:master with commit 04baddb Nov 3, 2023
8 checks passed
@Philippe-Cholet Philippe-Cholet deleted the permutations-laziness branch November 3, 2023 20:12
@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.

None yet

2 participants