Skip to main content

DbIter

Struct DbIter 

Source
pub struct DbIter { /* private fields */ }
Expand description

User-facing iterator over a consistent snapshot of the database.

Applies snapshot filtering, tombstone handling, and version merging across the active memtable, any in-progress flush memtable, and all SSTable files.

Obtain via Db::new_iterator. The iterator starts unpositioned; call seek_to_first, seek_to_last, or seek before reading keys or values. Supports both forward (next) and backward (prev) traversal; direction switches are handled transparently.

Implementations§

Source§

impl DbIter

Source

pub fn valid(&self) -> bool

Returns true if the iterator is positioned at a valid entry.

Source

pub fn seek_to_first(&mut self)

Position at the first user-visible entry.

Source

pub fn seek_to_last(&mut self)

Position at the last user-visible entry.

Source

pub fn seek(&mut self, key: &[u8])

Position at the first user-visible entry with key >= target.

Source

pub fn next(&mut self)

Advance to the next user-visible entry.

§Panics

Panics (debug) if valid() is false.

Source

pub fn prev(&mut self)

Move to the previous user-visible entry.

§Panics

Panics (debug) if valid() is false.

Source

pub fn key(&self) -> &[u8]

Current user key. Only valid when valid() is true.

Source

pub fn value(&self) -> &[u8]

Current value. Only valid when valid() is true.

Source

pub fn status(&self) -> Option<&Error>

Returns a sticky error if the iterator encountered corruption.

Auto Trait Implementations§

§

impl Freeze for DbIter

§

impl !RefUnwindSafe for DbIter

§

impl !Send for DbIter

§

impl !Sync for DbIter

§

impl Unpin for DbIter

§

impl UnsafeUnpin for DbIter

§

impl !UnwindSafe for DbIter

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.