Struct phf::Map
[−]
[src]
pub struct Map<K: 'static, V: 'static> { // some fields omitted }
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.
Methods
impl<K, V> Map<K, V>
[src]
fn is_empty(&self) -> bool
Returns true if the Map
is empty.
fn len(&self) -> usize
Returns the number of entries in the Map
.
fn contains_key<T: ?Sized>(&self, key: &T) -> bool where T: Eq + PhfHash, K: Borrow<T>
Determines if key
is in the Map
.
fn get<T: ?Sized>(&self, key: &T) -> Option<&V> where T: Eq + PhfHash, K: Borrow<T>
Returns a reference to the value that key
maps to.
fn get_key<T: ?Sized>(&self, key: &T) -> Option<&K> where T: Eq + PhfHash, K: Borrow<T>
Returns a reference to the map's internal static instance of the given key.
This can be useful for interning schemes.
fn get_entry<T: ?Sized>(&self, key: &T) -> Option<(&K, &V)> where T: Eq + PhfHash, K: Borrow<T>
Like get
, but returns both the key and the value.
fn entries<'a>(&'a self) -> Entries<'a, K, V>
Returns an iterator over the key/value pairs in the map.
Entries are retuned in an arbitrary but fixed order.
fn keys<'a>(&'a self) -> Keys<'a, K, V>
Returns an iterator over the keys in the map.
Keys are returned in an arbitrary but fixed order.
fn values<'a>(&'a self) -> Values<'a, K, V>
Returns an iterator over the values in the map.
Values are returned in an arbitrary but fixed order.
Trait Implementations
impl<K, V> Debug for Map<K, V> where K: Debug, V: Debug
[src]
impl<'a, K, V, T: ?Sized> Index<&'a T> for Map<K, V> where T: Eq + PhfHash, K: Borrow<T>
[src]
type Output = V
The returned type after indexing
fn index(&self, k: &'a T) -> &V
The method for the indexing (Foo[Bar]
) operation