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

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(K1, K2, 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)>[src]

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

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

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

Loading content...

Required methods

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

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[src]

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[src]

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[src]

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(K1, K2, O) -> Option<V>>(f: F)[src]

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.

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 = PrefixIterator<(K2, V)>

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

Loading content...