Skip to content

bytecodealliance/wasi-rs

wasi

A Bytecode Alliance project

WASI API Bindings for Rust

Crates.io version Download docs.rs docs

This repository contains low-level Rust bindings to WASI APIs which are distributed and published to crates on crates.io. Crates currently are:

  • wasi - this is a reexport of the latest stable WASI proposal. At this time this represents bindings to WASIp2.
  • wasip1 - this crate explicitly contains bindings for the WASIp1 snapshot. Development of the WASIp1 version of the standard has ceased and this crate is in maintenance mode.
  • wasip2 - this crate explicitly contains bindings for the latest stable WASIp2 release generated by the latest stable wit-bindgen release.
  • wasip3 - contains the latest snapshot of the WASIp3 APIs using the latest wit-bindgen.

The wasi crate

The wasi crate today is a lightweight reexport of the latest stable version of the WASI standard. Currently that is WASIp2. The wasi crate version number will be bumped every timet he wasip2 crate version number is bumped, for example, and its interface and bindings may change over time as WASIp2 APIs are added or the wit-bindgen tool to generate bindings evolves.

To explicitly indicate which version of the WASI standard you'd like to use it's recommended to use the wasip2 crate directly.

Crate version numbers

The wasi crate contains "build metadata" which indicates what version of the WASI standard it contains bindings for. This metadata is purely informational and cannot be used to constrain a version requirement in Cargo. This scheme is mirrored for the wasip2 crate as well, for example.

Which crate to use?

The most appropriate crate to use depends on the WebAssembly Rust target that you're compiling with:

  • wasm32-unknown-unknown - don't use any of these crates in this repository as WASI is typically not intended to be used with this target.
  • wasm32-wasip1 - use the wasip1 crate, as other crates are based on component APIs which this target does not use.
  • wasm32-wasip2 - use the wasip2 crate and update as-needed to newer versions.
  • wasm32-wasip3 - use the wasip3 crate.

For component-producing targets, for example wasm32-wasip2 and wasm32-wasip3, you can technically use any of wasip2, wasip3, or wasi. It's recommended where possible to stick with the target, however.

License

This project is licensed under the Apache 2.0 license with the LLVM exception. See LICENSE for more details.

Contribution

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

About

WASI bindings for Rust

Topics

Resources

License

Apache-2.0 and 2 other licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
Apache-2.0
LICENSE-Apache-2.0_WITH_LLVM-exception
MIT
LICENSE-MIT

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 23