Skip to main content

Backend

Trait Backend 

Source
pub trait Backend: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn language(&self) -> Language;
    fn capabilities(&self) -> Capabilities;
    fn generate_bindings(
        &self,
        api: &ApiSurface,
        config: &AlefConfig,
    ) -> Result<Vec<GeneratedFile>>;

    // Provided methods
    fn generate_type_stubs(
        &self,
        _api: &ApiSurface,
        _config: &AlefConfig,
    ) -> Result<Vec<GeneratedFile>> { ... }
    fn generate_scaffold(
        &self,
        _api: &ApiSurface,
        _config: &AlefConfig,
    ) -> Result<Vec<GeneratedFile>> { ... }
    fn generate_public_api(
        &self,
        _api: &ApiSurface,
        _config: &AlefConfig,
    ) -> Result<Vec<GeneratedFile>> { ... }
    fn build_config(&self) -> Option<BuildConfig> { ... }
}
Expand description

Trait that all language backends implement.

Required Methods§

Source

fn name(&self) -> &str

Backend identifier (e.g., “pyo3”, “napi”, “ffi”).

Source

fn language(&self) -> Language

Target language.

Source

fn capabilities(&self) -> Capabilities

What this backend supports.

Source

fn generate_bindings( &self, api: &ApiSurface, config: &AlefConfig, ) -> Result<Vec<GeneratedFile>>

Generate binding source code.

Provided Methods§

Source

fn generate_type_stubs( &self, _api: &ApiSurface, _config: &AlefConfig, ) -> Result<Vec<GeneratedFile>>

Generate type stubs (.pyi, .rbs, .d.ts). Optional — default returns empty.

Source

fn generate_scaffold( &self, _api: &ApiSurface, _config: &AlefConfig, ) -> Result<Vec<GeneratedFile>>

Generate package scaffolding. Optional — default returns empty.

Source

fn generate_public_api( &self, _api: &ApiSurface, _config: &AlefConfig, ) -> Result<Vec<GeneratedFile>>

Generate language-native public API wrappers. Optional — default returns empty.

Source

fn build_config(&self) -> Option<BuildConfig>

Build configuration for this backend. Returns None if build is not supported.

Implementors§