pub trait CodeGraph: Send + Sync {
// Required methods
fn neighborhood(&self, symbol: &str) -> Option<Neighborhood>;
fn resolve_in_file(&self, file: &str, name: &str) -> Option<SymbolRef>;
fn symbol_names(&self) -> Vec<String>;
// Provided method
fn neighborhood_all(&self, symbol: &str) -> Vec<Neighborhood> { ... }
}Expand description
Read-only view over the code graph. Implementations must be Send + Sync
so they can be shared across async task boundaries.
Required Methods§
Sourcefn neighborhood(&self, symbol: &str) -> Option<Neighborhood>
fn neighborhood(&self, symbol: &str) -> Option<Neighborhood>
Returns the neighborhood of the first symbol matching symbol, or None
if the symbol is not in the index.
Prefer CodeGraph::neighborhood_all when the same name may be defined in
more than one place: this method collapses those to one arbitrary match.
Sourcefn resolve_in_file(&self, file: &str, name: &str) -> Option<SymbolRef>
fn resolve_in_file(&self, file: &str, name: &str) -> Option<SymbolRef>
Returns the first symbol named name defined in file, or None.
Sourcefn symbol_names(&self) -> Vec<String>
fn symbol_names(&self) -> Vec<String>
Returns the names of every symbol currently in the index.
Provided Methods§
Sourcefn neighborhood_all(&self, symbol: &str) -> Vec<Neighborhood>
fn neighborhood_all(&self, symbol: &str) -> Vec<Neighborhood>
Returns the neighborhood of every symbol matching symbol, one per
definition site, in a deterministic order (by file, then line).
This is the multi-result form that avoids the single-winner collapse of
CodeGraph::neighborhood. The default implementation returns at most the
single CodeGraph::neighborhood result so existing implementations keep
compiling; the concrete rinne-graph store overrides it to return all.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".