[][src]Trait frame_support::storage::IterableStorageDoubleMap

pub trait IterableStorageDoubleMap<K1: FullCodec, K2: FullCodec, V: FullCodec>: StorageDoubleMap<K1, K2, V> {
    type PrefixIterator: Iterator<Item = (K2, V)>;
    type Iterator: Iterator<Item = (K1, K2, V)>;
    fn iter_prefix(k1: impl EncodeLike<K1>) -> Self::PrefixIterator;
fn drain_prefix(k1: impl EncodeLike<K1>) -> Self::PrefixIterator;
fn iter() -> Self::Iterator;
fn drain() -> Self::Iterator;
fn translate<O: Decode, F: Fn(O) -> Option<V>>(f: F); }

A strongly-typed double map in storage whose secondary keys and values can be iterated over.

Associated Types

type PrefixIterator: Iterator<Item = (K2, V)>

The type that iterates over all (key2, value).

type Iterator: Iterator<Item = (K1, K2, V)>

The type that iterates over all (key1, key2, value).

Loading content...

Required methods

fn iter_prefix(k1: impl EncodeLike<K1>) -> Self::PrefixIterator

Enumerate all elements in the map with first key k1 in no particular order. If you add or remove values whose first key is k1 to the map while doing this, you'll get undefined results.

fn drain_prefix(k1: impl EncodeLike<K1>) -> Self::PrefixIterator

Remove all elements from the map with first key k1 and iterate through them in no particular order. If you add elements with first key k1 to the map while doing this, you'll get undefined results.

fn iter() -> Self::Iterator

Enumerate all elements in the map in no particular order. If you add or remove values to the map while doing this, you'll get undefined results.

fn drain() -> Self::Iterator

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.

fn translate<O: Decode, F: Fn(O) -> Option<V>>(f: F)

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.

Loading content...

Implementors

impl<K1: FullCodec, K2: FullCodec, V: FullCodec, G: StorageDoubleMap<K1, K2, V>> IterableStorageDoubleMap<K1, K2, V> for G where
    G::Hasher1: ReversibleStorageHasher,
    G::Hasher2: ReversibleStorageHasher
[src]

type PrefixIterator = MapIterator<(K2, V)>

type Iterator = MapIterator<(K1, K2, V)>

Loading content...