• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Persons example
2
3## Run
4
5```
6$ cargo run --example persons
7```
8
9## Run (wasm32-wasi)
10
11### Requisites
12
13- [wasi-sdk](https://github.com/WebAssembly/wasi-sdk)
14- [wasmtime](https://wasmtime.dev/)
15
16```
17# Set to wasi-sdk directory
18$ export WASI_SDK_PATH=`<wasi-sdk-path>`
19$ export CC_wasm32_wasi="${WASI_SDK_PATH}/bin/clang --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot"
20# Build
21$ cargo build --example persons --target wasm32-wasi --release --features bundled
22# Run
23$ wasmtime target/wasm32-wasi/release/examples/persons.wasm
24Found persons:
25ID: 1, Name: Steven
26ID: 2, Name: John
27ID: 3, Name: Alex
28```
29