Skip to content

Commit

Permalink
Tuple1Combinations::fold
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe-Cholet committed Oct 6, 2023
1 parent 01406b3 commit a90d341
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/adaptors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,13 @@ impl<I: Iterator> Iterator for Tuple1Combination<I> {
fn count(self) -> usize {
self.iter.count()
}

fn fold<B, F>(self, init: B, f: F) -> B
where
F: FnMut(B, Self::Item) -> B,
{
self.iter.map(|x| (x,)).fold(init, f)
}
}

impl<I: Iterator> HasCombination<I> for (I::Item,) {
Expand Down

0 comments on commit a90d341

Please sign in to comment.