pub trait DoubleMapStorage {
type Key1;
type Key2;
type Value;
// Required methods
fn contains_keys(key1: &Self::Key1, key2: &Self::Key2) -> bool;
fn get(key1: &Self::Key1, key2: &Self::Key2) -> Option<Self::Value>;
fn insert(key1: Self::Key1, key2: Self::Key2, value: Self::Value);
fn mutate<R, F: FnOnce(&mut Option<Self::Value>) -> R>(
key1: Self::Key1,
key2: Self::Key2,
f: F,
) -> R;
fn mutate_values<F: FnMut(Self::Value) -> Self::Value>(f: F);
fn remove(key1: Self::Key1, key2: Self::Key2);
fn clear();
fn take(key1: Self::Key1, key2: Self::Key2) -> Option<Self::Value>;
fn clear_prefix(first_key: Self::Key1);
// Provided method
fn mutate_exists<R, F: FnOnce(&mut Self::Value) -> R>(
key1: Self::Key1,
key2: Self::Key2,
f: F,
) -> Option<R> { ... }
}Expand description
Represents logic of managing globally stored double-key map for more complicated logic.
In fact, represents custom implementation/wrapper
around of Substrate’s StorageDoubleMap with OptionQuery.
Required Associated Types§
Required Methods§
Sourcefn contains_keys(key1: &Self::Key1, key2: &Self::Key2) -> bool
fn contains_keys(key1: &Self::Key1, key2: &Self::Key2) -> bool
Returns bool, defining does map contain value under given keys.
Sourcefn get(key1: &Self::Key1, key2: &Self::Key2) -> Option<Self::Value>
fn get(key1: &Self::Key1, key2: &Self::Key2) -> Option<Self::Value>
Gets value stored under given keys, if present.
Sourcefn insert(key1: Self::Key1, key2: Self::Key2, value: Self::Value)
fn insert(key1: Self::Key1, key2: Self::Key2, value: Self::Value)
Inserts value with given keys.
Sourcefn mutate<R, F: FnOnce(&mut Option<Self::Value>) -> R>(
key1: Self::Key1,
key2: Self::Key2,
f: F,
) -> R
fn mutate<R, F: FnOnce(&mut Option<Self::Value>) -> R>( key1: Self::Key1, key2: Self::Key2, f: F, ) -> R
Mutates value by Option reference, which stored (or not
in None case) under given keys with given function.
May return generic type value.
Sourcefn mutate_values<F: FnMut(Self::Value) -> Self::Value>(f: F)
fn mutate_values<F: FnMut(Self::Value) -> Self::Value>(f: F)
Mutates all stored values with given convert function.
Sourcefn take(key1: Self::Key1, key2: Self::Key2) -> Option<Self::Value>
fn take(key1: Self::Key1, key2: Self::Key2) -> Option<Self::Value>
Gets value stored under given keys, if present, and removes it from storage.
Sourcefn clear_prefix(first_key: Self::Key1)
fn clear_prefix(first_key: Self::Key1)
Remove items from the map matching a first_key prefix.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl<T: AuxiliaryDoubleStorageWrap> DoubleMapStorage for T
Available on crate feature std only.
impl<T: AuxiliaryDoubleStorageWrap> DoubleMapStorage for T
std only.