SliceStorage

Trait SliceStorage 

Source
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§

Source

fn insert(&mut self, value: V) -> K

Source

fn remove(&mut self, key: K) -> Option<V>

Source

fn get(&self, key: K) -> Option<&V>

Source

fn iter(&self) -> Box<dyn Iterator<Item = (K, &V)> + '_>

Source

fn values(&self) -> Box<dyn Iterator<Item = &V> + '_>

Source

fn values_mut(&mut self) -> Box<dyn Iterator<Item = &mut V> + '_>

Source

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.

Implementations on Foreign Types§

Source§

impl<K, V> SliceStorage<K, V> for SlotMap<K, V>
where K: Key,

Source§

fn insert(&mut self, value: V) -> K

Source§

fn remove(&mut self, key: K) -> Option<V>

Source§

fn get(&self, key: K) -> Option<&V>

Source§

fn iter(&self) -> Box<dyn Iterator<Item = (K, &V)> + '_>

Source§

fn values(&self) -> Box<dyn Iterator<Item = &V> + '_>

Source§

fn values_mut(&mut self) -> Box<dyn Iterator<Item = &mut V> + '_>

Source§

fn is_empty(&self) -> bool

Source§

impl<K, V> SliceStorage<K, V> for SecondaryMap<K, V>
where K: Key,

Source§

fn insert(&mut self, _value: V) -> K

Source§

fn remove(&mut self, key: K) -> Option<V>

Source§

fn get(&self, key: K) -> Option<&V>

Source§

fn iter(&self) -> Box<dyn Iterator<Item = (K, &V)> + '_>

Source§

fn values(&self) -> Box<dyn Iterator<Item = &V> + '_>

Source§

fn values_mut(&mut self) -> Box<dyn Iterator<Item = &mut V> + '_>

Source§

fn is_empty(&self) -> bool

Source§

impl<K, V> SliceStorage<K, V> for SparseSecondaryMap<K, V>
where K: Key,

Source§

fn insert(&mut self, _value: V) -> K

Source§

fn remove(&mut self, key: K) -> Option<V>

Source§

fn get(&self, key: K) -> Option<&V>

Source§

fn iter(&self) -> Box<dyn Iterator<Item = (K, &V)> + '_>

Source§

fn values(&self) -> Box<dyn Iterator<Item = &V> + '_>

Source§

fn values_mut(&mut self) -> Box<dyn Iterator<Item = &mut V> + '_>

Source§

fn is_empty(&self) -> bool

Implementors§