pub trait AsImHashMap<K: Hash + Eq + Clone, V: Clone>: Clone {
// Required methods
fn insert(&mut self, k: K, v: V) -> Option<V>;
fn remove<BK: Hash + Eq + ?Sized>(&mut self, k: &BK) -> Option<V>
where K: Borrow<BK>;
fn remove_with_key<BK: Hash + Eq + ?Sized>(
&mut self,
k: &BK,
) -> Option<(K, V)>
where K: Borrow<BK>;
fn retain<F: FnMut(&K, &V) -> bool>(&mut self, f: F);
// Provided methods
fn to_inserted(&self, k: K, v: V) -> (Self, Option<V>) { ... }
fn to_removed<BK: Hash + Eq + ?Sized>(
&mut self,
k: &BK,
) -> (Self, Option<V>)
where K: Borrow<BK> { ... }
fn to_removed_with_key<BK: Hash + Eq + ?Sized>(
&mut self,
k: &BK,
) -> (Self, Option<(K, V)>)
where K: Borrow<BK> { ... }
fn to_retained<F: FnMut(&K, &V) -> bool>(&self, f: F) -> Self { ... }
fn to_extended<I: IntoIterator<Item = (K, V)>>(&self, iter: I) -> Self
where Self: Extend<(K, V)> { ... }
fn iter_clone(&self) -> Self::IntoIter
where Self: IntoIterator { ... }
}
Required Methods§
fn insert(&mut self, k: K, v: V) -> Option<V>
fn remove<BK: Hash + Eq + ?Sized>(&mut self, k: &BK) -> Option<V>where
K: Borrow<BK>,
fn remove_with_key<BK: Hash + Eq + ?Sized>(&mut self, k: &BK) -> Option<(K, V)>where
K: Borrow<BK>,
fn retain<F: FnMut(&K, &V) -> bool>(&mut self, f: F)
Provided Methods§
fn to_inserted(&self, k: K, v: V) -> (Self, Option<V>)
fn to_removed<BK: Hash + Eq + ?Sized>(&mut self, k: &BK) -> (Self, Option<V>)where
K: Borrow<BK>,
fn to_removed_with_key<BK: Hash + Eq + ?Sized>(
&mut self,
k: &BK,
) -> (Self, Option<(K, V)>)where
K: Borrow<BK>,
fn to_retained<F: FnMut(&K, &V) -> bool>(&self, f: F) -> Self
fn to_extended<I: IntoIterator<Item = (K, V)>>(&self, iter: I) -> Self
fn iter_clone(&self) -> Self::IntoIterwhere
Self: IntoIterator,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.