Skip to main content

MapView

Struct MapView 

Source
pub struct MapView<'msg, K: ?Sized, V: ?Sized> { /* private fields */ }
Expand description

A view of a map field.

This is a proxy type that is conceptually similar to a &Map<K, V>

Implementations§

Source§

impl<'msg, K: MapKey, V: MapValue> MapView<'msg, K, V>

Source

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

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 iter(self) -> MapIter<'msg, K, V> ⓘ

Returns an iterator visiting all key-value pairs in arbitrary order.

The iterator element type is (View<K>, View<V>). This is an alias for <Self as IntoIterator>::into_iter.

Source

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

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<'msg, V>> + 'msg

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> AsView for MapView<'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> Clone for MapView<'msg, K, V>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'msg, K: ?Sized, V: ?Sized> Copy for MapView<'msg, K, V>

Source§

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

Source§

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

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

impl<'msg, K: MapKey, V: MapValue> IntoIterator for MapView<'msg, K, V>

Source§

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

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

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

The type of the elements being iterated over.
Source§

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

Creates an iterator from a value. Read more
Source§

impl<'a, 'msg, K: MapKey, V: MapValue> IntoIterator for &'a MapView<'msg, K, V>
where 'msg: 'a,

Source§

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

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

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

The type of the elements being iterated over.
Source§

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

Creates an iterator from a value. Read more
Source§

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

Source§

impl<'msg, K: MapKey, V: MapValue> IntoView<'msg> for MapView<'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 MapView<'msg, K, V>

Source§

impl<'msg, K: ?Sized, V: ?Sized> Send for MapView<'msg, K, V>

Source§

impl<'msg, K: ?Sized, V: ?Sized> Sync for MapView<'msg, K, V>

Auto Trait Implementations§

§

impl<'msg, K, V> Forget for MapView<'msg, K, V>
where K: ?Sized, V: ?Sized,

§

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

§

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

§

impl<'msg, K, V> RefUnwindSafe for MapView<'msg, K, V>

§

impl<'msg, K, V> Unpin for MapView<'msg, K, V>
where PhantomData<(&'msg K, &'msg V)>: Unpin, K: ?Sized, V: ?Sized,

§

impl<'msg, K, V> UnsafeUnpin for MapView<'msg, K, V>

§

impl<'msg, K, V> UnwindSafe for MapView<'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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.