Struct concread::hashmap::HashMapReadTxn
source · pub struct HashMapReadTxn<'a, K, V>{ /* 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§
source§impl<K: Hash + Eq + Clone + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static> HashMapReadTxn<'_, K, V>
impl<K: Hash + Eq + Clone + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static> HashMapReadTxn<'_, K, V>
sourcepub fn get<Q>(&self, k: &Q) -> Option<&V>
pub fn get<Q>(&self, k: &Q) -> Option<&V>
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<Q>(&self, k: &Q) -> bool
pub fn contains_key<Q>(&self, k: &Q) -> bool
Assert if a key exists in the tree.
sourcepub fn to_snapshot(&self) -> HashMapReadSnapshot<'_, K, V>
pub fn to_snapshot(&self) -> HashMapReadSnapshot<'_, 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> Freeze for HashMapReadTxn<'a, K, V>
impl<'a, K, V> RefUnwindSafe for HashMapReadTxn<'a, K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
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>where
K: RefUnwindSafe,
V: RefUnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more