We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
PeekNth::fold
1 parent 2357feb commit 298eb8bCopy full SHA for 298eb8b
src/peek_nth.rs
@@ -152,6 +152,14 @@ where
152
fn size_hint(&self) -> (usize, Option<usize>) {
153
size_hint::add_scalar(self.iter.size_hint(), self.buf.len())
154
}
155
+
156
+ fn fold<B, F>(self, mut init: B, mut f: F) -> B
157
+ where
158
+ F: FnMut(B, Self::Item) -> B,
159
+ {
160
+ init = self.buf.into_iter().fold(init, &mut f);
161
+ self.iter.fold(init, f)
162
+ }
163
164
165
impl<I> ExactSizeIterator for PeekNth<I> where I: ExactSizeIterator {}
0 commit comments