wasi_common/snapshots/
mod.rs

1//! One goal of `wasi-common` is for multiple WASI snapshots to provide an
2//! interface to the same underlying `crate::WasiCtx`. This provides us a path
3//! to evolve WASI by allowing the same WASI Command to import functions from
4//! different snapshots - e.g. the user could use Rust's `std` which imports
5//! snapshot 1, but also depend directly on the `wasi` crate which imports
6//! some future snapshot 2. Right now, this amounts to supporting snapshot 1
7//! and "snapshot 0" aka wasi_unstable at once.
8//!
9//! The architectural rules for snapshots are:
10//!
11//! * Snapshots are arranged into modules under `crate::snapshots::`.
12//! * Each snapshot should invoke `wiggle::from_witx!` with `ctx:
13//!   crate::WasiCtx` in its module, and impl all of the required traits.
14//! * Snapshots can be implemented in terms of other snapshots. For example,
15//!   snapshot 0 is mostly implemented by calling the snapshot 1 implementation,
16//!   and converting its own types back and forth with the snapshot 1 types. In a
17//!   few cases, that is not feasible, so snapshot 0 carries its own
18//!   implementations in terms of the `WasiFile` and `WasiSched` traits.
19//! * Snapshots can be implemented in terms of the `Wasi*` traits given by
20//!   `WasiCtx`. No further downcasting via the `as_any` escape hatch is
21//!   permitted.
22
23pub mod preview_0;
24pub mod preview_1;