Skip to main content

ProjectQuery

Trait ProjectQuery 

Source
pub trait ProjectQuery: Send + Sync {
Show 13 methods // 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; fn function_at( &self, path: &Path, line: u32, col: u32, ) -> Option<FunctionInfo>;
}
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§

Source

fn is_called_externally(&self, name: &str, exclude_path: &Path) -> bool

True if name is called from any file other than exclude_path.

Source

fn callers_of(&self, name: &str) -> Vec<PathBuf>

All files that reference name (excluding self-references).

Source

fn cross_file_call_counts(&self) -> Vec<((PathBuf, PathBuf), u32)>

Pre-computed cross-file call counts: ((caller, callee), count).

Source

fn function_home(&self, name: &str) -> Option<PathBuf>

First file that declared this function.

Source

fn function_by_name(&self, name: &str) -> Option<(PathBuf, FunctionInfo)>

First (file, FunctionInfo) tuple — fuller than function_home.

Source

fn class_home(&self, name: &str) -> Option<PathBuf>

First file that declared this class/struct.

Source

fn model_by_path(&self, path: &Path) -> Option<SourceModel>

O(1) model lookup by path.

Source

fn is_project_type(&self, name: &str) -> bool

True if name is declared somewhere in the project.

Source

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).

Source

fn workspace_crate_names(&self) -> Vec<String>

Workspace sibling crate names (Rust workspace) — empty otherwise.

Source

fn is_test_path(&self, path: &Path) -> bool

True if path looks like a test file or sits inside a test directory.

Source

fn file_count(&self) -> usize

Total count of analyzed files.

Source

fn function_at(&self, path: &Path, line: u32, col: u32) -> Option<FunctionInfo>

Find the function whose body contains the given (line, col) position in path. Lines are 1-based, columns are 0-based. Returns the innermost matching function (smallest line range).

Implementors§