pub trait Collection<I, T>:
Any
+ Debug
+ Send {
// Required methods
fn get(&self, id: &I) -> Option<&T>;
fn contains_key(&self, id: &I) -> bool;
fn len(&self) -> usize;
fn is_empty(&self) -> bool;
fn iter(&self) -> Box<dyn Iterator<Item = (&'_ I, &'_ T)> + '_>;
fn keys(&self) -> Box<dyn Iterator<Item = &'_ I> + '_>;
fn values(&self) -> Box<dyn Iterator<Item = &'_ T> + '_>;
}Expand description
Collection of items.
This data type combines the most common traits from our store abstractions into a single trait that is dyn-compatible, so it can be used in operator functions to erase the concrete store type, which is central to hiding the implementation details of operators.
In order to automatically implement the Value trait for all data types
that implement Store and friends, we must implement Value on the
trait object dyn Collection<I, T>. Thus, we must require the supertraits
of Value on this trait, and for the blanket implementation. In case more
supertraits are added to Value in the future, we must add them here as
well, which is however unlikely to happen.
Required Methods§
Sourcefn contains_key(&self, id: &I) -> bool
fn contains_key(&self, id: &I) -> bool
Returns whether the collection contains the key.