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§
Sourcefn capabilities(&self) -> Capabilities
fn capabilities(&self) -> Capabilities
What this backend supports.
Sourcefn generate_bindings(
&self,
api: &ApiSurface,
config: &AlefConfig,
) -> Result<Vec<GeneratedFile>>
fn generate_bindings( &self, api: &ApiSurface, config: &AlefConfig, ) -> Result<Vec<GeneratedFile>>
Generate binding source code.
Provided Methods§
Sourcefn generate_type_stubs(
&self,
_api: &ApiSurface,
_config: &AlefConfig,
) -> Result<Vec<GeneratedFile>>
fn generate_type_stubs( &self, _api: &ApiSurface, _config: &AlefConfig, ) -> Result<Vec<GeneratedFile>>
Generate type stubs (.pyi, .rbs, .d.ts). Optional — default returns empty.
Sourcefn generate_scaffold(
&self,
_api: &ApiSurface,
_config: &AlefConfig,
) -> Result<Vec<GeneratedFile>>
fn generate_scaffold( &self, _api: &ApiSurface, _config: &AlefConfig, ) -> Result<Vec<GeneratedFile>>
Generate package scaffolding. Optional — default returns empty.
Sourcefn generate_public_api(
&self,
_api: &ApiSurface,
_config: &AlefConfig,
) -> Result<Vec<GeneratedFile>>
fn generate_public_api( &self, _api: &ApiSurface, _config: &AlefConfig, ) -> Result<Vec<GeneratedFile>>
Generate language-native public API wrappers. Optional — default returns empty.
Sourcefn build_config(&self) -> Option<BuildConfig>
fn build_config(&self) -> Option<BuildConfig>
Build configuration for this backend. Returns None if build is not supported.