Skip to main content

ReverseRangeIter

Struct ReverseRangeIter 

Source
pub struct ReverseRangeIter<'p> { /* private fields */ }
Expand description

A descending range cursor. Unlike reversing a forward RangeIter, this pins one leaf at a time and never materialises the range it is walking.

Implementations§

Source§

impl ReverseRangeIter<'_>

Source

pub fn peek_ref(&mut self) -> Result<Option<(&[u8], &[u8])>>

The descending record the cursor is parked on, borrowed from the pinned leaf, with no allocation. Paired with ReverseRangeIter::step this is the PULL cursor the forward iterator already has: peek, use, step, peek.

A query executor cannot live inside for_each_ref’s callback – it has to interleave the walk with a heap, a work meter and a cancellation check – and until this existed, every descending order had to materialise its whole range before it could rank it. Same leaf pin, same tree-id and cycle checks, same overflow resolution as the callback form.

Source

pub fn step(&mut self)

Step past the record the last peek returned. Crossing into the leaf to the LEFT is left to the next peek, which retreats through the saved parent path when the slot index reaches the start of the leaf.

Source

pub fn for_each_ref(self, f: impl FnMut(&[u8], &[u8]) -> bool) -> Result<()>

Visit descending records as borrows into one pinned leaf. The cursor is bounded by the buffer pool; a caller stopping after k entries pays for only the pages containing those entries.

Auto Trait Implementations§

§

impl<'p> !RefUnwindSafe for ReverseRangeIter<'p>

§

impl<'p> !Send for ReverseRangeIter<'p>

§

impl<'p> !Sync for ReverseRangeIter<'p>

§

impl<'p> !UnwindSafe for ReverseRangeIter<'p>

§

impl<'p> Freeze for ReverseRangeIter<'p>

§

impl<'p> Unpin for ReverseRangeIter<'p>

§

impl<'p> UnsafeUnpin for ReverseRangeIter<'p>

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 = !

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.