pub struct SymbolGraph { /* private fields */ }Expand description
A directed reference graph over file-scoped symbols: (file, name) → the symbols it references.
Implementations§
Source§impl SymbolGraph
impl SymbolGraph
Sourcepub fn from_source(source: &str, lang: Lang) -> Self
pub fn from_source(source: &str, lang: Lang) -> Self
Build a graph from a single source file.
Sourcepub fn from_sources<'a>(
sources: impl IntoIterator<Item = (Lang, &'a str)>,
) -> Self
pub fn from_sources<'a>( sources: impl IntoIterator<Item = (Lang, &'a str)>, ) -> Self
Build a graph spanning several files (e.g. a cross-file refactor fixture). A reference is resolved to a same-file definition first; a cross-file edge (by name) forms only when the name is not defined in the referencing file — so a call to a same-named local symbol no longer merges with an unrelated definition elsewhere, while genuinely cross-file edges (the budget loop’s refactor case) still link.
Sourcepub fn neighbors_within(&self, target: &str, radius: u8) -> HashSet<String>
pub fn neighbors_within(&self, target: &str, radius: u8) -> HashSet<String>
The set of symbol names within radius reference-hops of target (inclusive of
target itself), across all files. radius 0 yields just the target. Names are collapsed at
the end, so this matches the prior name-based API for single-file callers and the
skeletoniser; traversal itself is file-scoped, so same-named symbols no longer over-link.
Sourcepub fn neighbors_within_by_file(
&self,
target: &str,
radius: u8,
) -> Vec<HashSet<String>>
pub fn neighbors_within_by_file( &self, target: &str, radius: u8, ) -> Vec<HashSet<String>>
Like neighbors_within, but the names to keep are returned per
file (index → names defined in that file within radius). Lets a multi-file skeletoniser keep
a body only in the file that actually owns the reached symbol, instead of keeping every
same-named body. vec[i] is the keep set for the i-th source passed to
from_sources.
Trait Implementations§
Source§impl Clone for SymbolGraph
impl Clone for SymbolGraph
Source§fn clone(&self) -> SymbolGraph
fn clone(&self) -> SymbolGraph
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more