From 1629077004c5d511a3882963f9332092673f13ec Mon Sep 17 00:00:00 2001 From: Philippe-Cholet Date: Sun, 26 Nov 2023 14:07:00 +0100 Subject: [PATCH] `PadUsing::rfold` --- src/pad_tail.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/pad_tail.rs b/src/pad_tail.rs index 4be781242..5595b42ba 100644 --- a/src/pad_tail.rs +++ b/src/pad_tail.rs @@ -97,6 +97,16 @@ where Some((self.filler)(self.min)) } } + + fn rfold(self, mut init: B, mut f: G) -> B + where + G: FnMut(B, Self::Item) -> B, + { + init = (self.iter.len()..self.min) + .map(self.filler) + .rfold(init, &mut f); + self.iter.rfold(init, f) + } } impl ExactSizeIterator for PadUsing