Trait lsmlite_rs::Cursor
source · pub trait Cursor {
// Required methods
fn close(&mut self) -> Result<(), LsmErrorCode>;
fn first(&mut self) -> Result<(), LsmErrorCode>;
fn last(&mut self) -> Result<(), LsmErrorCode>;
fn seek(
&mut self,
key: &[u8],
mode: LsmCursorSeekOp
) -> Result<(), LsmErrorCode>;
fn next(&mut self) -> Result<(), LsmErrorCode>;
fn prev(&mut self) -> Result<(), LsmErrorCode>;
fn valid(&self) -> Result<(), LsmErrorCode>;
fn get_key(&self) -> Result<Vec<u8>, LsmErrorCode>;
fn get_value(&self) -> Result<Vec<u8>, LsmErrorCode>;
fn compare(&self, key: &[u8]) -> Result<Ordering, LsmErrorCode>;
}
Expand description
Primary set of methods of database cursors.
Required Methods§
sourcefn close(&mut self) -> Result<(), LsmErrorCode>
fn close(&mut self) -> Result<(), LsmErrorCode>
Closes a database cursor.
sourcefn first(&mut self) -> Result<(), LsmErrorCode>
fn first(&mut self) -> Result<(), LsmErrorCode>
Moves the cursor to the very first record in the database.
sourcefn last(&mut self) -> Result<(), LsmErrorCode>
fn last(&mut self) -> Result<(), LsmErrorCode>
Moves the cursor to the very last record in the database.
sourcefn seek(
&mut self,
key: &[u8],
mode: LsmCursorSeekOp
) -> Result<(), LsmErrorCode>
fn seek( &mut self, key: &[u8], mode: LsmCursorSeekOp ) -> Result<(), LsmErrorCode>
Moves the cursor in the database to the record pointed by key
.
How this operation behaves depends on the given seek mode (LsmCursorSeekOp
).
sourcefn next(&mut self) -> Result<(), LsmErrorCode>
fn next(&mut self) -> Result<(), LsmErrorCode>
Moves the cursor to the next record in the database (as seen from the current value the cursor is pointing to).
sourcefn prev(&mut self) -> Result<(), LsmErrorCode>
fn prev(&mut self) -> Result<(), LsmErrorCode>
Moves the cursor to the previous record in the database (as seen from the current value the cursor is pointing to).
sourcefn valid(&self) -> Result<(), LsmErrorCode>
fn valid(&self) -> Result<(), LsmErrorCode>
Tests whether the cursor is currently pointing to a valid database record.
sourcefn get_key(&self) -> Result<Vec<u8>, LsmErrorCode>
fn get_key(&self) -> Result<Vec<u8>, LsmErrorCode>
Obtains a copy of the key of the record the cursor is currently pointing to (if valid).