Skip to content

Commit 3be5734

Browse files
authored
api: implement FusedIterator
`IntoIter` and `FilterEntry<IntoIter, P>` will return `None` once they returned `None`. Implementing `FusedIterator` allows `Iterator::fuse` method to be optimized. PR #139
1 parent b0d16b7 commit 3be5734

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ use std::cmp::{min, Ordering};
113113
use std::fmt;
114114
use std::fs::{self, ReadDir};
115115
use std::io;
116+
use std::iter;
116117
use std::path::{Path, PathBuf};
117118
use std::result;
118119
use std::vec;
@@ -1001,6 +1002,8 @@ impl IntoIter {
10011002
}
10021003
}
10031004

1005+
impl iter::FusedIterator for IntoIter {}
1006+
10041007
impl DirList {
10051008
fn close(&mut self) {
10061009
if let DirList::Opened { .. } = *self {
@@ -1083,6 +1086,11 @@ where
10831086
}
10841087
}
10851088

1089+
impl<P> iter::FusedIterator for FilterEntry<IntoIter, P> where
1090+
P: FnMut(&DirEntry) -> bool
1091+
{
1092+
}
1093+
10861094
impl<P> FilterEntry<IntoIter, P>
10871095
where
10881096
P: FnMut(&DirEntry) -> bool,

0 commit comments

Comments
 (0)