pub struct HashMapReadTxn<'a, K, V> where
K: Hash + Eq + Clone + Debug + Sync + Send + 'static,
V: Clone + Sync + Send + 'static, { /* private fields */ }
Expand description
An active read transaction over a HashMap
. The data in this tree
is guaranteed to not change and will remain consistent for the life
of this transaction.
Implementations
sourceimpl<'a, K: Hash + Eq + Clone + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static> HashMapReadTxn<'a, K, V>
impl<'a, K: Hash + Eq + Clone + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static> HashMapReadTxn<'a, K, V>
sourcepub fn get<'b, Q: ?Sized>(&'a self, k: &'b Q) -> Option<&'a V> where
K: Borrow<Q>,
Q: Hash + Eq,
pub fn get<'b, Q: ?Sized>(&'a self, k: &'b Q) -> Option<&'a V> where
K: Borrow<Q>,
Q: Hash + Eq,
Retrieve a value from the tree. If the value exists, a reference is returned
as Some(&V)
, otherwise if not present None
is returned.
sourcepub fn contains_key<'b, Q: ?Sized>(&'a self, k: &'b Q) -> bool where
K: Borrow<Q>,
Q: Hash + Eq,
pub fn contains_key<'b, Q: ?Sized>(&'a self, k: &'b Q) -> bool where
K: Borrow<Q>,
Q: Hash + Eq,
Assert if a key exists in the tree.
sourcepub fn iter(&self) -> Iter<'_, K, V>ⓘNotable traits for Iter<'a, K, V>impl<'a, K: Clone + Hash + Eq + Debug, V: Clone> Iterator for Iter<'a, K, V> type Item = (&'a K, &'a V);
pub fn iter(&self) -> Iter<'_, K, V>ⓘNotable traits for Iter<'a, K, V>impl<'a, K: Clone + Hash + Eq + Debug, V: Clone> Iterator for Iter<'a, K, V> type Item = (&'a K, &'a V);
Iterator over (&K, &V)
of the set
sourcepub fn values(&self) -> ValueIter<'_, K, V>ⓘNotable traits for ValueIter<'a, K, V>impl<'a, K: Clone + Hash + Eq + Debug, V: Clone> Iterator for ValueIter<'a, K, V> type Item = &'a V;
pub fn values(&self) -> ValueIter<'_, K, V>ⓘNotable traits for ValueIter<'a, K, V>impl<'a, K: Clone + Hash + Eq + Debug, V: Clone> Iterator for ValueIter<'a, K, V> type Item = &'a V;
Iterator over &K
sourcepub fn keys(&self) -> KeyIter<'_, K, V>ⓘNotable traits for KeyIter<'a, K, V>impl<'a, K: Clone + Hash + Eq + Debug, V: Clone> Iterator for KeyIter<'a, K, V> type Item = &'a K;
pub fn keys(&self) -> KeyIter<'_, K, V>ⓘNotable traits for KeyIter<'a, K, V>impl<'a, K: Clone + Hash + Eq + Debug, V: Clone> Iterator for KeyIter<'a, K, V> type Item = &'a K;
Iterator over &V
sourcepub fn to_snapshot(&'a self) -> HashMapReadSnapshot<'a, K, V>
pub fn to_snapshot(&'a self) -> HashMapReadSnapshot<'a, K, V>
Create a read-snapshot of the current tree. As this is the read variant, it IS safe, and guaranteed the tree will not change.
Auto Trait Implementations
impl<'a, K, V> !RefUnwindSafe for HashMapReadTxn<'a, K, V>
impl<'a, K, V> Send for HashMapReadTxn<'a, K, V>
impl<'a, K, V> Sync for HashMapReadTxn<'a, K, V>
impl<'a, K, V> Unpin for HashMapReadTxn<'a, K, V>
impl<'a, K, V> !UnwindSafe for HashMapReadTxn<'a, K, V>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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