diff --git a/src/hash_map.rs b/src/hash_map.rs index 4044e6a..5316829 100644 --- a/src/hash_map.rs +++ b/src/hash_map.rs @@ -130,6 +130,18 @@ where /// /// let hashmap: HashMap = HashMap::with_hasher(RandomState::new()); /// ``` + #[cfg(not(feature = "loom"))] + #[inline] + pub const fn with_hasher(build_hasher: H) -> Self { + Self { + array: AtomicShared::null(), + minimum_capacity: AtomicUsize::new(0), + build_hasher, + } + } + + /// Creates an empty [`HashMap`] with the given [`BuildHasher`]. + #[cfg(feature = "loom")] #[inline] pub fn with_hasher(build_hasher: H) -> Self { Self { diff --git a/src/hash_set.rs b/src/hash_set.rs index 58610cf..546707e 100644 --- a/src/hash_set.rs +++ b/src/hash_set.rs @@ -35,6 +35,16 @@ where /// /// let hashset: HashSet = HashSet::with_hasher(RandomState::new()); /// ``` + #[cfg(not(feature = "loom"))] + #[inline] + pub const fn with_hasher(build_hasher: H) -> Self { + Self { + map: HashMap::with_hasher(build_hasher), + } + } + + /// Creates an empty [`HashSet`] with the given [`BuildHasher`]. + #[cfg(feature = "loom")] #[inline] pub fn with_hasher(build_hasher: H) -> Self { Self {