pub trait Cursor<'txn> {
// Required method
fn cursor(&self) -> *mut MDB_cursor;
// Provided methods
fn get(
&self,
key: Option<&[u8]>,
data: Option<&[u8]>,
op: c_uint,
) -> Result<(Option<&'txn [u8]>, &'txn [u8])> { ... }
fn iter(&mut self) -> Iter<'txn> ⓘ { ... }
fn iter_start(&mut self) -> Iter<'txn> ⓘ { ... }
fn iter_from<K>(&mut self, key: K) -> Iter<'txn> ⓘ
where K: AsRef<[u8]> { ... }
fn iter_dup(&mut self) -> IterDup<'txn> ⓘ { ... }
fn iter_dup_start(&mut self) -> IterDup<'txn> ⓘ { ... }
fn iter_dup_from<K>(&mut self, key: K) -> IterDup<'txn> ⓘ
where K: AsRef<[u8]> { ... }
fn iter_dup_of<K>(&mut self, key: K) -> Iter<'txn> ⓘ
where K: AsRef<[u8]> { ... }
}
Expand description
An LMDB cursor.
Required Methods§
Sourcefn cursor(&self) -> *mut MDB_cursor
fn cursor(&self) -> *mut MDB_cursor
Returns a raw pointer to the underlying LMDB cursor.
The caller must ensure that the pointer is not used after the lifetime of the cursor.
Provided Methods§
Sourcefn get(
&self,
key: Option<&[u8]>,
data: Option<&[u8]>,
op: c_uint,
) -> Result<(Option<&'txn [u8]>, &'txn [u8])>
fn get( &self, key: Option<&[u8]>, data: Option<&[u8]>, op: c_uint, ) -> Result<(Option<&'txn [u8]>, &'txn [u8])>
Retrieves a key/data pair from the cursor. Depending on the cursor op, the current key may be returned.
Sourcefn iter(&mut self) -> Iter<'txn> ⓘ
fn iter(&mut self) -> Iter<'txn> ⓘ
Iterate over database items. The iterator will begin with item next after the cursor, and continue until the end of the database. For new cursors, the iterator will begin with the first item in the database.
For databases with duplicate data items (DatabaseFlags::DUP_SORT
), the
duplicate data items of each key will be returned before moving on to
the next key.
Sourcefn iter_start(&mut self) -> Iter<'txn> ⓘ
fn iter_start(&mut self) -> Iter<'txn> ⓘ
Iterate over database items starting from the beginning of the database.
For databases with duplicate data items (DatabaseFlags::DUP_SORT
), the
duplicate data items of each key will be returned before moving on to
the next key.
Sourcefn iter_from<K>(&mut self, key: K) -> Iter<'txn> ⓘ
fn iter_from<K>(&mut self, key: K) -> Iter<'txn> ⓘ
Iterate over database items starting from the given key.
For databases with duplicate data items (DatabaseFlags::DUP_SORT
), the
duplicate data items of each key will be returned before moving on to
the next key.
Sourcefn iter_dup(&mut self) -> IterDup<'txn> ⓘ
fn iter_dup(&mut self) -> IterDup<'txn> ⓘ
Iterate over duplicate database items. The iterator will begin with the item next after the cursor, and continue until the end of the database. Each item will be returned as an iterator of its duplicates.
Sourcefn iter_dup_start(&mut self) -> IterDup<'txn> ⓘ
fn iter_dup_start(&mut self) -> IterDup<'txn> ⓘ
Iterate over duplicate database items starting from the beginning of the database. Each item will be returned as an iterator of its duplicates.
Sourcefn iter_dup_from<K>(&mut self, key: K) -> IterDup<'txn> ⓘ
fn iter_dup_from<K>(&mut self, key: K) -> IterDup<'txn> ⓘ
Iterate over duplicate items in the database starting from the given key. Each item will be returned as an iterator of its duplicates.
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.