rustc_data_structures/
fx.rs

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