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
impl PostingList
Sourcepub fn single(locator: RowLocator) -> Self
pub fn single(locator: RowLocator) -> Self
A list holding one locator — the shape every new index key starts in.
Sourcepub fn push(&mut self, locator: RowLocator)
pub fn push(&mut self, locator: RowLocator)
Append one locator.
Sourcepub fn iter_copied(&self) -> impl Iterator<Item = RowLocator> + '_
pub fn iter_copied(&self) -> impl Iterator<Item = RowLocator> + '_
The locators in insertion order, by value.
Sourcepub fn first(&self) -> Option<RowLocator>
pub fn first(&self) -> Option<RowLocator>
The first locator, if any.
Sourcepub fn last(&self) -> Option<RowLocator>
pub fn last(&self) -> Option<RowLocator>
The last locator, if any.
Sourcepub fn contains(&self, locator: RowLocator) -> bool
pub fn contains(&self, locator: RowLocator) -> bool
Whether locator appears in the list.
Sourcepub fn retain(&mut self, keep: impl Fn(RowLocator) -> bool)
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.
Sourcepub fn to_vec(&self) -> Vec<RowLocator>
pub fn to_vec(&self) -> Vec<RowLocator>
Collect into a flat Vec, for callers that need contiguity.
Trait Implementations§
Source§impl Clone for PostingList
impl Clone for PostingList
Source§fn clone(&self) -> PostingList
fn clone(&self) -> PostingList
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PostingList
impl Debug for PostingList
Source§impl Default for PostingList
impl Default for PostingList
Source§fn default() -> PostingList
fn default() -> PostingList
impl Eq for PostingList
Source§impl From<Vec<RowLocator>> for PostingList
impl From<Vec<RowLocator>> for PostingList
Source§fn from(v: Vec<RowLocator>) -> Self
fn from(v: Vec<RowLocator>) -> Self
Source§impl FromIterator<RowLocator> for PostingList
impl FromIterator<RowLocator> for PostingList
Source§fn from_iter<I: IntoIterator<Item = RowLocator>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = RowLocator>>(iter: I) -> Self
Source§impl<'a> IntoIterator for &'a PostingList
impl<'a> IntoIterator for &'a PostingList
Source§impl PartialEq for PostingList
impl PartialEq for PostingList
Source§impl<const N: usize> PartialEq<[RowLocator; N]> for PostingList
impl<const N: usize> PartialEq<[RowLocator; N]> for PostingList
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.
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.