Skip to main content

PostingList

Struct PostingList 

Source
pub struct PostingList { /* private fields */ }
Expand description

The locators stored under one index key. See the module docs for why this is not a Vec.

Implementations§

Source§

impl PostingList

Source

pub const fn new() -> Self

An empty list. Allocates nothing.

Source

pub fn single(locator: RowLocator) -> Self

A list holding one locator — the shape every new index key starts in.

Source

pub fn push(&mut self, locator: RowLocator)

Append one locator.

Source

pub fn len(&self) -> usize

Number of locators.

Source

pub fn is_empty(&self) -> bool

Whether the list holds no locators.

Source

pub fn iter(&self) -> Iter<'_>

The locators in insertion order.

Source

pub fn iter_copied(&self) -> impl Iterator<Item = RowLocator> + '_

The locators in insertion order, by value.

Source

pub fn first(&self) -> Option<RowLocator>

The first locator, if any.

Source

pub fn last(&self) -> Option<RowLocator>

The last locator, if any.

Source

pub fn contains(&self, locator: RowLocator) -> bool

Whether locator appears in the list.

Source

pub fn retain(&mut self, keep: impl Fn(RowLocator) -> bool)

Keep only the locators keep accepts, rebuilding the blocks.

Rebuilds rather than edits in place: the frozen blocks are shared, so dropping from the middle of one would copy it anyway.

The common call drops nothing, and that case must not allocate — the insert path prunes a key’s dead versions every time its list reaches a power-of-two length. So the list is tested first and only rebuilt if something is actually going. keep therefore sees a retained locator TWICE, which is why it is Fn and not FnMut: a predicate here has to be pure.

Source

pub fn to_vec(&self) -> Vec<RowLocator>

Collect into a flat Vec, for callers that need contiguity.

Trait Implementations§

Source§

impl Clone for PostingList

Source§

fn clone(&self) -> PostingList

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 Debug for PostingList

Source§

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

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

impl Default for PostingList

Source§

fn default() -> PostingList

Returns the “default value” for a type. Read more
Source§

impl Eq for PostingList

Source§

impl From<Vec<RowLocator>> for PostingList

Source§

fn from(v: Vec<RowLocator>) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<RowLocator> for PostingList

Source§

fn from_iter<I: IntoIterator<Item = RowLocator>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a> IntoIterator for &'a PostingList

Source§

type Item = &'a RowLocator

The type of the elements being iterated over.
Source§

type IntoIter = Box<dyn Iterator<Item = &'a RowLocator> + 'a>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl PartialEq for PostingList

Source§

fn eq(&self, other: &PostingList) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<const N: usize> PartialEq<[RowLocator; N]> for PostingList

Source§

fn eq(&self, other: &[RowLocator; N]) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialEq<[RowLocator]> for PostingList

Compare against a flat sequence, so a caller holding an expected order does not have to know how the list is blocked internally.

Source§

fn eq(&self, other: &[RowLocator]) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PostingList

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