Skip to main content

TryIndexMut

Trait TryIndexMut 

Source
pub trait TryIndexMut<Idx: ?Sized>: TryIndex<Idx> {
    // Required method
    fn try_index_mut(&mut self, index: &Idx) -> Option<&mut Self::Output>;
}
Expand description

A TryIndex whose elements can also be modified in place.

Required Methods§

Source

fn try_index_mut(&mut self, index: &Idx) -> Option<&mut Self::Output>

Mutably borrows the element stored under index, or None if there is none.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<K, V, S> TryIndexMut<K> for HashMap<K, V, S>
where K: Hash + Eq, S: BuildHasher,

Source§

fn try_index_mut(&mut self, index: &K) -> Option<&mut V>

Source§

impl<K, V> TryIndexMut<K> for BTreeMap<K, V>
where K: Ord,

Source§

fn try_index_mut(&mut self, index: &K) -> Option<&mut V>

Implementors§