Skip to main content

SliceCursor

Struct SliceCursor 

Source
pub struct SliceCursor<'a> { /* private fields */ }
Expand description

Cursor over a slice of Postings sorted by id.

Implementations§

Source§

impl<'a> SliceCursor<'a>

Source

pub fn new(items: &'a [Posting]) -> Self

Cursor at the start of items. The slice must be sorted by id with no duplicates and satisfy the ceiling invariant.

Source

pub fn position(&self) -> usize

Index of the current element within the slice.

Trait Implementations§

Source§

impl<'a> Clone for SliceCursor<'a>

Source§

fn clone(&self) -> SliceCursor<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for SliceCursor<'a>

Source§

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

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

impl PostingCursor for SliceCursor<'_>

Source§

fn peek(&self) -> Option<Posting>

The current element, or None once the cursor is past the end.
Source§

fn advance(&mut self)

Move to the next element (no-op past the end).
Source§

fn seek(&mut self, target: RecordId) -> Option<Posting>

Move forward to the first element whose id is >= target and return it. Returns None when no such element exists; the cursor is then past the end. Never moves backwards.
Source§

fn remaining(&self) -> usize

Number of elements not yet consumed, the current one included.
Source§

fn last_id(&self) -> Option<RecordId>

Id of the last element of the whole list (regardless of position); None for an empty list.
Source§

fn exhaust(&mut self)

Move past the end.
Source§

fn drain_through(&mut self, hi: RecordId, visit: impl FnMut(RecordId, Weight))

Consume every element with id <= hi, handing each (id, weight) to visit in id order. Leaves the cursor on the first element above hi (or past the end).
Source§

fn upper_bound(&self) -> Weight

An upper bound on the weights of the elements not yet consumed, the current one included. f32::NEG_INFINITY once past the end.
Source§

fn lower_bound(&self) -> Weight

A lower bound on the weights of the elements not yet consumed. The default is unbounded, which is always correct; storages that track a suffix minimum can tighten it so negative query weights prune too.
Source§

fn is_exhausted(&self) -> bool

True once the cursor is past the end.

Auto Trait Implementations§

§

impl<'a> Freeze for SliceCursor<'a>

§

impl<'a> RefUnwindSafe for SliceCursor<'a>

§

impl<'a> Send for SliceCursor<'a>

§

impl<'a> Sync for SliceCursor<'a>

§

impl<'a> Unpin for SliceCursor<'a>

§

impl<'a> UnsafeUnpin for SliceCursor<'a>

§

impl<'a> UnwindSafe for SliceCursor<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.