Skip to content

Commit fbe30e7

Browse files
Philippe-Choletphimuemue
authored andcommitted
Multipeek::fold
1 parent db0311c commit fbe30e7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/multipeek_impl.rs

+8
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ where
102102
fn size_hint(&self) -> (usize, Option<usize>) {
103103
size_hint::add_scalar(self.iter.size_hint(), self.buf.len())
104104
}
105+
106+
fn fold<B, F>(self, mut init: B, mut f: F) -> B
107+
where
108+
F: FnMut(B, Self::Item) -> B,
109+
{
110+
init = self.buf.into_iter().fold(init, &mut f);
111+
self.iter.fold(init, f)
112+
}
105113
}
106114

107115
// Same size

0 commit comments

Comments
 (0)