Skip to main content

ReverseKeyCursor

Struct ReverseKeyCursor 

Source
pub struct ReverseKeyCursor<'a, C: ?Sized, K: ?Sized, V: ?Sized, R: ?Sized> { /* private fields */ }
Expand description

Cursor that reverses the direction of keys in the underlying cursor.

WARNING: This cursor iterates over keys in descending order, and thus will not work correctly with code that assumes monotonically growing keys.

Implementations§

Source§

impl<'a, C, K: ?Sized, V: ?Sized, R: ?Sized> ReverseKeyCursor<'a, C, K, V, R>
where C: Cursor<K, V, (), R> + ?Sized,

Source

pub fn new(cursor: &'a mut C) -> Self

Trait Implementations§

Source§

impl<C, K: ?Sized, V: ?Sized, R: WeightTrait + ?Sized> Cursor<K, V, (), R> for ReverseKeyCursor<'_, C, K, V, R>
where C: Cursor<K, V, (), R> + ?Sized,

Source§

fn weight_factory(&self) -> &'static dyn Factory<R>

Source§

fn key_valid(&self) -> bool

Indicates if the current key is valid. Read more
Source§

fn val_valid(&self) -> bool

Indicates if the current value is valid. Read more
Source§

fn key(&self) -> &K

A reference to the current key. Panics if invalid.
Source§

fn val(&self) -> &V

A reference to the current value. Panics if invalid.
Source§

fn get_key(&self) -> Option<&K>

Returns a reference to the current key, if valid.
Source§

fn get_val(&self) -> Option<&V>

Returns a reference to the current value, if valid.
Source§

fn map_times(&mut self, logic: &mut dyn FnMut(&(), &R))

Applies logic to each pair of time and difference. Intended for mutation of the closure’s scope.
Source§

fn map_times_through(&mut self, upper: &(), logic: &mut dyn FnMut(&(), &R))

Applies logic to each pair of time and difference, restricted to times t <= upper.
Source§

fn weight(&mut self) -> &R

Returns the weight associated with the current key/value pair. This concept only makes sense for cursors with unit timestamp type (T=()), since otherwise there is no singular definition of weight. This method is more convenient, and may be more efficient, than the equivalent call to Self::map_times. Read more
Source§

fn weight_checked(&mut self) -> &R

Returns the weight associated with the current key/value pair is T is (); panics otherwise. Read more
Source§

fn map_values(&mut self, logic: &mut dyn FnMut(&V, &R))

Apply a function to all values associated with the current key.
Source§

fn step_key(&mut self)

Advances the cursor to the next key.
Source§

fn step_key_reverse(&mut self)

Moves the cursor to the previous key.
Source§

fn seek_key(&mut self, key: &K)

Advances the cursor to the specified key. If key itself is not present, advances to the first key greater than key; if there is no such key, the cursor becomes invalid. Read more
Source§

fn seek_key_exact(&mut self, _key: &K, _hash: Option<u64>) -> bool

Looks up the specified key and returns true if it is present. Read more
Source§

fn seek_key_with(&mut self, predicate: &dyn Fn(&K) -> bool)

Advances the cursor to the first key that satisfies predicate. Assumes that predicate remains true once it turns true.
Source§

fn seek_key_with_reverse(&mut self, predicate: &dyn Fn(&K) -> bool)

Move the cursor backward to the first key that satisfies predicate. Assumes that predicate remains true once it turns true.
Source§

fn seek_key_reverse(&mut self, key: &K)

Moves the cursor backward to the specified key. If key itself is not present, moves backward to the first key less than key; if there is no such key, the cursor becomes invalid.
Source§

fn step_val(&mut self)

Advances the cursor to the next value.
Source§

fn step_val_reverse(&mut self)

Moves the cursor to the previous value.
Source§

fn seek_val(&mut self, val: &V)

Advances the cursor to the specified value.
Source§

fn seek_val_reverse(&mut self, val: &V)

Moves the cursor back to the specified value.
Source§

fn seek_val_with(&mut self, predicate: &dyn Fn(&V) -> bool)

Move the cursor to the first value (for the current key) that satisfies predicate. Assumes that predicate remains true once it turns true.
Source§

fn seek_val_with_reverse(&mut self, predicate: &dyn Fn(&V) -> bool)

Move the cursor back to the largest value (for the current key) that satisfies predicate. Assumes that predicate remains true once it turns true.
Source§

fn rewind_keys(&mut self)

Rewinds the cursor to the first key.
Source§

fn fast_forward_keys(&mut self)

Moves the cursor to the last key.
Source§

fn rewind_vals(&mut self)

Rewinds the cursor to the first value for current key.
Source§

fn fast_forward_vals(&mut self)

Move the cursor to the last value for the current key.
Source§

fn position(&self) -> Option<Position>

Source§

fn keyval_valid(&self) -> bool

Reports whether the current (key, value) pair is valid. Returns false if the cursor has exhausted all pairs.
Source§

fn keyval(&self) -> (&K, &V)

Returns current (key, value) pair. Panics if invalid.
Source§

fn step_keyval(&mut self)

Moves the cursor to the next (key, value) pair.
Source§

fn step_keyval_reverse(&mut self)

Moves the cursor to the previous (key, value) pair.
Source§

fn seek_keyval(&mut self, key: &K, val: &V)
where K: PartialEq,

Advance the cursor to the specified (key, value) pair.
Source§

fn seek_keyval_reverse(&mut self, key: &K, val: &V)
where K: PartialEq,

Moves the cursor back to the specified (key, value) pair.

Auto Trait Implementations§

§

impl<'a, C, K, V, R> !UnwindSafe for ReverseKeyCursor<'a, C, K, V, R>

§

impl<'a, C, K, V, R> Freeze for ReverseKeyCursor<'a, C, K, V, R>
where C: ?Sized, K: ?Sized, V: ?Sized, R: ?Sized,

§

impl<'a, C, K, V, R> RefUnwindSafe for ReverseKeyCursor<'a, C, K, V, R>
where C: RefUnwindSafe + ?Sized, K: ?Sized, V: ?Sized, R: ?Sized,

§

impl<'a, C, K, V, R> Send for ReverseKeyCursor<'a, C, K, V, R>
where C: Send + ?Sized, K: ?Sized, V: ?Sized, R: ?Sized,

§

impl<'a, C, K, V, R> Sync for ReverseKeyCursor<'a, C, K, V, R>
where C: Sync + ?Sized, K: ?Sized, V: ?Sized, R: ?Sized,

§

impl<'a, C, K, V, R> Unpin for ReverseKeyCursor<'a, C, K, V, R>
where C: ?Sized, K: ?Sized, V: ?Sized, R: ?Sized,

§

impl<'a, C, K, V, R> UnsafeUnpin for ReverseKeyCursor<'a, C, K, V, R>
where C: ?Sized, K: ?Sized, V: ?Sized, R: ?Sized,

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> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

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<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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 = 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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<K, V, T, C> ZCursor<K, V, T> for C
where C: Cursor<K, V, T, dyn WeightTyped<Type = i64>>, K: ?Sized, V: ?Sized,