wasmer::sys

Trait NativeEngineExt

Source
pub trait NativeEngineExt {
    // Required methods
    fn new(
        compiler_config: Box<dyn CompilerConfig>,
        target: Target,
        features: Features,
    ) -> Self;
    fn set_hash_algorithm(&mut self, hash_algorithm: Option<HashAlgorithm>);
    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 set_hash_algorithm(&mut self, hash_algorithm: Option<HashAlgorithm>)

Sets the hash algorithm

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§