Skip to main content

CursorMock

Struct CursorMock 

pub struct CursorMock { /* private fields */ }
Expand description

Mock cursor implementation for testing and development.

Implements all cursor traits. All operations are no-ops that return empty results, suitable for testing cursor operations without side effects.

Trait Implementations§

§

impl<T> DbCursorRO<T> for CursorMock
where T: Table,

§

fn first( &mut self, ) -> Result<Option<(<T as Table>::Key, <T as Table>::Value)>, DatabaseError>

Moves to the first entry in the table. Mock behavior: Always returns None.

§

fn seek_exact( &mut self, _key: <T as Table>::Key, ) -> Result<Option<(<T as Table>::Key, <T as Table>::Value)>, DatabaseError>

Seeks to an exact key match. Mock behavior: Always returns None.

§

fn seek( &mut self, _key: <T as Table>::Key, ) -> Result<Option<(<T as Table>::Key, <T as Table>::Value)>, DatabaseError>

Seeks to the first key greater than or equal to the given key. Mock behavior: Always returns None.

§

fn next( &mut self, ) -> Result<Option<(<T as Table>::Key, <T as Table>::Value)>, DatabaseError>

Moves to the next entry. Mock behavior: Always returns None.

§

fn prev( &mut self, ) -> Result<Option<(<T as Table>::Key, <T as Table>::Value)>, DatabaseError>

Moves to the previous entry. Mock behavior: Always returns None.

§

fn last( &mut self, ) -> Result<Option<(<T as Table>::Key, <T as Table>::Value)>, DatabaseError>

Moves to the last entry in the table. Mock behavior: Always returns None.

§

fn current( &mut self, ) -> Result<Option<(<T as Table>::Key, <T as Table>::Value)>, DatabaseError>

Returns the current entry without moving the cursor. Mock behavior: Always returns None.

§

fn walk( &mut self, start_key: Option<<T as Table>::Key>, ) -> Result<Walker<'_, T, CursorMock>, DatabaseError>

Creates a forward walker starting from the given key. Mock behavior: Returns an empty walker that won’t iterate over any data.

§

fn walk_range( &mut self, range: impl RangeBounds<<T as Table>::Key>, ) -> Result<RangeWalker<'_, T, CursorMock>, DatabaseError>

Creates a range walker for the specified key range. Mock behavior: Returns an empty walker that won’t iterate over any data.

§

fn walk_back( &mut self, start_key: Option<<T as Table>::Key>, ) -> Result<ReverseWalker<'_, T, CursorMock>, DatabaseError>

Creates a backward walker starting from the given key. Mock behavior: Returns an empty walker that won’t iterate over any data.

§

fn prefetch(&mut self, _enabled: bool) -> &mut Self
where Self: Sized,

Enables or disables best-effort read-ahead for subsequent value reads on this cursor. Read more
§

impl<T> DbCursorRW<T> for CursorMock
where T: Table,

§

fn upsert( &mut self, _key: <T as Table>::Key, _value: &<T as Table>::Value, ) -> Result<(), DatabaseError>

Inserts or updates a key-value pair at the current cursor position. Mock behavior: Always succeeds without modifying any data.

§

fn insert( &mut self, _key: <T as Table>::Key, _value: &<T as Table>::Value, ) -> Result<(), DatabaseError>

Inserts a key-value pair at the current cursor position. Mock behavior: Always succeeds without modifying any data.

§

fn append( &mut self, _key: <T as Table>::Key, _value: &<T as Table>::Value, ) -> Result<(), DatabaseError>

Appends a key-value pair at the end of the table. Mock behavior: Always succeeds without modifying any data.

§

fn delete_current(&mut self) -> Result<(), DatabaseError>

Deletes the entry at the current cursor position. Mock behavior: Always succeeds without modifying any data.

§

impl<T> DbDupCursorRO<T> for CursorMock
where T: DupSort,

§

fn next_dup( &mut self, ) -> Result<Option<(<T as Table>::Key, <T as Table>::Value)>, DatabaseError>

Moves to the next duplicate entry. Mock behavior: Always returns None.

§

fn prev_dup( &mut self, ) -> Result<Option<(<T as Table>::Key, <T as Table>::Value)>, DatabaseError>

Moves to the previous duplicate entry. Mock behavior: Always returns None.

§

fn last_dup(&mut self) -> Result<Option<<T as Table>::Value>, DatabaseError>

Moves to the last duplicate entry. Mock behavior: Always returns None.

§

fn next_no_dup( &mut self, ) -> Result<Option<(<T as Table>::Key, <T as Table>::Value)>, DatabaseError>

Moves to the next entry with a different key. Mock behavior: Always returns None.

§

fn next_dup_val(&mut self) -> Result<Option<<T as Table>::Value>, DatabaseError>

Moves to the next duplicate value. Mock behavior: Always returns None.

§

fn seek_by_key_subkey( &mut self, _key: <T as Table>::Key, _subkey: <T as DupSort>::SubKey, ) -> Result<Option<<T as Table>::Value>, DatabaseError>

Seeks to a specific key-subkey combination. Mock behavior: Always returns None.

§

fn walk_dup( &mut self, _key: Option<<T as Table>::Key>, _subkey: Option<<T as DupSort>::SubKey>, ) -> Result<DupWalker<'_, T, CursorMock>, DatabaseError>

Creates a duplicate walker for the specified key and subkey. Mock behavior: Returns an empty walker that won’t iterate over any data.

§

impl<T> DbDupCursorRW<T> for CursorMock
where T: DupSort,

§

fn delete_current_duplicates(&mut self) -> Result<(), DatabaseError>

Deletes all duplicate entries at the current cursor position. Mock behavior: Always succeeds without modifying any data.

§

fn append_dup( &mut self, _key: <T as Table>::Key, _value: <T as Table>::Value, ) -> Result<(), DatabaseError>

Appends a duplicate key-value pair. Mock behavior: Always succeeds without modifying any data.

§

impl Debug for CursorMock

§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> MaybeDebug for T
where T: Debug,

§

impl<T> NonStaticAny for T
where T: ?Sized,

§

fn type_id(&self) -> TypeId

Returns the lifetime-erased type ID of self.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 4 bytes