pub trait ObjectMut {
type Key: ?Sized;
type Element;
// Required methods
fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut Self::Element>
where Self::Key: Borrow<Q>,
Q: Hash + Eq + Ord + ?Sized;
fn insert<K, V>(&mut self, k: K, v: V) -> Option<Self::Element>
where Self::Key: From<K> + Hash + Eq,
V: Into<Self::Element>;
fn remove<Q>(&mut self, k: &Q) -> Option<Self::Element>
where Self::Key: Borrow<Q>,
Q: Hash + Eq + Ord + ?Sized;
}Expand description
A mutable value Object
Required Associated Types§
Required Methods§
Sourcefn get_mut<Q>(&mut self, k: &Q) -> Option<&mut Self::Element>
fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut Self::Element>
Gets the value of a key as a mutable reference.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<MapK, MapE, S> ObjectMut for HashMap<MapK, MapE, S>
impl<MapK, MapE, S> ObjectMut for HashMap<MapK, MapE, S>
type Key = MapK
type Element = MapE
fn get_mut<Q>( &mut self, k: &Q, ) -> Option<&mut <HashMap<MapK, MapE, S> as ObjectMut>::Element>
fn insert<K, V>( &mut self, k: K, v: V, ) -> Option<<HashMap<MapK, MapE, S> as ObjectMut>::Element>
fn remove<Q>( &mut self, k: &Q, ) -> Option<<HashMap<MapK, MapE, S> as ObjectMut>::Element>
Source§impl<MapK, MapE, S> ObjectMut for SizedHashMap<MapK, MapE, S>
Available on crate feature halfbrown only.
impl<MapK, MapE, S> ObjectMut for SizedHashMap<MapK, MapE, S>
Available on crate feature
halfbrown only.