BurntSushi / walkdir

Rust library for walking directories recursively.
The Unlicense
1.27k stars 109 forks source link

iterator: implement `FusedIterator` #139

Closed lo48576 closed 7 months ago

lo48576 commented 4 years ago

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.

vallentin commented 7 months ago

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

BurntSushi commented 7 months ago

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