[][src]Trait srml_support::storage::StorageMap

pub trait StorageMap<K: Codec, V: Codec> {
    type Query;
    fn prefix() -> &'static [u8];
fn key_for<KeyArg: Borrow<K>>(key: KeyArg) -> Vec<u8>;
fn exists<KeyArg: Borrow<K>>(key: KeyArg) -> bool;
fn get<KeyArg: Borrow<K>>(key: KeyArg) -> Self::Query;
fn swap<KeyArg1: Borrow<K>, KeyArg2: Borrow<K>>(
        key1: KeyArg1,
        key2: KeyArg2
    );
fn insert<KeyArg: Borrow<K>, ValArg: Borrow<V>>(key: KeyArg, val: ValArg);
fn insert_ref<KeyArg: Borrow<K>, ValArg: ?Sized + Encode>(
        key: KeyArg,
        val: &ValArg
    )
    where
        V: AsRef<ValArg>
;
fn remove<KeyArg: Borrow<K>>(key: KeyArg);
fn mutate<KeyArg: Borrow<K>, R, F: FnOnce(&mut Self::Query) -> R>(
        key: KeyArg,
        f: F
    ) -> R;
fn take<KeyArg: Borrow<K>>(key: KeyArg) -> Self::Query; }

A strongly-typed map in storage.

Associated Types

type Query

The type that get/take return.

Loading content...

Required methods

Important traits for &'_ mut [u8]
fn prefix() -> &'static [u8]

Get the prefix key in storage.

Important traits for Vec<u8>
fn key_for<KeyArg: Borrow<K>>(key: KeyArg) -> Vec<u8>

Get the storage key used to fetch a value corresponding to a specific key.

fn exists<KeyArg: Borrow<K>>(key: KeyArg) -> bool

Does the value (explicitly) exist in storage?

fn get<KeyArg: Borrow<K>>(key: KeyArg) -> Self::Query

Load the value associated with the given key from the map.

fn swap<KeyArg1: Borrow<K>, KeyArg2: Borrow<K>>(key1: KeyArg1, key2: KeyArg2)

Swap the values of two keys.

fn insert<KeyArg: Borrow<K>, ValArg: Borrow<V>>(key: KeyArg, val: ValArg)

Store a value to be associated with the given key from the map.

fn insert_ref<KeyArg: Borrow<K>, ValArg: ?Sized + Encode>(
    key: KeyArg,
    val: &ValArg
) where
    V: AsRef<ValArg>, 

Store a value under this key into the provided storage instance; this can take any reference type that derefs to T (and has Encode implemented).

fn remove<KeyArg: Borrow<K>>(key: KeyArg)

Remove the value under a key.

fn mutate<KeyArg: Borrow<K>, R, F: FnOnce(&mut Self::Query) -> R>(
    key: KeyArg,
    f: F
) -> R

Mutate the value under a key.

fn take<KeyArg: Borrow<K>>(key: KeyArg) -> Self::Query

Take the value under a key.

Loading content...

Implementors

impl<K: Codec, V: Codec, U> StorageMap<K, V> for U where
    U: StorageMap<K, V>, 
[src]

type Query = U::Query

Loading content...