[−][src]Trait frame_support::storage::StorageMap
A strongly-typed map in storage.
Details on implementation can be found at
[generator::StorageMap]
Associated Types
Loading content...Required methods
pub fn hashed_key_for<KeyArg: EncodeLike<K>>(key: KeyArg) -> Vec<u8>ⓘ[src]
Get the storage key used to fetch a value corresponding to a specific key.
pub fn contains_key<KeyArg: EncodeLike<K>>(key: KeyArg) -> bool[src]
Does the value (explicitly) exist in storage?
pub fn get<KeyArg: EncodeLike<K>>(key: KeyArg) -> Self::Query[src]
Load the value associated with the given key from the map.
pub fn swap<KeyArg1: EncodeLike<K>, KeyArg2: EncodeLike<K>>(
key1: KeyArg1,
key2: KeyArg2
)[src]
key1: KeyArg1,
key2: KeyArg2
)
Swap the values of two keys.
pub fn insert<KeyArg: EncodeLike<K>, ValArg: EncodeLike<V>>(
key: KeyArg,
val: ValArg
)[src]
key: KeyArg,
val: ValArg
)
Store a value to be associated with the given key from the map.
pub fn remove<KeyArg: EncodeLike<K>>(key: KeyArg)[src]
Remove the value under a key.
pub fn mutate<KeyArg: EncodeLike<K>, R, F: FnOnce(&mut Self::Query) -> R>(
key: KeyArg,
f: F
) -> R[src]
key: KeyArg,
f: F
) -> R
Mutate the value under a key.
pub fn try_mutate<KeyArg: EncodeLike<K>, R, E, F: FnOnce(&mut Self::Query) -> Result<R, E>>(
key: KeyArg,
f: F
) -> Result<R, E>[src]
key: KeyArg,
f: F
) -> Result<R, E>
Mutate the item, only if an Ok value is returned.
pub fn mutate_exists<KeyArg: EncodeLike<K>, R, F: FnOnce(&mut Option<V>) -> R>(
key: KeyArg,
f: F
) -> R[src]
key: KeyArg,
f: F
) -> R
Mutate the value under a key. Deletes the item if mutated to a None.
pub fn try_mutate_exists<KeyArg: EncodeLike<K>, R, E, F: FnOnce(&mut Option<V>) -> Result<R, E>>(
key: KeyArg,
f: F
) -> Result<R, E>[src]
key: KeyArg,
f: F
) -> Result<R, E>
Mutate the item, only if an Ok value is returned. Deletes the item if mutated to a None.
pub fn take<KeyArg: EncodeLike<K>>(key: KeyArg) -> Self::Query[src]
Take the value under a key.
pub fn append<Item, EncodeLikeItem, EncodeLikeKey>(
key: EncodeLikeKey,
item: EncodeLikeItem
) where
EncodeLikeKey: EncodeLike<K>,
Item: Encode,
EncodeLikeItem: EncodeLike<Item>,
V: StorageAppend<Item>, [src]
key: EncodeLikeKey,
item: EncodeLikeItem
) where
EncodeLikeKey: EncodeLike<K>,
Item: Encode,
EncodeLikeItem: EncodeLike<Item>,
V: StorageAppend<Item>,
Append the given items to the value in the storage.
V is required to implement codec::EncodeAppend.
Warning
If the storage item is not encoded properly, the storage will be overwritten
and set to [item]. Any default value set for the storage item will be ignored
on overwrite.
pub fn migrate_key<OldHasher: StorageHasher, KeyArg: EncodeLike<K>>(
key: KeyArg
) -> Option<V>[src]
key: KeyArg
) -> Option<V>
Migrate an item with the given key from a defunct OldHasher to the current hasher.
If the key doesn't exist, then it's a no-op. If it does, then it returns its value.
Provided methods
pub fn decode_len<KeyArg: EncodeLike<K>>(key: KeyArg) -> Option<usize> where
V: StorageDecodeLength, [src]
V: StorageDecodeLength,
Read the length of the storage value without decoding the entire value under the
given key.
V is required to implement StorageDecodeLength.
If the value does not exists or it fails to decode the length, None is returned.
Otherwise Some(len) is returned.
Warning
None does not mean that get() does not return a value. The default value is completly
ignored by this function.
pub fn migrate_key_from_blake<KeyArg: EncodeLike<K>>(key: KeyArg) -> Option<V>[src]
Migrate an item with the given key from a blake2_256 hasher to the current hasher.
If the key doesn't exist, then it's a no-op. If it does, then it returns its value.
Implementors
impl<K: FullEncode, V: FullCodec, G: StorageMap<K, V>> StorageMap<K, V> for G[src]
type Query = G::Query
pub fn hashed_key_for<KeyArg: EncodeLike<K>>(key: KeyArg) -> Vec<u8>ⓘ[src]
pub fn swap<KeyArg1: EncodeLike<K>, KeyArg2: EncodeLike<K>>(
key1: KeyArg1,
key2: KeyArg2
)[src]
key1: KeyArg1,
key2: KeyArg2
)
pub fn contains_key<KeyArg: EncodeLike<K>>(key: KeyArg) -> bool[src]
pub fn get<KeyArg: EncodeLike<K>>(key: KeyArg) -> Self::Query[src]
pub fn insert<KeyArg: EncodeLike<K>, ValArg: EncodeLike<V>>(
key: KeyArg,
val: ValArg
)[src]
key: KeyArg,
val: ValArg
)
pub fn remove<KeyArg: EncodeLike<K>>(key: KeyArg)[src]
pub fn mutate<KeyArg: EncodeLike<K>, R, F: FnOnce(&mut Self::Query) -> R>(
key: KeyArg,
f: F
) -> R[src]
key: KeyArg,
f: F
) -> R
pub fn mutate_exists<KeyArg: EncodeLike<K>, R, F: FnOnce(&mut Option<V>) -> R>(
key: KeyArg,
f: F
) -> R[src]
key: KeyArg,
f: F
) -> R
pub fn try_mutate<KeyArg: EncodeLike<K>, R, E, F: FnOnce(&mut Self::Query) -> Result<R, E>>(
key: KeyArg,
f: F
) -> Result<R, E>[src]
key: KeyArg,
f: F
) -> Result<R, E>
pub fn try_mutate_exists<KeyArg: EncodeLike<K>, R, E, F: FnOnce(&mut Option<V>) -> Result<R, E>>(
key: KeyArg,
f: F
) -> Result<R, E>[src]
key: KeyArg,
f: F
) -> Result<R, E>
pub fn take<KeyArg: EncodeLike<K>>(key: KeyArg) -> Self::Query[src]
pub fn append<Item, EncodeLikeItem, EncodeLikeKey>(
key: EncodeLikeKey,
item: EncodeLikeItem
) where
EncodeLikeKey: EncodeLike<K>,
Item: Encode,
EncodeLikeItem: EncodeLike<Item>,
V: StorageAppend<Item>, [src]
key: EncodeLikeKey,
item: EncodeLikeItem
) where
EncodeLikeKey: EncodeLike<K>,
Item: Encode,
EncodeLikeItem: EncodeLike<Item>,
V: StorageAppend<Item>,
pub fn migrate_key<OldHasher: StorageHasher, KeyArg: EncodeLike<K>>(
key: KeyArg
) -> Option<V>[src]
key: KeyArg
) -> Option<V>