Struct KeyCursor

Source
pub struct KeyCursor<'t, M, K> { /* private fields */ }
Expand description

Cursor on an object store or index

Implementations§

Source§

impl<'t, M, K> KeyCursor<'t, M, K>

Source

pub fn direction(&self) -> Result<Option<CursorDirection>, Error>

Returns the direction of the cursor

Source

pub fn key(&self) -> Result<Option<K>, Error>

Returns the key at the current position of the cursor

Source

pub fn primary_key(&self) -> Result<Option<M::Key>, Error>

Returns the primary key at the current position of the cursor

Source

pub async fn advance(&mut self, count: u32) -> Result<(), Error>

Advances the cursor through the next count records in range.

Source

pub async fn next<Q>(&mut self, key: Option<&Q>) -> Result<(), Error>
where K: Borrow<Q>, Q: Serialize,

Advances the cursor to the next record in range matching or after key (if provided).

Source

pub async fn next_primary_key<Q, R>( &mut self, key: &Q, primary_key: &R, ) -> Result<(), Error>
where K: Borrow<Q>, Q: Serialize, M::Key: Borrow<R>, R: Serialize,

Advances the cursor to the next record in range matching or after key and primary key. Returns an Error if the source is not an Index.

Source

pub async fn update<V>(&mut self, value: &V) -> Result<M, Error>
where M: Borrow<V>, V: Serialize,

Updates the value at the current position of the cursor

Source

pub async fn delete(&mut self) -> Result<(), Error>

Deletes the value at the current position of the cursor

Trait Implementations§

Source§

impl<'t, M: Debug, K: Debug> Debug for KeyCursor<'t, M, K>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'t, M, K> Freeze for KeyCursor<'t, M, K>

§

impl<'t, M, K> !RefUnwindSafe for KeyCursor<'t, M, K>

§

impl<'t, M, K> !Send for KeyCursor<'t, M, K>

§

impl<'t, M, K> !Sync for KeyCursor<'t, M, K>

§

impl<'t, M, K> Unpin for KeyCursor<'t, M, K>
where M: Unpin, K: Unpin,

§

impl<'t, M, K> !UnwindSafe for KeyCursor<'t, M, K>

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.