sst

Trait Cursor

Source
pub trait Cursor {
    // Required methods
    fn seek_to_first(&mut self) -> Result<(), Error>;
    fn seek_to_last(&mut self) -> Result<(), Error>;
    fn seek(&mut self, key: &[u8]) -> Result<(), Error>;
    fn prev(&mut self) -> Result<(), Error>;
    fn next(&mut self) -> Result<(), Error>;
    fn key(&self) -> Option<KeyRef<"_>>;
    fn value(&self) -> Option<&[u8]>;

    // Provided method
    fn key_value(&self) -> Option<KeyValueRef<"_>> { ... }
}
Expand description

A Cursor allows for iterating through data.

Required Methods§

Source

fn seek_to_first(&mut self) -> Result<(), Error>

Seek past the first valid key-value pair to a beginning-of-stream sentinel.

Source

fn seek_to_last(&mut self) -> Result<(), Error>

Seek past the last valid key-value pair to an end-of-stream sentinel.

Source

fn seek(&mut self, key: &[u8]) -> Result<(), Error>

Seek to this key. After a call to seek, the values of [key] and [value] should return the sought-to key or the key that’s lexicographically next after key.

Source

fn prev(&mut self) -> Result<(), Error>

Advance the cursor forward to the lexicographically-previous key.

Source

fn next(&mut self) -> Result<(), Error>

Advance the cursor forward to the lexicographically-next key.

Source

fn key(&self) -> Option<KeyRef<"_>>

The key where this cursor is positioned, or None if the cursor is positioned at the bounds.

Source

fn value(&self) -> Option<&[u8]>

The value where this cursor is positioned, or None if the cursor is positioned at a tombstone or the limits of the cursor.

Provided Methods§

Source

fn key_value(&self) -> Option<KeyValueRef<"_>>

Return a KeyValueRef corresponding to the current position of the cursor. By default this will stitch together the values of key() and value() to make a KeyValueRef.

Trait Implementations§

Source§

impl Cursor for Box<dyn Cursor>

Source§

fn seek_to_first(&mut self) -> Result<(), Error>

Seek past the first valid key-value pair to a beginning-of-stream sentinel.
Source§

fn seek_to_last(&mut self) -> Result<(), Error>

Seek past the last valid key-value pair to an end-of-stream sentinel.
Source§

fn seek(&mut self, key: &[u8]) -> Result<(), Error>

Seek to this key. After a call to seek, the values of [key] and [value] should return the sought-to key or the key that’s lexicographically next after key.
Source§

fn prev(&mut self) -> Result<(), Error>

Advance the cursor forward to the lexicographically-previous key.
Source§

fn next(&mut self) -> Result<(), Error>

Advance the cursor forward to the lexicographically-next key.
Source§

fn key(&self) -> Option<KeyRef<"_>>

The key where this cursor is positioned, or None if the cursor is positioned at the bounds.
Source§

fn value(&self) -> Option<&[u8]>

The value where this cursor is positioned, or None if the cursor is positioned at a tombstone or the limits of the cursor.
Source§

fn key_value(&self) -> Option<KeyValueRef<"_>>

Return a KeyValueRef corresponding to the current position of the cursor. By default this will stitch together the values of key() and value() to make a KeyValueRef.

Implementations on Foreign Types§

Source§

impl Cursor for ()

Source§

fn seek_to_first(&mut self) -> Result<(), Error>

Source§

fn seek_to_last(&mut self) -> Result<(), Error>

Source§

fn seek(&mut self, _: &[u8]) -> Result<(), Error>

Source§

fn prev(&mut self) -> Result<(), Error>

Source§

fn next(&mut self) -> Result<(), Error>

Source§

fn key(&self) -> Option<KeyRef<"_>>

Source§

fn value(&self) -> Option<&[u8]>

Source§

impl Cursor for Box<dyn Cursor>

Source§

fn seek_to_first(&mut self) -> Result<(), Error>

Source§

fn seek_to_last(&mut self) -> Result<(), Error>

Source§

fn seek(&mut self, key: &[u8]) -> Result<(), Error>

Source§

fn prev(&mut self) -> Result<(), Error>

Source§

fn next(&mut self) -> Result<(), Error>

Source§

fn key(&self) -> Option<KeyRef<"_>>

Source§

fn value(&self) -> Option<&[u8]>

Implementors§