pub struct DylibEngine { /* private fields */ }
Expand description
A WebAssembly Dylib
Engine.
Implementations§
Source§impl DylibEngine
impl DylibEngine
Sourcepub fn headless() -> Self
pub fn headless() -> Self
Create a headless DylibEngine
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 shared 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 DylibEngine
impl Clone for DylibEngine
Source§fn clone(&self) -> DylibEngine
fn clone(&self) -> DylibEngine
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Engine for DylibEngine
impl Engine for DylibEngine
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 shared 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 shared object file generated by this engine.