Crate wasmer_wasi

Source
Expand description

Wasmer’s WASI implementation

Use generate_import_object to create an Imports. This Imports can be combined with a module to create an Instance which can execute WASI Wasm functions.

See state for the experimental WASI FS API. Also see the WASI plugin example for an example of how to extend WASI using the WASI FS API.

Modules§

types

Structs§

Fd
Pipe
For piping stdio. Stores all output / input in a byte-vector.
PluggableRuntimeImplementation
Stderr
A wrapper type around Stderr that implements VirtualFile and Serialize + Deserialize.
Stdin
A wrapper type around Stdin that implements VirtualFile and Serialize + Deserialize.
Stdout
A wrapper type around Stdout that implements VirtualFile and Serialize + Deserialize.
UnsupportedVirtualBus
UnsupportedVirtualNetworking
WasiBusProcessId
Represents the ID of a sub-process
WasiEnv
The environment provided to the WASI imports.
WasiFs
Warning, modifying these fields directly may cause invariants to break and should be considered unsafe. These fields may be made private in a future release
WasiFunctionEnv
WasiInodes
WasiState
Top level data type containing all* the state with which WASI can interact.
WasiStateBuilder
Convenient builder API for configuring WASI via WasiState.
WasiThread
WasiThreadId
Represents the ID of a WASI thread
WasiTtyState

Enums§

FsError
Error type for external users
WasiError
This is returned in RuntimeError. Use downcast or downcast_ref to retrieve the ExitCode.
WasiFsError
Error type for external users
WasiStateCreationError
Error type returned when bad data is given to WasiStateBuilder.
WasiThreadError
WasiVersion
The version of WASI. This is determined by the imports namespace string.

Constants§

ALL_RIGHTS
all the rights enabled
VIRTUAL_ROOT_FD
the fd value of the virtual root

Traits§

VirtualBus
VirtualFile
This trait relies on your file closing when it goes out of scope via Drop
VirtualNetworking
An implementation of virtual networking
WasiFile
This trait relies on your file closing when it goes out of scope via Drop
WasiRuntimeImplementation
Represents an implementation of the WASI runtime - by default everything is unimplemented.

Functions§

generate_import_object_from_env
Create an Imports from a [Context]
get_wasi_version
Detect the version of WASI being used based on the import namespaces.
get_wasi_versions
Like get_wasi_version but detects multiple WASI versions in a single module. Thus strict behaves differently in this function as multiple versions are always supported. strict indicates whether non-WASI imports should trigger a failure or be ignored.
import_object_for_all_wasi_versions
is_wasi_module
Check if a provided module is compiled for some version of WASI. Use get_wasi_version to find out which version of WASI the module is.
is_wasix_module
Returns if the module is WASIX or not
wasi_import_shared_memory
Imports (any) shared memory into the imports. (if the module does not import memory then this function is ignored)