pub struct MapMut<'msg, K: ?Sized, V: ?Sized> { /* private fields */ }Expand description
A mutable proxy of a map field.
This is a proxy type that is conceptually similar to a &mut Map<K, V>
Implementations§
Source§impl<'msg, K: MapKey, V: MapValue> MapMut<'msg, K, V>
impl<'msg, K: MapKey, V: MapValue> MapMut<'msg, K, V>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn contains_key<'a>(&self, key: impl Into<View<'a, K>>) -> boolwhere
K: 'a,
Sourcepub fn insert<'a>(
&mut self,
key: impl Into<View<'a, K>>,
value: impl IntoProxied<V>,
) -> bool
pub fn insert<'a>( &mut self, key: impl Into<View<'a, K>>, value: impl IntoProxied<V>, ) -> bool
Adds a key-value pair to the map.
Returns true if the entry was newly inserted.
pub fn remove<'a>(&mut self, key: impl Into<View<'a, K>>) -> bool
pub fn clear(&mut self)
pub fn get<'a>(&self, key: impl Into<View<'a, K>>) -> Option<View<'_, V>>
pub fn get_mut<'a>(&mut self, key: impl Into<View<'a, K>>) -> Option<Mut<'_, V>>where
V: Message,
pub fn copy_from<'a>( &mut self, src: impl IntoIterator<Item = (impl Into<View<'a, K>>, impl IntoProxied<V>)>, )
Sourcepub fn iter(&self) -> MapIter<'_, K, V> ⓘ
pub fn iter(&self) -> MapIter<'_, K, V> ⓘ
Returns an iterator visiting all key-value pairs in arbitrary order.
The iterator element type is (View<K>, View<V>).
Trait Implementations§
Source§impl<'msg, 'k, KView, VView, K, V> Extend<(KView, VView)> for MapMut<'msg, K, V>
impl<'msg, 'k, KView, VView, K, V> Extend<(KView, VView)> for MapMut<'msg, K, V>
Source§fn extend<T: IntoIterator<Item = (KView, VView)>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = (KView, VView)>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<'a, 'msg, K: MapKey, V: MapValue> IntoIterator for &'a MapMut<'msg, K, V>where
'msg: 'a,
impl<'a, 'msg, K: MapKey, V: MapValue> IntoIterator for &'a MapMut<'msg, K, V>where
'msg: 'a,
Source§type Item = (<K as ProtoObject>::View<'a>, <V as ProtoObject>::View<'a>)
type Item = (<K as ProtoObject>::View<'a>, <V as ProtoObject>::View<'a>)
The type of the elements being iterated over.
impl<'msg, K: MapKey, V: MapValue> IntoProxied<Map<K, V>> for MapMut<'msg, K, V>where
View<'msg, V>: IntoProxied<V>,
impl<'msg, K: MapKey, V: MapValue> SealedInternal for MapMut<'msg, K, V>
impl<'msg, K: ?Sized, V: ?Sized> Sync for MapMut<'msg, K, V>
Auto Trait Implementations§
impl<'msg, K, V> !RefUnwindSafe for MapMut<'msg, K, V>
impl<'msg, K, V> !Send for MapMut<'msg, K, V>
impl<'msg, K, V> !UnwindSafe for MapMut<'msg, K, V>
impl<'msg, K, V> Forget for MapMut<'msg, K, V>
impl<'msg, K, V> Freeze for MapMut<'msg, K, V>
impl<'msg, K, V> Move for MapMut<'msg, K, V>
impl<'msg, K, V> Unpin for MapMut<'msg, K, V>
impl<'msg, K, V> UnsafeUnpin for MapMut<'msg, 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