Struct concread::bptree::asynch::BptreeMapReadSnapshot
source · pub struct BptreeMapReadSnapshot<'a, K, V>{ /* 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 on top of this structure, as you need a way to downcast both BptreeMapReadTxn or BptreeMapWriteTxn 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§
source§impl<K: Clone + Ord + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static> BptreeMapReadSnapshot<'_, K, V>
impl<K: Clone + Ord + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static> BptreeMapReadSnapshot<'_, 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.
Auto Trait Implementations§
impl<'a, K, V> Freeze for BptreeMapReadSnapshot<'a, K, V>
impl<'a, K, V> RefUnwindSafe for BptreeMapReadSnapshot<'a, K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<'a, K, V> Send for BptreeMapReadSnapshot<'a, K, V>
impl<'a, K, V> Sync for BptreeMapReadSnapshot<'a, K, V>
impl<'a, K, V> Unpin for BptreeMapReadSnapshot<'a, K, V>
impl<'a, K, V> UnwindSafe for BptreeMapReadSnapshot<'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