Trait frame_support::traits::StoredMap  [−][src]
An abstraction of a value stored within storage, but possibly as part of a larger composite item.
Required methods
fn get(k: &K) -> T[src]
Get the item, or its default if it doesn’t yet exist; we make no distinction between the two.
fn try_mutate_exists<R, E: From<StoredMapError>>(
    k: &K, 
    f: impl FnOnce(&mut Option<T>) -> Result<R, E>
) -> Result<R, E>[src]
k: &K,
f: impl FnOnce(&mut Option<T>) -> Result<R, E>
) -> Result<R, E>
Maybe mutate the item only if an Ok value is returned from f. Do nothing if an Err is
returned. It is removed or reset to default value if it has been mutated to None
Provided methods
fn mutate<R>(k: &K, f: impl FnOnce(&mut T) -> R) -> Result<R, StoredMapError>[src]
Mutate the item.
fn mutate_exists<R>(
    k: &K, 
    f: impl FnOnce(&mut Option<T>) -> R
) -> Result<R, StoredMapError>[src]
k: &K,
f: impl FnOnce(&mut Option<T>) -> R
) -> Result<R, StoredMapError>
Mutate the item, removing or resetting to default value if it has been mutated to None.
This is infallible as long as the value does not get destroyed.
fn insert(k: &K, t: T) -> Result<(), StoredMapError>[src]
Set the item to something new.
fn remove(k: &K) -> Result<(), StoredMapError>[src]
Remove the item or otherwise replace it with its default value; we don’t care which.
Implementors
impl<S: StorageMap<K, T, Query = T>, L: HandleLifetime<K>, K: FullCodec, T: FullCodec + Default> StoredMap<K, T> for StorageMapShim<S, L, K, T>[src]
fn get(k: &K) -> T[src]
fn insert(k: &K, t: T) -> Result<(), StoredMapError>[src]
fn remove(k: &K) -> Result<(), StoredMapError>[src]
fn mutate<R>(k: &K, f: impl FnOnce(&mut T) -> R) -> Result<R, StoredMapError>[src]
fn mutate_exists<R>(
    k: &K, 
    f: impl FnOnce(&mut Option<T>) -> R
) -> Result<R, StoredMapError>[src]
k: &K,
f: impl FnOnce(&mut Option<T>) -> R
) -> Result<R, StoredMapError>
fn try_mutate_exists<R, E: From<StoredMapError>>(
    k: &K, 
    f: impl FnOnce(&mut Option<T>) -> Result<R, E>
) -> Result<R, E>[src]
k: &K,
f: impl FnOnce(&mut Option<T>) -> Result<R, E>
) -> Result<R, E>