We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Positions::rfold
1 parent e23d1cb commit 0fc4675Copy full SHA for 0fc4675
src/adaptors/mod.rs
@@ -1111,6 +1111,21 @@ where
1111
}
1112
None
1113
1114
+
1115
+ fn rfold<B, G>(self, init: B, mut func: G) -> B
1116
+ where
1117
+ G: FnMut(B, Self::Item) -> B,
1118
+ {
1119
+ let mut count = self.count + self.iter.len();
1120
+ let mut f = self.f;
1121
+ self.iter.rfold(init, |mut acc, val| {
1122
+ count -= 1;
1123
+ if f(val) {
1124
+ acc = func(acc, count);
1125
+ }
1126
+ acc
1127
+ })
1128
1129
1130
1131
impl<I, F> FusedIterator for Positions<I, F>
0 commit comments