pub trait Executable {
    // Required methods
    fn load(
        &self,
        engine: &(dyn Engine + 'static)
    ) -> Result<Arc<dyn Artifact>, CompileError>;
    fn features(&self) -> Features;
    fn cpu_features(&self) -> EnumSet<CpuFeature>;
    fn serialize(&self) -> Result<Vec<u8>, Box<dyn Error + Send + Sync>>;
    fn function_name(&self, index: FunctionIndex) -> Option<&str>;
}
Expand description

A WASM module built by some Engine.

Types implementing this trait are ready to be saved (to e.g. disk) for later use or loaded with the Engine to in order to produce an Artifact.

Required Methods§

source

fn load( &self, engine: &(dyn Engine + 'static) ) -> Result<Arc<dyn Artifact>, CompileError>

Load this executable with the specified engine.

TODO(0-copy): change error type here.

source

fn features(&self) -> Features

The features with which this Executable was built.

source

fn cpu_features(&self) -> EnumSet<CpuFeature>

The CPU features this Executable requires.

source

fn serialize(&self) -> Result<Vec<u8>, Box<dyn Error + Send + Sync>>

Serializes the artifact into bytes

source

fn function_name(&self, index: FunctionIndex) -> Option<&str>

Obtain a best effort description for the function at the given function index.

Implementations are not required to maintain symbol names, so this may always return None.

Implementations§

source§

impl dyn Executable

source

pub fn downcast_ref<T: Executable + 'static>(&self) -> Option<&T>

Downcast a dynamic Executable object to a concrete implementation of the trait.

Implementors§