Skip to main content

TripleBlock

Struct TripleBlock 

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

A parsed triple block.

Implementations§

Source§

impl<'a> TripleBlock<'a>

Source

pub fn parse(bytes: &'a [u8]) -> Result<TripleBlock<'a>, TripleError>

Source

pub fn zone(&self) -> &ZoneMap

Source

pub fn triples(&self) -> Vec<(u32, u32, u32)>

Decode all triples in ascending order. The bytes may be corrupt (a block from an untrusted file), so decoding is bounds-safe and stops gracefully at the first malformed varint rather than panicking — returning whatever prefix decoded cleanly.

Source

pub fn group_directory(&self) -> GroupDirectory

Build the byte-offset directory of this block’s a-groups (one header walk), enabling binary-search probes via scan_from. On corrupt bytes the walk stops early — the directory is a prefix, and the bounds-checked cursor degrades gracefully like every other reader.

Source

pub fn scan_from( &self, dir: &GroupDirectory, pa: u32, pb: Option<u32>, pc: Option<u32>, ) -> BlockCursor<'a>

Probe the block for a bound leading component pa, jumping straight to its a-group through the directory (binary search) instead of walking every preceding group header. Yields exactly what scan(Some(pa), pb, pc) would.

Source

pub fn scan( &self, pa: Option<u32>, pb: Option<u32>, pc: Option<u32>, ) -> BlockCursor<'a>

Stream the triples matching a (permuted) pattern, without decoding the whole block. pa/pb/pc are the bound components in this block’s stored order (None = wildcard). The cursor walks the grouped body and:

  • range-stops once the leading component a exceeds a bound pa — the a-groups are stored ascending, so nothing later can match (the early-out that makes a leading-bound lookup O(matches + preceding groups) instead of O(whole block));
  • group-skips a/b groups that can’t match (decoding their headers to advance, but never building or emitting their triples);
  • equality-filters pb/pc without ever early-breaking inside a c-list, so on a valid block the yielded set equals what triples would yield filtered — even on corrupt bytes it only ever yields fewer, never panics (every read is bounds-checked).

Yields triples in this block’s stored (a, b, c) order; callers map back to canonical (s, p, o) themselves.

Auto Trait Implementations§

§

impl<'a> Freeze for TripleBlock<'a>

§

impl<'a> RefUnwindSafe for TripleBlock<'a>

§

impl<'a> Send for TripleBlock<'a>

§

impl<'a> Sync for TripleBlock<'a>

§

impl<'a> Unpin for TripleBlock<'a>

§

impl<'a> UnsafeUnpin for TripleBlock<'a>

§

impl<'a> UnwindSafe for TripleBlock<'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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V