Install WASIX for Rust
cargo-wasix adds a wasix subcommand to
Cargo, so you can build, run, and test Rust applications for WASIX with familiar
commands.
Prerequisites
Install Rust using rustup . Both cargo and rustup must be
available in your terminal.
Install cargo-wasix
cargo install cargo-wasixThe WASIX Rust toolchain downloads automatically the first time you run a command
such as cargo wasix build. You do not need to install it separately.
Prebuilt installers for macOS, Linux, and Windows are also available in the official installation guide .
Verify installation
cargo wasix --versionBuild your first project
cargo new hello-wasix
cd hello-wasix
cargo wasix build --releaseRun with Wasmer
Install Wasmer , then run the release build from the project directory:
wasmer run target/wasm32-wasmer-wasi/release/hello-wasix.wasmReplace hello-wasix with your project’s binary name if you are using an existing
project. Cargo places WASIX release builds in target/wasm32-wasmer-wasi/release/
by default.
You can also build and run directly through cargo-wasix:
cargo wasix runYou can also run your project’s tests:
cargo wasix testNext steps
- Read the Rust usage guide.
- Explore the Rust examples.
- Browse WASIX builds for package recipes and toolchains in wasinix.