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§
Structs§
- Fd
- Pipe
- For piping stdio. Stores all output / input in a byte-vector.
- Pluggable
Runtime Implementation - Stderr
- A wrapper type around Stderr that implements
VirtualFile
andSerialize
+Deserialize
. - Stdin
- A wrapper type around Stdin that implements
VirtualFile
andSerialize
+Deserialize
. - Stdout
- A wrapper type around Stdout that implements
VirtualFile
andSerialize
+Deserialize
. - Unsupported
Virtual Bus - Unsupported
Virtual Networking - Wasi
BusProcess Id - 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
- Wasi
Function Env - Wasi
Inodes - Wasi
State - Top level data type containing all* the state with which WASI can interact.
- Wasi
State Builder - Convenient builder API for configuring WASI via
WasiState
. - Wasi
Thread - Wasi
Thread Id - Represents the ID of a WASI thread
- Wasi
TtyState
Enums§
- FsError
- Error type for external users
- Wasi
Error - This is returned in
RuntimeError
. Usedowncast
ordowncast_ref
to retrieve theExitCode
. - Wasi
FsError - Error type for external users
- Wasi
State Creation Error - Error type returned when bad data is given to
WasiStateBuilder
. - Wasi
Thread Error - Wasi
Version - 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§
- Virtual
Bus - Virtual
File - This trait relies on your file closing when it goes out of scope via
Drop
- Virtual
Networking - An implementation of virtual networking
- Wasi
File - This trait relies on your file closing when it goes out of scope via
Drop
- Wasi
Runtime Implementation - 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. Thusstrict
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)