pub trait StoreValues<K, V>: Store<K, V>{
type Values<'a>: Iterator<Item = &'a V>
where Self: 'a;
// Required method
fn values(&self) -> Self::Values<'_>;
}Expand description
Immutable store that is iterable over its values.
This trait extends Store, adding value iteration capabilities as a
requirement, so a store can enumerate its values.
§Examples
use std::collections::HashMap;
use zrx_store::{StoreMut, StoreValues};
// Create store and initial state
let mut store = HashMap::new();
store.insert("key", 42);
// Create iterator over the store
for value in store.values() {
println!("{value}");
}Required Associated Types§
Required Methods§
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> StoreValues<K, V> for BTreeMap<K, V>
impl<K, V> StoreValues<K, V> for BTreeMap<K, V>
Source§fn values(&self) -> Self::Values<'_>
fn values(&self) -> Self::Values<'_>
Creates an iterator over the values of the store.
§Examples
use std::collections::BTreeMap;
use zrx_store::{StoreMut, StoreValues};
// Create store and initial state
let mut store = BTreeMap::new();
store.insert("key", 42);
// Create iterator over the store
for value in store.values() {
println!("{value}");
}type Values<'a> = Values<'a, K, V> where Self: 'a
Source§impl<K, V> StoreValues<K, V> for Slab<(K, V)>
impl<K, V> StoreValues<K, V> for Slab<(K, V)>
Source§fn values(&self) -> Self::Values<'_>
fn values(&self) -> Self::Values<'_>
Creates an iterator over the values of the store.
§Examples
use slab::Slab;
use zrx_store::{StoreValues, StoreMut};
// Create store and initial state
let mut store = Slab::new();
StoreMut::insert(&mut store, "key", 42);
// Create iterator over the store
for key in StoreValues::values(&store) {
println!("{key}");
}type Values<'a> = Values<'a, K, V> where Self: 'a
Source§impl<K, V, S> StoreValues<K, V> for HashMap<K, V, S>
impl<K, V, S> StoreValues<K, V> for HashMap<K, V, S>
Source§fn values(&self) -> Self::Values<'_>
fn values(&self) -> Self::Values<'_>
Creates an iterator over the values of the store.
§Examples
use std::collections::HashMap;
use zrx_store::{StoreMut, StoreValues};
// Create store and initial state
let mut store = HashMap::new();
store.insert("key", 42);
// Create iterator over the store
for value in store.values() {
println!("{value}");
}