Enum hamt::RcTrick
[−]
[src]
pub enum RcTrick<K, V> { RcTrick(Rc<Hamt<K, V, RcTrick<K, V>>>), }
Variants
RcTrick(Rc<Hamt<K, V, RcTrick<K, V>>>)
Methods from Deref<Target = Hamt<K, V, RcTrick<K, V>>>
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn iter(&self) -> Iter<K, V, HamtRef>
Returns a key value iterator.
fn keys(&self) -> Keys<K, V, HamtRef>
Returns an iterator that visits every key in an unspecified order.
fn values(&self) -> Values<K, V, HamtRef>
Returns an iterator that visits every value in an unspecified order.
fn get<Q: ?Sized>(&self, k: &Q) -> Option<&V> where
K: Borrow<Q>,
Q: Hash + Eq,
K: Borrow<Q>,
Q: Hash + Eq,
Returns a reference to the value corresponding to the given key, or None if there is no value associated with the key.
fn contains_key<Q: ?Sized>(&self, k: &Q) -> bool where
K: Borrow<Q>,
Q: Hash + Eq,
K: Borrow<Q>,
Q: Hash + Eq,
Returns true if the map contains the given key.
fn insert<Q: ?Sized, R: ?Sized>(&self, k: &Q, v: &R) -> Self where
K: Borrow<Q>,
Q: Hash + Eq + ToOwned<Owned = K>,
V: Borrow<R>,
R: ToOwned<Owned = V>,
K: Borrow<Q>,
Q: Hash + Eq + ToOwned<Owned = K>,
V: Borrow<R>,
R: ToOwned<Owned = V>,
fn remove<Q: ?Sized>(&self, k: &Q) -> Self where
K: Borrow<Q>,
Q: Hash + Eq,
K: Borrow<Q>,
Q: Hash + Eq,
Returns a new map without an entry corresponding to the given key.
fn adjust<F, Q: ?Sized>(&self, key: &Q, f: F) -> Self where
F: FnOnce(&V) -> V,
K: Borrow<Q>,
Q: Hash + Eq,
F: FnOnce(&V) -> V,
K: Borrow<Q>,
Q: Hash + Eq,
Modifies the value tied to the given key with the function f
. Otherwise, the map returned
is identical.
fn update<F, Q: ?Sized>(&self, key: &Q, f: F) -> Self where
F: FnOnce(&V) -> Option<V>,
K: Borrow<Q>,
Q: Hash + Eq + ToOwned<Owned = K>,
F: FnOnce(&V) -> Option<V>,
K: Borrow<Q>,
Q: Hash + Eq + ToOwned<Owned = K>,
Updates the value at the given key using f
. If f
returns None, then the entry
is removed.
fn alter<F, Q: ?Sized>(&self, key: &Q, f: F) -> Self where
F: FnOnce(Option<&V>) -> Option<V>,
K: Borrow<Q>,
Q: Hash + Eq + ToOwned<Owned = K>,
F: FnOnce(Option<&V>) -> Option<V>,
K: Borrow<Q>,
Q: Hash + Eq + ToOwned<Owned = K>,
Updates the value at the given key using f
as in Self::update
. If no value exists for
the given key, then f
is passed None
.
Trait Implementations
impl<K: Clone, V: Clone> Clone for RcTrick<K, V>
[src]
fn clone(&self) -> RcTrick<K, V>
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<K: Debug, V: Debug> Debug for RcTrick<K, V>
[src]
impl<K: PartialEq, V: PartialEq> PartialEq for RcTrick<K, V>
[src]
fn eq(&self, __arg_0: &RcTrick<K, V>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &RcTrick<K, V>) -> bool
This method tests for !=
.