Struct wasmtime_types::prelude::IndexMap
source · pub struct IndexMap<K, V> { /* private fields */ }
Expand description
Implementations§
source§impl<K, V> IndexMap<K, V>
impl<K, V> IndexMap<K, V>
sourcepub fn iter(&self) -> Iter<'_, K, V>
pub fn iter(&self) -> Iter<'_, K, V>
Returns an iterator that yields the items in the IndexMap
.
sourcepub fn iter_mut(&mut self) -> IterMut<'_, K, V>
pub fn iter_mut(&mut self) -> IterMut<'_, K, V>
Returns an iterator that yields the mutable items in the IndexMap
.
sourcepub fn values(&self) -> Values<'_, K, V>
pub fn values(&self) -> Values<'_, K, V>
Returns an iterator that yields the values in the IndexMap
.
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 IndexMap
.
source§impl<K, V> IndexMap<K, V>
impl<K, V> IndexMap<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 IndexMap
.
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 IndexMap
.
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)>
Return references to the key-value pair stored for key
,
if it is present, else None
.
sourcepub fn get_full<Q>(&self, key: &Q) -> Option<(usize, &K, &V)>
pub fn get_full<Q>(&self, key: &Q) -> Option<(usize, &K, &V)>
Returns the key-value pair corresponding to the supplied key as well as the unique index of the returned key-value pair.
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 IndexMap
.
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 swap_remove<Q>(&mut self, key: &Q) -> Option<V>
pub fn swap_remove<Q>(&mut self, key: &Q) -> Option<V>
Remove the key-value pair equivalent to key
and return its value.
Like Vec::swap_remove
, the pair is removed by swapping it with the
last element of the map and popping it off. This perturbs
the position of what used to be the last element!
Return None
if key
is not in map.
sourcepub fn swap_remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)>
pub fn swap_remove_entry<Q>(&mut self, key: &Q) -> Option<(K, V)>
Remove and return the key-value pair equivalent to key
.
Like Vec::swap_remove
, the pair is removed by swapping it with the
last element of the map and popping it off. This perturbs
the position of what used to be the last element!
Return None
if key
is not in map.
Trait Implementations§
source§impl<'a, K, V> Deserialize<'a> for IndexMap<K, V>
impl<'a, K, V> Deserialize<'a> for IndexMap<K, V>
source§fn deserialize<D>(
deserializer: D,
) -> Result<IndexMap<K, V>, <D as Deserializer<'a>>::Error>where
D: Deserializer<'a>,
fn deserialize<D>(
deserializer: D,
) -> Result<IndexMap<K, V>, <D as Deserializer<'a>>::Error>where
D: Deserializer<'a>,
source§impl<K, V> Extend<(K, V)> for IndexMap<K, V>
impl<K, V> Extend<(K, V)> for IndexMap<K, V>
source§fn extend<Iter>(&mut self, iter: Iter)where
Iter: IntoIterator<Item = (K, V)>,
fn extend<Iter>(&mut self, iter: Iter)where
Iter: 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
)source§impl<K, V> FromIterator<(K, V)> for IndexMap<K, V>
impl<K, V> FromIterator<(K, V)> for IndexMap<K, V>
source§impl<'a, K, V> IntoIterator for &'a IndexMap<K, V>
impl<'a, K, V> IntoIterator for &'a IndexMap<K, V>
source§impl<'a, K, V> IntoIterator for &'a mut IndexMap<K, V>
impl<'a, K, V> IntoIterator for &'a mut IndexMap<K, V>
source§impl<K, V> IntoIterator for IndexMap<K, V>
impl<K, V> IntoIterator for IndexMap<K, V>
source§impl<K, V> Serialize for IndexMap<K, V>
impl<K, V> Serialize for IndexMap<K, V>
source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl<K, V> Eq for IndexMap<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for IndexMap<K, V>
impl<K, V> RefUnwindSafe for IndexMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for IndexMap<K, V>
impl<K, V> Sync for IndexMap<K, V>
impl<K, V> Unpin for IndexMap<K, V>
impl<K, V> UnwindSafe for IndexMap<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.