pub struct Map<K: 'static, V: 'static> { /* private fields */ }Expand description
An immutable map.
Construct one with From or FromIterator.
Implementations§
Source§impl<K, V> Map<K, V>
impl<K, V> Map<K, V>
Sourcepub fn get_entry<Q>(&self, key: &Q) -> Option<(&K, &V)>
pub fn get_entry<Q>(&self, key: &Q) -> Option<(&K, &V)>
Returns the key-value entry corresponding to the given key, if present.
Sourcepub fn get<Q>(&self, key: &Q) -> Option<&V>
pub fn get<Q>(&self, key: &Q) -> Option<&V>
Returns a reference to the value corresponding to the given key, if present.
Sourcepub fn contains_key<Q>(&self, key: &Q) -> bool
pub fn contains_key<Q>(&self, key: &Q) -> bool
Returns true if the map contains an entry for the given key.
Sourcepub fn entries(&self) -> MapEntries<'_, K, V> ⓘ
pub fn entries(&self) -> MapEntries<'_, K, V> ⓘ
Returns an iterator over the key-value pairs of the map in an unspecified order.
Trait Implementations§
Source§impl<K, V> Bake for Map<K, V>
Available on crate feature codegen only.
impl<K, V> Bake for Map<K, V>
Available on crate feature
codegen only.Source§fn bake(&self, ctx: &CrateEnv) -> TokenStream
fn bake(&self, ctx: &CrateEnv) -> TokenStream
impl<K, V> Eq for Map<K, V>
Source§impl<K, V, const N: usize> From<[(K, V); N]> for Map<K, V>
Available on crate feature construct only.
impl<K, V, const N: usize> From<[(K, V); N]> for Map<K, V>
Available on crate feature
construct only.Source§impl<K, V> FromIterator<(K, V)> for Map<K, V>
Available on crate feature construct only.
impl<K, V> FromIterator<(K, V)> for Map<K, V>
Available on crate feature
construct only.Source§impl<'a, K, V> IntoIterator for &'a Map<K, V>
impl<'a, K, V> IntoIterator for &'a Map<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for Map<K, V>
impl<K, V> RefUnwindSafe for Map<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for Map<K, V>
impl<K, V> Sync for Map<K, V>
impl<K, V> Unpin for Map<K, V>
impl<K, V> UnsafeUnpin for Map<K, V>
impl<K, V> UnwindSafe for Map<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.