Skip to main content

CppWorkspaceSource

Trait CppWorkspaceSource 

Source
pub trait CppWorkspaceSource {
    // Required methods
    fn import_statements(&self, file: &ProjectFile) -> Vec<String>;
    fn definitions_by_fqn(&self, fqn: &str) -> Vec<&CodeUnit>;
}
Expand description

The workspace-wide questions a C++ scan asks of the dispatching analyzer rather than of the C++ analyzer.

Two of them have no core capability to sit on: import_statements is IAnalyzer’s raw #include lines, and the workspace definition index is reached through an analysis-side DefinitionIndexHandle that is built per call and so cannot be borrowed as a &dyn BoundedDefinitionLookup. Both stay the dispatching analyzer’s job – in a mixed workspace the query is issued against a MultiAnalyzer whose shards span languages, and the C++ owner resolution depends on that reach.

Required Methods§

Source

fn import_statements(&self, file: &ProjectFile) -> Vec<String>

The raw import (#include) lines recorded for file.

Source

fn definitions_by_fqn(&self, fqn: &str) -> Vec<&CodeUnit>

Declarations in the workspace usage-definition index whose fq name is exactly fqn, across every shard.

Borrows the shard-owned units rather than cloning them. Two constraints make that the only workable shape. Every owner-resolution caller filters the result and clones at most one survivor, so cloning every match per reference was pure waste; and the global-field linkage walk returns its matches to a caller that outlives the lookup, so they must borrow the analyzer. Both are why the impls read the index shard-by-shard: the per-call DefinitionIndexHandle dies with the call.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§