Struct dharitri_wasm::storage::mappers::MapStorageMapper
source · pub struct MapStorageMapper<SA, K, V>where
SA: StorageMapperApi,
K: TopEncode + TopDecode + NestedEncode + NestedDecode + 'static,
V: StorageMapper<SA> + StorageClearable,{ /* private fields */ }Implementations§
source§impl<SA, K, V> MapStorageMapper<SA, K, V>where
SA: StorageMapperApi,
K: TopEncode + TopDecode + NestedEncode + NestedDecode,
V: StorageMapper<SA> + StorageClearable,
impl<SA, K, V> MapStorageMapper<SA, K, V>where
SA: StorageMapperApi,
K: TopEncode + TopDecode + NestedEncode + NestedDecode,
V: StorageMapper<SA> + StorageClearable,
sourcepub fn contains_key(&self, k: &K) -> bool
pub fn contains_key(&self, k: &K) -> bool
Returns true if the map contains a value for the specified key.
sourcepub fn entry(&mut self, key: K) -> Entry<'_, SA, K, V>
pub fn entry(&mut self, key: K) -> Entry<'_, SA, K, V>
Gets the given key’s corresponding entry in the map for in-place manipulation.
sourcepub fn insert_default(&mut self, k: K) -> bool
pub fn insert_default(&mut self, k: K) -> bool
Adds a default value for the key, if it is not already present.
If the map did not have this key present, true is returned.
If the map did have this value present, false is returned.
sourcepub fn remove(&mut self, k: &K) -> bool
pub fn remove(&mut self, k: &K) -> bool
Removes the entry from the map.
If the entry was removed, true is returned.
If the map didn’t contain an entry with this key, false is returned.
sourcepub fn keys(&self) -> Iter<'_, SA, K>
pub fn keys(&self) -> Iter<'_, SA, K>
An iterator visiting all keys in arbitrary order.
The iterator element type is &'a K.
Trait Implementations§
source§impl<SA, K, V> StorageClearable for MapStorageMapper<SA, K, V>where
SA: StorageMapperApi,
K: TopEncode + TopDecode + NestedEncode + NestedDecode,
V: StorageMapper<SA> + StorageClearable,
impl<SA, K, V> StorageClearable for MapStorageMapper<SA, K, V>where
SA: StorageMapperApi,
K: TopEncode + TopDecode + NestedEncode + NestedDecode,
V: StorageMapper<SA> + StorageClearable,
source§impl<SA, K, V> StorageMapper<SA> for MapStorageMapper<SA, K, V>where
SA: StorageMapperApi,
K: TopEncode + TopDecode + NestedEncode + NestedDecode,
V: StorageMapper<SA> + StorageClearable,
impl<SA, K, V> StorageMapper<SA> for MapStorageMapper<SA, K, V>where
SA: StorageMapperApi,
K: TopEncode + TopDecode + NestedEncode + NestedDecode,
V: StorageMapper<SA> + StorageClearable,
source§fn new(base_key: StorageKey<SA>) -> Self
fn new(base_key: StorageKey<SA>) -> Self
Will be called automatically by the
#[storage_mapper] annotation generated code.Auto Trait Implementations§
impl<SA, K, V> CodecFromSelf for MapStorageMapper<SA, K, V>
impl<SA, K, V> RefUnwindSafe for MapStorageMapper<SA, K, V>where
K: RefUnwindSafe,
SA: RefUnwindSafe,
V: RefUnwindSafe,
<SA as HandleTypeInfo>::ManagedBufferHandle: RefUnwindSafe,
impl<SA, K, V> Send for MapStorageMapper<SA, K, V>
impl<SA, K, V> Sync for MapStorageMapper<SA, K, V>
impl<SA, K, V> Unpin for MapStorageMapper<SA, K, V>
impl<SA, K, V> UnwindSafe for MapStorageMapper<SA, K, V>where
K: UnwindSafe,
SA: UnwindSafe,
V: UnwindSafe,
<SA as HandleTypeInfo>::ManagedBufferHandle: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more