Skip to main content

Cursor

Struct Cursor 

Source
pub struct Cursor { /* private fields */ }
Expand description

B+ tree cursor position with root-to-leaf path.

Implementations§

Source§

impl Cursor

Source

pub fn seek(pages: &impl PageMap, root: PageId, key: &[u8]) -> Result<Self>

Seek to first key >= key. Empty key = first entry.

Source

pub fn first(pages: &impl PageMap, root: PageId) -> Result<Self>

Position the cursor at the first entry in the tree.

Source

pub fn last(pages: &impl PageMap, root: PageId) -> Result<Self>

Position the cursor at the last entry in the tree.

Source

pub fn is_valid(&self) -> bool

Whether the cursor is at a valid position.

Source

pub fn leaf_page_id(&self) -> PageId

Current leaf page ID.

Source

pub fn cell_index(&self) -> u16

Current cell index within the leaf.

Source

pub fn set_leaf_page_id(&mut self, id: PageId)

Update the current leaf page ID after a CoW operation.

Source

pub fn current(&self, pages: &impl PageMap) -> Option<CursorEntry>

Source

pub fn current_ref<'a, P: PageMap>(&self, pages: &'a P) -> Option<LeafCell<'a>>

Source

pub fn next(&mut self, pages: &impl PageMap) -> Result<bool>

Move the cursor to the next entry (forward).

Source

pub fn prev(&mut self, pages: &impl PageMap) -> Result<bool>

Move the cursor to the previous entry (backward).

Source

pub fn seek_lazy( pages: &mut impl PageLoader, root: PageId, key: &[u8], ) -> Result<Self>

Seek with lazy page loading — only loads the root-to-leaf path.

Source

pub fn current_ref_lazy<'a, P: PageLoader>( &self, pages: &'a mut P, ) -> Option<LeafCell<'a>>

Read the current entry, loading the leaf page if needed.

Source

pub fn next_lazy(&mut self, pages: &mut impl PageLoader) -> Result<bool>

Advance to the next entry, loading pages on demand.

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V