#[cfg(feature = "gxhash")]
pub use gxhash::{
HashMap as GxHashMap, HashMapExt, HashSet as GxHashSet, HashSetExt, GxBuildHasher,
};
#[cfg(not(feature = "gxhash"))]
use std::collections::{HashMap as StdHashMap, HashSet as StdHashSet};
#[cfg(feature = "gxhash")]
pub type HashMap<K, V> = GxHashMap<K, V>;
#[cfg(not(feature = "gxhash"))]
pub type HashMap<K, V> = StdHashMap<K, V>;
#[cfg(feature = "gxhash")]
pub type HashSet<T> = GxHashSet<T>;
#[cfg(not(feature = "gxhash"))]
pub type HashSet<T> = StdHashSet<T>;
#[cfg(not(feature = "gxhash"))]
pub trait HashMapExt {
fn new() -> Self;
fn with_capacity(capacity: usize) -> Self;
}
#[cfg(not(feature = "gxhash"))]
impl<K, V> HashMapExt for StdHashMap<K, V> {
fn new() -> Self {
StdHashMap::new()
}
fn with_capacity(capacity: usize) -> Self {
StdHashMap::with_capacity(capacity)
}
}
#[cfg(not(feature = "gxhash"))]
pub trait HashSetExt {
fn new() -> Self;
fn with_capacity(capacity: usize) -> Self;
}
#[cfg(not(feature = "gxhash"))]
impl<T> HashSetExt for StdHashSet<T> {
fn new() -> Self {
StdHashSet::new()
}
fn with_capacity(capacity: usize) -> Self {
StdHashSet::with_capacity(capacity)
}
}
#[cfg(not(feature = "gxhash"))]
pub type GxBuildHasher = std::hash::RandomState;