1 | use std::hash::BuildHasherDefault; |
2 | |
3 | pub use rustc_hash::{FxHashMap, FxHashSet, FxHasher}; |
4 | |
5 | pub type StdEntry<'a, K, V> = std::collections::hash_map::Entry<'a, K, V>; |
6 | |
7 | pub type FxIndexMap<K, V> = indexmap::IndexMap<K, V, BuildHasherDefault<FxHasher>>; |
8 | pub type FxIndexSet<V> = indexmap::IndexSet<V, BuildHasherDefault<FxHasher>>; |
9 | pub type IndexEntry<'a, K, V> = indexmap::map::Entry<'a, K, V>; |
10 | pub type IndexOccupiedEntry<'a, K, V> = indexmap::map::OccupiedEntry<'a, K, V>; |
11 | |
12 | #[macro_export ] |
13 | macro_rules! define_id_collections { |
14 | ($map_name:ident, $set_name:ident, $entry_name:ident, $key:ty) => { |
15 | pub type $map_name<T> = $crate::unord::UnordMap<$key, T>; |
16 | pub type $set_name = $crate::unord::UnordSet<$key>; |
17 | pub type $entry_name<'a, T> = $crate::fx::StdEntry<'a, $key, T>; |
18 | }; |
19 | } |
20 | |
21 | #[macro_export ] |
22 | macro_rules! define_stable_id_collections { |
23 | ($map_name:ident, $set_name:ident, $entry_name:ident, $key:ty) => { |
24 | pub type $map_name<T> = $crate::fx::FxIndexMap<$key, T>; |
25 | pub type $set_name = $crate::fx::FxIndexSet<$key>; |
26 | pub type $entry_name<'a, T> = $crate::fx::IndexEntry<'a, $key, T>; |
27 | }; |
28 | } |
29 | |