Expand description
This crate contains an implementation of WebAssembly Interface Types (abbreviated WIT). It is composed of 5 parts:
- Types and Values: To represent the WIT types and values representations,
- AST: To represent the WIT language as a tree (which is not really abstract). This is the central representation of the language.
- Decoders: To read the AST from a particular data
representation; for instance,
decoders::binary::parsereads the AST from a binary. - Encoders: To write the AST into a particular
format; for instance,
encoders::watwrites the AST into a string representing WIT with its textual format. - Interpreter: WIT defines a concept called
Adapters. An adapter contains a set of instructions. So, in
more details, this module contains:
- A very light and generic stack implementation, exposing only the operations required by the interpreter,
- A stack-based interpreter,
defined by:
- A compiler that transforms a set of instructions into a set of executable instructions,
- A stack,
- A runtime that holds the “invocation inputs” (arguments of the interpreter), the stack, and the WebAssembly instance (which holds the exports, the imports, the memories, the tables etc.),
- An hypothetic WebAssembly runtime,
represented as a set of enums, types, and traits —basically
this is the part a runtime should take a look to use the
wasmer-interface-typescrate—.
Modules§
- ast
- Represents the WIT language as a tree. This is the central representation of the language.
- decoders
- Reads the AST from a particular data representation; for instance,
decoders::binaryreads the AST from a binary. - encoders
- Writes the AST into a particular format; for instance,
encoders::watwrites the AST into a string representing WIT with its textual format. - errors
- The error module contains all the data structures that represent an error.
- interpreter
- A stack-based interpreter to execute instructions of WIT adapters.
- macros
- Collection of helpful macros.
- ne_vec
NEVec<T>represents a non-emptyVec<T>.
Macros§
- instr_
error - Allows you to shorten the expression creates a new InstructionError.
- ne_vec
- This macro creates a
Vec1by checking at compile-time that its invariant holds.
Structs§
- IRecord
Field Type - Represents a record field type.
- IRecord
Type - Represents a record type.
- NEVec
NEVec<T>represents a non-emptyVec<T>. It derefs toVec<T>directly.
Enums§
Traits§
- ToBytes
- A trait for converting a value to bytes.
Functions§
- from_
interface_ values - Deserialize a set of
IValues to a typeTthat implements theDeserializetrait. - to_
interface_ value - Serialize a type
Tthat implements theSerializetrait to anIValue.