#[cfg(any(target_arch = "wasm32", not(feature = "internal_use_ahash")))]
#[cfg(feature = "std")]
pub type HashBuilder = std::hash::RandomState;
#[cfg(all(not(target_arch = "wasm32"), feature = "internal_use_ahash"))]
#[cfg(feature = "std")]
pub type HashBuilder = std::hash::BuildHasherDefault<ahash::AHasher>;
#[cfg(any(target_arch = "wasm32", not(feature = "internal_use_indexmap")))]
#[cfg(feature = "std")]
pub type MapType<K, V> = std::collections::HashMap<K, V, HashBuilder>;
#[cfg(feature = "std")]
#[cfg(all(not(target_arch = "wasm32"), feature = "internal_use_indexmap"))]
pub type MapType<K, V> = indexmap::IndexMap<K, V, HashBuilder>;
#[cfg(feature = "std")]
pub trait SettingsMapType<K, V> {
fn new_map() -> Self;
fn remove_thingy(&mut self, key: &K) -> Option<V>;
}
#[cfg(feature = "std")]
#[cfg(all(not(target_arch = "wasm32"), feature = "internal_use_indexmap"))]
impl<K: Sized + core::hash::Hash + indexmap::Equivalent<K>, V>
SettingsMapType<K, V> for MapType<K, V>
{
fn new_map() -> Self {
Self::with_capacity_and_hasher(0, HashBuilder::default())
}
fn remove_thingy(&mut self, key: &K) -> Option<V> {
self.swap_remove(key)
}
}
#[cfg(feature = "std")]
#[allow(clippy::implicit_hasher)]
#[cfg(any(target_arch = "wasm32", not(feature = "internal_use_indexmap")))]
impl<K: Sized + core::cmp::Eq + core::hash::Hash, V> SettingsMapType<K, V>
for MapType<K, V>
{
fn new_map() -> Self {
Self::with_capacity_and_hasher(0, HashBuilder::default())
}
fn remove_thingy(&mut self, key: &K) -> Option<V> {
self.remove(key)
}
}