Struct sanakirja_core::btree::Cursor
source · pub struct Cursor<K: ?Sized, V: ?Sized, P: BTreePage<K, V>> { /* private fields */ }
Expand description
A position in a B tree.
Implementations§
source§impl<K: ?Sized + Storable, V: ?Sized + Storable, P: BTreePage<K, V>> Cursor<K, V, P>
impl<K: ?Sized + Storable, V: ?Sized + Storable, P: BTreePage<K, V>> Cursor<K, V, P>
sourcepub fn new<T: LoadPage>(txn: &T, db: &Db_<K, V, P>) -> Result<Self, T::Error>
pub fn new<T: LoadPage>(txn: &T, db: &Db_<K, V, P>) -> Result<Self, T::Error>
Create a new cursor, initialised to the first entry of the B tree.
sourcepub fn reset<'a, T: LoadPage>(&mut self)
pub fn reset<'a, T: LoadPage>(&mut self)
Reset the cursor to the first element of the database.
sourcepub fn set<'a, T: LoadPage>(
&mut self,
txn: &'a T,
k: &K,
v: Option<&V>
) -> Result<Option<(&'a K, &'a V)>, T::Error>
pub fn set<'a, T: LoadPage>( &mut self, txn: &'a T, k: &K, v: Option<&V> ) -> Result<Option<(&'a K, &'a V)>, T::Error>
Set the cursor to the first position larger than or equal to the specified key and value.
sourcepub fn set_last<'a, T: LoadPage>(&mut self, txn: &'a T) -> Result<(), T::Error>
pub fn set_last<'a, T: LoadPage>(&mut self, txn: &'a T) -> Result<(), T::Error>
Set the cursor after the last element, so that Self::next
returns None
, and Self::prev
returns the last element.
sourcepub fn current<'a, T: LoadPage>(
&mut self,
txn: &'a T
) -> Result<Option<(&'a K, &'a V)>, T::Error>
pub fn current<'a, T: LoadPage>( &mut self, txn: &'a T ) -> Result<Option<(&'a K, &'a V)>, T::Error>
Return the current position of the cursor.
Trait Implementations§
Auto Trait Implementations§
impl<K: ?Sized, V: ?Sized, P> RefUnwindSafe for Cursor<K, V, P>
impl<K: ?Sized, V: ?Sized, P> Send for Cursor<K, V, P>
impl<K: ?Sized, V: ?Sized, P> Sync for Cursor<K, V, P>
impl<K: ?Sized, V: ?Sized, P> Unpin for Cursor<K, V, P>
impl<K: ?Sized, V: ?Sized, P> UnwindSafe for Cursor<K, V, P>
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