Skip to main content

CppSource

Trait CppSource 

Source
pub trait CppSource:
    CodeUnitIndex
    + TypeAliasProvider
    + TypeHierarchyProvider
    + CppWorkspaceSource {
    // Required methods
    fn include_target_index(&self) -> &IncludeTargetIndex;
    fn raw_supertypes_of(&self, code_unit: &CodeUnit) -> Vec<String>;
    fn visible_type_units(&self, file: &ProjectFile) -> Arc<Vec<CodeUnit>> ;
    fn file_source(&self, file: &ProjectFile) -> Option<String>;
    fn prepared_syntax(
        &self,
        file: &ProjectFile,
    ) -> Option<Arc<PreparedSyntaxTree>>;
    fn cpp_field_linkage(&self, code_unit: &CodeUnit) -> Option<CppFieldLinkage>;
    fn cached_unconditional_include_reachability(
        &self,
        first: &ProjectFile,
        donor_source: &ProjectFile,
        reference_is_c: bool,
    ) -> Option<bool>;
    fn cache_unconditional_include_reachability(
        &self,
        first: &ProjectFile,
        donor_source: &ProjectFile,
        reference_is_c: bool,
        reaches: bool,
    );
    fn structural_parent_of(&self, code_unit: &CodeUnit) -> Option<CodeUnit>;
    fn template_metadata(
        &self,
        code_unit: &CodeUnit,
    ) -> Option<CppTemplateMetadata>;
    fn compile_context_for(
        &self,
        file: &ProjectFile,
    ) -> Option<&CppCompileContext>;
}

Required Methods§

Source

fn include_target_index(&self) -> &IncludeTargetIndex

The workspace-wide #include resolution table, built once per analyzer generation from IncludeTargetIndex::build.

Source

fn raw_supertypes_of(&self, code_unit: &CodeUnit) -> Vec<String>

The declared base specifiers of code_unit, as written (TreeSitterAnalyzer::raw_supertypes_of).

Source

fn visible_type_units(&self, file: &ProjectFile) -> Arc<Vec<CodeUnit>>

Every class-like or alias declaration reachable from file through its #include closure, memoized per file. See this module’s note.

Source

fn file_source(&self, file: &ProjectFile) -> Option<String>

The indexed source of file (TreeSitterAnalyzer::file_source).

Source

fn prepared_syntax(&self, file: &ProjectFile) -> Option<Arc<PreparedSyntaxTree>>

The parsed tree and its source backing for file, from the analyzer’s query read cache.

The single hottest member of this trait: the usage graph reaches it at 27 call sites. The cache is not rebuilt per call – VisibilityIndex borrows the analyzer rather than cloning it precisely so this stays warm across a scan (#1175), so an implementor must forward to the same analyzer the query is running against.

Source

fn cpp_field_linkage(&self, code_unit: &CodeUnit) -> Option<CppFieldLinkage>

The persisted linkage fact for one C++ field, when the parser recorded it. A missing fact requires the resolver’s syntax fallback.

Source

fn cached_unconditional_include_reachability( &self, first: &ProjectFile, donor_source: &ProjectFile, reference_is_c: bool, ) -> Option<bool>

The cached result of a preprocessor-visible include-reachability walk.

The reference language affects only __cplusplus guards. Callers pass that fact as a Boolean so cache keys do not retain the full reference path.

Source

fn cache_unconditional_include_reachability( &self, first: &ProjectFile, donor_source: &ProjectFile, reference_is_c: bool, reaches: bool, )

Store a completed preprocessor-visible include-reachability walk.

Source

fn structural_parent_of(&self, code_unit: &CodeUnit) -> Option<CodeUnit>

The declaration’s syntactic owner, which unlike CodeUnitIndex::parent_of never falls back to a definition-row lookup.

Source

fn template_metadata(&self, code_unit: &CodeUnit) -> Option<CppTemplateMetadata>

The persisted C++ template metadata side table’s row for code_unit.

Source

fn compile_context_for(&self, file: &ProjectFile) -> Option<&CppCompileContext>

The compile_commands.json entry governing file, if the workspace has a compile database that names it. The only analyzer-resident product crate::diagnostics needs.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§