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