Trait frame_support::storage::IterableStorageMap
source · [−]pub trait IterableStorageMap<K: FullEncode, V: FullCodec>: StorageMap<K, V> {
type Iterator: Iterator<Item = (K, V)>;
fn iter() -> Self::Iterator;
fn drain() -> Self::Iterator;
fn translate<O: Decode, F: FnMut(K, O) -> Option<V>>(f: F);
}
Expand description
A strongly-typed map in storage whose keys and values can be iterated over.
Associated Types
Required methods
Enumerate all elements in the map in no particular order. If you alter the map while doing this, you’ll get undefined results.
Remove all elements from the map and iterate through them in no particular order. If you add elements to the map while doing this, you’ll get undefined results.
Translate the values of all elements by a function f
, in the map in no particular order.
By returning None
from f
for an element, you’ll remove it from the map.
NOTE: If a value fail to decode because storage is corrupted then it is skipped.