pub struct Dict { /* private fields */ }
Expand description
A dict (dictionary) storing arbitrarily typed keys and values.
Note that this type has interior mutability. This is because dicts in Mica are shared by
reference; creating a new dict requires using clone
.
Implementations§
source§impl Dict
impl Dict
sourcepub fn insert(&self, key: RawValue, value: RawValue) -> RawValue
pub fn insert(&self, key: RawValue, value: RawValue) -> RawValue
Sets the value at the given key. Returns the old value, or nil
if there was no value.
sourcepub fn remove(&self, key: RawValue) -> RawValue
pub fn remove(&self, key: RawValue) -> RawValue
Removes the value at the given key and returns it (or nil
if there was no value).
sourcepub fn get(&self, key: RawValue) -> Option<RawValue>
pub fn get(&self, key: RawValue) -> Option<RawValue>
Returns the value under the given key, or None
if there is no such value.
sourcepub fn contains_key(&self, key: RawValue) -> bool
pub fn contains_key(&self, key: RawValue) -> bool
Returns whether the dict contains a value under the given key.