Skip to content

Commit 3918da2

Browse files
into_group_map_by with FnMut
1 parent de00c7a commit 3918da2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/group_map.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ where
2222
lookup
2323
}
2424

25-
pub fn into_group_map_by<I, K, V>(iter: I, f: impl Fn(&V) -> K) -> HashMap<K, Vec<V>>
25+
pub fn into_group_map_by<I, K, V, F>(iter: I, mut f: F) -> HashMap<K, Vec<V>>
2626
where
2727
I: Iterator<Item = V>,
2828
K: Hash + Eq,
29+
F: FnMut(&V) -> K,
2930
{
3031
into_group_map(iter.map(|v| (f(&v), v)))
3132
}

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3257,7 +3257,7 @@ pub trait Itertools: Iterator {
32573257
where
32583258
Self: Iterator<Item = V> + Sized,
32593259
K: Hash + Eq,
3260-
F: Fn(&V) -> K,
3260+
F: FnMut(&V) -> K,
32613261
{
32623262
group_map::into_group_map_by(self, f)
32633263
}

0 commit comments

Comments
 (0)