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.
PadUsing::fold
1 parent a90f095 commit e3f8b27Copy full SHA for e3f8b27
src/pad_tail.rs
@@ -67,6 +67,18 @@ where
67
let tail = self.min.saturating_sub(self.pos);
68
size_hint::max(self.iter.size_hint(), (tail, Some(tail)))
69
}
70
+
71
+ fn fold<B, G>(self, mut init: B, mut f: G) -> B
72
+ where
73
+ G: FnMut(B, Self::Item) -> B,
74
+ {
75
+ let mut pos = self.pos;
76
+ init = self.iter.fold(init, |acc, item| {
77
+ pos += 1;
78
+ f(acc, item)
79
+ });
80
+ (pos..self.min).map(self.filler).fold(init, f)
81
+ }
82
83
84
impl<I, F> DoubleEndedIterator for PadUsing<I, F>
0 commit comments