Module aingle_wasmer_host::prelude[][src]

Re-exports

pub use crate::guest;
pub use crate::instantiate::instantiate;
pub use crate::instantiate::module;

Modules

cache

The cache module provides the common data structures used by compiler backends to allow serializing compiled wasm code to a binary format. The binary format can be persisted, and loaded to allow skipping compilation and fast startup.

error

The error module contains the data structures and helper functions used to implement errors that are produced and returned from the wasmer runtime.

memory

The memory module contains the implementation data structures and helper functions used to manipulate and access wasm memory.

result
serde_bytes

Wrapper types to enable optimized handling of &[u8] and Vec<u8>.

types

Types used in the Wasm runtime and conversion functions.

units

Various unit types.

wasm

Various types exposed by the Wasmer Runtime.

Macros

aingle_serial

unidiomatic way to derive default trait implementations of TryFrom in/out of SerializedBytes

func

Helper macro to create a new Func object using the provided function pointer.

imports

Generate an ImportObject safely.

Structs

Array

The Array marker type. This type can be used like WasmPtr<T, Array> to get access to methods

CodeVersion

A CodeVersion is a container for a unit of generated code for a module.

CompilerConfig

Configuration data for the compiler

Ctx

The context of the currently running WebAssembly instance.

DynFunc

A representation of an exported WebAssembly function.

Features

Controls which experimental features will be enabled. Features usually have a corresponding WebAssembly proposal.

Func

Represents a function that can be used by WebAssembly.

Global

A handle to a Wasm Global

ImportObject

All of the import data used when instantiating.

ImportObjectIterator

Iterator for an ImportObject's exports.

Instance

An instantiated WebAssembly module.

Item

The Item marker type. This is the default and does not usually need to be specified.

Memory

A shared or unshared wasm linear memory.

MiddlewareChain

A container for a chain of middlewares.

Module

A compiled WebAssembly module.

Namespace

The top-level container for the two-level wasm imports

SerializedBytes

A Canonical Serialized Bytes representation for data If you have a data structure that needs a canonical byte representation use this Always round-trip through SerializedBytes via. a single TryFrom implementation. This ensures that the internal bytes of SerializedBytes are indeed canonical. The corrolary is that if bytes are NOT wrapped in SerializedBytes we can assume they are NOT canonical. Typically we need a canonical middleware when data is to be handled at the byte level by independently implemented and maintained systems.

StreamingCompiler

A streaming compiler which is designed to generated code for a module based on a stream of wasm parser events.

Table

Container with a descriptor and a reference to a table storage.

UnsafeBytes

UnsafeBytes the only way to implement a custom round trip through bytes for SerializedBytes It is intended to be an internal implementation in TryFrom implementations The assumption is that any code using UnsafeBytes is NOT valid messagepack data This allows us to enforce that all data round-tripping through SerializedBytes is via TryFrom and also allow for custom non-messagepack canonical representations of data types.

WasmPtr

A zero-cost type that represents a pointer to something in Wasm linear memory.

Enums

Backend

Enum used to select which compiler should be used to generate code.

ExceptionCode

The code of an exception.

Export

Kind of WebAssembly export.

SerializedBytesError
Value

Represents a WebAssembly value.

WasmError

Enum of all possible ERROR codes that a Zome API Function could return.

Constants

VERSION

The current version of this crate.

Traits

Compiler
Deserialize

A data structure that can be deserialized from any data format supported by Serde.

IsExport

A trait that represents Export values.

LikeNamespace

This trait represents objects that act as a namespace for imports. For example, an Instance or ImportObject could be considered namespaces that could provide imports to an instance.

Serialize

A data structure that can be serialized into any data format supported by Serde.

TryFrom

Simple and safe type conversions that may fail in a controlled way under some circumstances. It is the reciprocal of TryInto.

TryInto

An attempted conversion that consumes self, which may or may not be expensive.

Functions

compile

Compile WebAssembly binary code into a Module. This function is useful if it is necessary to compile a module before it can be instantiated (otherwise, the instantiate function should be used).

compile_with

Compile a Module using the provided compiler from WebAssembly binary code. This function is useful if it is necessary to a compile a module before it can be instantiated and must be used if you wish to use a different backend from the default.

compile_with_config

The same as compile but takes a CompilerConfig for the purpose of changing the compiler's behavior

compile_with_config_with

The same as compile_with_config but takes a Compiler for the purpose of changing the backend.

compiler_for_backend

Get the Compiler as a trait object for the given Backend. Returns Option because support for the requested Compiler may not be enabled by feature flags.

decode
default_compiler

Get a single instance of the default compiler to use.

encode
instantiate

Compile and instantiate WebAssembly code without creating a Module.

pop_code_version

Pops a CodeVersion from the current code versions.

push_code_version

Pushes a new CodeVersion to the current code versions.

validate

Perform validation as defined by the WebAssembly specification. Returns true if validation succeeded, false if validation failed.

Type Definitions

GuestPtr

a WasmSize integer that points to a position in wasm linear memory that the host and guest are sharing to communicate across function calls

Len

a WasmSize integer that represents the size of bytes to read/write to memory in direct manipulations

WasmSize

something like usize for wasm wasm has a memory limit of 4GB so offsets and lengths fit in u32

Derive Macros

Deserialize
Serialize
SerializedBytes