pub trait NativeEngineExt {
    // Required methods
    fn new(
        compiler_config: Box<dyn CompilerConfig>,
        target: Target,
        features: Features
    ) -> Self;
    fn headless() -> Self;
    fn target(&self) -> &Target;
    fn set_tunables(&mut self, tunables: impl Tunables + Send + Sync + 'static);
    fn tunables(&self) -> &dyn Tunables;
    unsafe fn deserialize_from_mmapped_file_unchecked(
        &self,
        file_ref: &Path
    ) -> Result<Module, DeserializeError>;
    unsafe fn deserialize_from_mmapped_file(
        &self,
        file_ref: &Path
    ) -> Result<Module, DeserializeError>;
}
Expand description

The custom trait to access to all the sys function in the common engine.

Required Methods§

source

fn new( compiler_config: Box<dyn CompilerConfig>, target: Target, features: Features ) -> Self

Create a new Engine with the given config

source

fn headless() -> Self

Create a headless Engine

A headless engine is an engine without any compiler attached. This is useful for assuring a minimal runtime for running WebAssembly modules.

For example, for running in IoT devices where compilers are very expensive, or also to optimize startup speed.

Important

Headless engines can’t compile or validate any modules, they just take already processed Modules (via Module::serialize).

source

fn target(&self) -> &Target

Gets the target

source

fn set_tunables(&mut self, tunables: impl Tunables + Send + Sync + 'static)

Attach a Tunable to this engine

source

fn tunables(&self) -> &dyn Tunables

Get a reference to attached Tunable of this engine

source

unsafe fn deserialize_from_mmapped_file_unchecked( &self, file_ref: &Path ) -> Result<Module, DeserializeError>

Load a serialized WebAssembly module from a memory mapped file and deserialize it.

NOTE: you should almost always prefer Self::deserialize_from_mmapped_file.

Safety

See Artifact::deserialize_unchecked.

source

unsafe fn deserialize_from_mmapped_file( &self, file_ref: &Path ) -> Result<Module, DeserializeError>

Load a serialized WebAssembly module from a memory mapped file and deserialize it.

Safety

See Artifact::deserialize.

Implementors§