pub trait Map<C, T>: Default + FromIterator<(C, T)> {
type Iter<'a>: Iterator<Item = (&'a C, &'a T)>
where C: 'a,
T: 'a,
Self: 'a;
type IntoEntries: Iterator<Item = (C, T)>;
// Required methods
fn get(&self, class: &C) -> Option<&T>;
fn get_mut(&mut self, class: &C) -> Option<&mut T>;
fn set(&mut self, class: C, value: T);
fn iter(&self) -> Self::Iter<'_>;
fn into_entries(self) -> Self::IntoEntries;
// Provided methods
fn singleton(class: C, value: T) -> Self { ... }
fn contains(&self, class: &C) -> bool { ... }
fn get_mut_or_insert_with(
&mut self,
class: &C,
f: impl FnOnce() -> T,
) -> &mut T
where C: Clone { ... }
fn get_or_try_insert_with<E>(
&mut self,
class: &C,
f: impl FnOnce() -> Result<T, E>,
) -> Result<&T, E>
where C: Clone { ... }
}Required Associated Types§
type Iter<'a>: Iterator<Item = (&'a C, &'a T)> where C: 'a, T: 'a, Self: 'a
type IntoEntries: Iterator<Item = (C, T)>
Required Methods§
fn get(&self, class: &C) -> Option<&T>
fn get_mut(&mut self, class: &C) -> Option<&mut T>
fn set(&mut self, class: C, value: T)
fn iter(&self) -> Self::Iter<'_>
fn into_entries(self) -> Self::IntoEntries
Provided Methods§
fn singleton(class: C, value: T) -> Self
fn contains(&self, class: &C) -> bool
fn get_mut_or_insert_with(&mut self, class: &C, f: impl FnOnce() -> T) -> &mut Twhere
C: Clone,
fn get_or_try_insert_with<E>(
&mut self,
class: &C,
f: impl FnOnce() -> Result<T, E>,
) -> Result<&T, E>where
C: Clone,
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.