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
sourceimpl<K, V> Map<K, V>
impl<K, V> Map<K, V>
sourcepub fn contains_key<T: ?Sized>(&self, key: &T) -> boolwhere
T: Eq + PhfHash,
K: PhfBorrow<T>,
pub fn contains_key<T: ?Sized>(&self, key: &T) -> boolwhere
T: Eq + PhfHash,
K: PhfBorrow<T>,
Determines if key
is in the Map
.
sourcepub fn get<T: ?Sized>(&self, key: &T) -> Option<&V>where
T: Eq + PhfHash,
K: PhfBorrow<T>,
pub fn get<T: ?Sized>(&self, key: &T) -> Option<&V>where
T: Eq + PhfHash,
K: PhfBorrow<T>,
Returns a reference to the value that key
maps to.
sourcepub fn get_key<T: ?Sized>(&self, key: &T) -> Option<&K>where
T: Eq + PhfHash,
K: PhfBorrow<T>,
pub fn get_key<T: ?Sized>(&self, key: &T) -> Option<&K>where
T: Eq + PhfHash,
K: PhfBorrow<T>,
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: ?Sized>(&self, key: &T) -> Option<(&K, &V)>where
T: Eq + PhfHash,
K: PhfBorrow<T>,
pub fn get_entry<T: ?Sized>(&self, key: &T) -> Option<(&K, &V)>where
T: Eq + PhfHash,
K: PhfBorrow<T>,
Like get
, but returns both the key and the value.
sourcepub fn entries(&self) -> Entries<'_, K, V>ⓘNotable traits for Entries<'a, K, V>impl<'a, K, V> Iterator for Entries<'a, K, V> type Item = (&'a K, &'a V);
pub fn entries(&self) -> Entries<'_, K, V>ⓘNotable traits for Entries<'a, K, V>impl<'a, K, V> Iterator for Entries<'a, K, V> type Item = (&'a K, &'a V);
Returns an iterator over the key/value pairs in the map.
Entries are returned in an arbitrary but fixed order.
Trait Implementations
sourceimpl<'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> RefUnwindSafe for Map<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for Map<K, V>where
K: Sync,
V: Sync,
impl<K, V> Sync for Map<K, V>where
K: Sync,
V: Sync,
impl<K, V> Unpin for Map<K, V>
impl<K, V> UnwindSafe for Map<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more