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>

source

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.

source

pub fn reset<'a, T: LoadPage>(&mut self)

Reset the cursor to the first element of the database.

source

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.

source

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.

source

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.

source

pub fn next<'a, T: LoadPage>( &mut self, txn: &'a T ) -> Result<Option<(&'a K, &'a V)>, T::Error>

Return the current position of the cursor, and move the cursor to the next position.

source

pub fn prev<'a, T: LoadPage>( &mut self, txn: &'a T ) -> Result<Option<(&'a K, &'a V)>, T::Error>

Move the cursor to the previous entry, and return the entry that was current before the move. If the cursor is initially after all the entries, this moves it back by two steps.

Trait Implementations§

source§

impl<K: Debug + ?Sized, V: Debug + ?Sized, P: Debug + BTreePage<K, V>> Debug for Cursor<K, V, P>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<K: ?Sized, V: ?Sized, P> RefUnwindSafe for Cursor<K, V, P>
where <P as BTreePage<K, V>>::Cursor: RefUnwindSafe,

§

impl<K: ?Sized, V: ?Sized, P> Send for Cursor<K, V, P>
where <P as BTreePage<K, V>>::Cursor: Send,

§

impl<K: ?Sized, V: ?Sized, P> Sync for Cursor<K, V, P>
where <P as BTreePage<K, V>>::Cursor: Sync,

§

impl<K: ?Sized, V: ?Sized, P> Unpin for Cursor<K, V, P>
where <P as BTreePage<K, V>>::Cursor: Unpin,

§

impl<K: ?Sized, V: ?Sized, P> UnwindSafe for Cursor<K, V, P>
where <P as BTreePage<K, V>>::Cursor: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.