We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 34ece9e + 5c11e00 commit 9dd1ad4Copy full SHA for 9dd1ad4
src/unique_impl.rs
@@ -1,6 +1,5 @@
1
-
2
use std::collections::HashMap;
3
-use std::collections::hash_map::{Entry};
+use std::collections::hash_map::Entry;
4
use std::hash::Hash;
5
use std::fmt;
6
use std::iter::FusedIterator;
@@ -12,7 +11,9 @@ use std::iter::FusedIterator;
12
11
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
13
pub struct UniqueBy<I: Iterator, V, F> {
14
iter: I,
15
- // Use a hashmap for the entry API
+ // Use a Hashmap for the Entry API in order to prevent hashing twice.
+ // This can maybe be replaced with a HashSet once `get_or_insert_with`
16
+ // or a proper Entry API for Hashset is stable and meets this msrv
17
used: HashMap<V, ()>,
18
f: F,
19
}
0 commit comments