Struct rocksdb::DBIteratorWithThreadMode[][src]

pub struct DBIteratorWithThreadMode<'a, D: DBAccess> { /* 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, D: DBAccess> DBIteratorWithThreadMode<'a, D>[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, D: DBAccess> Into<DBRawIteratorWithThreadMode<'a, D>> for DBIteratorWithThreadMode<'a, D>[src]

impl<'a, D: DBAccess> Iterator for DBIteratorWithThreadMode<'a, D>[src]

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

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a, D> RefUnwindSafe for DBIteratorWithThreadMode<'a, D> where
    D: RefUnwindSafe

impl<'a, D> Send for DBIteratorWithThreadMode<'a, D>

impl<'a, D> Sync for DBIteratorWithThreadMode<'a, D>

impl<'a, D> Unpin for DBIteratorWithThreadMode<'a, D>

impl<'a, D> UnwindSafe for DBIteratorWithThreadMode<'a, D> where
    D: RefUnwindSafe

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.