pub struct SymbolIndex { /* private fields */ }Expand description
Pre-computed symbol-to-file index for O(1) lookups.
Uses DashMap for lock-free concurrent reads and writes.
Keys are Arc<str> for memory-efficient string interning — many lookups
against the same symbol names benefit from shared allocations.
Implementations§
Source§impl SymbolIndex
impl SymbolIndex
Sourcepub fn build(&self, scope: &Path)
pub fn build(&self, scope: &Path)
Build the index by walking all code files in scope.
Uses ignore::WalkBuilder with the same directory filtering as search
(skipping .git, node_modules, target, etc.) and processes files
in parallel via rayon for speed.
Sourcepub fn is_built(&self, scope: &Path) -> bool
pub fn is_built(&self, scope: &Path) -> bool
Check if the index has been built for the given scope.
Simple heuristic: returns true if any indexed file path starts with scope.
Sourcepub fn lookup(&self, name: &str, scope: &Path) -> Vec<SymbolLocation>
pub fn lookup(&self, name: &str, scope: &Path) -> Vec<SymbolLocation>
Look up all locations of a symbol within scope.
Returns matching locations filtered to paths within scope.
Results may include stale entries if files have changed since indexing –
callers can check mtime against the current file if freshness matters.
Sourcepub fn lookup_definitions(
&self,
name: &str,
scope: &Path,
) -> Vec<SymbolLocation>
pub fn lookup_definitions( &self, name: &str, scope: &Path, ) -> Vec<SymbolLocation>
Look up only definition locations of a symbol within scope.
Same as lookup but filters to is_definition == true.
Sourcepub fn index_file(&self, path: &Path, content: &str)
pub fn index_file(&self, path: &Path, content: &str)
Index a single file, updating the symbol maps.
Used for incremental updates when a file changes. Removes old entries for this file before inserting new ones.
Sourcepub fn symbol_count(&self) -> usize
pub fn symbol_count(&self) -> usize
Number of unique symbol names in the index.
Sourcepub fn file_count(&self) -> usize
pub fn file_count(&self) -> usize
Number of indexed files.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SymbolIndex
impl !RefUnwindSafe for SymbolIndex
impl Send for SymbolIndex
impl Sync for SymbolIndex
impl Unpin for SymbolIndex
impl UnsafeUnpin for SymbolIndex
impl UnwindSafe for SymbolIndex
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> 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