pub struct DictMut<'v> { /* private fields */ }
Expand description
Mutably borrowed Dict
.
Implementations§
Methods from Deref<Target = Dict<'v>>§
pub const TYPE: &'static str = "dict"
sourcepub fn iter<'a>(
&'a self
) -> impl ExactSizeIterator<Item = (Value<'v>, Value<'v>)> + 'a
pub fn iter<'a>( &'a self ) -> impl ExactSizeIterator<Item = (Value<'v>, Value<'v>)> + 'a
Iterate through the key/value pairs in the dictionary.
sourcepub fn iter_hashed<'a>(
&'a self
) -> impl Iterator<Item = (Hashed<Value<'v>>, Value<'v>)> + 'awhere
'v: 'a,
pub fn iter_hashed<'a>(
&'a self
) -> impl Iterator<Item = (Hashed<Value<'v>>, Value<'v>)> + 'awhere
'v: 'a,
Iterate through the key/value pairs in the dictionary, but retaining the hash of the keys.
sourcepub fn get_hashed(&self, key: Hashed<Value<'v>>) -> Option<Value<'v>>
pub fn get_hashed(&self, key: Hashed<Value<'v>>) -> Option<Value<'v>>
Lookup the value by the given prehashed key.
sourcepub fn get_str(&self, key: &str) -> Option<Value<'v>>
pub fn get_str(&self, key: &str) -> Option<Value<'v>>
Get the value associated with a particular string. Equivalent to allocating the string on the heap, turning it into a value, and looking up using that.
sourcepub fn get_str_hashed(&self, key: Hashed<&str>) -> Option<Value<'v>>
pub fn get_str_hashed(&self, key: Hashed<&str>) -> Option<Value<'v>>
Like Dict::get_str
, but where you already have the hash.
sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserve capacity to insert additional
elements without reallocating.
sourcepub fn insert_hashed(&mut self, key: Hashed<Value<'v>>, value: Value<'v>)
pub fn insert_hashed(&mut self, key: Hashed<Value<'v>>, value: Value<'v>)
Insert a key/value pair into the dictionary.
Trait Implementations§
Auto Trait Implementations§
impl<'v> !RefUnwindSafe for DictMut<'v>
impl<'v> !Send for DictMut<'v>
impl<'v> !Sync for DictMut<'v>
impl<'v> Unpin for DictMut<'v>
impl<'v> !UnwindSafe for DictMut<'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