pub struct Cursor { /* private fields */ }Expand description
B+ tree cursor position with root-to-leaf path.
Implementations§
Source§impl Cursor
impl Cursor
Sourcepub fn seek(pages: &impl PageMap, root: PageId, key: &[u8]) -> Result<Self>
pub fn seek(pages: &impl PageMap, root: PageId, key: &[u8]) -> Result<Self>
Seek to first key >= key. Empty key = first entry.
Sourcepub fn first(pages: &impl PageMap, root: PageId) -> Result<Self>
pub fn first(pages: &impl PageMap, root: PageId) -> Result<Self>
Position the cursor at the first entry in the tree.
Sourcepub fn last(pages: &impl PageMap, root: PageId) -> Result<Self>
pub fn last(pages: &impl PageMap, root: PageId) -> Result<Self>
Position the cursor at the last entry in the tree.
Sourcepub fn leaf_page_id(&self) -> PageId
pub fn leaf_page_id(&self) -> PageId
Current leaf page ID.
Sourcepub fn cell_index(&self) -> u16
pub fn cell_index(&self) -> u16
Current cell index within the leaf.
Sourcepub fn set_leaf_page_id(&mut self, id: PageId)
pub fn set_leaf_page_id(&mut self, id: PageId)
Update the current leaf page ID after a CoW operation.
pub fn current(&self, pages: &impl PageMap) -> Option<CursorEntry>
pub fn current_ref<'a, P: PageMap>(&self, pages: &'a P) -> Option<LeafCell<'a>>
Sourcepub fn next(&mut self, pages: &impl PageMap) -> Result<bool>
pub fn next(&mut self, pages: &impl PageMap) -> Result<bool>
Move the cursor to the next entry (forward).
Sourcepub fn prev(&mut self, pages: &impl PageMap) -> Result<bool>
pub fn prev(&mut self, pages: &impl PageMap) -> Result<bool>
Move the cursor to the previous entry (backward).
Sourcepub fn seek_lazy(
pages: &mut impl PageLoader,
root: PageId,
key: &[u8],
) -> Result<Self>
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.
Sourcepub fn current_ref_lazy<'a, P: PageLoader>(
&self,
pages: &'a mut P,
) -> Option<LeafCell<'a>>
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.
Sourcepub fn next_lazy(&mut self, pages: &mut impl PageLoader) -> Result<bool>
pub fn next_lazy(&mut self, pages: &mut impl PageLoader) -> Result<bool>
Advance to the next entry, loading pages on demand.
Auto Trait Implementations§
impl Freeze for Cursor
impl RefUnwindSafe for Cursor
impl Send for Cursor
impl Sync for Cursor
impl Unpin for Cursor
impl UnsafeUnpin for Cursor
impl UnwindSafe for Cursor
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