Skip to content

Commit

Permalink
PadUsing::rfold
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe-Cholet committed Dec 15, 2023
1 parent c5b367b commit 1629077
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/pad_tail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ where
Some((self.filler)(self.min))
}
}

fn rfold<B, G>(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<I, F> ExactSizeIterator for PadUsing<I, F>
Expand Down

0 comments on commit 1629077

Please sign in to comment.