From c8fcfcb4d79e09705832aa02eb05849e1f8f79b7 Mon Sep 17 00:00:00 2001 From: Xinzhao Xu Date: Wed, 9 Oct 2024 15:23:09 +0800 Subject: [PATCH] examples: use the wasm32-wasip2 target --- examples/client/.cargo/config.toml | 2 ++ examples/client/Cargo.toml | 3 ++- examples/client/README.md | 10 +++++----- examples/server/.cargo/config.toml | 2 ++ examples/server/Cargo.toml | 3 ++- examples/server/README.md | 10 +++++----- 6 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 examples/client/.cargo/config.toml create mode 100644 examples/server/.cargo/config.toml diff --git a/examples/client/.cargo/config.toml b/examples/client/.cargo/config.toml new file mode 100644 index 0000000..f68f33c --- /dev/null +++ b/examples/client/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +target = "wasm32-wasip2" diff --git a/examples/client/Cargo.toml b/examples/client/Cargo.toml index 70016ed..8735d79 100644 --- a/examples/client/Cargo.toml +++ b/examples/client/Cargo.toml @@ -2,10 +2,11 @@ name = "http-client" version = "0.0.0" edition = "2021" +rust-version = "1.82" publish = false [dependencies] -waki = { version = "0.3.1", features = ["json", "multipart"] } +waki = { version = "0.4.0", features = ["json", "multipart"] } serde = { version = "1.0.202", features = ["derive"] } # reduce wasm binary size diff --git a/examples/client/README.md b/examples/client/README.md index 3a6f3b3..6de877a 100644 --- a/examples/client/README.md +++ b/examples/client/README.md @@ -5,22 +5,22 @@ with the [waki](https://github.com/wacker-dev/waki) library. ## Build -First, install [cargo component](https://github.com/bytecodealliance/cargo-component): +Requires Rust 1.82+. ``` -cargo install cargo-component@0.15.0 +$ rustup target add wasm32-wasip2 ``` -Then execute the following command to compile it into a WASM program: +Use the following command to compile it into a WASM program: ``` -$ cargo component build +$ cargo build ``` Or use `--release` option to build it in release mode: ``` -$ cargo component build --release +$ cargo build --release ``` ## Run diff --git a/examples/server/.cargo/config.toml b/examples/server/.cargo/config.toml new file mode 100644 index 0000000..f68f33c --- /dev/null +++ b/examples/server/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +target = "wasm32-wasip2" diff --git a/examples/server/Cargo.toml b/examples/server/Cargo.toml index 243e6c9..e2b0e3c 100644 --- a/examples/server/Cargo.toml +++ b/examples/server/Cargo.toml @@ -2,6 +2,7 @@ name = "http-server" version = "0.1.0" edition = "2021" +rust-version = "1.82" publish = false [lib] @@ -11,7 +12,7 @@ crate-type = ["cdylib"] proxy = true [dependencies] -waki = "0.3.1" +waki = "0.4.0" # reduce wasm binary size [profile.release] diff --git a/examples/server/README.md b/examples/server/README.md index 062334c..7b0804e 100644 --- a/examples/server/README.md +++ b/examples/server/README.md @@ -5,22 +5,22 @@ with the [waki](https://github.com/wacker-dev/waki) library. ## Build -First, install [cargo component](https://github.com/bytecodealliance/cargo-component): +Requires Rust 1.82+. ``` -cargo install cargo-component@0.15.0 +$ rustup target add wasm32-wasip2 ``` -Then execute the following command to compile it into a WASM program: +Use the following command to compile it into a WASM program: ``` -$ cargo component build +$ cargo build ``` Or use `--release` option to build it in release mode: ``` -$ cargo component build --release +$ cargo build --release ``` ## Run