Skip to main content

Backend

Trait Backend 

Source
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§

Source

fn name(&self) -> &str

Human-readable backend name

Source

fn capabilities(&self) -> BackendCapabilities

What this backend can do

Source

fn supported_targets(&self) -> Vec<TargetSpec>

Which targets this backend supports

Source

fn compile_module( &self, module: &DecodedModule, config: &CompileConfig, ) -> Result<CompilationResult, BackendError>

Compile an entire decoded WASM module

Source

fn compile_function( &self, name: &str, ops: &[WasmOp], config: &CompileConfig, ) -> Result<CompiledFunction, BackendError>

Compile a single function from WASM ops to machine code

Source

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".

Implementors§