pub trait ProjectQuery: Send + Sync {
// Required methods
fn is_called_externally(&self, name: &str, exclude_path: &Path) -> bool;
fn callers_of(&self, name: &str) -> Vec<PathBuf>;
fn cross_file_call_counts(&self) -> Vec<((PathBuf, PathBuf), u32)>;
fn function_home(&self, name: &str) -> Option<PathBuf>;
fn function_by_name(&self, name: &str) -> Option<(PathBuf, FunctionInfo)>;
fn class_home(&self, name: &str) -> Option<PathBuf>;
fn model_by_path(&self, path: &Path) -> Option<SourceModel>;
fn is_project_type(&self, name: &str) -> bool;
fn is_third_party(&self, type_ref: &TypeRef) -> bool;
fn workspace_crate_names(&self) -> Vec<String>;
fn is_test_path(&self, path: &Path) -> bool;
fn file_count(&self) -> usize;
}Expand description
Project-level queries available to all plugins (built-in + WASM).
Methods return owned/cheap-to-copy types (PathBuf/Vec) so WASM host
imports can wrap them directly without borrow gymnastics. For built-in
plugins needing bulk access (iterate every model), use the
ProjectQueryBulk extension trait via downcast.
Required Methods§
Sourcefn is_called_externally(&self, name: &str, exclude_path: &Path) -> bool
fn is_called_externally(&self, name: &str, exclude_path: &Path) -> bool
True if name is called from any file other than exclude_path.
Sourcefn callers_of(&self, name: &str) -> Vec<PathBuf>
fn callers_of(&self, name: &str) -> Vec<PathBuf>
All files that reference name (excluding self-references).
Sourcefn cross_file_call_counts(&self) -> Vec<((PathBuf, PathBuf), u32)>
fn cross_file_call_counts(&self) -> Vec<((PathBuf, PathBuf), u32)>
Pre-computed cross-file call counts: ((caller, callee), count).
Sourcefn function_home(&self, name: &str) -> Option<PathBuf>
fn function_home(&self, name: &str) -> Option<PathBuf>
First file that declared this function.
Sourcefn function_by_name(&self, name: &str) -> Option<(PathBuf, FunctionInfo)>
fn function_by_name(&self, name: &str) -> Option<(PathBuf, FunctionInfo)>
First (file, FunctionInfo) tuple — fuller than function_home.
Sourcefn class_home(&self, name: &str) -> Option<PathBuf>
fn class_home(&self, name: &str) -> Option<PathBuf>
First file that declared this class/struct.
Sourcefn model_by_path(&self, path: &Path) -> Option<SourceModel>
fn model_by_path(&self, path: &Path) -> Option<SourceModel>
O(1) model lookup by path.
Sourcefn is_project_type(&self, name: &str) -> bool
fn is_project_type(&self, name: &str) -> bool
True if name is declared somewhere in the project.
Sourcefn is_third_party(&self, type_ref: &TypeRef) -> bool
fn is_third_party(&self, type_ref: &TypeRef) -> bool
True if the type is a genuine third-party dependency (External origin AND not stdlib AND not workspace sibling).
Sourcefn workspace_crate_names(&self) -> Vec<String>
fn workspace_crate_names(&self) -> Vec<String>
Workspace sibling crate names (Rust workspace) — empty otherwise.
Sourcefn is_test_path(&self, path: &Path) -> bool
fn is_test_path(&self, path: &Path) -> bool
True if path looks like a test file or sits inside a test directory.
Sourcefn file_count(&self) -> usize
fn file_count(&self) -> usize
Total count of analyzed files.