Struct rocksdb::DBIterator[][src]

pub struct DBIterator<'a> { /* fields omitted */ }

An iterator over a database or column family, with specifiable ranges and direction.

use rocksdb::{DB, Direction, IteratorMode, Options};

let path = "_path_for_rocksdb_storage2";
{
    let db = DB::open_default(path).unwrap();
    let mut iter = db.iterator(IteratorMode::Start); // Always iterates forward
    for (key, value) in iter {
        println!("Saw {:?} {:?}", key, value);
    }
    iter = db.iterator(IteratorMode::End);  // Always iterates backward
    for (key, value) in iter {
        println!("Saw {:?} {:?}", key, value);
    }
    iter = db.iterator(IteratorMode::From(b"my key", Direction::Forward)); // From a key in Direction::{forward,reverse}
    for (key, value) in iter {
        println!("Saw {:?} {:?}", key, value);
    }

    // You can seek with an existing Iterator instance, too
    iter = db.iterator(IteratorMode::Start);
    iter.set_mode(IteratorMode::From(b"another key", Direction::Reverse));
    for (key, value) in iter {
        println!("Saw {:?} {:?}", key, value);
    }
}
let _ = DB::destroy(&Options::default(), path);

Implementations

impl<'a> DBIterator<'a>[src]

pub fn set_mode(&mut self, mode: IteratorMode<'_>)[src]

pub fn valid(&self) -> bool[src]

See valid

pub fn status(&self) -> Result<(), Error>[src]

See status

Trait Implementations

impl<'a> Into<DBRawIterator<'a>> for DBIterator<'a>[src]

impl<'a> Iterator for DBIterator<'a>[src]

type Item = (Box<[u8]>, Box<[u8]>)

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a> RefUnwindSafe for DBIterator<'a>

impl<'a> Send for DBIterator<'a>

impl<'a> Sync for DBIterator<'a>

impl<'a> Unpin for DBIterator<'a>

impl<'a> UnwindSafe for DBIterator<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.