Crate wasm

Crate wasm 

Source
Expand description

§wasm-interpreter

Website  •  Features  •  Resources

ci status code coverage license license

A minimal in-place interpreter for WebAssembly bytecode (almost without) dependencies while being no_std.

§Features

  • In-place interpretation: No intermediate representation, directly interprets WebAssembly bytecode. This allows for fast start-up times.
  • no_std support: The interpreter requires only Rust’s core and alloc libraries allowing its use in various environments, such as bare-metal systems.
  • Minimal dependencies: The interpreter requires only two dependencies: log, libm.
  • Compliance with specification: The interpreter passes all tests from the official WebAssembly testsuite, except for the unfinished proposal tests. See GlobalConfig in tests/specification/mod.rs for the default spec-test filter regex.
  • Returning host functions: The host system can provide functions for Wasm code to call. Contrary to other Wasm runtimes, host functions are not owned by the interpreter. Instead control flow is returned back to the user, when Wasm code calls a host function.
  • Fuel & resumable execution: A fuel mechanism is used to halt execution once fuel runs out. Then fuel can be refilled and execution resumed.

For information on other features, visit our requirements page.

§Planned

  • C bindings: The interpreter can be used from C code.
  • Migratability: Wasm instances can be transferred between systems during their execution.
  • Threading: There are multiple threading proposals, but we have not yet chosen a specific one. Some options are shared-everything-threads, threads, wasi-threads.

§Not planned

Multi-memory proposal, GC proposal

§Resources

§License

Licensed under either of

at your option.

§Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Copyright © 2024-2026 Deutsches Zentrum für Luft- und Raumfahrt e.V. (DLR) Copyright © 2024-2025 OxidOS Automotive SRL

Modules§

core 🔒
execution 🔒
instructions
All instructions, in alphanumerical order by their numeric (hex-)value
rw_spinlock
Naive implementation of spin based locking mechanisms
validation 🔒

Macros§

unreachable_validated

Structs§

CustomSection
DataAddr
An address to a data instance that lives in a specific Store.
ElemAddr
An address to an element instance that lives in a specific Store.
ExternAddr
The WebAssembly specification defines an externaddr as an address to an “external” type, i.e. is a type which is managed by the embedder. For this interpreter the task of managing external objects and relating them to addresses is handed off to the user, which means that an ExternAddr can simply be seen as an integer that is opaque to Wasm code without any meaning assigned to it.
F32
F64
FuncAddr
An address to a function instance that lives in a specific Store.
FuncType
A function type
GlobalAddr
An address to a global instance that lives in a specific Store.
GlobalType
A global type
HostCall
A HostCall object contains information required for executing a specific host function.
HostResumable
A HostResumable is used to resume execution after executing its HostCall.
InstantiationOutcome
Represents a successful, possibly fueled instantiation of a module.
Limits
A limits object
MemAddr
An address to a memory instance that lives in a specific Store.
MemType
A memory type
Module
Information collected from validating a module.
ModuleAddr
An address to a module instance that lives in a specific Store.
ResultType
A result type
Store
The store represents all global state that can be manipulated by WebAssembly programs. It consists of the runtime representation of all instances of functions, tables, memories, and globals, element segments, and data segments that have been allocated during the life time of the abstract machine. https://webassembly.github.io/spec/core/exec/runtime.html#store
TableAddr
An address to a table instance that lives in a specific Store.
TableType
A table type
ValueTypeMismatchError
An error used in all TryFrom<Value> implementations for Rust types (i32, F32, Ref, …)
WasmResumable
A WasmResumable is an object used to resume execution of Wasm code.

Enums§

DecodingError
Error
An opt-in error type useful for merging all error types of this crate into a single type.
ExternType
An external type
ExternVal
https://webassembly.github.io/spec/core/exec/runtime.html#external-values
NumType
A number type
Ref
RefType
A reference type
Resumable
RunState
Represents the state of a possibly interrupted resumable.
RuntimeError
TrapError
ValType
A value type
ValidationError
Value
A value at runtime. This is essentially a duplicate of ValType just with additional values.

Traits§

Config
Trait that allows user specified configuration for various items during interpretation. Additionally, the types implementing this trait can act as custom user data within an interpreter instance, passed along to each method of this trait and host functions whenever they are invoked.

Functions§

decode_and_validate

Type Aliases§

Hostcode
Result
A definition for a Result using the optional Error type.