pub struct Mapping<K, V> { /* private fields */ }Expand description
Data structure for storing key-value pairs.
Implementations§
source§impl<K: ToBytes, V: FromBytes + CLTyped + Default> Mapping<K, V>
impl<K: ToBytes, V: FromBytes + CLTyped + Default> Mapping<K, V>
sourcepub fn get_or_default(&self, key: &K) -> V
pub fn get_or_default(&self, key: &K) -> V
Retrieves the value associated with the given key from the mapping.
If the key does not exist, returns the default value of type V.
Trait Implementations§
source§impl<K: ToBytes, V> ModuleComponent for Mapping<K, V>
impl<K: ToBytes, V> ModuleComponent for Mapping<K, V>
source§impl<K: ToBytes, V> Revertible for Mapping<K, V>
impl<K: ToBytes, V> Revertible for Mapping<K, V>
impl<K: ToBytes, V> ModulePrimitive for Mapping<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for Mapping<K, V>
impl<K, V> !RefUnwindSafe for Mapping<K, V>
impl<K, V> !Send for Mapping<K, V>
impl<K, V> !Sync for Mapping<K, V>
impl<K, V> Unpin for Mapping<K, V>
impl<K, V> !UnwindSafe for Mapping<K, V>
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