[−][src]Trait wasmer::Engine
A unimplemented Wasmer Engine
.
This trait is used by implementors to implement custom engines such as: JIT or Native.
The product that an Engine
produces and consumes is the Artifact
.
Required methods
fn target(&self) -> &Target
Gets the target
fn register_signature(&self, func_type: &FunctionType) -> VMSharedSignatureIndex
Register a signature
fn lookup_signature(&self, sig: VMSharedSignatureIndex) -> Option<FunctionType>
Lookup a signature
fn function_call_trampoline(
&self,
sig: VMSharedSignatureIndex
) -> Option<unsafe extern "C" fn(*mut VMContext, *const VMFunctionBody, *mut u128)>
&self,
sig: VMSharedSignatureIndex
) -> Option<unsafe extern "C" fn(*mut VMContext, *const VMFunctionBody, *mut u128)>
Retrieves a trampoline given a signature
fn validate(&self, binary: &[u8]) -> Result<(), CompileError>
Validates a WebAssembly module
fn compile(
&self,
binary: &[u8],
tunables: &dyn Tunables
) -> Result<Arc<dyn Artifact + 'static>, CompileError>
&self,
binary: &[u8],
tunables: &dyn Tunables
) -> Result<Arc<dyn Artifact + 'static>, CompileError>
Compile a WebAssembly binary
unsafe fn deserialize(
&self,
bytes: &[u8]
) -> Result<Arc<dyn Artifact + 'static>, DeserializeError>
&self,
bytes: &[u8]
) -> Result<Arc<dyn Artifact + 'static>, DeserializeError>
Deserializes a WebAssembly module
Safety
The serialized content must represent a serialized WebAssembly module.
fn id(&self) -> &EngineId
A unique identifier for this object.
This exists to allow us to compare two Engines for equality. Otherwise, comparing two trait objects unsafely relies on implementation details of trait representation.
fn cloned(&self) -> Arc<dyn Engine + 'static + Sync + Send>
Clone the engine
Provided methods
unsafe fn deserialize_from_file(
&self,
file_ref: &Path
) -> Result<Arc<dyn Artifact + 'static>, DeserializeError>
&self,
file_ref: &Path
) -> Result<Arc<dyn Artifact + 'static>, DeserializeError>
Deserializes a WebAssembly module from a path
Safety
The file's content must represent a serialized WebAssembly module.
Implementations on Foreign Types
impl Engine for NativeEngine
[src]
fn target(&self) -> &Target
[src]
The target
fn register_signature(&self, func_type: &FunctionType) -> VMSharedSignatureIndex
[src]
Register a signature
fn lookup_signature(&self, sig: VMSharedSignatureIndex) -> Option<FunctionType>
[src]
Lookup a signature
fn function_call_trampoline(
&self,
sig: VMSharedSignatureIndex
) -> Option<unsafe extern "C" fn(*mut VMContext, *const VMFunctionBody, *mut u128)>
[src]
&self,
sig: VMSharedSignatureIndex
) -> Option<unsafe extern "C" fn(*mut VMContext, *const VMFunctionBody, *mut u128)>
Retrieves a trampoline given a signature
fn validate(&self, binary: &[u8]) -> Result<(), CompileError>
[src]
Validates a WebAssembly module
fn compile(
&self,
binary: &[u8],
tunables: &dyn Tunables
) -> Result<Arc<dyn Artifact + 'static>, CompileError>
[src]
&self,
binary: &[u8],
tunables: &dyn Tunables
) -> Result<Arc<dyn Artifact + 'static>, CompileError>
Compile a WebAssembly binary
unsafe fn deserialize(
&self,
bytes: &[u8]
) -> Result<Arc<dyn Artifact + 'static>, DeserializeError>
[src]
&self,
bytes: &[u8]
) -> Result<Arc<dyn Artifact + 'static>, DeserializeError>
Deserializes a WebAssembly module (binary content of a Shared Object file)
unsafe fn deserialize_from_file(
&self,
file_ref: &Path
) -> Result<Arc<dyn Artifact + 'static>, DeserializeError>
[src]
&self,
file_ref: &Path
) -> Result<Arc<dyn Artifact + 'static>, DeserializeError>
Deserializes a WebAssembly module from a path It should point to a Shared Object file generated by this engine.
fn id(&self) -> &EngineId
[src]
fn cloned(&self) -> Arc<dyn Engine + 'static + Sync + Send>
[src]
Implementors
impl Engine for JITEngine
[src]
fn target(&self) -> &Target
[src]
The target
fn register_signature(&self, func_type: &FunctionType) -> VMSharedSignatureIndex
[src]
Register a signature
fn lookup_signature(&self, sig: VMSharedSignatureIndex) -> Option<FunctionType>
[src]
Lookup a signature
fn function_call_trampoline(
&self,
sig: VMSharedSignatureIndex
) -> Option<unsafe extern "C" fn(*mut VMContext, *const VMFunctionBody, *mut u128)>
[src]
&self,
sig: VMSharedSignatureIndex
) -> Option<unsafe extern "C" fn(*mut VMContext, *const VMFunctionBody, *mut u128)>
Retrieves a trampoline given a signature
fn validate(&self, binary: &[u8]) -> Result<(), CompileError>
[src]
Validates a WebAssembly module
fn compile(
&self,
binary: &[u8],
tunables: &dyn Tunables
) -> Result<Arc<dyn Artifact + 'static>, CompileError>
[src]
&self,
binary: &[u8],
tunables: &dyn Tunables
) -> Result<Arc<dyn Artifact + 'static>, CompileError>
Compile a WebAssembly binary
unsafe fn deserialize(
&self,
bytes: &[u8]
) -> Result<Arc<dyn Artifact + 'static>, DeserializeError>
[src]
&self,
bytes: &[u8]
) -> Result<Arc<dyn Artifact + 'static>, DeserializeError>
Deserializes a WebAssembly module