Skip to main content

SourceGenerator

Trait SourceGenerator 

Source
pub trait SourceGenerator {
    // Required method
    fn generate(
        &self,
        ast_registry: &ASTRegistry,
        symbol_registry: &SymbolRegistry,
    ) -> Result<GeneratedWorkspace, ToSynError>;
}
Expand description

Trait for source code generators.

Implementors transform ASTRegistry + SymbolRegistry into GeneratedWorkspace. The key responsibility is determining module structure and handling edge cases like empty modules.

Required Methods§

Source

fn generate( &self, ast_registry: &ASTRegistry, symbol_registry: &SymbolRegistry, ) -> Result<GeneratedWorkspace, ToSynError>

Generate source files from registries.

§Returns

GeneratedWorkspace containing crate-relative paths (e.g., "src/lib.rs"). The caller is responsible for converting these to workspace-relative paths.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§