[][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 insert<KeyArg: Borrow<K>, ValArg: Borrow<V>>(key: KeyArg, val: 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 &'_ [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 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 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...