Trait frame_support::storage::IterableStorageNMap[][src]

pub trait IterableStorageNMap<K: ReversibleKeyGenerator, V: FullCodec>: StorageNMap<K, V> {
    type KeyIterator: Iterator<Item = K::Key>;
    type Iterator: Iterator<Item = (K::Key, V)>;
    fn iter_prefix<KP>(
        kp: KP
    ) -> PrefixIterator<(<K as HasKeyPrefix<KP>>::Suffix, V)>
Notable traits for PrefixIterator<T, OnRemoval>
impl<T, OnRemoval: PrefixIteratorOnRemoval> Iterator for PrefixIterator<T, OnRemoval> type Item = T;

    where
        K: HasReversibleKeyPrefix<KP>
;
fn iter_prefix_from<KP>(
        kp: KP,
        starting_raw_key: Vec<u8>
    ) -> PrefixIterator<(<K as HasKeyPrefix<KP>>::Suffix, V)>
Notable traits for PrefixIterator<T, OnRemoval>
impl<T, OnRemoval: PrefixIteratorOnRemoval> Iterator for PrefixIterator<T, OnRemoval> type Item = T;

    where
        K: HasReversibleKeyPrefix<KP>
;
fn iter_key_prefix<KP>(
        kp: KP
    ) -> KeyPrefixIterator<<K as HasKeyPrefix<KP>>::Suffix>
Notable traits for KeyPrefixIterator<T>
impl<T> Iterator for KeyPrefixIterator<T> type Item = T;

    where
        K: HasReversibleKeyPrefix<KP>
;
fn iter_key_prefix_from<KP>(
        kp: KP,
        starting_raw_key: Vec<u8>
    ) -> KeyPrefixIterator<<K as HasKeyPrefix<KP>>::Suffix>
Notable traits for KeyPrefixIterator<T>
impl<T> Iterator for KeyPrefixIterator<T> type Item = T;

    where
        K: HasReversibleKeyPrefix<KP>
;
fn drain_prefix<KP>(
        kp: KP
    ) -> PrefixIterator<(<K as HasKeyPrefix<KP>>::Suffix, V)>
Notable traits for PrefixIterator<T, OnRemoval>
impl<T, OnRemoval: PrefixIteratorOnRemoval> Iterator for PrefixIterator<T, OnRemoval> type Item = T;

    where
        K: HasReversibleKeyPrefix<KP>
;
fn iter() -> Self::Iterator;
fn iter_from(starting_raw_key: Vec<u8>) -> Self::Iterator;
fn iter_keys() -> Self::KeyIterator;
fn iter_keys_from(starting_raw_key: Vec<u8>) -> Self::KeyIterator;
fn drain() -> Self::Iterator;
fn translate<O: Decode, F: FnMut(K::Key, O) -> Option<V>>(f: F); }
Expand description

A strongly-typed map with arbitrary number of keys in storage whose keys and values can be iterated over.

Associated Types

The type that iterates over all (key1, key2, key3, ... keyN) tuples.

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

Required methods

Enumerate all elements in the map with prefix key kp in lexicographical order of the encoded key. If you add or remove values whose prefix is kp to the map while doing this, you’ll get undefined results.

Enumerate all elements in the map with prefix key kp after a specified starting_raw_key in lexicographical order of the encoded key. If you add or remove values whose prefix is kp to the map while doing this, you’ll get undefined results.

Enumerate all suffix keys in the map with prefix key kp in lexicographical order of the encoded key. If you add or remove values whose prefix is kp to the map while doing this, you’ll get undefined results.

Enumerate all suffix keys in the map with prefix key kp after a specified starting_raw_key in lexicographical order of the encoded key. If you add or remove values whose prefix is kp to the map while doing this, you’ll get undefined results.

Remove all elements from the map with prefix key kp and iterate through them in lexicographical order of the encoded key. If you add elements with prefix key kp to the map while doing this, you’ll get undefined results.

Enumerate all elements in the map in lexicographical order of the encoded key. If you add or remove values to the map while doing this, you’ll get undefined results.

Enumerate all elements in the map after a specified starting_raw_key in lexicographical order of the encoded key. If you add or remove values to the map while doing this, you’ll get undefined results.

Enumerate all keys in the map in lexicographical order of the encoded key. If you add or remove values to the map while doing this, you’ll get undefined results.

Enumerate all keys in the map after starting_raw_key in lexicographical order of the encoded key. If you add or remove values to the map while doing this, you’ll get undefined results.

Remove all elements from the map and iterate through them in lexicographical order of the encoded key. 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 lexicographical order of the encoded key. 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.

Implementors