Struct Cursor

Source
pub struct Cursor<'txn> { /* private fields */ }

Implementations§

Source§

impl<'txn> Cursor<'txn>

Source

pub fn to_first(&mut self) -> MdbResult<()>

Moves cursor to first entry

Source

pub fn to_last(&mut self) -> MdbResult<()>

Moves cursor to last entry

Source

pub fn to_key<'k, K: ToMdbValue>(&mut self, key: &'k K) -> MdbResult<()>

Moves cursor to first entry for key if it exists

Source

pub fn to_gte_key<'k, K: ToMdbValue>(&mut self, key: &'k K) -> MdbResult<()>

Moves cursor to first entry for key greater than or equal to ke

Source

pub fn to_item<K, V>(&mut self, key: &K, value: &V) -> MdbResult<()>
where K: ToMdbValue, V: ToMdbValue,

Moves cursor to specific item (for example, if cursor already points to a correct key and you need to delete a specific item through cursor)

Source

pub fn to_gte_item<K, V>(&mut self, key: &K, value: &V) -> MdbResult<()>
where K: ToMdbValue, V: ToMdbValue,

Moves cursor to nearest item.

Source

pub fn to_next_key(&mut self) -> MdbResult<()>

Moves cursor to next key, i.e. skip items with duplicate keys

Source

pub fn to_next_item(&mut self) -> MdbResult<()>

Moves cursor to next item with the same key as current

Source

pub fn to_prev_key(&mut self) -> MdbResult<()>

Moves cursor to prev entry, i.e. skips items with duplicate keys

Source

pub fn to_prev_item(&mut self) -> MdbResult<()>

Moves cursor to prev item with the same key as current

Source

pub fn to_first_item(&mut self) -> MdbResult<()>

Moves cursor to first item with the same key as current

Source

pub fn to_last_item(&mut self) -> MdbResult<()>

Moves cursor to last item with the same key as current

Source

pub fn get<'a, T: FromMdbValue + 'a, U: FromMdbValue + 'a>( &'a mut self, ) -> MdbResult<(T, U)>

Retrieves current key/value as tuple

Source

pub fn get_value<'a, V: FromMdbValue + 'a>(&'a mut self) -> MdbResult<V>

Retrieves current value

Source

pub fn get_key<'a, K: FromMdbValue + 'a>(&'a mut self) -> MdbResult<K>

Retrieves current key

Source

pub fn set<K: ToMdbValue, V: ToMdbValue>( &mut self, key: &K, value: &V, flags: c_uint, ) -> MdbResult<()>

Source

pub fn replace<V: ToMdbValue>(&mut self, value: &V) -> MdbResult<()>

Overwrites value for current item Note: overwrites max cur_value.len() bytes

Source

pub fn add_item<V: ToMdbValue>(&mut self, value: &V) -> MdbResult<()>

Adds a new item when created with allowed duplicates

Source

pub fn del(&mut self) -> MdbResult<()>

Deletes current key

Source

pub fn del_item(&mut self) -> MdbResult<()>

Deletes only current item

Note that it doesn’t check anything so it is caller responsibility to make sure that correct item is deleted if, for example, caller wants to delete only items of current key

Source

pub fn del_all(&mut self) -> MdbResult<()>

Deletes all items with same key as current

Source

pub fn item_count(&self) -> MdbResult<size_t>

Returns count of items with the same key as current

Source

pub fn get_item<'k, K: ToMdbValue>( self, k: &'k K, ) -> CursorItemAccessor<'txn, 'k, K>

Trait Implementations§

Source§

impl<'txn> Debug for Cursor<'txn>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'txn> Drop for Cursor<'txn>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'txn> Freeze for Cursor<'txn>

§

impl<'txn> RefUnwindSafe for Cursor<'txn>

§

impl<'txn> !Send for Cursor<'txn>

§

impl<'txn> !Sync for Cursor<'txn>

§

impl<'txn> Unpin for Cursor<'txn>

§

impl<'txn> UnwindSafe for Cursor<'txn>

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.