pub struct SegmentData {
pub docs: Vec<DocMeta>,
/* private fields */
}Expand description
The immutable, shareable portion of an opened segment: mmaps, decoded side
tables, and the derived lookup structures. Wrapped in an Arc so a daemon
reloading its searcher after an incremental index can reuse unchanged
segments instead of re-parsing and re-deriving everything.
Fields§
§docs: Vec<DocMeta>Implementations§
Source§impl SegmentData
impl SegmentData
pub fn doc(&self, doc_id: u32) -> Option<&DocMeta>
Sourcepub fn sym(&self, i: u32) -> Option<SymbolEntry>
pub fn sym(&self, i: u32) -> Option<SymbolEntry>
Decode symbol row i. None for out-of-range ids or a corrupt row.
Sourcepub fn sym_names(&self) -> impl Iterator<Item = (u32, &str, &str)>
pub fn sym_names(&self) -> impl Iterator<Item = (u32, &str, &str)>
(row id, name, lowercased name) of every symbol — the fuzzy-scan
path. Walks the packed name columns only; rows are decoded lazily by
the caller for actual matches.
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) range lookup.
Sourcepub fn doc_sym_count(&self, doc_id: u32) -> u32
pub fn doc_sym_count(&self, doc_id: u32) -> u32
Number of symbols defined in doc_id, without decoding any row.
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.
Sourcepub fn refs_named<'s>(
&'s self,
name: &'s str,
) -> impl Iterator<Item = RefEntry> + 's
pub fn refs_named<'s>( &'s self, name: &'s str, ) -> impl Iterator<Item = RefEntry> + 's
References (calls and imports) whose name is exactly name, via the
persisted name index (O(results), no full scan). Liveness is not
filtered here; callers that care should check Segment::is_live.
Sourcepub fn calls_to<'s>(
&'s self,
name: &'s str,
) -> impl Iterator<Item = RefEntry> + 's
pub fn calls_to<'s>( &'s self, name: &'s str, ) -> impl Iterator<Item = RefEntry> + 's
Call sites whose callee is exactly name (see Self::refs_named).
Sourcepub fn syms_by_lower<'s>(
&'s self,
lower: &'s str,
) -> impl Iterator<Item = u32> + 's
pub fn syms_by_lower<'s>( &'s self, lower: &'s str, ) -> impl Iterator<Item = u32> + 's
Symbol row ids whose lowercased name is exactly lower. O(results)
via the persisted name FST.
Sourcepub fn sym_name_lower(&self, i: u32) -> &str
pub fn sym_name_lower(&self, i: u32) -> &str
Lowercased name of symbol row i (borrowed from the name column).
Auto Trait Implementations§
impl Freeze for SegmentData
impl RefUnwindSafe for SegmentData
impl Send for SegmentData
impl Sync for SegmentData
impl Unpin for SegmentData
impl UnsafeUnpin for SegmentData
impl UnwindSafe for SegmentData
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
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>
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