pub struct Map<K: 'static, V: 'static> { /* private fields */ }
Expand description
An immutable map constructed at compile time.
§Note
The fields of this struct are public so that they may be initialized by the
phf_map!
macro and code generation. They are subject to change at any
time and should never be accessed directly.
Implementations§
source§impl<K, V> Map<K, V>
impl<K, V> Map<K, V>
sourcepub fn contains_key<T>(&self, key: &T) -> bool
pub fn contains_key<T>(&self, key: &T) -> bool
Determines if key
is in the Map
.
sourcepub fn get_key<T>(&self, key: &T) -> Option<&K>
pub fn get_key<T>(&self, key: &T) -> Option<&K>
Returns a reference to the map’s internal static instance of the given key.
This can be useful for interning schemes.
sourcepub fn get_entry<T>(&self, key: &T) -> Option<(&K, &V)>
pub fn get_entry<T>(&self, key: &T) -> Option<(&K, &V)>
Like get
, but returns both the key and the value.
sourcepub fn entries(&self) -> Entries<'_, K, V> ⓘ
pub fn entries(&self) -> Entries<'_, K, V> ⓘ
Returns an iterator over the key/value pairs in the map.
Entries are returned in an arbitrary but fixed order.
Trait Implementations§
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> UnwindSafe for Map<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
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