pub struct HashMapReadSnapshot<'a, K, V> where
K: Hash + Eq + Clone + Debug + Sync + Send + 'static,
V: Clone + Sync + Send + 'static, { /* private fields */ }
Expand description
A point-in-time snapshot of the tree from within a read OR write. This is useful for building other transactional types ontop of this structure, as you need a way to downcast both HashMapReadTxn or HashMapWriteTxn to a singular reader type for a number of get_inner() style patterns.
This snapshot IS safe within the read thread due to the nature of the implementation borrowing the inner tree to prevent mutations within the same thread while the read snapshot is open.
Implementations
sourceimpl<'a, K: Hash + Eq + Clone + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static> HashMapReadSnapshot<'a, K, V>
impl<'a, K: Hash + Eq + Clone + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static> HashMapReadSnapshot<'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
Auto Trait Implementations
impl<'a, K, V> RefUnwindSafe for HashMapReadSnapshot<'a, K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<'a, K, V> Send for HashMapReadSnapshot<'a, K, V>
impl<'a, K, V> Sync for HashMapReadSnapshot<'a, K, V>
impl<'a, K, V> Unpin for HashMapReadSnapshot<'a, K, V>
impl<'a, K, V> UnwindSafe for HashMapReadSnapshot<'a, K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
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