pub struct QuinIndex { /* private fields */ }Expand description
In-memory inverted index over a NQuin collection.
Provides O(1) average lookup by subject, predicate, object, or context. Build once
from a slice (from_slice) or grow incrementally (insert); the zero-alloc
iter_* / object_of accessors yield copies, so they stay valid across the Vec
reallocation an insert can trigger. Designed to live per 512 MB cell; wiring it to
BIDX/demand-paging across cells is separate (task #22).
Implementations§
Source§impl QuinIndex
impl QuinIndex
Sourcepub fn from_slice(quins: &[NQuin]) -> Self
pub fn from_slice(quins: &[NQuin]) -> Self
Build an index from a slice of quins (copied into the index).
Sourcepub fn by_subject(&self, id: u64) -> Vec<NQuin>
pub fn by_subject(&self, id: u64) -> Vec<NQuin>
All quins with subject id.
Sourcepub fn by_predicate(&self, id: u64) -> Vec<NQuin>
pub fn by_predicate(&self, id: u64) -> Vec<NQuin>
All quins with predicate id.
Sourcepub fn by_context(&self, id: u64) -> Vec<NQuin>
pub fn by_context(&self, id: u64) -> Vec<NQuin>
All quins with context id.
Sourcepub fn by_subject_and_predicate(&self, s: u64, p: u64) -> Vec<NQuin>
pub fn by_subject_and_predicate(&self, s: u64, p: u64) -> Vec<NQuin>
Returns all quins where subject==s AND predicate==p.
Sourcepub fn iter_by_subject(&self, s: u64) -> impl Iterator<Item = NQuin> + '_
pub fn iter_by_subject(&self, s: u64) -> impl Iterator<Item = NQuin> + '_
Zero-alloc: every quin with this subject, yielded by copy.
Sourcepub fn iter_by_subject_and_predicate(
&self,
s: u64,
p: u64,
) -> impl Iterator<Item = NQuin> + '_
pub fn iter_by_subject_and_predicate( &self, s: u64, p: u64, ) -> impl Iterator<Item = NQuin> + '_
Zero-alloc: every quin matching subject AND predicate, yielded by copy.
Sourcepub fn object_of(&self, s: u64, p: u64) -> Option<u64>
pub fn object_of(&self, s: u64, p: u64) -> Option<u64>
Zero-alloc modal-kind resolution primitive: the first object of (s, p).
e.g. object_of(identifier, has_modality_kind) resolves an identifier’s kind
in one point lookup with no heap allocation.
Sourcepub fn rows_by_subject(&self, s: u64) -> &[usize]
pub fn rows_by_subject(&self, s: u64) -> &[usize]
Zero-copy raw backing-store row indices for a subject, for callers that gather
into their own contiguous scratch buffer (pair with quin_at).
Sourcepub fn rows_by_predicate(&self, p: u64) -> &[usize]
pub fn rows_by_predicate(&self, p: u64) -> &[usize]
Zero-copy raw backing-store row indices for a predicate, in ascending row order.
Sourcepub fn rows_by_object(&self, o: u64) -> &[usize]
pub fn rows_by_object(&self, o: u64) -> &[usize]
Zero-copy raw backing-store row indices for an object, in ascending row order.
Sourcepub fn rows_by_context(&self, c: u64) -> &[usize]
pub fn rows_by_context(&self, c: u64) -> &[usize]
Zero-copy raw backing-store row indices for a context, in ascending row order.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for QuinIndex
impl RefUnwindSafe for QuinIndex
impl Send for QuinIndex
impl Sync for QuinIndex
impl Unpin for QuinIndex
impl UnsafeUnpin for QuinIndex
impl UnwindSafe for QuinIndex
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more