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
sourceimpl 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.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Dict
impl !Send for Dict
impl !Sync for Dict
impl Unpin for Dict
impl UnwindSafe for Dict
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more