Skip to main content

TableCursor

Struct TableCursor 

Source
pub struct TableCursor<'p> { /* private fields */ }
Expand description

A cursor over a table b-tree, iterating rows in ascending rowid order.

Implementations§

Source§

impl<'p> TableCursor<'p>

Source

pub fn new(pager: &'p dyn PageSource, root: u32) -> TableCursor<'p>

Create a cursor over the table b-tree rooted at page root. The cursor is unpositioned until first or seek.

Source

pub fn last(&mut self) -> Result<bool>

Position at the last (highest-rowid) row. Returns false if empty. Useful for finding the next auto-assigned rowid in O(height).

Source

pub fn first(&mut self) -> Result<bool>

Position at the first (lowest-rowid) row. Returns false if the table is empty.

Source

pub fn is_valid(&self) -> bool

Whether the cursor currently points at a valid row.

Source

pub fn rowid(&self) -> Result<i64>

The rowid at the cursor.

Source

pub fn payload(&self) -> Result<Vec<u8>>

The full row record (payload) at the cursor.

Source

pub fn next(&mut self) -> Result<bool>

Advance to the next row. Returns false when the cursor moves past the last row.

Source

pub fn seek(&mut self, target: i64) -> Result<bool>

Seek to target rowid, positioning at the smallest rowid >= target. Returns true if an exact match exists.

Auto Trait Implementations§

§

impl<'p> !RefUnwindSafe for TableCursor<'p>

§

impl<'p> !Send for TableCursor<'p>

§

impl<'p> !Sync for TableCursor<'p>

§

impl<'p> !UnwindSafe for TableCursor<'p>

§

impl<'p> Freeze for TableCursor<'p>

§

impl<'p> Unpin for TableCursor<'p>

§

impl<'p> UnsafeUnpin for TableCursor<'p>

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

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.