pub trait Backend: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn capabilities(&self) -> BackendCapabilities;
fn supported_targets(&self) -> Vec<TargetSpec>;
fn compile_module(
&self,
module: &DecodedModule,
config: &CompileConfig,
) -> Result<CompilationResult, BackendError>;
fn compile_function(
&self,
name: &str,
ops: &[WasmOp],
config: &CompileConfig,
) -> Result<CompiledFunction, BackendError>;
fn is_available(&self) -> bool;
}Expand description
Trait that every compilation backend implements
Required Methods§
Sourcefn capabilities(&self) -> BackendCapabilities
fn capabilities(&self) -> BackendCapabilities
What this backend can do
Sourcefn supported_targets(&self) -> Vec<TargetSpec>
fn supported_targets(&self) -> Vec<TargetSpec>
Which targets this backend supports
Sourcefn compile_module(
&self,
module: &DecodedModule,
config: &CompileConfig,
) -> Result<CompilationResult, BackendError>
fn compile_module( &self, module: &DecodedModule, config: &CompileConfig, ) -> Result<CompilationResult, BackendError>
Compile an entire decoded WASM module
Sourcefn compile_function(
&self,
name: &str,
ops: &[WasmOp],
config: &CompileConfig,
) -> Result<CompiledFunction, BackendError>
fn compile_function( &self, name: &str, ops: &[WasmOp], config: &CompileConfig, ) -> Result<CompiledFunction, BackendError>
Compile a single function from WASM ops to machine code
Sourcefn is_available(&self) -> bool
fn is_available(&self) -> bool
Check if this backend is available (external tools installed, etc.)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".