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