pub struct IndexReader<B> { /* private fields */ }Expand description
Zero-copy reader over a memory-mapped or buffered .ridx index.
Implementations§
Source§impl<B: AsRef<[u8]>> IndexReader<B>
impl<B: AsRef<[u8]>> IndexReader<B>
Sourcepub fn target_triple(&self) -> &str
pub fn target_triple(&self) -> &str
Effective target triple recorded for this shard (or "" if none).
Sourcepub fn cfgs(&self) -> &[CfgEntry]
pub fn cfgs(&self) -> &[CfgEntry]
Raw slice of CfgEntry rows sorted by (key_str, Option<value_str>).
Sourcepub fn cfg_iter(
&self,
) -> impl ExactSizeIterator<Item = (&str, Option<&str>)> + '_
pub fn cfg_iter( &self, ) -> impl ExactSizeIterator<Item = (&str, Option<&str>)> + '_
Iterates over all (key, Option<value>) cfg predicates in sorted order.
Sourcepub fn has_cfg_flag(&self, key: &str) -> bool
pub fn has_cfg_flag(&self, key: &str) -> bool
O(log N) lookup for a bare cfg flag atom (#[cfg(unix)], #[cfg(test)]).
Sourcepub fn has_cfg_key_value(&self, key: &str, value: &str) -> bool
pub fn has_cfg_key_value(&self, key: &str, value: &str) -> bool
O(log N) lookup for a cfg(key = "value") predicate (#[cfg(feature = "std")]).
Sourcepub fn cfg_values<'a>(
&'a self,
key: &str,
) -> impl ExactSizeIterator<Item = &'a str> + 'a
pub fn cfg_values<'a>( &'a self, key: &str, ) -> impl ExactSizeIterator<Item = &'a str> + 'a
O(log N) zero-allocation iterator over all values v of cfg(key = "v") in sorted order.
Sourcepub fn enabled_features(&self) -> impl ExactSizeIterator<Item = &str> + '_
pub fn enabled_features(&self) -> impl ExactSizeIterator<Item = &str> + '_
O(log N) zero-allocation iterator over all enabled Cargo features (feature = "...").
Source§impl<B: AsRef<[u8]>> IndexReader<B>
impl<B: AsRef<[u8]>> IndexReader<B>
Sourcepub fn find_definition_at(
&self,
file: &str,
line: u32,
col: u32,
) -> Option<ResolvedDefinition<'_>>
pub fn find_definition_at( &self, file: &str, line: u32, col: u32, ) -> Option<ResolvedDefinition<'_>>
Go to definition at a given cursor position (file, line, col).
The innermost name reference at the cursor answers, unless a definition at the cursor lies inside that reference’s span: a reference spanning a macro invocation or a generated call encloses every item written inside it, and on such an item’s name the item is the answer. Equal spans (a self-reference) keep the reference. A reference as wide as its target’s name cannot enclose a definition, so no definition is looked for behind it. Without a reference the smallest named definition containing the cursor answers; the nameless crate-root module the driver records with the span of the whole file never does, so a position on no name has no definition.
Source§impl<B: AsRef<[u8]>> IndexReader<B>
impl<B: AsRef<[u8]>> IndexReader<B>
Sourcepub fn find_file_id(&self, file_path: &str) -> Option<u32>
pub fn find_file_id(&self, file_path: &str) -> Option<u32>
Looks up the file_id of the file stored as file_path: the same string, or the same path
by components (./src/lib.rs and src//lib.rs name src/lib.rs), or a stored path whose
.. components resolve lexically to it: a file pulled in by include!("../test_data/x.rs")
is stored as rustc spelled it, crate/src/../test_data/x.rs, and crate/test_data/x.rs
names it. .. on the query side is not resolved here: through a symlinked parent it is a
filesystem question, which WorkspaceIndex settles before asking. A path that merely ends
with a stored one, such as another crate’s src/lib.rs, does not match. The stored form is
the one the driver wrote: relative to the workspace root for workspace crates, relative to
the package directory for dependencies, relative to the rust-src root for the sysroot;
WorkspaceIndex::target_file_for_reader turns any input into it.
Source§impl<B: AsRef<[u8]>> IndexReader<B>
impl<B: AsRef<[u8]>> IndexReader<B>
Sourcepub fn macro_defs(&self) -> &[MacroDefEntry]
pub fn macro_defs(&self) -> &[MacroDefEntry]
Raw slice of MacroDefEntry rows sorted by def_index.
Sourcepub fn macro_defs_iter(
&self,
) -> impl ExactSizeIterator<Item = MacroDefView<'_>> + '_
pub fn macro_defs_iter( &self, ) -> impl ExactSizeIterator<Item = MacroDefView<'_>> + '_
Iterates over all decoded MacroDefView entries in def_index order.
Sourcepub fn macro_def_for_def(&self, def_index: u32) -> Option<MacroDefView<'_>>
pub fn macro_def_for_def(&self, def_index: u32) -> Option<MacroDefView<'_>>
O(log N) lookup for the declarative macro definition owned by def_index.
Source§impl<B: AsRef<[u8]>> IndexReader<B>
impl<B: AsRef<[u8]>> IndexReader<B>
Sourcepub fn has_macro_expansion_reference(
&self,
target_path: &str,
def_line: u32,
) -> bool
pub fn has_macro_expansion_reference( &self, target_path: &str, def_line: u32, ) -> bool
Whether a macro expansion wrote a reference to target_path whose target sits on 1-based def_line (0
matches any). Unlike find_references this counts the references that are no use of the name, such as a
proc macro’s generated call carrying its call site’s span: rename safety needs to know the call exists.
Sourcepub fn is_name_reference(&self, r: &RefEntry) -> bool
pub fn is_name_reference(&self, r: &RefEntry) -> bool
True when r is a use of its target’s name. A reference whose span properly encloses the
span of its own target’s definition is not one: it is the span of the item or file that
defines the target. The driver writes two such references per #[test] function: a plain
Fn reference spanning the whole function (the call the test harness generates) and a
macro Const reference to the generated test constant spanning the whole file or module
(the constant’s definition sits on the #[test] attribute, so the span begins where the
definition begins and reaches far past it); derive expansions add references spanning a
whole variant or field. A definition whose end lies before its start (an index without end
spans) is never enclosed. The reader’s lookups (find_innermost_ref_at_file_id,
find_references) skip references that fail this test; IndexReader::references still
returns every record.
Sourcepub fn may_enclose_definition(&self, r: &RefEntry) -> bool
pub fn may_enclose_definition(&self, r: &RefEntry) -> bool
True when the span of r can contain a definition’s name span: a span over more than one
line, or a single-line span wider than its target’s name. A reference as wide as the name
it uses contains no definition, so find_definition_at answers it without looking for one;
a span whose end lies before its start contains nothing.
Source§impl<B: AsRef<[u8]>> IndexReader<B>
impl<B: AsRef<[u8]>> IndexReader<B>
Sourcepub fn find_definition_by_path(&self, path: &str) -> Option<&DefEntry>
pub fn find_definition_by_path(&self, path: &str) -> Option<&DefEntry>
Find a definition by its canonical path (e.g. stdx::panic_context::enter).
Sourcepub fn has_multiple_definitions_at_path(&self, path: &str) -> bool
pub fn has_multiple_definitions_at_path(&self, path: &str) -> bool
Returns true when more than one definition in this shard shares path at distinct lines.
Sourcepub fn find_definition_by_path_and_id(
&self,
path: &str,
target_def_id: u32,
) -> Option<&DefEntry>
pub fn find_definition_by_path_and_id( &self, path: &str, target_def_id: u32, ) -> Option<&DefEntry>
Find a definition by its canonical path and exact def_id.
Sourcepub fn resolve_ref_definition(&self, r: &RefEntry) -> ResolvedDefinition<'_>
pub fn resolve_ref_definition(&self, r: &RefEntry) -> ResolvedDefinition<'_>
Resolves a RefEntry to its target ResolvedDefinition.
Sourcepub fn find_ref_targeting_position(
&self,
file_id: u32,
line: u32,
col: u32,
) -> Option<ResolvedDefinition<'_>>
pub fn find_ref_targeting_position( &self, file_id: u32, line: u32, col: u32, ) -> Option<ResolvedDefinition<'_>>
Resolves a field or variant definition at its declaration line when the index only recorded
references to it (e.g. in pre-existing indices where Field/Variant were not in definitions()).
Sourcepub fn references_in_file(&self, file_id: u32) -> &[RefEntry]
pub fn references_in_file(&self, file_id: u32) -> &[RefEntry]
Returns the contiguous slice of span-sorted references inside file_id.
Sourcepub fn references_at_start(
&self,
file_id: u32,
start_line: u32,
start_col: u32,
) -> &[RefEntry]
pub fn references_at_start( &self, file_id: u32, start_line: u32, start_col: u32, ) -> &[RefEntry]
Returns the contiguous slice of span-sorted references starting at (file_id, start_line, start_col).
Sourcepub fn find_references(&self, target_path: &str) -> Vec<&RefEntry>
pub fn find_references(&self, target_path: &str) -> Vec<&RefEntry>
Find all references to a given symbol path (e.g. thread::Builder::allow_leak).
References that are not uses of a name (is_name_reference) are left out.
Sourcepub fn find_innermost_type_entry(
&self,
file: &str,
line: u32,
col: u32,
) -> Option<&TypeEntry>
pub fn find_innermost_type_entry( &self, file: &str, line: u32, col: u32, ) -> Option<&TypeEntry>
Finds the innermost TypeEntry at a cursor position (file, line, col).
Sourcepub fn find_innermost_type_entry_at_file_id(
&self,
file_id: u32,
line: u32,
col: u32,
) -> Option<&TypeEntry>
pub fn find_innermost_type_entry_at_file_id( &self, file_id: u32, line: u32, col: u32, ) -> Option<&TypeEntry>
Finds the innermost TypeEntry at (file_id, line, col) without re-scanning the file table.
Sourcepub fn type_at(&self, file: &str, line: u32, col: u32) -> Option<&str>
pub fn type_at(&self, file: &str, line: u32, col: u32) -> Option<&str>
Retrieves the inferred expression type at a cursor position (file, line, col).
When nested expressions overlap, selects the tightest (innermost) span.
Sourcepub fn type_entry_at(
&self,
file: &str,
line: u32,
col: u32,
) -> Option<(&str, Option<&str>)>
pub fn type_entry_at( &self, file: &str, line: u32, col: u32, ) -> Option<(&str, Option<&str>)>
Retrieves the inferred expression type and optional canonical owner path at (file, line, col).
Returns (type_name, canonical_owner_path).
Sourcepub fn type_entry_at_file_id(
&self,
file_id: u32,
line: u32,
col: u32,
) -> Option<(&str, Option<&str>)>
pub fn type_entry_at_file_id( &self, file_id: u32, line: u32, col: u32, ) -> Option<(&str, Option<&str>)>
Retrieves the inferred expression type and optional canonical owner path at (file_id, line, col).
Sourcepub fn find_definitions_by_owner(&self, owner: &str) -> Vec<&DefEntry>
pub fn find_definitions_by_owner(&self, owner: &str) -> Vec<&DefEntry>
Find all definitions belonging to an owner (canonical type path or module path).
Performs binary search on the 64-bit FNV-1a hash of owner, with full collision
verification against the interned canonical owner string.
Sourcepub fn find_owners_by_def_index(&self, def_index: u32) -> Vec<&str>
pub fn find_owners_by_def_index(&self, def_index: u32) -> Vec<&str>
Find all canonical owners associated with a definition index.
Source§impl<B: AsRef<[u8]>> IndexReader<B>
impl<B: AsRef<[u8]>> IndexReader<B>
Sourcepub fn notes(&self) -> &[NoteEntry]
pub fn notes(&self) -> &[NoteEntry]
Slice of all notes in the index (sorted by span); empty for indexes older than format version 4.
Sourcepub fn note_at(
&self,
file_id: u32,
line: u32,
col: u32,
kind: u32,
) -> Option<&str>
pub fn note_at( &self, file_id: u32, line: u32, col: u32, kind: u32, ) -> Option<&str>
The text of the kind note whose span starts at (file_id, line, col).
Sourcepub fn ty_defs(&self) -> &[TyDefEntry]
pub fn ty_defs(&self) -> &[TyDefEntry]
Raw slice of TyDefEntry records in this shard’s TyArena (empty for format < v5).
Sourcepub fn ty_entries(&self) -> &[TyEntry]
pub fn ty_entries(&self) -> &[TyEntry]
Raw slice of TyEntry records in this shard’s TyArena (empty for format < v5).
Sourcepub fn ty_bounds(&self) -> &[TyBoundEntry]
pub fn ty_bounds(&self) -> &[TyBoundEntry]
Raw slice of TyBoundEntry records in this shard’s TyArena (empty for format < v5).
Sourcepub fn ty_args_raw(&self) -> &[u32]
pub fn ty_args_raw(&self) -> &[u32]
Raw slice of u32 words in this shard’s TyArena argument pool (empty for format < v5).
Sourcepub fn ty_arena(&self) -> TyArenaView<'_>
pub fn ty_arena(&self) -> TyArenaView<'_>
Zero-copy TyArenaView over this shard’s interned types and string pool.
Sourcepub fn fn_sigs(&self) -> &[FnSigEntry]
pub fn fn_sigs(&self) -> &[FnSigEntry]
Raw slice of sorted FnSigEntry records in this shard (empty for format < v5).
Sourcepub fn fn_sig_for_def(&self, def_index: u32) -> Option<FnSigView<'_>>
pub fn fn_sig_for_def(&self, def_index: u32) -> Option<FnSigView<'_>>
Looks up the structured FnSigView for def_index in O(log N) via binary search.
Sourcepub fn impls(&self) -> &[ImplEntry]
pub fn impls(&self) -> &[ImplEntry]
Raw slice of sorted ImplEntry records in this shard (empty for format < v5).
Sourcepub fn assoc_tys(&self) -> &[AssocTyEntry]
pub fn assoc_tys(&self) -> &[AssocTyEntry]
Raw slice of contiguous AssocTyEntry bindings in this shard (empty for format < v5).
Sourcepub fn impl_view(&self, impl_index: u32) -> Option<ImplView<'_>>
pub fn impl_view(&self, impl_index: u32) -> Option<ImplView<'_>>
Decodes the ImplView at impl_index (0..impls().len()).
Sourcepub fn impls_iter(&self) -> ImplIter<'_> ⓘ
pub fn impls_iter(&self) -> ImplIter<'_> ⓘ
Iterates over all ImplView headers in this shard.
Sourcepub fn impls_for_simplified(&self, kind: SimplifiedSelfKind) -> ImplIter<'_> ⓘ
pub fn impls_for_simplified(&self, kind: SimplifiedSelfKind) -> ImplIter<'_> ⓘ
Binary-searches all ImplEntry records (both inherent and trait) whose self_ty matches kind.
Sourcepub fn inherent_impls_for_simplified(
&self,
kind: SimplifiedSelfKind,
) -> ImplIter<'_> ⓘ
pub fn inherent_impls_for_simplified( &self, kind: SimplifiedSelfKind, ) -> ImplIter<'_> ⓘ
Binary-searches inherent impl Self blocks whose self_ty matches kind.
Sourcepub fn trait_impls_for_simplified(
&self,
kind: SimplifiedSelfKind,
) -> ImplIter<'_> ⓘ
pub fn trait_impls_for_simplified( &self, kind: SimplifiedSelfKind, ) -> ImplIter<'_> ⓘ
Binary-searches impl Trait for Self blocks whose self_ty matches kind.
Sourcepub fn fields(&self) -> &[FieldEntry]
pub fn fields(&self) -> &[FieldEntry]
Raw slice of sorted FieldEntry records in this shard (empty for format < v5).
Sourcepub fn fields_for_owner(&self, owner_def_index: u32) -> FieldIter<'_> ⓘ
pub fn fields_for_owner(&self, owner_def_index: u32) -> FieldIter<'_> ⓘ
Binary-searches all FieldEntry rows belonging to owner_def_index (Struct, Union, or Variant).
Sourcepub fn find_field(
&self,
owner_def_index: u32,
name: &str,
) -> Option<FieldView<'_>>
pub fn find_field( &self, owner_def_index: u32, name: &str, ) -> Option<FieldView<'_>>
Looks up a specific field name (or positional "0", "1") on owner_def_index.
Sourcepub fn def_tys(&self) -> &[DefTyEntry]
pub fn def_tys(&self) -> &[DefTyEntry]
Raw slice of sorted DefTyEntry records in this shard (empty for format < v5).
Sourcepub fn def_ty_for_def(&self, def_index: u32) -> Option<DefTyView>
pub fn def_ty_for_def(&self, def_index: u32) -> Option<DefTyView>
Looks up the DefTyView (TyAlias RHS, Const/Static/AssocConst type, or ADT/variant ctor shape)
for def_index in O(log N) via binary search.
Sourcepub fn generic_params(&self) -> &[GenericParamEntry]
pub fn generic_params(&self) -> &[GenericParamEntry]
Raw slice of sorted GenericParamEntry records in this shard (empty for format < v5).
Sourcepub fn generic_params_for_owner(
&self,
owner: GenericOwner,
) -> GenericParamIter<'_> ⓘ
pub fn generic_params_for_owner( &self, owner: GenericOwner, ) -> GenericParamIter<'_> ⓘ
Binary-searches all GenericParamEntry declarations owned by owner (Def or Impl).
Sourcepub fn generic_params_for_def(&self, def_index: u32) -> GenericParamIter<'_> ⓘ
pub fn generic_params_for_def(&self, def_index: u32) -> GenericParamIter<'_> ⓘ
Binary-searches all GenericParamEntry declarations owned by DefEntry def_index.
Sourcepub fn generic_params_for_impl(&self, impl_index: u32) -> GenericParamIter<'_> ⓘ
pub fn generic_params_for_impl(&self, impl_index: u32) -> GenericParamIter<'_> ⓘ
Binary-searches all GenericParamEntry declarations owned by ImplEntry impl_index.
Sourcepub fn where_preds(&self) -> &[WherePredEntry]
pub fn where_preds(&self) -> &[WherePredEntry]
Raw slice of sorted WherePredEntry records in this shard (empty for format < v5).
Sourcepub fn where_preds_for_owner(&self, owner: GenericOwner) -> WherePredIter<'_> ⓘ
pub fn where_preds_for_owner(&self, owner: GenericOwner) -> WherePredIter<'_> ⓘ
Binary-searches all WherePredEntry bounds/predicates owned by owner (Def or Impl).
Sourcepub fn where_preds_for_def(&self, def_index: u32) -> WherePredIter<'_> ⓘ
pub fn where_preds_for_def(&self, def_index: u32) -> WherePredIter<'_> ⓘ
Binary-searches all WherePredEntry bounds/predicates owned by DefEntry def_index.
Sourcepub fn where_preds_for_impl(&self, impl_index: u32) -> WherePredIter<'_> ⓘ
pub fn where_preds_for_impl(&self, impl_index: u32) -> WherePredIter<'_> ⓘ
Binary-searches all WherePredEntry bounds/predicates owned by ImplEntry impl_index.
Sourcepub fn lang_items(&self) -> &[LangItemEntry]
pub fn lang_items(&self) -> &[LangItemEntry]
Raw slice of LangItemEntry records sorted by kind (empty for v3/v4 shards).
Sourcepub fn lang_items_iter(&self) -> LangItemIter<'_> ⓘ
pub fn lang_items_iter(&self) -> LangItemIter<'_> ⓘ
Zero-allocation iterator over all LangItemEntry records in this shard.
Sourcepub fn lang_item(&self, kind: LangItemKind) -> Option<LangItemView>
pub fn lang_item(&self, kind: LangItemKind) -> Option<LangItemView>
Binary-searches the LangItemEntry for kind in this shard.
Source§impl<B: AsRef<[u8]>> IndexReader<B>
impl<B: AsRef<[u8]>> IndexReader<B>
Sourcepub fn uses(&self) -> &[UseEntry]
pub fn uses(&self) -> &[UseEntry]
Raw slice of UseEntry records sorted by (owner_raw, kind_bucket, name_bytes, ...) (empty for v3/v4 shards).
Sourcepub fn uses_iter(&self) -> UseIter<'_> ⓘ
pub fn uses_iter(&self) -> UseIter<'_> ⓘ
Zero-allocation iterator over all UseEntry records in this shard.
Sourcepub fn uses_for_owner(&self, owner: UseOwner) -> UseIter<'_> ⓘ
pub fn uses_for_owner(&self, owner: UseOwner) -> UseIter<'_> ⓘ
Binary-searches all UseEntry rows (named, glob, and _ trait imports) owned by owner.
Sourcepub fn uses_for_crate_root(&self) -> UseIter<'_> ⓘ
pub fn uses_for_crate_root(&self) -> UseIter<'_> ⓘ
Binary-searches all UseEntry rows owned by the crate root (UseOwner::CrateRoot).
Sourcepub fn uses_for_def(&self, def_index: u32) -> UseIter<'_> ⓘ
pub fn uses_for_def(&self, def_index: u32) -> UseIter<'_> ⓘ
Binary-searches all UseEntry rows owned by DefEntry def_index (UseOwner::Def(def_index)).
Sourcepub fn use_by_name(&self, owner: UseOwner, name: &str) -> Option<UseView<'_>>
pub fn use_by_name(&self, owner: UseOwner, name: &str) -> Option<UseView<'_>>
Binary-searches a named UseEntry (!is_glob && !is_underscore) in owner by identifier name in O(log N).
Sourcepub fn glob_uses_for_owner(&self, owner: UseOwner) -> UseIter<'_> ⓘ
pub fn glob_uses_for_owner(&self, owner: UseOwner) -> UseIter<'_> ⓘ
Binary-searches all glob imports/re-exports (use path::*;) owned by owner.
Sourcepub fn underscore_uses_for_owner(&self, owner: UseOwner) -> UseIter<'_> ⓘ
pub fn underscore_uses_for_owner(&self, owner: UseOwner) -> UseIter<'_> ⓘ
Binary-searches all anonymous trait imports (use Trait as _;) owned by owner.
Sourcepub fn prelude_use(&self) -> Option<UseView<'_>>
pub fn prelude_use(&self) -> Option<UseView<'_>>
Returns the crate’s active #[prelude_import] glob UseView (if present).
Source§impl<B: AsRef<[u8]>> IndexReader<B>
impl<B: AsRef<[u8]>> IndexReader<B>
Sourcepub fn find_deref_targets(&self, source: &str) -> Vec<&str>
pub fn find_deref_targets(&self, source: &str) -> Vec<&str>
Look up all direct Deref or supertrait targets for a canonical type path.
Sourcepub fn find_deref_target(&self, source: &str) -> Option<&str>
pub fn find_deref_target(&self, source: &str) -> Option<&str>
Look up the first direct Deref target for a canonical type path.
Sourcepub fn resolve_deref_chain(&self, source: &str, max_depth: usize) -> Vec<&str>
pub fn resolve_deref_chain(&self, source: &str, max_depth: usize) -> Vec<&str>
Resolves the autoderef/supertrait chain starting from source up to max_depth steps.
Returns the sequence of target type canonical paths (excluding source).
Handles multiple supertraits and cycles gracefully via breadth-first search and visited tracking.
Sourcepub fn search_symbols(&self, query: &str) -> Vec<&DefEntry>
pub fn search_symbols(&self, query: &str) -> Vec<&DefEntry>
Fast symbol search across definitions matching a query string.
For ASCII queries, this avoids per-entry heap allocations by lowercasing the query once and performing case-insensitive byte matching directly over string pool slices.
Sourcepub fn search_symbols_ascii(&self, needle_lower: &[u8]) -> Vec<&DefEntry>
pub fn search_symbols_ascii(&self, needle_lower: &[u8]) -> Vec<&DefEntry>
Fast ASCII case-insensitive symbol search across definitions using a pre-lowercased query slice.
Sourcepub fn for_each_symbol_ascii<F>(
&self,
needle_lower: &[u8],
budget: &mut usize,
cb: F,
) -> bool
pub fn for_each_symbol_ascii<F>( &self, needle_lower: &[u8], budget: &mut usize, cb: F, ) -> bool
Iterates over matching definitions without heap allocation, stopping when cb returns false
or when budget is exhausted.
Sourcepub fn for_each_symbol_ascii_budgeted<F>(
&self,
needle_lower: &[u8],
match_budget: &mut usize,
record_budget: &mut usize,
cb: F,
) -> bool
pub fn for_each_symbol_ascii_budgeted<F>( &self, needle_lower: &[u8], match_budget: &mut usize, record_budget: &mut usize, cb: F, ) -> bool
Iterates over matching definitions without heap allocation, stopping when cb returns false,
when match budget is exhausted, or when record_budget of inspected definitions is reached.
Source§impl IndexReader<Mmap>
impl IndexReader<Mmap>
Source§impl<B: AsRef<[u8]>> IndexReader<B>
impl<B: AsRef<[u8]>> IndexReader<B>
Sourcepub fn from_buffer(buffer: B) -> Result<Self>
pub fn from_buffer(buffer: B) -> Result<Self>
Wraps any byte buffer as an IndexReader.
pub fn header(&self) -> &Header
Sourcepub fn crate_name(&self) -> &str
pub fn crate_name(&self) -> &str
Crate name stored in the index.
Sourcepub fn crate_version(&self) -> &str
pub fn crate_version(&self) -> &str
Crate version stored in the index.
Sourcepub fn unit_key(&self) -> &str
pub fn unit_key(&self) -> &str
Compilation unit key stored in the index (or empty string if none).
Sourcepub fn generation(&self) -> &str
pub fn generation(&self) -> &str
Source snapshot generation digest stored in the index (or empty string if none).
Sourcepub fn target_unit(&self, r: &RefEntry) -> &str
pub fn target_unit(&self, r: &RefEntry) -> &str
Target compilation unit key for a reference (or empty string if none).
Sourcepub fn get_str(&self, offset: u32) -> &str
pub fn get_str(&self, offset: u32) -> &str
Retrieves an interned null-terminated string at the specified offset.
Sourcepub fn file_source_hash(&self, file_id: u32) -> u64
pub fn file_source_hash(&self, file_id: u32) -> u64
Returns the compiled source text hash for a given file_id embedded directly in this index.
Sourcepub fn embedded_file_hashes(&self) -> HashMap<String, u64>
pub fn embedded_file_hashes(&self) -> HashMap<String, u64>
Returns all source file provenance hashes embedded directly inside this index shard.
Sourcepub fn files_count(&self) -> u32
pub fn files_count(&self) -> u32
Total count of source files in the index.
Sourcepub fn definitions(&self) -> &[DefEntry]
pub fn definitions(&self) -> &[DefEntry]
Slice of all definitions in the index.
Sourcepub fn references(&self) -> &[RefEntry]
pub fn references(&self) -> &[RefEntry]
Slice of all references in the index (sorted by source span).
Sourcepub fn types(&self) -> &[TypeEntry]
pub fn types(&self) -> &[TypeEntry]
Slice of all expression types in the index (sorted by source span).
Sourcepub fn defs_by_owner(&self) -> &[OwnerIndexEntry]
pub fn defs_by_owner(&self) -> &[OwnerIndexEntry]
Slice of all definitions-by-owner entries in the index (sorted by owner hash).
Sourcepub fn deref_entries(&self) -> &[DerefEntry]
pub fn deref_entries(&self) -> &[DerefEntry]
Slice of all deref entries in the index (sorted by source_type_hash).