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

iterator: implement FusedIterator #139

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

lo48576
Copy link
Contributor

@lo48576 lo48576 commented Aug 15, 2020

IntoIter and FilterEntry<IntoIter, P> will return None once they returned None.
Implementing FusedIterator allows Iterator::fuse method to be optimized.

Calling next on a fused iterator that has returned None once is guaranteed to return None again. This trait should be implemented by all iterators that behave this way because it allows optimizing Iterator::fuse.

--- https://doc.rust-lang.org/1.45.2/std/iter/trait.FusedIterator.html

I checked next() implementations lightly and they seem to be already fused.

`IntoIter` and `FilterEntry<IntoIter, P>` will return `None` once they
returned `None`.
Implementing `FusedIterator` allows `Iterator::fuse` method to be
optimized.
@vallentin
Copy link

Bump. I second implementing FusedIterator, I was just about to make a PR as well.

@BurntSushi BurntSushi merged commit 3be5734 into BurntSushi:master Mar 1, 2024
@BurntSushi
Copy link
Owner

Thanks! This PR is on crates.io in walkdir 2.5.0.

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.

3 participants