Skip to content

Latest commit

 

History

History
59 lines (39 loc) · 1.25 KB

EXAMPLES.md

File metadata and controls

59 lines (39 loc) · 1.25 KB

Example Code

The code in the examples in the repo are not meant to be the best code out there, it's just to get simple points across.

If you think you can improve them, you're more than welcome to open a PR.

Make sure to resolve any warning reported by cargo check and cargo fmt --check.

Prefer .unwrap() over the ? operator, as this is not production code, and just getting a clear point where things went wrong is preferred over error propagation.

Setup env:

rustup target add wasm32-unknown-unknown
cargo install wasm-tools
cargo install wit-deps-cli

Install wit dependencies

In /

wit-deps

To run the examples:

In example-apps/*/

cargo build --release --target wasm32-unknown-unknown
wasm-tools component new ./target/wasm32-unknown-unknown/release/triangle.wasm -o out.wasm

In example-runtime/

cargo run -- --example triangle

Wayland on an Nvidia GPU is not working well, use XWayland instead:

export WAYLAND_DISPLAY=wayland-1 vkcube && cargo run -- --example triangle

View wit

In example-apps/*/

wasm-tools component wit ./target/wasm32-unknown-unknown/release/triangle.wasm