File tree 2 files changed +22
-0
lines changed
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,18 @@ where
130
130
///
131
131
/// let hashmap: HashMap<u64, u32, RandomState> = HashMap::with_hasher(RandomState::new());
132
132
/// ```
133
+ #[ cfg( not( feature = "loom" ) ) ]
134
+ #[ inline]
135
+ pub const fn with_hasher ( build_hasher : H ) -> Self {
136
+ Self {
137
+ array : AtomicShared :: null ( ) ,
138
+ minimum_capacity : AtomicUsize :: new ( 0 ) ,
139
+ build_hasher,
140
+ }
141
+ }
142
+
143
+ /// Creates an empty [`HashMap`] with the given [`BuildHasher`].
144
+ #[ cfg( feature = "loom" ) ]
133
145
#[ inline]
134
146
pub fn with_hasher ( build_hasher : H ) -> Self {
135
147
Self {
Original file line number Diff line number Diff line change 35
35
///
36
36
/// let hashset: HashSet<u64, RandomState> = HashSet::with_hasher(RandomState::new());
37
37
/// ```
38
+ #[ cfg( not( feature = "loom" ) ) ]
39
+ #[ inline]
40
+ pub const fn with_hasher ( build_hasher : H ) -> Self {
41
+ Self {
42
+ map : HashMap :: with_hasher ( build_hasher) ,
43
+ }
44
+ }
45
+
46
+ /// Creates an empty [`HashSet`] with the given [`BuildHasher`].
47
+ #[ cfg( feature = "loom" ) ]
38
48
#[ inline]
39
49
pub fn with_hasher ( build_hasher : H ) -> Self {
40
50
Self {
You can’t perform that action at this time.
0 commit comments