Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them.
Page: /drakestapleton/aienux/tree/main/vendor/wasi
# aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
Sign in to star 0 stars 0 watching
About Files History Releases Proposed changes Issues For developers
branch `main` Branches Tags History
`aienux / vendor / wasi`
`1096131` feat(artifact): add Ed25519 trust and host tooling Drake committed 2026-09-25
```
..
.github/
src/
.cargo-checksum.json 1618
.cargo_vcs_info.json 94
.gitmodules 115
CODE_OF_CONDUCT.md 3444
CONTRIBUTING.md 397
Cargo.lock 667
Cargo.toml 1386
Cargo.toml.orig 903
LICENSE-APACHE 10847
LICENSE-Apache-2.0_WITH_LLVM-exception 12243
LICENSE-MIT 1023
ORG_CODE_OF_CONDUCT.md 7226
README.md 3010
SECURITY.md 1839
```
README.md
This crate contains API bindings for WASI system calls in Rust, and currently reflects the `wasi_snapshot_preview1` module. This crate is quite low-level and provides conceptually a "system call" interface. In most settings, it's better to use the Rust standard library, which has WASI support.
The `wasi` crate is also entirely procedurally generated from the `*.witx` files describing the WASI apis. While some conveniences are provided the bindings here are intentionally low-level!
# Usage
First you can depend on this crate via `Cargo.toml`:
```
[dependencies]
wasi = "0.8.0"
```
Next you can use the APIs in the root of the module like so:
```
fn main() {
let stdout = 1;
let message = "Hello, World!\n";
let data = [wasi::Ciovec {
buf: message.as_ptr(),
buf_len: message.len(),
}];
wasi::fd_write(stdout, &data).unwrap();
}
```
Next you can use a tool like [`cargo wasi`](https://github.com/bytecodealliance/cargo-wasi ) to compile and run your project:
To compile Rust projects to wasm using WASI, use the `wasm32-wasi` target, like this:
```
$ cargo wasi run
Compiling wasi v0.8.0+wasi-snapshot-preview1
Compiling wut v0.1.0 (/code)
Finished dev [unoptimized + debuginfo] target(s) in 0.34s
Running `/.cargo/bin/cargo-wasi target/wasm32-wasi/debug/wut.wasm`
Running `target/wasm32-wasi/debug/wut.wasm`
Hello, World!
```
# Development
The bulk of the `wasi` crate is generated by the `witx-bindgen` tool, which lives at `crates/witx-bindgen` and is part of the cargo workspace.
The `src/lib_generated.rs` file can be re-generated with the following command:
```
cargo run -p witx-bindgen -- crates/witx-bindgen/WASI/phases/snapshot/witx/wasi_snapshot_preview1.witx > src/lib_generated.rs
```
Note that this uses the WASI standard repository as a submodule. If you do not have this submodule present in your source tree, run:
```
git submodule update --init
```
# 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.