pub struct Cursor<'a, B: Deref<Target = Bucket> + 'a> { /* private fields */ }
Expand description
Cursor represents an iterator that can traverse over all key/value pairs in a bucket in sorted order. Cursors see nested buckets with value == None. Cursors can be obtained from a transaction and are valid as long as the transaction is open.
Keys and values returned from the cursor are only valid for the life of the transaction.
Changing data while traversing with a cursor may cause it to be invalidated and return unexpected keys and/or values. You must reposition your cursor after mutating data.
Implementations§
Source§impl<'a, B: Deref<Target = Bucket> + 'a> Cursor<'a, B>
impl<'a, B: Deref<Target = Bucket> + 'a> Cursor<'a, B>
Sourcepub fn first(&self) -> Result<CursorItem<'a>, Error>
pub fn first(&self) -> Result<CursorItem<'a>, Error>
Moves the cursor to the first item in the bucket and returns its key and value. If the bucket is empty then a nil key and value are returned. The returned key and value are only valid for the life of the transaction.
Sourcepub fn last(&self) -> Result<CursorItem<'a>, Error>
pub fn last(&self) -> Result<CursorItem<'a>, Error>
Moves the cursor to the last item in the bucket and returns its key and value. If the bucket is empty then a nil key and value are returned. The returned key and value are only valid for the life of the transaction.
Sourcepub fn next(&self) -> Result<CursorItem<'a>, Error>
pub fn next(&self) -> Result<CursorItem<'a>, Error>
Moves the cursor to the next item in the bucket and returns its key and value. If the cursor is at the end of the bucket then a nil key and value are returned.
The returned key and value are only valid for the life of the transaction.
Sourcepub fn prev(&self) -> Result<CursorItem<'a>, Error>
pub fn prev(&self) -> Result<CursorItem<'a>, Error>
Moves the cursor to the previous item in the bucket and returns its key and value. If the cursor is at the beginning of the bucket then a nil key and value are returned. The returned key and value are only valid for the life of the transaction.
Auto Trait Implementations§
impl<'a, B> !Freeze for Cursor<'a, B>
impl<'a, B> !RefUnwindSafe for Cursor<'a, B>
impl<'a, B> !Send for Cursor<'a, B>
impl<'a, B> !Sync for Cursor<'a, B>
impl<'a, B> Unpin for Cursor<'a, B>where
B: Unpin,
impl<'a, B> !UnwindSafe for Cursor<'a, B>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more