Skip to main content

MapMut

Struct MapMut 

Source
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>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn contains_key<'a>(&self, key: impl Into<View<'a, K>>) -> bool
where K: 'a,

Source

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.

Source

pub fn remove<'a>(&mut self, key: impl Into<View<'a, K>>) -> bool

Source

pub fn clear(&mut self)

Source

pub fn get<'a>(&self, key: impl Into<View<'a, K>>) -> Option<View<'_, V>>

Source

pub fn get_mut<'a>(&mut self, key: impl Into<View<'a, K>>) -> Option<Mut<'_, V>>
where V: Message,

Source

pub fn copy_from<'a>( &mut self, src: impl IntoIterator<Item = (impl Into<View<'a, K>>, impl IntoProxied<V>)>, )

Source

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>).

Source

pub fn keys(&self) -> impl Iterator<Item = View<'_, K>> + '_

Returns an iterator visiting all keys in arbitrary order.

The iterator element type is View<K>.

Source

pub fn values(&self) -> impl Iterator<Item = View<'_, V>> + '_

Returns an iterator visiting all values in arbitrary order.

The iterator element type is View<V>.

Trait Implementations§

Source§

impl<'msg, K: MapKey, V: MapValue> AsMut for MapMut<'msg, K, V>

Source§

type MutProxied = Map<K, V>

Source§

fn as_mut(&mut self) -> MapMut<'_, K, V>

Converts a borrow into a Mut with the lifetime of that borrow.
Source§

impl<'msg, K: MapKey, V: MapValue> AsView for MapMut<'msg, K, V>

Source§

type Proxied = Map<K, V>

Source§

fn as_view(&self) -> MapView<'_, K, V>

Converts a borrow into a View with the lifetime of that borrow. Read more
Source§

impl<'msg, K: ?Sized, V: ?Sized> Debug for MapMut<'msg, K, V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'msg, 'k, KView, VView, K, V> Extend<(KView, VView)> for MapMut<'msg, K, V>
where K: MapKey, V: MapValue, KView: Into<View<'k, K>>, VView: IntoProxied<V>,

Source§

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)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

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,

Source§

type IntoIter = MapIter<'a, K, V>

Which kind of iterator are we turning this into?
Source§

type Item = (<K as ProtoObject>::View<'a>, <V as ProtoObject>::View<'a>)

The type of the elements being iterated over.
Source§

fn into_iter(self) -> MapIter<'a, K, V> ⓘ

Creates an iterator from a value. Read more
Source§

impl<'msg, K: MapKey, V: MapValue> IntoMut<'msg> for MapMut<'msg, K, V>

Source§

fn into_mut<'shorter>(self) -> MapMut<'shorter, K, V>
where 'msg: 'shorter,

Converts into a Mut with a potentially shorter lifetime. Read more
Source§

impl<'msg, K: MapKey, V: MapValue> IntoProxied<Map<K, V>> for MapMut<'msg, K, V>
where View<'msg, V>: IntoProxied<V>,

Source§

impl<'msg, K: MapKey, V: MapValue> IntoView<'msg> for MapMut<'msg, K, V>

Source§

fn into_view<'shorter>(self) -> MapView<'shorter, K, V>
where 'msg: 'shorter,

Converts into a View with a potentially shorter lifetime. Read more
Source§

impl<'msg, K: MapKey, V: MapValue> SealedInternal for MapMut<'msg, K, V>

Source§

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>
where K: ?Sized, V: ?Sized,

§

impl<'msg, K, V> Freeze for MapMut<'msg, K, V>

§

impl<'msg, K, V> Move for MapMut<'msg, K, V>
where K: ?Sized, V: ?Sized,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.