Struct grebedb::Cursor[][src]

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

Cursor for navigating key-value pairs in sorted order.

Implementations

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

pub fn error(&self) -> Option<&Error>[src]

Return the most recent error.

pub fn seek<K>(&mut self, key: K) -> Result<(), Error> where
    K: AsRef<[u8]>, 
[src]

Reposition the cursor at or after the given key.

In other words, the cursor will be positioned to return key-value pairs that are equal or greater than the given key.

If a range has been set and the cursor is positioned outside the range, the iteration is considered terminated and no key-value pairs will returned.

pub fn set_range<K, R>(&mut self, range: R) where
    K: AsRef<[u8]>,
    R: RangeBounds<K>, 
[src]

Limit the key-value pairs within a range of keys.

The cursor will return key-value pairs where the keys are contained within the given range.

This function will not reposition the cursor to a position within the range. You must call Self::seek() manually since the cursor will not automatically seek forward to a range’s starting bound.

pub fn next_buf(
    &mut self,
    key: &mut Vec<u8>,
    value: &mut Vec<u8>
) -> Result<bool, Error>
[src]

Advance the cursor forward and write the key-value pair to the given buffers.

Returns true if the key-value pair was written. Returns false if there are no more key-value pairs or the cursor is positioned outside the range if set.

The vectors will be cleared and resized.

Trait Implementations

impl<'a> Debug for Cursor<'a>[src]

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

type Item = KeyValuePair

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Cursor<'a>

impl<'a> Send for Cursor<'a>

impl<'a> Sync for Cursor<'a>

impl<'a> Unpin for Cursor<'a>

impl<'a> !UnwindSafe for Cursor<'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.