Skip to content

Commit eb18fd0

Browse files
committed
fn new_map_for_grouping as free function
1 parent 3de4e6c commit eb18fd0

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/grouping_map.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ impl<V, K, F: FnMut(&V) -> K> MapSpecialCaseFn<V> for GroupingMapFn<F> {
2727
}
2828
}
2929

30-
impl<K, I: Iterator, F: FnMut(&I::Item) -> K> MapForGrouping<I, F> {
31-
pub(crate) fn new(iter: I, key_mapper: F) -> Self {
32-
MapSpecialCase {
33-
iter,
34-
f: GroupingMapFn(key_mapper),
35-
}
30+
pub(crate) fn new_map_for_grouping<K, I: Iterator, F: FnMut(&I::Item) -> K>(
31+
iter: I,
32+
key_mapper: F,
33+
) -> MapForGrouping<I, F> {
34+
MapSpecialCase {
35+
iter,
36+
f: GroupingMapFn(key_mapper),
3637
}
3738
}
3839

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3194,7 +3194,7 @@ pub trait Itertools: Iterator {
31943194
K: Hash + Eq,
31953195
F: FnMut(&V) -> K,
31963196
{
3197-
grouping_map::new(grouping_map::MapForGrouping::new(self, key_mapper))
3197+
grouping_map::new(grouping_map::new_map_for_grouping(self, key_mapper))
31983198
}
31993199

32003200
/// Return all minimum elements of an iterator.

0 commit comments

Comments
 (0)