2019-05-14 19:42:57 +03:00
|
|
|
use std::hash::BuildHasherDefault;
|
|
|
|
|
2018-07-21 22:15:11 +03:00
|
|
|
pub use rustc_hash::{FxHashMap, FxHashSet, FxHasher};
|
2019-05-14 19:42:57 +03:00
|
|
|
|
2022-07-16 15:16:57 +02:00
|
|
|
pub type StdEntry<'a, K, V> = std::collections::hash_map::Entry<'a, K, V>;
|
|
|
|
|
2019-05-14 19:42:57 +03:00
|
|
|
pub type FxIndexMap<K, V> = indexmap::IndexMap<K, V, BuildHasherDefault<FxHasher>>;
|
|
|
|
pub type FxIndexSet<V> = indexmap::IndexSet<V, BuildHasherDefault<FxHasher>>;
|
2022-07-16 15:16:57 +02:00
|
|
|
pub type IndexEntry<'a, K, V> = indexmap::map::Entry<'a, K, V>;
|
2019-12-24 22:32:36 +01:00
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! define_id_collections {
|
2022-07-16 15:16:57 +02:00
|
|
|
($map_name:ident, $set_name:ident, $entry_name:ident, $key:ty) => {
|
2019-12-24 22:32:36 +01:00
|
|
|
pub type $map_name<T> = $crate::fx::FxHashMap<$key, T>;
|
2022-12-02 16:27:25 +01:00
|
|
|
pub type $set_name = $crate::unord::UnordSet<$key>;
|
2022-07-16 15:16:57 +02:00
|
|
|
pub type $entry_name<'a, T> = $crate::fx::StdEntry<'a, $key, T>;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! define_stable_id_collections {
|
|
|
|
($map_name:ident, $set_name:ident, $entry_name:ident, $key:ty) => {
|
|
|
|
pub type $map_name<T> = $crate::fx::FxIndexMap<$key, T>;
|
|
|
|
pub type $set_name = $crate::fx::FxIndexSet<$key>;
|
|
|
|
pub type $entry_name<'a, T> = $crate::fx::IndexEntry<'a, $key, T>;
|
2019-12-24 22:32:36 +01:00
|
|
|
};
|
|
|
|
}
|