[][src]Trait srml_support::storage::StorageValue

pub trait StorageValue<T: Codec> {
    type Query;
    fn key() -> &'static [u8];
fn exists() -> bool;
fn get() -> Self::Query;
fn put<Arg: Borrow<T>>(val: Arg);
fn mutate<R, F: FnOnce(&mut Self::Query) -> R>(f: F) -> R;
fn kill();
fn take() -> Self::Query;
fn append<I: Encode>(items: &[I]) -> Result<(), &'static str>
    where
        T: EncodeAppend<Item = I>
; }

A trait for working with macro-generated storage values under the substrate storage API.

Associated Types

type Query

The type that get/take return.

Loading content...

Required methods

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

Get the storage key.

fn exists() -> bool

Does the value (explicitly) exist in storage?

fn get() -> Self::Query

Load the value from the provided storage instance.

fn put<Arg: Borrow<T>>(val: Arg)

Store a value under this key into the provided storage instance.

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

Mutate the value

fn kill()

Clear the storage value.

fn take() -> Self::Query

Take a value from storage, removing it afterwards.

fn append<I: Encode>(items: &[I]) -> Result<(), &'static str> where
    T: EncodeAppend<Item = I>, 

Append the given item to the value in the storage.

T is required to implement codec::EncodeAppend.

Loading content...

Implementors

impl<T: Codec, U> StorageValue<T> for U where
    U: StorageValue<T>, 
[src]

type Query = U::Query

Loading content...