@@ -3,6 +3,7 @@ pub mod label;
3
3
4
4
pub use ahash:: AHasher ;
5
5
pub use enum_variant_meta:: * ;
6
+ pub type Entry < ' a , K , V > = hashbrown:: hash_map:: Entry < ' a , K , V , RandomState > ;
6
7
pub use instant:: { Duration , Instant } ;
7
8
pub use tracing;
8
9
pub use uuid:: Uuid ;
@@ -32,7 +33,7 @@ impl std::hash::BuildHasher for FixedState {
32
33
}
33
34
}
34
35
35
- /// A [`HashMap`][std::collections ::HashMap] implementing [`aHash`], a high
36
+ /// A [`HashMap`][hashbrown ::HashMap] implementing [`aHash`], a high
36
37
/// speed keyed hashing algorithm intended for use in in-memory hashmaps.
37
38
///
38
39
/// `aHash` is designed for performance and is NOT cryptographically secure.
@@ -50,7 +51,7 @@ impl std::hash::BuildHasher for FixedState {
50
51
/// # }
51
52
/// ```
52
53
///
53
- /// The standard library's [`HashMap::new`][std::collections ::HashMap::new] is
54
+ /// The standard library's [`HashMap::new`][hashbrown ::HashMap::new] is
54
55
/// implemented only for `HashMap`s which use the
55
56
/// [`DefaultHasher`][std::collections::hash_map::DefaultHasher], so it's not
56
57
/// available for Bevy's `HashMap`.
@@ -69,30 +70,30 @@ impl std::hash::BuildHasher for FixedState {
69
70
/// ```
70
71
///
71
72
/// [`aHash`]: https://github.com/tkaitchuck/aHash
72
- pub type HashMap < K , V > = std :: collections :: HashMap < K , V , RandomState > ;
73
-
74
- pub trait AHashExt {
75
- fn with_capacity ( capacity : usize ) -> Self ;
76
- }
77
-
78
- impl < K , V > AHashExt for HashMap < K , V > {
79
- /// Creates an empty `HashMap` with the specified capacity with aHash.
80
- ///
81
- /// The hash map will be able to hold at least `capacity` elements without
82
- /// reallocating. If `capacity` is 0, the hash map will not allocate.
83
- ///
84
- /// # Examples
85
- ///
86
- /// ```
87
- /// use bevy_utils::{HashMap, AHashExt};
88
- /// let mut map: HashMap<&str, i32> = HashMap::with_capacity(10);
89
- /// assert!(map.capacity() >= 10);
90
- /// ```
91
- #[ inline]
92
- fn with_capacity ( capacity : usize ) -> Self {
93
- HashMap :: with_capacity_and_hasher ( capacity, RandomState :: default ( ) )
94
- }
95
- }
73
+ pub type HashMap < K , V > = hashbrown :: HashMap < K , V , RandomState > ;
74
+
75
+ // pub trait AHashExt {
76
+ // fn with_capacity(capacity: usize) -> Self;
77
+ // }
78
+
79
+ // impl<K, V> AHashExt for HashMap<K, V> {
80
+ // /// Creates an empty `HashMap` with the specified capacity with aHash.
81
+ // ///
82
+ // /// The hash map will be able to hold at least `capacity` elements without
83
+ // /// reallocating. If `capacity` is 0, the hash map will not allocate.
84
+ // ///
85
+ // /// # Examples
86
+ // ///
87
+ // /// ```
88
+ // /// use bevy_utils::{HashMap, AHashExt};
89
+ // /// let mut map: HashMap<&str, i32> = HashMap::with_capacity(10);
90
+ // /// assert!(map.capacity() >= 10);
91
+ // /// ```
92
+ // #[inline]
93
+ // fn with_capacity(capacity: usize) -> Self {
94
+ // HashMap::with_capacity_and_hasher(capacity, RandomState::default())
95
+ // }
96
+ // }
96
97
97
98
/// A stable std hash map implementing `aHash`, a high speed keyed hashing algorithm
98
99
/// intended for use in in-memory hashmaps.
@@ -101,26 +102,26 @@ impl<K, V> AHashExt for HashMap<K, V> {
101
102
/// of insertions and deletions and not a random source.
102
103
///
103
104
/// `aHash` is designed for performance and is NOT cryptographically secure.
104
- pub type StableHashMap < K , V > = std :: collections :: HashMap < K , V , FixedState > ;
105
-
106
- impl < K , V > AHashExt for StableHashMap < K , V > {
107
- /// Creates an empty `StableHashMap` with the specified capacity with `aHash`.
108
- ///
109
- /// The hash map will be able to hold at least `capacity` elements without
110
- /// reallocating. If `capacity` is 0, the hash map will not allocate.
111
- ///
112
- /// # Examples
113
- ///
114
- /// ```
115
- /// use bevy_utils::{StableHashMap, AHashExt};
116
- /// let mut map: StableHashMap<&str, i32> = StableHashMap::with_capacity(10);
117
- /// assert!(map.capacity() >= 10);
118
- /// ```
119
- #[ inline]
120
- fn with_capacity ( capacity : usize ) -> Self {
121
- StableHashMap :: with_capacity_and_hasher ( capacity, FixedState :: default ( ) )
122
- }
123
- }
105
+ pub type StableHashMap < K , V > = hashbrown :: HashMap < K , V , FixedState > ;
106
+
107
+ // impl<K, V> AHashExt for StableHashMap<K, V> {
108
+ // /// Creates an empty `StableHashMap` with the specified capacity with `aHash`.
109
+ // ///
110
+ // /// The hash map will be able to hold at least `capacity` elements without
111
+ // /// reallocating. If `capacity` is 0, the hash map will not allocate.
112
+ // ///
113
+ // /// # Examples
114
+ // ///
115
+ // /// ```
116
+ // /// use bevy_utils::{StableHashMap, AHashExt};
117
+ // /// let mut map: StableHashMap<&str, i32> = StableHashMap::with_capacity(10);
118
+ // /// assert!(map.capacity() >= 10);
119
+ // /// ```
120
+ // #[inline]
121
+ // fn with_capacity(capacity: usize) -> Self {
122
+ // StableHashMap::with_capacity_and_hasher(capacity, FixedState::default())
123
+ // }
124
+ // }
124
125
125
126
/// A [`HashSet`][std::collections::HashSet] implementing [`aHash`], a high
126
127
/// speed keyed hashing algorithm intended for use in in-memory hashmaps.
@@ -159,26 +160,26 @@ impl<K, V> AHashExt for StableHashMap<K, V> {
159
160
/// ```
160
161
///
161
162
/// [`aHash`]: https://github.com/tkaitchuck/aHash
162
- pub type HashSet < K > = std :: collections :: HashSet < K , RandomState > ;
163
-
164
- impl < K > AHashExt for HashSet < K > {
165
- /// Creates an empty `HashSet` with the specified capacity with aHash.
166
- ///
167
- /// The hash set will be able to hold at least `capacity` elements without
168
- /// reallocating. If `capacity` is 0, the hash set will not allocate.
169
- ///
170
- /// # Examples
171
- ///
172
- /// ```
173
- /// use bevy_utils::{HashSet, AHashExt};
174
- /// let set: HashSet<i32> = HashSet::with_capacity(10);
175
- /// assert!(set.capacity() >= 10);
176
- /// ```
177
- #[ inline]
178
- fn with_capacity ( capacity : usize ) -> Self {
179
- HashSet :: with_capacity_and_hasher ( capacity, RandomState :: default ( ) )
180
- }
181
- }
163
+ pub type HashSet < K > = hashbrown :: HashSet < K , RandomState > ;
164
+
165
+ // impl<K> AHashExt for HashSet<K> {
166
+ // /// Creates an empty `HashSet` with the specified capacity with aHash.
167
+ // ///
168
+ // /// The hash set will be able to hold at least `capacity` elements without
169
+ // /// reallocating. If `capacity` is 0, the hash set will not allocate.
170
+ // ///
171
+ // /// # Examples
172
+ // ///
173
+ // /// ```
174
+ // /// use bevy_utils::{HashSet, AHashExt};
175
+ // /// let set: HashSet<i32> = HashSet::with_capacity(10);
176
+ // /// assert!(set.capacity() >= 10);
177
+ // /// ```
178
+ // #[inline]
179
+ // fn with_capacity(capacity: usize) -> Self {
180
+ // HashSet::with_capacity_and_hasher(capacity, RandomState::default())
181
+ // }
182
+ // }
182
183
183
184
/// A stable std hash set implementing `aHash`, a high speed keyed hashing algorithm
184
185
/// intended for use in in-memory hashmaps.
@@ -187,23 +188,23 @@ impl<K> AHashExt for HashSet<K> {
187
188
/// of insertions and deletions and not a random source.
188
189
///
189
190
/// `aHash` is designed for performance and is NOT cryptographically secure.
190
- pub type StableHashSet < K > = std :: collections :: HashSet < K , FixedState > ;
191
-
192
- impl < K > AHashExt for StableHashSet < K > {
193
- /// Creates an empty `StableHashSet` with the specified capacity with `aHash`.
194
- ///
195
- /// The hash set will be able to hold at least `capacity` elements without
196
- /// reallocating. If `capacity` is 0, the hash set will not allocate.
197
- ///
198
- /// # Examples
199
- ///
200
- /// ```
201
- /// use bevy_utils::{StableHashSet, AHashExt};
202
- /// let set: StableHashSet<i32> = StableHashSet::with_capacity(10);
203
- /// assert!(set.capacity() >= 10);
204
- /// ```
205
- #[ inline]
206
- fn with_capacity ( capacity : usize ) -> Self {
207
- StableHashSet :: with_capacity_and_hasher ( capacity, FixedState :: default ( ) )
208
- }
209
- }
191
+ pub type StableHashSet < K > = hashbrown :: HashSet < K , FixedState > ;
192
+
193
+ // impl<K> AHashExt for StableHashSet<K> {
194
+ // /// Creates an empty `StableHashSet` with the specified capacity with `aHash`.
195
+ // ///
196
+ // /// The hash set will be able to hold at least `capacity` elements without
197
+ // /// reallocating. If `capacity` is 0, the hash set will not allocate.
198
+ // ///
199
+ // /// # Examples
200
+ // ///
201
+ // /// ```
202
+ // /// use bevy_utils::{StableHashSet, AHashExt};
203
+ // /// let set: StableHashSet<i32> = StableHashSet::with_capacity(10);
204
+ // /// assert!(set.capacity() >= 10);
205
+ // /// ```
206
+ // #[inline]
207
+ // fn with_capacity(capacity: usize) -> Self {
208
+ // StableHashSet::with_capacity_and_hasher(capacity, FixedState::default())
209
+ // }
210
+ // }
0 commit comments