pub trait SliceStorage<K, V>: Default {
// Required methods
fn insert(&mut self, value: V) -> K;
fn remove(&mut self, key: K) -> Option<V>;
fn get(&self, key: K) -> Option<&V>;
fn iter(&self) -> Box<dyn Iterator<Item = (K, &V)> + '_>;
fn values(&self) -> Box<dyn Iterator<Item = &V> + '_>;
fn values_mut(&mut self) -> Box<dyn Iterator<Item = &mut V> + '_>;
fn is_empty(&self) -> bool;
}Expand description
Trait to abstract operations on storage of slices
Required Methods§
fn insert(&mut self, value: V) -> K
fn remove(&mut self, key: K) -> Option<V>
fn get(&self, key: K) -> Option<&V>
fn iter(&self) -> Box<dyn Iterator<Item = (K, &V)> + '_>
fn values(&self) -> Box<dyn Iterator<Item = &V> + '_>
fn values_mut(&mut self) -> Box<dyn Iterator<Item = &mut V> + '_>
fn is_empty(&self) -> bool
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.