11use core:: hash:: { BuildHasher , BuildHasherDefault } ;
2- pub use hashbrown:: hash_map:: Entry ;
32use nohash_hasher:: BuildNoHashHasher ;
3+
4+ pub use hashbrown:: Equivalent ;
45pub use nohash_hasher:: IsEnabled as ValidAsIdentityHash ;
56
7+ pub mod hash_set {
8+ pub use super :: HashSet ;
9+ pub use hashbrown:: hash_set:: * ;
10+ }
11+
12+ pub mod hash_map {
13+ pub use super :: HashMap ;
14+ pub use hashbrown:: hash_map:: * ;
15+ }
16+
617pub type DefaultHashBuilder = BuildHasherDefault < ahash:: AHasher > ;
718// TODO(centril): expose two maps instead,
819// one `map::fast::HashMap` and one `map::ddos::HashMap`.
920// In the first case we won't care about DDoS protection at all and can use `foldhash::fast`.
1021// In the lattr, we can use e.g., randomized AHash.
11- pub type HashMap < K , V , S = DefaultHashBuilder > = hashbrown:: HashMap < K , V , S > ;
12- pub type HashSet < T , S = DefaultHashBuilder > = hashbrown:: HashSet < T , S > ;
22+ pub type HashMap < K , V > = hashbrown:: HashMap < K , V , DefaultHashBuilder > ;
23+ pub type HashSet < T > = hashbrown:: HashSet < T , DefaultHashBuilder > ;
1324
1425/// A version of [`HashMap<K, V>`] using the identity hash function,
1526/// which is valid for any key type that can be converted to a `u64` without truncation.
16- pub type IntMap < K , V > = HashMap < K , V , BuildNoHashHasher < K > > ;
27+ pub type IntMap < K , V > = hashbrown :: HashMap < K , V , BuildNoHashHasher < K > > ;
1728
1829/// A version of [`HashSet<K>`] using the identity hash function,
1930/// which is valid for any key type that can be converted to a `u64` without truncation.
20- pub type IntSet < K > = HashSet < K , BuildNoHashHasher < K > > ;
31+ pub type IntSet < K > = hashbrown :: HashSet < K , BuildNoHashHasher < K > > ;
2132
2233pub trait HashCollectionExt {
2334 /// Returns a new collection with default capacity, using `S::default()` to build the hasher.
@@ -27,22 +38,22 @@ pub trait HashCollectionExt {
2738 fn with_capacity ( capacity : usize ) -> Self ;
2839}
2940
30- impl < K , V , S : BuildHasher + Default > HashCollectionExt for HashMap < K , V , S > {
41+ impl < K , V , S : BuildHasher + Default > HashCollectionExt for hashbrown :: HashMap < K , V , S > {
3142 fn new ( ) -> Self {
32- HashMap :: with_hasher ( S :: default ( ) )
43+ Self :: with_hasher ( S :: default ( ) )
3344 }
3445
3546 fn with_capacity ( capacity : usize ) -> Self {
36- HashMap :: with_capacity_and_hasher ( capacity, S :: default ( ) )
47+ Self :: with_capacity_and_hasher ( capacity, S :: default ( ) )
3748 }
3849}
3950
40- impl < K , S : BuildHasher + Default > HashCollectionExt for HashSet < K , S > {
51+ impl < K , S : BuildHasher + Default > HashCollectionExt for hashbrown :: HashSet < K , S > {
4152 fn new ( ) -> Self {
42- HashSet :: with_hasher ( S :: default ( ) )
53+ Self :: with_hasher ( S :: default ( ) )
4354 }
4455
4556 fn with_capacity ( capacity : usize ) -> Self {
46- HashSet :: with_capacity_and_hasher ( capacity, S :: default ( ) )
57+ Self :: with_capacity_and_hasher ( capacity, S :: default ( ) )
4758 }
4859}
0 commit comments