pub struct CallGraph {
pub format_version: u32,
pub project_root: String,
pub edges: Vec<CallEdge>,
pub file_hashes: HashMap<String, String>,
pub file_stamps: HashMap<String, FileStamp>,
pub skipped_files: Vec<String>,
}Fields§
§format_version: u32Missing in pre-v2 caches → 0 → rejected by load.
project_root: String§edges: Vec<CallEdge>§file_hashes: HashMap<String, String>§file_stamps: HashMap<String, FileStamp>Size and mtime of each analyzed or skipped file when it was read, so a persisted graph is rebuilt when a file changed in place. Missing in older caches → empty → such a cache counts as stale once.
skipped_files: Vec<String>Indexed files the build skipped because they are not UTF-8 text. They count as covered, so the cache is not rebuilt for them on every load.
Implementations§
Source§impl CallGraph
impl CallGraph
pub fn new(project_root: &str) -> Self
pub fn build_parallel( inputs: &CallGraphInputs, progress: Option<(&AtomicUsize, &AtomicUsize)>, ) -> Self
pub fn build_incremental_parallel( inputs: &CallGraphInputs, previous: &CallGraph, progress: Option<(&AtomicUsize, &AtomicUsize)>, ) -> Self
Sourcepub fn get_or_start_build(
project_root: &str,
inputs: Arc<CallGraphInputs>,
) -> Result<Arc<CallGraph>, BuildProgress>
pub fn get_or_start_build( project_root: &str, inputs: Arc<CallGraphInputs>, ) -> Result<Arc<CallGraph>, BuildProgress>
Returns the cached graph immediately, or None + starts a background build.
Sourcepub fn build_status() -> BuildProgress
pub fn build_status() -> BuildProgress
Returns the status of the most recently requested build without starting anything: counts only, no file or symbol of any project.
Sourcepub fn invalidate(project_root: &str)
pub fn invalidate(project_root: &str)
Drop the resident graphs of project_root (in every protection state)
so its next request checks the persisted graph against the files again
and rebuilds what changed. Called after the project’s index was
rebuilt; a build in flight is kept.
pub fn build(inputs: &CallGraphInputs) -> Self
pub fn build_incremental(inputs: &CallGraphInputs, previous: &CallGraph) -> Self
Sourcepub fn callers_of(&self, symbol: &str) -> Vec<&CallEdge>
pub fn callers_of(&self, symbol: &str) -> Vec<&CallEdge>
Edges calling symbol, however the call site spells it: a query for
write also finds crate::config_io::write(..) (see callee_matches).
pub fn callees_of(&self, symbol: &str) -> Vec<&CallEdge>
Sourcepub fn bfs_callers(&self, symbol: &str, max_depth: usize) -> Vec<BfsNode>
pub fn bfs_callers(&self, symbol: &str, max_depth: usize) -> Vec<BfsNode>
BFS callers up to max_depth hops. Returns (symbol, file, line, depth) per node.
Sourcepub fn bfs_callees(&self, symbol: &str, max_depth: usize) -> Vec<BfsNode>
pub fn bfs_callees(&self, symbol: &str, max_depth: usize) -> Vec<BfsNode>
BFS callees up to max_depth hops. Returns (symbol, file, line, depth) per node.
Sourcepub fn find_call_path(&self, from: &str, to: &str) -> Option<Vec<PathHop>>
pub fn find_call_path(&self, from: &str, to: &str) -> Option<Vec<PathHop>>
Find shortest call path from from to to using BFS.
Returns None if no path exists (searched up to depth 10).
Find shortest call path from from to to using BFS.
Returns None if no path exists (searched up to depth 10).
Sourcepub fn transitive_caller_count(&self, symbol: &str, max_depth: usize) -> usize
pub fn transitive_caller_count(&self, symbol: &str, max_depth: usize) -> usize
Count unique transitive callers up to max_depth.
pub fn save(&self) -> Result<(), String>
pub fn load(project_root: &str) -> Option<Self>
pub fn load_or_build(project_root: &str, inputs: &CallGraphInputs) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CallGraph
impl<'de> Deserialize<'de> for CallGraph
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Forget for CallGraph
impl Freeze for CallGraph
impl Move for CallGraph
impl RefUnwindSafe for CallGraph
impl Send for CallGraph
impl Sync for CallGraph
impl Unpin for CallGraph
impl UnsafeUnpin for CallGraph
impl UnwindSafe for CallGraph
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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