use super::fast::{FixedState, RandomState};
pub type HashMap<K, V> = std::collections::HashMap<K, V, RandomState>;
pub type HashSet<T> = std::collections::HashSet<T, RandomState>;
pub trait HashMapExt {
fn new() -> Self;
fn with_capacity(capacity: usize) -> Self;
}
impl<K, V> HashMapExt for std::collections::HashMap<K, V, RandomState> {
fn new() -> Self {
Self::with_hasher(RandomState::default())
}
fn with_capacity(capacity: usize) -> Self {
Self::with_capacity_and_hasher(capacity, RandomState::default())
}
}
impl<K, V> HashMapExt for std::collections::HashMap<K, V, FixedState> {
fn new() -> Self {
Self::with_hasher(FixedState::default())
}
fn with_capacity(capacity: usize) -> Self {
Self::with_capacity_and_hasher(capacity, FixedState::default())
}
}
pub trait HashSetExt {
fn new() -> Self;
fn with_capacity(capacity: usize) -> Self;
}
impl<T> HashSetExt for std::collections::HashSet<T, RandomState> {
fn new() -> Self {
Self::with_hasher(RandomState::default())
}
fn with_capacity(capacity: usize) -> Self {
Self::with_capacity_and_hasher(capacity, RandomState::default())
}
}
impl<T> HashSetExt for std::collections::HashSet<T, FixedState> {
fn new() -> Self {
Self::with_hasher(FixedState::default())
}
fn with_capacity(capacity: usize) -> Self {
Self::with_capacity_and_hasher(capacity, FixedState::default())
}
}