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.
Re-exportsΒ§
pub use crate::fs::Fd;
pub use crate::fs::VIRTUAL_ROOT_FD;
pub use crate::fs::WasiFs;
pub use crate::fs::WasiInodes;
pub use crate::fs::default_fs_backing;
pub use crate::os::WasiTtyState;
pub use crate::os::task::control_plane::WasiControlPlane;
pub use crate::os::task::process::WasiProcess;
pub use crate::os::task::process::WasiProcessId;
pub use crate::os::task::thread::WasiThread;
pub use crate::os::task::thread::WasiThreadError;
pub use crate::os::task::thread::WasiThreadHandle;
pub use crate::os::task::thread::WasiThreadId;
pub use crate::runtime::PluggableRuntime;
pub use crate::runtime::Runtime;
pub use crate::runtime::task_manager::VirtualTaskManager;
pub use wasmer;
pub use wasmer_wasix_types;
pub use virtual_fs;
pub use virtual_net;
ModulesΒ§
- bin_
factory - capabilities
- fs
- http
- journal
- macros π
- Macros to simplify some common WASI-specific tasks.
- net
- os
- rewind π
- runners
- runtime
- state π
- WARNING: the API exposed here is unstable and very experimental. Certain things are not ready yet and may be broken in patch releases. If youβre using this and have any specific needs, please let us know here or by filing an issue.
- syscalls π
- types
- utils π
StructsΒ§
- Deep
Sleep Work - Represents the work that will be done when a thread goes to deep sleep and includes the things needed to restore it again
- Duplex
Pipe - A pair of pipes that are connected together.
- Extended
FsError - Local
Networking - Local
TcpListener - Local
TcpStream - Local
UdpSocket - Pipe
- Rewind
State - The rewind state after a deep sleep
- Store
Snapshot - A snapshot that captures the runtime state of an instance.
- Unsupported
Virtual Networking - WasiEnv
- The environment provided to the WASI imports.
- Wasi
EnvBuilder - Builder API for configuring a
WasiEnv
environment needed to run WASI modules. - Wasi
EnvInit - Data required to construct a
WasiEnv
. - Wasi
Function Env - Wasi
Module Instance Handles - Various
TypedFunction
andGlobal
handles for an active WASI(X) instance. - WasiV
Fork
EnumsΒ§
- FsError
- Error type for external users
- Spawn
Error - Wasi
Error - This is returned in
RuntimeError
. Usedowncast
ordowncast_ref
to retrieve theExitCode
. - Wasi
Module Tree Handles - Wasi
Runtime Error - Wasi
State Creation Error - Error type returned when bad data is given to
WasiEnvBuilder
. - Wasi
Version - The version of WASI. This is determined by the imports namespace string.
ConstantsΒ§
- ALL_
RIGHTS - all the rights enabled
TraitsΒ§
- Rewind
Post Process - Trait that will be invoked after the rewind has finished It is possible that the process will be terminated rather than restored at this point
- Virtual
File - This trait relies on your file closing when it goes out of scope via
Drop
- Virtual
Networking - An implementation of virtual networking
FunctionsΒ§
- block_
in_ πplace - Run a synchronous function that would normally be blocking.
- capture_
store_ snapshot - generate_
import_ object_ from_ env - Create an [
Imports
] with an existingWasiEnv
.WasiEnv
values are typically constructed withWasiEnvBuilder
. - generate_
import_ πobject_ snapshot0 - Combines a state generating function with the import list for legacy WASI
- generate_
import_ πobject_ snapshot1 - generate_
import_ πobject_ wasix32_ v1 - Combines a state generating function with the import list for snapshot 1
- generate_
import_ πobject_ wasix64_ v1 - 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 - io_
err_ into_ net_ error - 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
- mem_
error_ πto_ wasi - restore_
store_ snapshot - rewind
- rewind_
ext - run_
wasi_ πfunc - run_
wasi_ πfunc_ start - Run a main function.
- spawn_
blocking π - Spawns a new blocking task that runs the provided closure.
- unwind
- wait_
for_ snapshot - wasi_
exports_ πgeneric - wasi_
snapshot_ πpreview1_ exports - wasi_
unstable_ πexports - wasix_
exports_ π32 - wasix_
exports_ π64
Type AliasesΒ§
- Rewind
State Option - Wasi
Bidirectional Shared Pipe Pair - Shared version of BidiPipe for situations where you need
to emulate the old behaviour of
Pipe
(both send and recv on one channel). - Wasi
Result