Skip to main content

SourceAdapter

Trait SourceAdapter 

Source
pub trait SourceAdapter: Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn language(&self) -> SourceLanguage;
    fn extract(&self, source: &str, file: &SourceFile) -> Result<Extraction>;

    // Provided methods
    fn extract_with_session(
        &self,
        source: &str,
        file: &SourceFile,
        _session: &mut SourceExtractionSession,
    ) -> Result<Extraction> { ... }
    fn extract_file(&self, file: &SourceFile) -> Result<Extraction> { ... }
    fn extract_file_with_session(
        &self,
        file: &SourceFile,
        session: &mut SourceExtractionSession,
    ) -> Result<Extraction> { ... }
}
Expand description

Converts one supported definition-source language into the shared definition IR.

Required Methods§

Source

fn name(&self) -> &'static str

Stable adapter name used in diagnostics and registry inspection.

Source

fn language(&self) -> SourceLanguage

Parser language produced by this adapter registration.

Source

fn extract(&self, source: &str, file: &SourceFile) -> Result<Extraction>

Extracts definitions from in-memory source using file for source locations.

Provided Methods§

Source

fn extract_with_session( &self, source: &str, file: &SourceFile, _session: &mut SourceExtractionSession, ) -> Result<Extraction>

Extracts definitions while sharing bounded state with other files in the same run.

Source

fn extract_file(&self, file: &SourceFile) -> Result<Extraction>

Reads and extracts one source file.

Source

fn extract_file_with_session( &self, file: &SourceFile, session: &mut SourceExtractionSession, ) -> Result<Extraction>

Reads and extracts one source file using shared run state.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§