pub struct MapStorageMapper<SA, K, V, A = CurrentStorage>where
SA: StorageMapperApi,
K: TopEncode + TopDecode + NestedEncode + NestedDecode + 'static,
A: StorageAddress<SA>,
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 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.
Source§impl<SA, A, K, V> MapStorageMapper<SA, K, V, A>where
SA: StorageMapperApi,
A: StorageAddress<SA>,
K: TopEncode + TopDecode + NestedEncode + NestedDecode,
V: StorageMapper<SA> + StorageClearable,
impl<SA, A, K, V> MapStorageMapper<SA, K, V, A>where
SA: StorageMapperApi,
A: StorageAddress<SA>,
K: TopEncode + TopDecode + NestedEncode + NestedDecode,
V: StorageMapper<SA> + StorageClearable,
pub fn keys(&self) -> Iter<'_, SA, A, K>
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, A, K, V>
pub fn entry(&mut self, key: K) -> Entry<'_, SA, A, K, V>
Gets the given key’s corresponding entry in the map for in-place manipulation.
Trait Implementations§
Source§impl<'a, SA, A, K, V> IntoIterator for &'a MapStorageMapper<SA, K, V, A>where
SA: StorageMapperApi,
A: StorageAddress<SA>,
K: TopEncode + TopDecode + NestedEncode + NestedDecode + 'static,
V: StorageMapper<SA> + StorageClearable,
impl<'a, SA, A, K, V> IntoIterator for &'a MapStorageMapper<SA, K, V, A>where
SA: StorageMapperApi,
A: StorageAddress<SA>,
K: TopEncode + TopDecode + NestedEncode + NestedDecode + 'static,
V: StorageMapper<SA> + StorageClearable,
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>) -> MapStorageMapper<SA, K, V>
fn new(base_key: StorageKey<SA>) -> MapStorageMapper<SA, K, V>
Will be called automatically by the
#[storage_mapper]
annotation generated code.Source§impl<SA, K, V> StorageMapperFromAddress<SA> for MapStorageMapper<SA, K, V, ManagedAddress<SA>>where
SA: StorageMapperApi,
K: TopEncode + TopDecode + NestedEncode + NestedDecode,
V: StorageMapper<SA> + StorageClearable,
impl<SA, K, V> StorageMapperFromAddress<SA> for MapStorageMapper<SA, K, V, ManagedAddress<SA>>where
SA: StorageMapperApi,
K: TopEncode + TopDecode + NestedEncode + NestedDecode,
V: StorageMapper<SA> + StorageClearable,
Source§fn new_from_address(
address: ManagedAddress<SA>,
base_key: StorageKey<SA>,
) -> MapStorageMapper<SA, K, V, ManagedAddress<SA>>
fn new_from_address( address: ManagedAddress<SA>, base_key: StorageKey<SA>, ) -> MapStorageMapper<SA, K, V, ManagedAddress<SA>>
Will be called automatically by the
#[storage_mapper_from_address]
annotation generated code.Auto Trait Implementations§
impl<SA, K, V, A> Freeze for MapStorageMapper<SA, K, V, A>
impl<SA, K, V, A> RefUnwindSafe for MapStorageMapper<SA, K, V, A>where
SA: RefUnwindSafe,
A: RefUnwindSafe,
V: RefUnwindSafe,
<SA as HandleTypeInfo>::ManagedBufferHandle: RefUnwindSafe,
K: RefUnwindSafe,
impl<SA, K, V, A> Send for MapStorageMapper<SA, K, V, A>
impl<SA, K, V, A> Sync for MapStorageMapper<SA, K, V, A>
impl<SA, K, V, A> Unpin for MapStorageMapper<SA, K, V, A>
impl<SA, K, V, A> UnwindSafe for MapStorageMapper<SA, K, V, A>where
SA: UnwindSafe,
A: UnwindSafe,
V: UnwindSafe,
<SA as HandleTypeInfo>::ManagedBufferHandle: UnwindSafe,
K: 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> InterpretableFrom<T> for T
impl<T> InterpretableFrom<T> for T
fn interpret_from(from: T, _context: &InterpreterContext) -> T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more