Struct wasmparser::collections::map::Map
source · pub struct Map<K, V> { /* private fields */ }
Expand description
Implementations§
source§impl<K, V> Map<K, V>
impl<K, V> Map<K, V>
sourcepub fn iter_mut(&mut self) -> IterMut<'_, K, V> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_, K, V> ⓘ
Returns a mutable iterator that yields the items in the Map
.
sourcepub fn into_keys(self) -> IntoKeys<K, V> ⓘ
pub fn into_keys(self) -> IntoKeys<K, V> ⓘ
Creates a consuming iterator visiting all the keys in arbitrary order.
The Map
cannot be used after calling this.
The iterator element type is K
.
sourcepub fn values(&self) -> Values<'_, K, V> ⓘ
pub fn values(&self) -> Values<'_, K, V> ⓘ
Returns an iterator that yields the values in the Map
.
sourcepub fn into_values(self) -> IntoValues<K, V> ⓘ
pub fn into_values(self) -> IntoValues<K, V> ⓘ
Creates a consuming iterator visiting all the values in arbitrary order.
The Map
cannot be used after calling this.
The iterator element type is V
.
sourcepub fn values_mut(&mut self) -> ValuesMut<'_, K, V> ⓘ
pub fn values_mut(&mut self) -> ValuesMut<'_, K, V> ⓘ
Returns a mutable iterator that yields the values in the Map
.
source§impl<K, V> Map<K, V>
impl<K, V> Map<K, V>
sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional
more elements to be inserted in the Map
.
sourcepub fn contains_key<Q>(&self, key: &Q) -> bool
pub fn contains_key<Q>(&self, key: &Q) -> bool
Returns true if key
is contains in the Map
.
sourcepub fn get<Q>(&self, key: &Q) -> Option<&V>
pub fn get<Q>(&self, key: &Q) -> Option<&V>
Returns a reference to the value corresponding to the key
.
sourcepub fn get_key_value<Q>(&self, key: &Q) -> Option<(&K, &V)>
pub fn get_key_value<Q>(&self, key: &Q) -> Option<(&K, &V)>
Returns the key-value pair corresponding to the supplied key.
The supplied key may be any borrowed form of the map’s key type, but the ordering on the borrowed form must match the ordering on the key type.
sourcepub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>
Returns a mutable reference to the value corresponding to the key.
sourcepub fn insert(&mut self, key: K, value: V) -> Option<V>
pub fn insert(&mut self, key: K, value: V) -> Option<V>
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.
sourcepub fn remove<Q>(&mut self, key: &Q) -> Option<V>
pub fn remove<Q>(&mut self, key: &Q) -> Option<V>
Removes a key from the Map
, returning the value at the key if the key was previously in the map.
sourcepub fn remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)>
pub fn remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)>
Removes a key from the Map
, returning the stored key and value if the key
was previously in the map.
The key may be any borrowed form of the map’s key type, but the ordering on the borrowed form must match the ordering on the key type.
Trait Implementations§
source§impl<'a, K, V> Extend<(&'a K, &'a V)> for Map<K, V>
impl<'a, K, V> Extend<(&'a K, &'a V)> for Map<K, V>
source§fn extend<Iter: IntoIterator<Item = (&'a K, &'a V)>>(&mut self, iter: Iter)
fn extend<Iter: IntoIterator<Item = (&'a K, &'a V)>>(&mut self, iter: Iter)
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
)source§impl<K, V> Extend<(K, V)> for Map<K, V>
impl<K, V> Extend<(K, V)> for Map<K, V>
source§fn extend<Iter: IntoIterator<Item = (K, V)>>(&mut self, iter: Iter)
fn extend<Iter: IntoIterator<Item = (K, V)>>(&mut self, iter: Iter)
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
)source§impl<K, V> FromIterator<(K, V)> for Map<K, V>
impl<K, V> FromIterator<(K, V)> for Map<K, V>
source§impl<'a, K, V> IntoIterator for &'a Map<K, V>
impl<'a, K, V> IntoIterator for &'a Map<K, V>
source§impl<'a, K: 'a, V: 'a> IntoIterator for &'a mut Map<K, V>
impl<'a, K: 'a, V: 'a> IntoIterator for &'a mut Map<K, V>
source§impl<K, V> IntoIterator for Map<K, V>
impl<K, V> IntoIterator for Map<K, V>
impl<K, V> Eq for Map<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for Map<K, V>
impl<K, V> RefUnwindSafe for Map<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for Map<K, V>
impl<K, V> Sync for Map<K, V>
impl<K, V> Unpin for Map<K, V>
impl<K, V> UnwindSafe for Map<K, V>where
K: UnwindSafe,
V: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.