Skip to main content

PostingsReader

Struct PostingsReader 

Source
pub struct PostingsReader<'bytes> { /* private fields */ }
Expand description

A validated view over an encoded posting list.

Implementations§

Source§

impl<'bytes> PostingsReader<'bytes>

Source

pub fn positions( &self, row: u32, ) -> Result<Option<RowPositions<'bytes>>, PostingsError>

Locates only one row’s position deltas. Other rows’ positions are not decoded; their frequencies establish the offset within this block.

§Errors

Returns a typed posting error for malformed frequencies or geometry.

Source

pub fn open(bytes: &'bytes [u8]) -> Result<Self, PostingsError>

Validates and opens an encoded posting list.

Every structural claim the bytes make is checked here, so the iteration methods below cannot fail on a reader that exists. Corrupt bytes produce a typed error and never a panic.

§Errors

Returns PostingsError for bad magic, an unreadable version, a zero block size, an oversized bit width, an inconsistent posting count, or truncation anywhere.

Source

pub fn blocks(&self) -> &[BlockMeta]

Returns the block metadata rows.

Source

pub const fn version(&self) -> u16

Returns the format version the stream declared.

A caller that needs impact pairs checks this rather than inferring their presence from a zero pair, so a v1 stream is refused loudly instead of silently bounding nothing.

Source

pub const fn postings_per_block(&self) -> u16

Returns the postings-per-block geometry recorded in the header.

Source

pub const fn document_frequency(&self) -> u32

Returns the total posting count.

Source

pub fn decode_block(&self, index: usize) -> Result<Vec<Posting>, PostingsError>

Decodes one block into document ids, frequencies, and positions.

§Errors

Returns PostingsError::Truncated when a stream is short. Bounds were validated at PostingsReader::open, so a well-formed reader decodes every block successfully.

Source

pub fn decode_all(&self) -> Result<PostingList, PostingsError>

Decodes the whole list.

§Errors

Propagates any PostingsError from block decoding.

Trait Implementations§

Source§

impl<'bytes> Clone for PostingsReader<'bytes>

Source§

fn clone(&self) -> Self

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<'bytes> Debug for PostingsReader<'bytes>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'bytes> Freeze for PostingsReader<'bytes>

§

impl<'bytes> RefUnwindSafe for PostingsReader<'bytes>

§

impl<'bytes> Send for PostingsReader<'bytes>

§

impl<'bytes> Sync for PostingsReader<'bytes>

§

impl<'bytes> Unpin for PostingsReader<'bytes>

§

impl<'bytes> UnsafeUnpin for PostingsReader<'bytes>

§

impl<'bytes> UnwindSafe for PostingsReader<'bytes>

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.