pub type DefIdMap<T> = UnordMap<DefId, T>;
Aliased Type§
struct DefIdMap<T> { /* private fields */ }
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 32 bytes
Implementations
Source§impl<K, V> UnordMap<K, V>
impl<K, V> UnordMap<K, V>
pub fn with_capacity(capacity: usize) -> UnordMap<K, V>
pub fn len(&self) -> usize
pub fn insert(&mut self, k: K, v: V) -> Option<V>
pub fn try_insert( &mut self, k: K, v: V, ) -> Result<&mut V, OccupiedError<'_, K, V>>
pub fn contains_key<Q>(&self, k: &Q) -> bool
pub fn is_empty(&self) -> bool
pub fn entry(&mut self, key: K) -> Entry<'_, K, V>
pub fn get<Q>(&self, k: &Q) -> Option<&V>
pub fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut V>
pub fn remove<Q>(&mut self, k: &Q) -> Option<V>
pub fn items(&self) -> UnordItems<(&K, &V), impl Iterator<Item = (&K, &V)>>
pub fn into_items(self) -> UnordItems<(K, V), impl Iterator<Item = (K, V)>>
pub fn keys(&self) -> UnordItems<&K, impl Iterator<Item = &K>>
Sourcepub fn to_sorted<HCX>(&self, hcx: &HCX, cache_sort_key: bool) -> Vec<(&K, &V)>where
K: ToStableHashKey<HCX>,
pub fn to_sorted<HCX>(&self, hcx: &HCX, cache_sort_key: bool) -> Vec<(&K, &V)>where
K: ToStableHashKey<HCX>,
Returns the entries of this map in stable sort order (as defined by ToStableHashKey
).
The cache_sort_key
parameter controls if slice::sort_by_cached_key or
slice::sort_unstable_by_key will be used for sorting the vec. Use
cache_sort_key
when the ToStableHashKey::to_stable_hash_key implementation
for K
is expensive (e.g. a DefId -> DefPathHash
lookup).
Sourcepub fn to_sorted_stable_ord(&self) -> Vec<(&K, &V)>where
K: StableCompare,
pub fn to_sorted_stable_ord(&self) -> Vec<(&K, &V)>where
K: StableCompare,
Returns the entries of this map in stable sort order (as defined by StableCompare
).
This method can be much more efficient than into_sorted
because it does not need
to transform keys to their ToStableHashKey
equivalent.
Sourcepub fn into_sorted<HCX>(self, hcx: &HCX, cache_sort_key: bool) -> Vec<(K, V)>where
K: ToStableHashKey<HCX>,
pub fn into_sorted<HCX>(self, hcx: &HCX, cache_sort_key: bool) -> Vec<(K, V)>where
K: ToStableHashKey<HCX>,
Returns the entries of this map in stable sort order (as defined by ToStableHashKey
).
The cache_sort_key
parameter controls if slice::sort_by_cached_key or
slice::sort_unstable_by_key will be used for sorting the vec. Use
cache_sort_key
when the ToStableHashKey::to_stable_hash_key implementation
for K
is expensive (e.g. a DefId -> DefPathHash
lookup).
Sourcepub fn into_sorted_stable_ord(self) -> Vec<(K, V)>where
K: StableCompare,
pub fn into_sorted_stable_ord(self) -> Vec<(K, V)>where
K: StableCompare,
Returns the entries of this map in stable sort order (as defined by StableCompare
).
This method can be much more efficient than into_sorted
because it does not need
to transform keys to their ToStableHashKey
equivalent.
Sourcepub fn values_sorted<HCX>(
&self,
hcx: &HCX,
cache_sort_key: bool,
) -> impl Iterator<Item = &V>where
K: ToStableHashKey<HCX>,
pub fn values_sorted<HCX>(
&self,
hcx: &HCX,
cache_sort_key: bool,
) -> impl Iterator<Item = &V>where
K: ToStableHashKey<HCX>,
Returns the values of this map in stable sort order (as defined by K’s
ToStableHashKey
implementation).
The cache_sort_key
parameter controls if slice::sort_by_cached_key or
slice::sort_unstable_by_key will be used for sorting the vec. Use
cache_sort_key
when the ToStableHashKey::to_stable_hash_key implementation
for K
is expensive (e.g. a DefId -> DefPathHash
lookup).
pub fn clear(&mut self)
Trait Implementations
Source§impl<K, V> Extend<(K, V)> for UnordMap<K, V>
impl<K, V> Extend<(K, V)> for UnordMap<K, V>
Source§fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = (K, V)>,
fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = (K, V)>,
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)