Struct concread::bptree::asynch::BptreeMapReadTxn
source · pub struct BptreeMapReadTxn<'a, K, V>{ /* private fields */ }
Expand description
An active read transaction over a BptreeMap. The data in this tree is guaranteed to not change and will remain consistent for the life of this transaction.
Implementations§
source§impl<K: Clone + Ord + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static> BptreeMapReadTxn<'_, K, V>
impl<K: Clone + Ord + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static> BptreeMapReadTxn<'_, 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 range<R, T>(&self, range: R) -> RangeIter<'_, '_, K, V> ⓘ
pub fn range<R, T>(&self, range: R) -> RangeIter<'_, '_, K, V> ⓘ
Iterate over a range of values
sourcepub fn first_key_value(&self) -> Option<(&K, &V)>
pub fn first_key_value(&self) -> Option<(&K, &V)>
Retrieve the first (minimum) key-value pair from the map if it exists.
sourcepub fn last_key_value(&self) -> Option<(&K, &V)>
pub fn last_key_value(&self) -> Option<(&K, &V)>
Retrieve the last (maximum) key-value pair from the map if it exists.
sourcepub fn to_snapshot(&self) -> BptreeMapReadSnapshot<'_, K, V>
pub fn to_snapshot(&self) -> BptreeMapReadSnapshot<'_, 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.
Trait Implementations§
impl<K: Clone + Ord + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static> Send for BptreeMapReadTxn<'_, K, V>
impl<K: Clone + Ord + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static> Sync for BptreeMapReadTxn<'_, K, V>
Auto Trait Implementations§
impl<'a, K, V> Freeze for BptreeMapReadTxn<'a, K, V>
impl<'a, K, V> !RefUnwindSafe for BptreeMapReadTxn<'a, K, V>
impl<'a, K, V> Unpin for BptreeMapReadTxn<'a, K, V>
impl<'a, K, V> !UnwindSafe for BptreeMapReadTxn<'a, K, V>
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