pub struct StaticlibEngine { /* private fields */ }
Expand description
A WebAssembly Staticlib
Engine.
Implementations§
Source§impl StaticlibEngine
impl StaticlibEngine
Sourcepub fn headless() -> Self
pub fn headless() -> Self
Create a headless StaticlibEngine
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
).
Sourcepub fn set_deterministic_prefixer<F>(&mut self, prefixer: F)
pub fn set_deterministic_prefixer<F>(&mut self, prefixer: F)
Sets a prefixer for the Wasm module, so we can avoid any collisions in the exported function names on the generated object.
This, allows us to rather than have functions named
wasmer_function_1
to be named wasmer_function_PREFIX_1
.
§Important
This prefixer function should be deterministic, so the compilation remains deterministic.
Trait Implementations§
Source§impl Clone for StaticlibEngine
impl Clone for StaticlibEngine
Source§fn clone(&self) -> StaticlibEngine
fn clone(&self) -> StaticlibEngine
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Engine for StaticlibEngine
impl Engine for StaticlibEngine
Source§fn register_signature(&self, func_type: &FunctionType) -> VMSharedSignatureIndex
fn register_signature(&self, func_type: &FunctionType) -> VMSharedSignatureIndex
Register a signature
Source§fn lookup_signature(&self, sig: VMSharedSignatureIndex) -> Option<FunctionType>
fn lookup_signature(&self, sig: VMSharedSignatureIndex) -> Option<FunctionType>
Lookup a signature
Source§fn compile(
&self,
_binary: &[u8],
_tunables: &dyn Tunables,
) -> Result<Arc<dyn Artifact>, CompileError>
fn compile( &self, _binary: &[u8], _tunables: &dyn Tunables, ) -> Result<Arc<dyn Artifact>, CompileError>
Compile a WebAssembly binary (it will fail because the compiler
flag is disabled).
Source§unsafe fn deserialize(
&self,
bytes: &[u8],
) -> Result<Arc<dyn Artifact>, DeserializeError>
unsafe fn deserialize( &self, bytes: &[u8], ) -> Result<Arc<dyn Artifact>, DeserializeError>
Deserializes a WebAssembly module (binary content of a static object file)
Source§unsafe fn deserialize_from_file(
&self,
file_ref: &Path,
) -> Result<Arc<dyn Artifact>, DeserializeError>
unsafe fn deserialize_from_file( &self, file_ref: &Path, ) -> Result<Arc<dyn Artifact>, DeserializeError>
Deserializes a WebAssembly module from a path
It should point to a static object file generated by this engine.