pub struct Segment {
pub id: u64,
pub docs: Vec<DocMeta>,
pub syms: Vec<SymbolEntry>,
pub refs: Vec<RefEntry>,
/* private fields */
}Expand description
A read-only, mmap-backed view of a segment.
Fields§
§id: u64§docs: Vec<DocMeta>§syms: Vec<SymbolEntry>§refs: Vec<RefEntry>Implementations§
Source§impl Segment
impl Segment
pub fn open(paths: &Paths, seg_id: u64) -> Result<Segment>
pub fn doc(&self, doc_id: u32) -> Option<&DocMeta>
Sourcepub fn doc_syms(&self, doc_id: u32) -> impl Iterator<Item = &SymbolEntry>
pub fn doc_syms(&self, doc_id: u32) -> impl Iterator<Item = &SymbolEntry>
The symbols defined in doc_id, in storage order. O(1) lookup.
Sourcepub fn doc_refs(&self, doc_id: u32) -> impl Iterator<Item = &RefEntry>
pub fn doc_refs(&self, doc_id: u32) -> impl Iterator<Item = &RefEntry>
The references (calls + imports) originating in doc_id. O(1) lookup.
Sourcepub fn calls_to(&self, name: &str) -> impl Iterator<Item = &RefEntry>
pub fn calls_to(&self, name: &str) -> impl Iterator<Item = &RefEntry>
Call sites whose callee is exactly name, via the prebuilt name index
(O(results), no full scan). Liveness is not filtered here; callers that
care should check Segment::is_live.
Sourcepub fn sym_name_lower(&self, i: usize) -> &str
pub fn sym_name_lower(&self, i: usize) -> &str
Lowercased name of the symbol at index i in syms.
pub fn is_live(&self, doc_id: u32) -> bool
pub fn live_count(&self) -> u64
Sourcepub fn all_live(&self) -> RoaringBitmap
pub fn all_live(&self) -> RoaringBitmap
All live doc ids in this segment.
Sourcepub fn candidates(&self, query: &TrigramQuery) -> Result<RoaringBitmap>
pub fn candidates(&self, query: &TrigramQuery) -> Result<RoaringBitmap>
Compute candidate doc ids satisfying the trigram query, intersected with the live set. An unconstrained query yields all live docs.
Auto Trait Implementations§
impl Freeze for Segment
impl RefUnwindSafe for Segment
impl Send for Segment
impl Sync for Segment
impl Unpin for Segment
impl UnsafeUnpin for Segment
impl UnwindSafe for Segment
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
Converts
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>
Converts
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