Skip to main content

ReadCursor

Trait ReadCursor 

Source
pub trait ReadCursor<'txn, T: Table>: Clone {
    type IntoIter: Iterator<Item = Row<T>>;

    // Required methods
    fn first(&mut self) -> Option<Row<T>>;
    fn last(&mut self) -> Option<Row<T>>;
    fn next(&mut self) -> Option<Row<T>>;
    fn prev(&mut self) -> Option<Row<T>>;
    fn get_current(&mut self) -> Option<Row<T>>;
    fn set_key(&mut self, key: &T::Key) -> Option<T::Value>;
    fn set_lowerbound_key(&mut self, key: &T::Key) -> Option<Row<T>>;
    fn into_iter_start(self) -> Self::IntoIter;
    fn into_iter_from(self, key: &T::Key) -> Self::IntoIter;
}
Expand description

A cursor is used for navigating the entries within a table. The read-only version cannot modify entries.

Closely follows libmdbx’s cursor API.

Required Associated Types§

Source

type IntoIter: Iterator<Item = Row<T>>

Required Methods§

Source

fn first(&mut self) -> Option<Row<T>>

Positions the cursor at the first entry in the table.

Source

fn last(&mut self) -> Option<Row<T>>

Positions the cursor at the last entry in the table.

Source

fn next(&mut self) -> Option<Row<T>>

Positions the cursor at the next entry in the table. For a DupTable, this can be either the next duplicate for the current key or the first duplicate for the next key.

Source

fn prev(&mut self) -> Option<Row<T>>

Positions the cursor at the previous entry in the table. For a DupTable, this can be either the next duplicate for the current key or the first duplicate for the next key.

Source

fn get_current(&mut self) -> Option<Row<T>>

Returns the current entry at the cursor position.

Source

fn set_key(&mut self, key: &T::Key) -> Option<T::Value>

Positions the cursor at the entry that has a key == key. Previously seek_key.

Source

fn set_lowerbound_key(&mut self, key: &T::Key) -> Option<Row<T>>

Positions the cursor at the first entry that has a key >= key. Previously seek_range_key.

Source

fn into_iter_start(self) -> Self::IntoIter

Iterates over all entries in the table.

Source

fn into_iter_from(self, key: &T::Key) -> Self::IntoIter

Iterates over all entries in the table starting from a given key.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'txn, Kind: TransactionKind, T: Table> ReadCursor<'txn, T> for MdbxCursor<'txn, Kind, T>

Source§

type IntoIter = IntoIter<'txn, Kind, T>

Source§

impl<'txn, T: Table> ReadCursor<'txn, T> for CursorProxy<'txn, T>