1use super::fast::{FixedState, RandomState};
2
3pub type HashMap<K, V> = std::collections::HashMap<K, V, RandomState>;
5
6pub type HashSet<T> = std::collections::HashSet<T, RandomState>;
8
9pub trait HashMapExt {
11 fn new() -> Self;
13
14 fn with_capacity(capacity: usize) -> Self;
16}
17
18impl<K, V> HashMapExt for std::collections::HashMap<K, V, RandomState> {
19 #[inline(always)]
20 fn new() -> Self {
21 Self::with_hasher(RandomState::default())
22 }
23
24 #[inline(always)]
25 fn with_capacity(capacity: usize) -> Self {
26 Self::with_capacity_and_hasher(capacity, RandomState::default())
27 }
28}
29
30impl<K, V> HashMapExt for std::collections::HashMap<K, V, FixedState> {
31 #[inline(always)]
32 fn new() -> Self {
33 Self::with_hasher(FixedState::default())
34 }
35
36 #[inline(always)]
37 fn with_capacity(capacity: usize) -> Self {
38 Self::with_capacity_and_hasher(capacity, FixedState::default())
39 }
40}
41
42pub trait HashSetExt {
44 fn new() -> Self;
46
47 fn with_capacity(capacity: usize) -> Self;
49}
50
51impl<T> HashSetExt for std::collections::HashSet<T, RandomState> {
52 #[inline(always)]
53 fn new() -> Self {
54 Self::with_hasher(RandomState::default())
55 }
56
57 #[inline(always)]
58 fn with_capacity(capacity: usize) -> Self {
59 Self::with_capacity_and_hasher(capacity, RandomState::default())
60 }
61}
62
63impl<T> HashSetExt for std::collections::HashSet<T, FixedState> {
64 #[inline(always)]
65 fn new() -> Self {
66 Self::with_hasher(FixedState::default())
67 }
68
69 #[inline(always)]
70 fn with_capacity(capacity: usize) -> Self {
71 Self::with_capacity_and_hasher(capacity, FixedState::default())
72 }
73}