Struct phf_mut::Map
[−]
[src]
pub struct Map<V, H> { /* fields omitted */ }
A mutable, perfectly-hashed map. Note that a Map
is always full,
so you might prefer std::collections::HashMap
for sparse maps.
Methods
impl<V: Default, H: PerfectHash> Map<V, H>
[src]
fn new(hash: H) -> Self
Create a new Map
full default values.
Also see from_initial
and from_element
.
impl<V: Copy, H: PerfectHash> Map<V, H>
[src]
fn from_element(hash: H, value: &V) -> Self
Create a new Map
full of copies of some value.
Also see from_initial
and new
.
impl<V, H: HashInverse> Map<V, H>
[src]
fn iter(&self) -> MapIter<H, V>
Directly create a new iterator over entries:
Iterator<Item=(K,&V)>
.
fn iter_mut(&mut self) -> MapIterMut<H, V>
Directly create a new iterator over mutable entries:
Iterator<Item=(K,&mut V)>
.
impl<V, H: PerfectHash> Map<V, H>
[src]
fn from_initial(hash: H, init: Vec<V>) -> Self
Create a new Map
from a given vector of values.
The vector must be compatible to the PerfectHash.
Also see new
and from_element
.
fn insert(&mut self, k: H::K, v: V)
Overwrite the currently stored value for key k
by v
.
The name insert
is s homage to HashMap::insert
.
fn swap(&mut self, k: H::K, v: &mut V)
Swaps the currently stored value for key k
with v
,
so the old value is now stored in v
.
fn get(&self, k: H::K) -> &V
Directly get a reference the value for key k
.
Also see the Index
implementation.
fn get_mut(&mut self, k: H::K) -> &mut V
Directly get a mutable reference the value for key k
.
Also see the Index
implementation.
impl<V, H> Map<V, H>
[src]
fn is_empty(&self) -> bool
Returns true if the map contains no elements.
fn len(&self) -> usize
Returns the amount of entries,
which is always equal to the hasher's domain (i.e., hasher.size()
).
fn values(&self) -> Iter<V>
Directly create a new iterator over the values:
Iterator<Item=&V>
.
fn values_mut(&mut self) -> IterMut<V>
Directly create a new iterator over the mutable values:
Iterator<Item=&mut V>
.
Trait Implementations
impl<'a, V, H: HashInverse> IntoIterator for &'a Map<V, H>
[src]
type Item = (H::K, &'a V)
The type of the elements being iterated over.
type IntoIter = MapIter<'a, H, V>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<'a, V, H: HashInverse> IntoIterator for &'a mut Map<V, H>
[src]
type Item = (H::K, &'a mut V)
The type of the elements being iterated over.
type IntoIter = MapIterMut<'a, H, V>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<V, H> Debug for Map<V, H> where
V: Debug,
[src]
V: Debug,
impl<V: Clone, H: Clone> Clone for Map<V, H>
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<V, H: PerfectHash> Index<H::K> for Map<V, H>
[src]
type Output = V
The returned type after indexing
fn index(&self, k: H::K) -> &V
The method for the indexing (container[index]
) operation