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 method
    fn extract_file(&self, file: &SourceFile) -> 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_file(&self, file: &SourceFile) -> Result<Extraction>

Reads and extracts one source file.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§