diff --git a/src/peek_nth.rs b/src/peek_nth.rs index e8546030d..ff5a55cc0 100644 --- a/src/peek_nth.rs +++ b/src/peek_nth.rs @@ -152,6 +152,14 @@ where fn size_hint(&self) -> (usize, Option) { size_hint::add_scalar(self.iter.size_hint(), self.buf.len()) } + + fn fold(self, mut init: B, mut f: F) -> B + where + F: FnMut(B, Self::Item) -> B, + { + init = self.buf.into_iter().fold(init, &mut f); + self.iter.fold(init, f) + } } impl ExactSizeIterator for PeekNth where I: ExactSizeIterator {}