File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ pub type FxHashSetRand<V> = HashSet<V, FxRandomState>;
13
13
/// A particular instance `FxRandomState` will create the same instances of
14
14
/// [`Hasher`], but the hashers created by two different `FxRandomState`
15
15
/// instances are unlikely to produce the same result for the same values.
16
+ #[ derive( Clone ) ]
16
17
pub struct FxRandomState {
17
18
seed : usize ,
18
19
}
@@ -62,6 +63,15 @@ mod tests {
62
63
63
64
use crate :: FxHashMapRand ;
64
65
66
+ #[ test]
67
+ fn cloned_random_states_are_equal ( ) {
68
+ // The standard library's `RandomState` derives `Clone` without updating the seed.
69
+ let a = FxHashMapRand :: < & str , u32 > :: default ( ) ;
70
+ let b = a. clone ( ) ;
71
+
72
+ assert_eq ! ( a. hasher( ) . seed, b. hasher( ) . seed) ;
73
+ }
74
+
65
75
#[ test]
66
76
fn random_states_are_different ( ) {
67
77
let a = FxHashMapRand :: < & str , u32 > :: default ( ) ;
You can’t perform that action at this time.
0 commit comments