|
1 |
| -use std::collections::{HashMap, HashSet}; |
2 |
| - |
3 | 1 | use crate::FxHasher;
|
4 | 2 |
|
5 | 3 | /// Type alias for a hashmap using the `fx` hash algorithm with [`FxSeededState`].
|
6 |
| -pub type FxHashMapSeed<K, V> = HashMap<K, V, FxSeededState>; |
| 4 | +#[cfg(feature = "std")] |
| 5 | +pub type FxHashMapSeed<K, V> = std::collections::HashMap<K, V, FxSeededState>; |
7 | 6 |
|
8 | 7 | /// Type alias for a hashmap using the `fx` hash algorithm with [`FxSeededState`].
|
9 |
| -pub type FxHashSetSeed<V> = HashSet<V, FxSeededState>; |
| 8 | +#[cfg(feature = "std")] |
| 9 | +pub type FxHashSetSeed<V> = std::collections::HashSet<V, FxSeededState>; |
10 | 10 |
|
11 | 11 | /// [`FxSetState`] is an alternative state for `HashMap` types, allowing to use [`FxHasher`] with a set seed.
|
12 | 12 | ///
|
@@ -41,16 +41,13 @@ impl core::hash::BuildHasher for FxSeededState {
|
41 | 41 | mod tests {
|
42 | 42 | use core::hash::BuildHasher;
|
43 | 43 |
|
44 |
| - use crate::{FxHashMapSeed, FxSeededState}; |
| 44 | + use crate::FxSeededState; |
45 | 45 |
|
46 | 46 | #[test]
|
47 | 47 | fn different_states_are_different() {
|
48 |
| - let a = FxHashMapSeed::<&str, u32>::with_hasher(FxSeededState::with_seed(1)); |
49 |
| - let b = FxHashMapSeed::<&str, u32>::with_hasher(FxSeededState::with_seed(2)); |
| 48 | + let a = FxSeededState::with_seed(1); |
| 49 | + let b = FxSeededState::with_seed(2); |
50 | 50 |
|
51 |
| - assert_ne!( |
52 |
| - a.hasher().build_hasher().hash, |
53 |
| - b.hasher().build_hasher().hash |
54 |
| - ); |
| 51 | + assert_ne!(a.build_hasher().hash, b.build_hasher().hash); |
55 | 52 | }
|
56 | 53 | }
|
0 commit comments