Enum rustc_ap_rustc_data_structures::sso::SsoHashMap [−][src]
Expand description
Small-storage-optimized implementation of a map.
Stores elements in a small array up to a certain length
and switches to HashMap
when that length is exceeded.
Variants
Map(FxHashMap<K, V>)
Implementations
impl<K, V> SsoHashMap<K, V>
[src]
impl<K, V> SsoHashMap<K, V>
[src]pub fn with_capacity(cap: usize) -> Self
[src]
pub fn with_capacity(cap: usize) -> Self
[src]Creates an empty SsoHashMap
with the specified capacity.
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
[src]Clears the map, removing all key-value pairs. Keeps the allocated memory for reuse.
pub fn capacity(&self) -> usize
[src]
pub fn capacity(&self) -> usize
[src]Returns the number of elements the map can hold without reallocating.
pub fn iter(&self) -> <&Self as IntoIterator>::IntoIter
[src]
pub fn iter(&self) -> <&Self as IntoIterator>::IntoIter
[src]An iterator visiting all key-value pairs in arbitrary order.
The iterator element type is (&'a K, &'a V)
.
pub fn iter_mut(&mut self) -> impl Iterator<Item = (&K, &mut V)>
[src]
pub fn iter_mut(&mut self) -> impl Iterator<Item = (&K, &mut V)>
[src]An iterator visiting all key-value pairs in arbitrary order,
with mutable references to the values.
The iterator element type is (&'a K, &'a mut V)
.
pub fn keys(&self) -> impl Iterator<Item = &K>
[src]
pub fn keys(&self) -> impl Iterator<Item = &K>
[src]An iterator visiting all keys in arbitrary order.
The iterator element type is &'a K
.
pub fn values(&self) -> impl Iterator<Item = &V>
[src]
pub fn values(&self) -> impl Iterator<Item = &V>
[src]An iterator visiting all values in arbitrary order.
The iterator element type is &'a V
.
pub fn values_mut(&mut self) -> impl Iterator<Item = &mut V>
[src]
pub fn values_mut(&mut self) -> impl Iterator<Item = &mut V>
[src]An iterator visiting all values mutably in arbitrary order.
The iterator element type is &'a mut V
.
impl<K: Eq + Hash, V> SsoHashMap<K, V>
[src]
impl<K: Eq + Hash, V> SsoHashMap<K, V>
[src]pub fn reserve(&mut self, additional: usize)
[src]
pub fn reserve(&mut self, additional: usize)
[src]Reserves capacity for at least additional
more elements to be inserted
in the SsoHashMap
. The collection may reserve more space to avoid
frequent reallocations.
pub fn shrink_to_fit(&mut self)
[src]
pub fn shrink_to_fit(&mut self)
[src]Shrinks the capacity of the map as much as possible. It will drop down as much as possible while maintaining the internal rules and possibly leaving some space in accordance with the resize policy.
pub fn retain<F>(&mut self, f: F) where
F: FnMut(&K, &mut V) -> bool,
[src]
pub fn retain<F>(&mut self, f: F) where
F: FnMut(&K, &mut V) -> bool,
[src]Retains only the elements specified by the predicate.
pub fn insert(&mut self, key: K, value: V) -> Option<V>
[src]
pub fn insert(&mut self, key: K, value: V) -> Option<V>
[src]Inserts a key-value pair into the map.
If the map did not have this key present, None
is returned.
If the map did have this key present, the value is updated, and the old
value is returned. The key is not updated, though; this matters for
types that can be ==
without being identical. See the [module-level
documentation] for more.
pub fn remove(&mut self, key: &K) -> Option<V>
[src]
pub fn remove(&mut self, key: &K) -> Option<V>
[src]Removes a key from the map, returning the value at the key if the key was previously in the map.
pub fn remove_entry(&mut self, key: &K) -> Option<(K, V)>
[src]
pub fn remove_entry(&mut self, key: &K) -> Option<(K, V)>
[src]Removes a key from the map, returning the stored key and value if the key was previously in the map.
pub fn get(&self, key: &K) -> Option<&V>
[src]
pub fn get(&self, key: &K) -> Option<&V>
[src]Returns a reference to the value corresponding to the key.
pub fn get_mut(&mut self, key: &K) -> Option<&mut V>
[src]
pub fn get_mut(&mut self, key: &K) -> Option<&mut V>
[src]Returns a mutable reference to the value corresponding to the key.
pub fn get_key_value(&self, key: &K) -> Option<(&K, &V)>
[src]
pub fn get_key_value(&self, key: &K) -> Option<(&K, &V)>
[src]Returns the key-value pair corresponding to the supplied key.
pub fn contains_key(&self, key: &K) -> bool
[src]
pub fn contains_key(&self, key: &K) -> bool
[src]Returns true
if the map contains a value for the specified key.
Trait Implementations
impl<K: Clone, V: Clone> Clone for SsoHashMap<K, V>
[src]
impl<K: Clone, V: Clone> Clone for SsoHashMap<K, V>
[src]fn clone(&self) -> SsoHashMap<K, V>
[src]
fn clone(&self) -> SsoHashMap<K, V>
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl<K, V> Debug for SsoHashMap<K, V> where
K: Debug,
V: Debug,
[src]
impl<K, V> Debug for SsoHashMap<K, V> where
K: Debug,
V: Debug,
[src]impl<K, V> Default for SsoHashMap<K, V>
[src]
impl<K, V> Default for SsoHashMap<K, V>
[src]impl<'a, K, V> Extend<(&'a K, &'a V)> for SsoHashMap<K, V> where
K: Eq + Hash + Copy,
V: Copy,
[src]
impl<'a, K, V> Extend<(&'a K, &'a V)> for SsoHashMap<K, V> where
K: Eq + Hash + Copy,
V: Copy,
[src]fn extend<T: IntoIterator<Item = (&'a K, &'a V)>>(&mut self, iter: T)
[src]
fn extend<T: IntoIterator<Item = (&'a K, &'a V)>>(&mut self, iter: T)
[src]Extends a collection with the contents of an iterator. Read more
fn extend_one(&mut self, (k, v): (&'a K, &'a V))
[src]
fn extend_one(&mut self, (k, v): (&'a K, &'a V))
[src]extend_one
)Extends a collection with exactly one element.
fn extend_reserve(&mut self, additional: usize)
[src]
fn extend_reserve(&mut self, additional: usize)
[src]extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
impl<K: Eq + Hash, V> Extend<(K, V)> for SsoHashMap<K, V>
[src]
impl<K: Eq + Hash, V> Extend<(K, V)> for SsoHashMap<K, V>
[src]fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = (K, V)>,
[src]
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = (K, V)>,
[src]Extends a collection with the contents of an iterator. Read more
fn extend_one(&mut self, (k, v): (K, V))
[src]
fn extend_one(&mut self, (k, v): (K, V))
[src]extend_one
)Extends a collection with exactly one element.
fn extend_reserve(&mut self, additional: usize)
[src]
fn extend_reserve(&mut self, additional: usize)
[src]extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
impl<K: Eq + Hash, V> FromIterator<(K, V)> for SsoHashMap<K, V>
[src]
impl<K: Eq + Hash, V> FromIterator<(K, V)> for SsoHashMap<K, V>
[src]fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> SsoHashMap<K, V>
[src]
fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> SsoHashMap<K, V>
[src]Creates a value from an iterator. Read more
impl<K, V> IntoIterator for SsoHashMap<K, V>
[src]
impl<K, V> IntoIterator for SsoHashMap<K, V>
[src]type IntoIter = EitherIter<<ArrayVec<(K, V), 8> as IntoIterator>::IntoIter, <FxHashMap<K, V> as IntoIterator>::IntoIter>
type IntoIter = EitherIter<<ArrayVec<(K, V), 8> as IntoIterator>::IntoIter, <FxHashMap<K, V> as IntoIterator>::IntoIter>
Which kind of iterator are we turning this into?
impl<'a, K, V> IntoIterator for &'a SsoHashMap<K, V>
[src]
impl<'a, K, V> IntoIterator for &'a SsoHashMap<K, V>
[src]impl<'a, K, V> IntoIterator for &'a mut SsoHashMap<K, V>
[src]
impl<'a, K, V> IntoIterator for &'a mut SsoHashMap<K, V>
[src]Auto Trait Implementations
impl<K, V> RefUnwindSafe for SsoHashMap<K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for SsoHashMap<K, V> where
K: Send,
V: Send,
K: Send,
V: Send,
impl<K, V> Sync for SsoHashMap<K, V> where
K: Sync,
V: Sync,
K: Sync,
V: Sync,
impl<K, V> Unpin for SsoHashMap<K, V> where
K: Unpin,
V: Unpin,
K: Unpin,
V: Unpin,
impl<K, V> UnwindSafe for SsoHashMap<K, V> where
K: UnwindSafe,
V: UnwindSafe,
K: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<'a, T> Captures<'a> for T where
T: ?Sized,
[src]
T: ?Sized,