[][src]Trait wasmer::Engine

pub trait Engine {
    pub fn target(&self) -> &Target;
pub fn register_signature(
        &self,
        func_type: &FunctionType
    ) -> VMSharedSignatureIndex;
pub fn lookup_signature(
        &self,
        sig: VMSharedSignatureIndex
    ) -> Option<FunctionType>;
pub fn validate(&self, binary: &[u8]) -> Result<(), CompileError>;
pub fn compile(
        &self,
        binary: &[u8],
        tunables: &dyn Tunables
    ) -> Result<Arc<dyn Artifact + 'static>, CompileError>;
pub unsafe fn deserialize(
        &self,
        bytes: &[u8]
    ) -> Result<Arc<dyn Artifact + 'static>, DeserializeError>;
pub fn id(&self) -> &EngineId;
pub fn cloned(&self) -> Arc<dyn Engine + 'static + Send + Sync>; pub unsafe fn deserialize_from_file(
        &self,
        file_ref: &Path
    ) -> Result<Arc<dyn Artifact + 'static>, DeserializeError> { ... } }

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

pub fn target(&self) -> &Target[src]

Gets the target

pub fn register_signature(
    &self,
    func_type: &FunctionType
) -> VMSharedSignatureIndex
[src]

Register a signature

pub fn lookup_signature(
    &self,
    sig: VMSharedSignatureIndex
) -> Option<FunctionType>
[src]

Lookup a signature

pub fn validate(&self, binary: &[u8]) -> Result<(), CompileError>[src]

Validates a WebAssembly module

pub fn compile(
    &self,
    binary: &[u8],
    tunables: &dyn Tunables
) -> Result<Arc<dyn Artifact + 'static>, CompileError>
[src]

Compile a WebAssembly binary

pub unsafe fn deserialize(
    &self,
    bytes: &[u8]
) -> Result<Arc<dyn Artifact + 'static>, DeserializeError>
[src]

Deserializes a WebAssembly module

Safety

The serialized content must represent a serialized WebAssembly module.

pub fn id(&self) -> &EngineId[src]

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.

pub fn cloned(&self) -> Arc<dyn Engine + 'static + Send + Sync>[src]

Clone the engine

Loading content...

Provided methods

pub unsafe fn deserialize_from_file(
    &self,
    file_ref: &Path
) -> Result<Arc<dyn Artifact + 'static>, DeserializeError>
[src]

Deserializes a WebAssembly module from a path

Safety

The file's content must represent a serialized WebAssembly module.

Loading content...

Implementations on Foreign Types

impl Engine for NativeEngine[src]

pub fn target(&self) -> &Target[src]

The target

pub fn register_signature(
    &self,
    func_type: &FunctionType
) -> VMSharedSignatureIndex
[src]

Register a signature

pub fn lookup_signature(
    &self,
    sig: VMSharedSignatureIndex
) -> Option<FunctionType>
[src]

Lookup a signature

pub fn validate(&self, binary: &[u8]) -> Result<(), CompileError>[src]

Validates a WebAssembly module

pub fn compile(
    &self,
    binary: &[u8],
    tunables: &dyn Tunables
) -> Result<Arc<dyn Artifact + 'static>, CompileError>
[src]

Compile a WebAssembly binary

pub unsafe fn deserialize(
    &self,
    bytes: &[u8]
) -> Result<Arc<dyn Artifact + 'static>, DeserializeError>
[src]

Deserializes a WebAssembly module (binary content of a Shared Object file)

pub unsafe fn deserialize_from_file(
    &self,
    file_ref: &Path
) -> Result<Arc<dyn Artifact + 'static>, DeserializeError>
[src]

Deserializes a WebAssembly module from a path It should point to a Shared Object file generated by this engine.

Loading content...

Implementors

impl Engine for JITEngine[src]

pub fn target(&self) -> &Target[src]

The target

pub fn register_signature(
    &self,
    func_type: &FunctionType
) -> VMSharedSignatureIndex
[src]

Register a signature

pub fn lookup_signature(
    &self,
    sig: VMSharedSignatureIndex
) -> Option<FunctionType>
[src]

Lookup a signature

pub fn validate(&self, binary: &[u8]) -> Result<(), CompileError>[src]

Validates a WebAssembly module

pub fn compile(
    &self,
    binary: &[u8],
    tunables: &dyn Tunables
) -> Result<Arc<dyn Artifact + 'static>, CompileError>
[src]

Compile a WebAssembly binary

pub unsafe fn deserialize(
    &self,
    bytes: &[u8]
) -> Result<Arc<dyn Artifact + 'static>, DeserializeError>
[src]

Deserializes a WebAssembly module

Loading content...