From 28f54ab6a1ec39d11cf3d6fa572d9f5a6bc4eca9 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Sun, 25 Jun 2023 07:42:34 +0000 Subject: [PATCH 01/20] version(rust-types): bump to 0.4.2-alpha.1 Signed-off-by: Xin Liu --- crates/wasmedge-types/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wasmedge-types/Cargo.toml b/crates/wasmedge-types/Cargo.toml index 98dca3597..b40c2d5af 100644 --- a/crates/wasmedge-types/Cargo.toml +++ b/crates/wasmedge-types/Cargo.toml @@ -7,7 +7,7 @@ license = "Apache-2.0" name = "wasmedge-types" readme = "README.md" repository = "https://github.com/WasmEdge/wasmedge-rust-sdk" -version = "0.4.2" +version = "0.4.2-alpha.1" [dependencies] thiserror = "1.0.30" From 221df6b517a5f99bee8a5c2bb4f0de5dba1050a5 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Sun, 25 Jun 2023 07:43:01 +0000 Subject: [PATCH 02/20] version(async-wasi): bump to 0.0.1-alpha.1 Signed-off-by: Xin Liu --- crates/async-wasi/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/async-wasi/Cargo.toml b/crates/async-wasi/Cargo.toml index 1c6d4a8ab..9318e0ba4 100644 --- a/crates/async-wasi/Cargo.toml +++ b/crates/async-wasi/Cargo.toml @@ -7,7 +7,7 @@ license = "Apache-2.0" name = "async-wasi" readme = "README.md" repository = "https://github.com/WasmEdge/wasmedge-rust-sdk" -version = "0.0.1" +version = "0.0.1-alpha.1" [dependencies] bitflags = "2.0.2" From 79b4518438c7a997c9d889991ca933b4e172d9f5 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Sun, 25 Jun 2023 07:43:39 +0000 Subject: [PATCH 03/20] version(rust-macro): bump to 0.4.0-alpha.1 Signed-off-by: Xin Liu --- crates/wasmedge-macro/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wasmedge-macro/Cargo.toml b/crates/wasmedge-macro/Cargo.toml index bf1972d88..53bf8cb24 100644 --- a/crates/wasmedge-macro/Cargo.toml +++ b/crates/wasmedge-macro/Cargo.toml @@ -6,7 +6,7 @@ license = "Apache-2.0" name = "wasmedge-macro" readme = "README.md" repository = "https://github.com/WasmEdge/wasmedge-rust-sdk" -version = "0.4.0" +version = "0.4.0-alpha.1" [lib] proc-macro = true From 66486ea9c65f45ac0e788f1e17ab78ca978b39df Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Sun, 25 Jun 2023 07:44:02 +0000 Subject: [PATCH 04/20] version(rust-sys): bump to 0.14.0-alpha.1 Signed-off-by: Xin Liu --- crates/wasmedge-sys/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wasmedge-sys/Cargo.toml b/crates/wasmedge-sys/Cargo.toml index c9f474a18..c591d5fdf 100644 --- a/crates/wasmedge-sys/Cargo.toml +++ b/crates/wasmedge-sys/Cargo.toml @@ -10,7 +10,7 @@ links = "wasmedge" name = "wasmedge-sys" readme = "README.md" repository = "https://github.com/WasmEdge/wasmedge-rust-sdk" -version = "0.14.0" +version = "0.14.0-alpha.1" [dependencies] fiber-for-wasmedge = {version = "8.0.1", optional = true} From 2b6a56960c05d87cc20619d2f25ac741bde38e44 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Sun, 25 Jun 2023 07:44:26 +0000 Subject: [PATCH 05/20] version(rust-sdk): bump to 0.9.0-alpha.1 Signed-off-by: Xin Liu --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 8661d7fb4..2568cbf12 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ license = "Apache-2.0" name = "wasmedge-sdk" readme = "README.md" repository = "https://github.com/WasmEdge/WasmEdge/blob/master/bindings/rust/wasmedge-sdk" -version = "0.9.0" +version = "0.9.0-alpha.1" [dependencies] anyhow = "1.0" From 519b6685194123d4141749471b080f9018a3e2e8 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Sun, 25 Jun 2023 07:49:40 +0000 Subject: [PATCH 06/20] chore(rust-sys): update WASMEDGE_RELEASE_VERSION Signed-off-by: Xin Liu --- crates/wasmedge-sys/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wasmedge-sys/build.rs b/crates/wasmedge-sys/build.rs index eb11b7600..a48d89465 100644 --- a/crates/wasmedge-sys/build.rs +++ b/crates/wasmedge-sys/build.rs @@ -12,7 +12,7 @@ const WASMEDGE_H: &str = "wasmedge.h"; target_family = "unix", not(feature = "static") ))] -const WASMEDGE_RELEASE_VERSION: &str = "0.12.1"; +const WASMEDGE_RELEASE_VERSION: &str = "0.13.0-alpha.1"; macro_rules! env_path { ($env_var:literal) => { From 54de450a8f480bb78c815c16495834bbe25eaa06 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Sun, 25 Jun 2023 08:02:42 +0000 Subject: [PATCH 07/20] chore(rust-sys): update dependencies Signed-off-by: Xin Liu --- crates/wasmedge-sys/Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/wasmedge-sys/Cargo.toml b/crates/wasmedge-sys/Cargo.toml index c591d5fdf..6c660097d 100644 --- a/crates/wasmedge-sys/Cargo.toml +++ b/crates/wasmedge-sys/Cargo.toml @@ -18,12 +18,12 @@ libc = "0.2.94" paste = "1.0.5" scoped-tls = "1" thiserror = "1.0.30" -wasmedge-macro = {path = "../wasmedge-macro", version = "0.4"} -wasmedge-types = {path = "../wasmedge-types", version = "0.4"} +wasmedge-macro = {path = "../wasmedge-macro", version = "0.4.0-alpha.1"} +wasmedge-types = {path = "../wasmedge-types", version = "0.4.2-alpha.1"} wat = "1.0" [target.'cfg(target_os = "linux")'.dependencies] -async-wasi = {path = "../async-wasi", optional = true} +async-wasi = {path = "../async-wasi", version = "0.0.1-alpha.1", optional = true} [build-dependencies] bindgen = {version = "0.65", default-features = false, features = ["runtime"]} From e619a6d1b3bc62f2a51cf0c4c700054d4689e18d Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Sun, 25 Jun 2023 08:03:06 +0000 Subject: [PATCH 08/20] chore(rust-sdk): update dependencies Signed-off-by: Xin Liu --- Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2568cbf12..2219dd6f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,9 +15,9 @@ anyhow = "1.0" num-derive = "0.3" num-traits = "0.2" thiserror = "1.0.30" -wasmedge-macro = {path = "crates/wasmedge-macro", version = "0.4"} -wasmedge-sys = {path = "crates/wasmedge-sys", version = "0.14", default-features = false} -wasmedge-types = {path = "crates/wasmedge-types", version = "0.4"} +wasmedge-macro = {path = "crates/wasmedge-macro", version = "0.4.0-alpha.1"} +wasmedge-sys = {path = "crates/wasmedge-sys", version = "0.14.0-alpha.1", default-features = false} +wasmedge-types = {path = "crates/wasmedge-types", version = "0.4.2-alpha.1"} wat = "1.0" [features] From 1cf84b462dd5a4c6e3b429ae14298c81f21e3c95 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Sun, 25 Jun 2023 08:52:46 +0000 Subject: [PATCH 09/20] ci(standalone): update workflow Signed-off-by: Xin Liu --- .github/workflows/standalone.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/standalone.yml b/.github/workflows/standalone.yml index 9a1094c02..96197ec4b 100644 --- a/.github/workflows/standalone.yml +++ b/.github/workflows/standalone.yml @@ -40,6 +40,7 @@ jobs: export CXX=clang++ export LD_LIBRARY_PATH=$HOME/.wasmedge/lib cargo test -p wasmedge-sdk --all --examples --features standalone + wasmedge --version build_ubuntu_2004: name: Ubuntu @@ -74,6 +75,7 @@ jobs: export CXX=clang++ export LD_LIBRARY_PATH=$HOME/.wasmedge/lib cargo test -p wasmedge-sdk --all --examples --features standalone + wasmedge --version build_fedora: name: Fedora latest @@ -109,6 +111,7 @@ jobs: export CXX=clang++ export LD_LIBRARY_PATH=$HOME/.wasmedge/lib cargo test -p wasmedge-sdk --all --examples --features standalone + wasmedge --version build_macos: name: MacOS @@ -139,3 +142,4 @@ jobs: export CXX=clang++ export DYLD_LIBRARY_PATH=$HOME/.wasmedge/lib cargo test -p wasmedge-sdk --all --examples --features standalone + wasmedge --version From b4aab9137fc1bb54575eeb5f192c0961241f0966 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Tue, 27 Jun 2023 07:57:28 +0000 Subject: [PATCH 10/20] chore(rust-macro): update dependency Signed-off-by: Xin Liu --- crates/wasmedge-macro/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wasmedge-macro/Cargo.toml b/crates/wasmedge-macro/Cargo.toml index 53bf8cb24..72b5c35e0 100644 --- a/crates/wasmedge-macro/Cargo.toml +++ b/crates/wasmedge-macro/Cargo.toml @@ -14,4 +14,4 @@ proc-macro = true [dependencies] proc-macro2 = "1.0.43" quote = "1" -syn = {version = "2.0.18", features = ["full", "extra-traits"]} +syn = {version = "2", features = ["full", "extra-traits"]} From 4fa5eb6b6a8b09d6bcb90033490f491d3174ada4 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Wed, 28 Jun 2023 03:20:13 +0000 Subject: [PATCH 11/20] chore(async-wasi): bump to `0.0.1` Signed-off-by: Xin Liu --- crates/async-wasi/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/async-wasi/Cargo.toml b/crates/async-wasi/Cargo.toml index 9318e0ba4..1c6d4a8ab 100644 --- a/crates/async-wasi/Cargo.toml +++ b/crates/async-wasi/Cargo.toml @@ -7,7 +7,7 @@ license = "Apache-2.0" name = "async-wasi" readme = "README.md" repository = "https://github.com/WasmEdge/wasmedge-rust-sdk" -version = "0.0.1-alpha.1" +version = "0.0.1" [dependencies] bitflags = "2.0.2" From cf0a7defe8855d3a5557472c3c4bf56d384aff8f Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Wed, 28 Jun 2023 03:20:43 +0000 Subject: [PATCH 12/20] chore(rust-macro): bump to `0.4.0` Signed-off-by: Xin Liu --- crates/wasmedge-macro/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wasmedge-macro/Cargo.toml b/crates/wasmedge-macro/Cargo.toml index 72b5c35e0..347291923 100644 --- a/crates/wasmedge-macro/Cargo.toml +++ b/crates/wasmedge-macro/Cargo.toml @@ -6,7 +6,7 @@ license = "Apache-2.0" name = "wasmedge-macro" readme = "README.md" repository = "https://github.com/WasmEdge/wasmedge-rust-sdk" -version = "0.4.0-alpha.1" +version = "0.4.0" [lib] proc-macro = true From 95b72832011c5ad9d00559d252b14048fc62bda8 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Wed, 28 Jun 2023 03:21:09 +0000 Subject: [PATCH 13/20] chore(rust-types): bump to `0.4.2` Signed-off-by: Xin Liu --- crates/wasmedge-types/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wasmedge-types/Cargo.toml b/crates/wasmedge-types/Cargo.toml index b40c2d5af..98dca3597 100644 --- a/crates/wasmedge-types/Cargo.toml +++ b/crates/wasmedge-types/Cargo.toml @@ -7,7 +7,7 @@ license = "Apache-2.0" name = "wasmedge-types" readme = "README.md" repository = "https://github.com/WasmEdge/wasmedge-rust-sdk" -version = "0.4.2-alpha.1" +version = "0.4.2" [dependencies] thiserror = "1.0.30" From f2880ba202fe520632994a56a3e076174fc8bd61 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Wed, 28 Jun 2023 03:21:52 +0000 Subject: [PATCH 14/20] chore(rust-sys): bump to `0.14.0` Signed-off-by: Xin Liu --- crates/wasmedge-sys/Cargo.toml | 8 ++++---- crates/wasmedge-sys/README.md | 23 ++++++++++++----------- crates/wasmedge-sys/build.rs | 2 +- crates/wasmedge-sys/src/lib.rs | 23 ++++++++++++----------- 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/crates/wasmedge-sys/Cargo.toml b/crates/wasmedge-sys/Cargo.toml index 6c660097d..1d8e2f27a 100644 --- a/crates/wasmedge-sys/Cargo.toml +++ b/crates/wasmedge-sys/Cargo.toml @@ -10,7 +10,7 @@ links = "wasmedge" name = "wasmedge-sys" readme = "README.md" repository = "https://github.com/WasmEdge/wasmedge-rust-sdk" -version = "0.14.0-alpha.1" +version = "0.14.0" [dependencies] fiber-for-wasmedge = {version = "8.0.1", optional = true} @@ -18,12 +18,12 @@ libc = "0.2.94" paste = "1.0.5" scoped-tls = "1" thiserror = "1.0.30" -wasmedge-macro = {path = "../wasmedge-macro", version = "0.4.0-alpha.1"} -wasmedge-types = {path = "../wasmedge-types", version = "0.4.2-alpha.1"} +wasmedge-macro = {path = "../wasmedge-macro", version = "0.4"} +wasmedge-types = {path = "../wasmedge-types", version = "0.4"} wat = "1.0" [target.'cfg(target_os = "linux")'.dependencies] -async-wasi = {path = "../async-wasi", version = "0.0.1-alpha.1", optional = true} +async-wasi = {path = "../async-wasi", version = "0.0.1", optional = true} [build-dependencies] bindgen = {version = "0.65", default-features = false, features = ["runtime"]} diff --git a/crates/wasmedge-sys/README.md b/crates/wasmedge-sys/README.md index 8988beb29..6033bc4ee 100644 --- a/crates/wasmedge-sys/README.md +++ b/crates/wasmedge-sys/README.md @@ -12,17 +12,18 @@ To use or build the `wasmedge-sys` crate, the `WasmEdge` library is required. Pl * The following table provides the versioning information about each crate of WasmEdge Rust bindings. - | wasmedge-sdk | WasmEdge lib | wasmedge-sys | wasmedge-types| wasmedge-macro| - | :-----------: | :-----------: | :-----------: | :-----------: | :-----------: | - | 0.8.1 | 0.12.1 | 0.13.1 | 0.4.1 | 0.3.0 | - | 0.8.0 | 0.12.0 | 0.13.0 | 0.4.1 | 0.3.0 | - | 0.7.1 | 0.11.2 | 0.12.2 | 0.3.1 | 0.3.0 | - | 0.7.0 | 0.11.2 | 0.12 | 0.3.1 | 0.3.0 | - | 0.6.0 | 0.11.2 | 0.11 | 0.3.0 | 0.2.0 | - | 0.5.0 | 0.11.1 | 0.10 | 0.3.0 | 0.1.0 | - | 0.4.0 | 0.11.0 | 0.9 | 0.2.1 | - | - | 0.3.0 | 0.10.1 | 0.8 | 0.2 | - | - | 0.1.0 | 0.10.0 | 0.7 | 0.1 | - | + | wasmedge-sdk | WasmEdge lib | wasmedge-sys | wasmedge-types| wasmedge-macro| async-wasi| + | :-----------: | :-----------: | :-----------: | :-----------: | :-----------: | :-------: | + | 0.9.0 | 0.13.0 | 0.14.0 | 0.4.2 | 0.4.0 | 0.0.1 | + | 0.8.1 | 0.12.1 | 0.13.1 | 0.4.1 | 0.3.0 | - | + | 0.8.0 | 0.12.0 | 0.13.0 | 0.4.1 | 0.3.0 | - | + | 0.7.1 | 0.11.2 | 0.12.2 | 0.3.1 | 0.3.0 | - | + | 0.7.0 | 0.11.2 | 0.12 | 0.3.1 | 0.3.0 | - | + | 0.6.0 | 0.11.2 | 0.11 | 0.3.0 | 0.2.0 | - | + | 0.5.0 | 0.11.1 | 0.10 | 0.3.0 | 0.1.0 | - | + | 0.4.0 | 0.11.0 | 0.9 | 0.2.1 | - | - | + | 0.3.0 | 0.10.1 | 0.8 | 0.2 | - | - | + | 0.1.0 | 0.10.0 | 0.7 | 0.1 | - | - | ## See also diff --git a/crates/wasmedge-sys/build.rs b/crates/wasmedge-sys/build.rs index a48d89465..4efd5f231 100644 --- a/crates/wasmedge-sys/build.rs +++ b/crates/wasmedge-sys/build.rs @@ -12,7 +12,7 @@ const WASMEDGE_H: &str = "wasmedge.h"; target_family = "unix", not(feature = "static") ))] -const WASMEDGE_RELEASE_VERSION: &str = "0.13.0-alpha.1"; +const WASMEDGE_RELEASE_VERSION: &str = "0.13.0"; macro_rules! env_path { ($env_var:literal) => { diff --git a/crates/wasmedge-sys/src/lib.rs b/crates/wasmedge-sys/src/lib.rs index 6bdea4991..b63e13aa9 100644 --- a/crates/wasmedge-sys/src/lib.rs +++ b/crates/wasmedge-sys/src/lib.rs @@ -17,17 +17,18 @@ //! //! * The following table provides the versioning information about each crate of WasmEdge Rust bindings. //! -//! | wasmedge-sdk | WasmEdge lib | wasmedge-sys | wasmedge-types| wasmedge-macro| -//! | :-----------: | :-----------: | :-----------: | :-----------: | :-----------: | -//! | 0.8.1 | 0.12.1 | 0.13.1 | 0.4.1 | 0.3.0 | -//! | 0.8.0 | 0.12.0 | 0.13.0 | 0.4.1 | 0.3.0 | -//! | 0.7.1 | 0.11.2 | 0.12.2 | 0.3.1 | 0.3.0 | -//! | 0.7.0 | 0.11.2 | 0.12 | 0.3.1 | 0.3.0 | -//! | 0.6.0 | 0.11.2 | 0.11 | 0.3.0 | 0.2.0 | -//! | 0.5.0 | 0.11.1 | 0.10 | 0.3.0 | 0.1.0 | -//! | 0.4.0 | 0.11.0 | 0.9 | 0.2.1 | - | -//! | 0.3.0 | 0.10.1 | 0.8 | 0.2 | - | -//! | 0.1.0 | 0.10.0 | 0.7 | 0.1 | - | +//! | wasmedge-sdk | WasmEdge lib | wasmedge-sys | wasmedge-types| wasmedge-macro| async-wasi| +//! | :-----------: | :-----------: | :-----------: | :-----------: | :-----------: | :-------: | +//! | 0.9.0 | 0.13.0 | 0.14.0 | 0.4.2 | 0.4.0 | 0.0.1 | +//! | 0.8.1 | 0.12.1 | 0.13.1 | 0.4.1 | 0.3.0 | - | +//! | 0.8.0 | 0.12.0 | 0.13.0 | 0.4.1 | 0.3.0 | - | +//! | 0.7.1 | 0.11.2 | 0.12.2 | 0.3.1 | 0.3.0 | - | +//! | 0.7.0 | 0.11.2 | 0.12 | 0.3.1 | 0.3.0 | - | +//! | 0.6.0 | 0.11.2 | 0.11 | 0.3.0 | 0.2.0 | - | +//! | 0.5.0 | 0.11.1 | 0.10 | 0.3.0 | 0.1.0 | - | +//! | 0.4.0 | 0.11.0 | 0.9 | 0.2.1 | - | - | +//! | 0.3.0 | 0.10.1 | 0.8 | 0.2 | - | - | +//! | 0.1.0 | 0.10.0 | 0.7 | 0.1 | - | - | //! //! //! From 5a47f76a0c1a9bf399aa68a79e574cd27313ba56 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Wed, 28 Jun 2023 03:22:17 +0000 Subject: [PATCH 15/20] chore(rust-sdk): bump to `0.9.0` Signed-off-by: Xin Liu --- Cargo.toml | 8 ++-- README.md | 35 +++++++------- src/lib.rs | 136 +++++++++++++++++++---------------------------------- 3 files changed, 72 insertions(+), 107 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2219dd6f4..8661d7fb4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,16 +8,16 @@ license = "Apache-2.0" name = "wasmedge-sdk" readme = "README.md" repository = "https://github.com/WasmEdge/WasmEdge/blob/master/bindings/rust/wasmedge-sdk" -version = "0.9.0-alpha.1" +version = "0.9.0" [dependencies] anyhow = "1.0" num-derive = "0.3" num-traits = "0.2" thiserror = "1.0.30" -wasmedge-macro = {path = "crates/wasmedge-macro", version = "0.4.0-alpha.1"} -wasmedge-sys = {path = "crates/wasmedge-sys", version = "0.14.0-alpha.1", default-features = false} -wasmedge-types = {path = "crates/wasmedge-types", version = "0.4.2-alpha.1"} +wasmedge-macro = {path = "crates/wasmedge-macro", version = "0.4"} +wasmedge-sys = {path = "crates/wasmedge-sys", version = "0.14", default-features = false} +wasmedge-types = {path = "crates/wasmedge-types", version = "0.4"} wat = "1.0" [features] diff --git a/README.md b/README.md index 5b08a1d67..d72f2c23d 100644 --- a/README.md +++ b/README.md @@ -4,34 +4,37 @@ WasmEdge Rust SDK provides idiomatic [Rust](https://www.rust-lang.org/) language **Notice:** This project is still under active development and not guaranteed to have a stable API. -- [Documentation]() +- [Documentation](https://wasmedge.org/docs/) - [WasmEdge website](https://wasmedge.org/) -- [WasmEdge GitHub page](https://github.com/WasmEdge/WasmEdge) +- [WasmEdge GitHub Page](https://github.com/WasmEdge/WasmEdge) +- [WasmEdge Rust SDK GitHub Page](https://github.com/WasmEdge/wasmedge-rust-sdk) +- [WasmEdge Rust SDK Examples](https://github.com/second-state/wasmedge-rustsdk-examples) ## Get Started Since this crate depends on the WasmEdge C API, it needs to be installed in your system first. Please refer to [WasmEdge Installation and Uninstallation](https://wasmedge.org/book/en/quick_start/install.html) to install the WasmEdge library. The versioning table below shows the version of the WasmEdge library required by each version of the `wasmedge-sdk` crate. - | wasmedge-sdk | WasmEdge lib | wasmedge-sys | wasmedge-types| wasmedge-macro| - | :-----------: | :-----------: | :-----------: | :-----------: | :-----------: | - | 0.8.1 | 0.12.1 | 0.13.1 | 0.4.1 | 0.3.0 | - | 0.8.0 | 0.12.0 | 0.13.0 | 0.4.1 | 0.3.0 | - | 0.7.1 | 0.11.2 | 0.12.2 | 0.3.1 | 0.3.0 | - | 0.7.0 | 0.11.2 | 0.12 | 0.3.1 | 0.3.0 | - | 0.6.0 | 0.11.2 | 0.11 | 0.3.0 | 0.2.0 | - | 0.5.0 | 0.11.1 | 0.10 | 0.3.0 | 0.1.0 | - | 0.4.0 | 0.11.0 | 0.9 | 0.2.1 | - | - | 0.3.0 | 0.10.1 | 0.8 | 0.2 | - | - | 0.1.0 | 0.10.0 | 0.7 | 0.1 | - | + | wasmedge-sdk | WasmEdge lib | wasmedge-sys | wasmedge-types| wasmedge-macro| async-wasi| + | :-----------: | :-----------: | :-----------: | :-----------: | :-----------: | :-------: | + | 0.9.0 | 0.13.0 | 0.14.0 | 0.4.2 | 0.4.0 | 0.0.1 | + | 0.8.1 | 0.12.1 | 0.13.1 | 0.4.1 | 0.3.0 | - | + | 0.8.0 | 0.12.0 | 0.13.0 | 0.4.1 | 0.3.0 | - | + | 0.7.1 | 0.11.2 | 0.12.2 | 0.3.1 | 0.3.0 | - | + | 0.7.0 | 0.11.2 | 0.12 | 0.3.1 | 0.3.0 | - | + | 0.6.0 | 0.11.2 | 0.11 | 0.3.0 | 0.2.0 | - | + | 0.5.0 | 0.11.1 | 0.10 | 0.3.0 | 0.1.0 | - | + | 0.4.0 | 0.11.0 | 0.9 | 0.2.1 | - | - | + | 0.3.0 | 0.10.1 | 0.8 | 0.2 | - | - | + | 0.1.0 | 0.10.0 | 0.7 | 0.1 | - | - | WasmEdge Rust SDK can automatically search the following paths for the WasmEdge library: -- `/usr/local` (Linux/macOS) - `$HOME/.wasmedge` (Linux/macOS) +- `/usr/local` (Linux/macOS) If you have installed the WasmEdge library in a different path, you can set the `WASMEDGE_INCLUDE_DIR` and `WASMEDGE_LIB_DIR` environment variables to the path of the WasmEdge library. -**Notice:** The minimum supported Rust version is 1.67. +**Notice:** The minimum supported Rust version is 1.68. ## Examples @@ -43,4 +46,4 @@ Please read the [contribution guidelines](https://github.com/WasmEdge/wasmedge-r ## License -This project is licensed under the terms of the [Apache 2.0 license](https://github.com/tensorflow/rust/blob/HEAD/LICENSE). \ No newline at end of file +This project is licensed under the terms of the [Apache 2.0 license](https://github.com/tensorflow/rust/blob/HEAD/LICENSE). diff --git a/src/lib.rs b/src/lib.rs index 049ae8f58..4d8e2aefe 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,93 +7,55 @@ #![allow(clippy::vec_init_then_push)] //! # Overview -//! -//! The [wasmedge-sdk](https://crates.io/crates/wasmedge-sdk) crate defines a group of high-level Rust APIs, which are used to build up business applications. -//! -//! * Notice that [wasmedge-sdk](https://crates.io/crates/wasmedge-sdk) requires **Rust v1.66 or above** in the **stable** channel. -//! -//! ## Build -//! -//! To use or build the `wasmedge-sdk` crate, the `WasmEdge` library is required. Please refer to [WasmEdge Installation and Uninstallation](https://wasmedge.org/book/en/quick_start/install.html) to install the `WasmEdge` library. -//! -//! * The following table provides the versioning information about each crate of WasmEdge Rust bindings. -//! -//! | wasmedge-sdk | WasmEdge lib | wasmedge-sys | wasmedge-types| wasmedge-macro| -//! | :-----------: | :-----------: | :-----------: | :-----------: | :-----------: | -//! | 0.8.1 | 0.12.1 | 0.13.1 | 0.4.1 | 0.3.0 | -//! | 0.8.0 | 0.12.0 | 0.13.0 | 0.4.1 | 0.3.0 | -//! | 0.7.1 | 0.11.2 | 0.12.2 | 0.3.1 | 0.3.0 | -//! | 0.7.0 | 0.11.2 | 0.12 | 0.3.1 | 0.3.0 | -//! | 0.6.0 | 0.11.2 | 0.11 | 0.3.0 | 0.2.0 | -//! | 0.5.0 | 0.11.1 | 0.10 | 0.3.0 | 0.1.0 | -//! | 0.4.0 | 0.11.0 | 0.9 | 0.2.1 | - | -//! | 0.3.0 | 0.10.1 | 0.8 | 0.2 | - | -//! | 0.1.0 | 0.10.0 | 0.7 | 0.1 | - | -//! -//! ## Example -//! -//! The example below is using `wasmedge-sdk` to run a WebAssembly module written with its WAT format (textual format). If you would like more examples, please refer to [Examples of WasmEdge RustSDK](https://github.com/second-state/wasmedge-rustsdk-examples). -//! -//! ```rust -//! #[cfg(not(feature = "async"))] -//! use wasmedge_sdk::{ -//! error::HostFuncError, host_function, params, wat2wasm, Caller, ImportObjectBuilder, Module, -//! VmBuilder, WasmValue, NeverType -//! }; -//! -//! // We define a function to act as our "env" "say_hello" function imported in the -//! // Wasm program above. -//! #[cfg(not(feature = "async"))] -//! #[host_function] -//! pub fn say_hello(_caller: Caller, _args: Vec, _data: Option<&mut T>) -> Result, HostFuncError> { -//! println!("Hello, world!"); -//! -//! Ok(vec![]) -//! } -//! -//! #[cfg_attr(test, test)] -//! fn main() -> anyhow::Result<()> { -//! #[cfg(not(feature = "async"))] -//! { -//! // create an import module -//! let import = ImportObjectBuilder::::new() -//! .with_func::<(), ()>("say_hello", say_hello)? -//! .build("env")?; -//! -//! let wasm_bytes = wat2wasm( -//! br#" -//! (module -//! ;; First we define a type with no parameters and no results. -//! (type $no_args_no_rets_t (func (param) (result))) -//! -//! ;; Then we declare that we want to import a function named "env" "say_hello" with -//! ;; that type signature. -//! (import "env" "say_hello" (func $say_hello (type $no_args_no_rets_t))) -//! -//! ;; Finally we create an entrypoint that calls our imported function. -//! (func $run (type $no_args_no_rets_t) -//! (call $say_hello)) -//! ;; And mark it as an exported function named "run". -//! (export "run" (func $run))) -//! "#, -//! )?; -//! -//! // loads a wasm module from the given in-memory bytes -//! let module = Module::from_bytes(None, wasm_bytes)?; -//! -//! // create an executor -//! VmBuilder::new() -//! .build::()? -//! .register_import_module(import)? -//! .register_module(Some("extern"), module)? -//! .run_func(Some("extern"), "run", params!())?; -//! } -//! -//! Ok(()) -//! } -//! -//! ``` -//! +//! +//! WasmEdge Rust SDK provides idiomatic [Rust](https://www.rust-lang.org/) language bindings for [WasmEdge](https://wasmedge.org/) +//! +//! **Notice:** This project is still under active development and not guaranteed to have a stable API. +//! +//! - [Documentation](https://wasmedge.org/docs/) +//! - [WasmEdge website](https://wasmedge.org/) +//! - [WasmEdge GitHub Page](https://github.com/WasmEdge/WasmEdge) +//! - [WasmEdge Rust SDK GitHub Page](https://github.com/WasmEdge/wasmedge-rust-sdk) +//! - [WasmEdge Rust SDK Examples](https://github.com/second-state/wasmedge-rustsdk-examples) +//! +//! ## Get Started +//! +//! Since this crate depends on the WasmEdge C API, it needs to be installed in your system first. Please refer to [WasmEdge Installation and Uninstallation](https://wasmedge.org/book/en/quick_start/install.html) to install the WasmEdge library. The versioning table below shows the version of the WasmEdge library required by each version of the `wasmedge-sdk` crate. +//! +//! | wasmedge-sdk | WasmEdge lib | wasmedge-sys | wasmedge-types| wasmedge-macro| async-wasi| +//! | :-----------: | :-----------: | :-----------: | :-----------: | :-----------: | :-------: | +//! | 0.9.0 | 0.13.0 | 0.14.0 | 0.4.2 | 0.4.0 | 0.0.1 | +//! | 0.8.1 | 0.12.1 | 0.13.1 | 0.4.1 | 0.3.0 | - | +//! | 0.8.0 | 0.12.0 | 0.13.0 | 0.4.1 | 0.3.0 | - | +//! | 0.7.1 | 0.11.2 | 0.12.2 | 0.3.1 | 0.3.0 | - | +//! | 0.7.0 | 0.11.2 | 0.12 | 0.3.1 | 0.3.0 | - | +//! | 0.6.0 | 0.11.2 | 0.11 | 0.3.0 | 0.2.0 | - | +//! | 0.5.0 | 0.11.1 | 0.10 | 0.3.0 | 0.1.0 | - | +//! | 0.4.0 | 0.11.0 | 0.9 | 0.2.1 | - | - | +//! | 0.3.0 | 0.10.1 | 0.8 | 0.2 | - | - | +//! | 0.1.0 | 0.10.0 | 0.7 | 0.1 | - | - | +//! +//! WasmEdge Rust SDK can automatically search the following paths for the WasmEdge library: +//! +//! - `$HOME/.wasmedge` (Linux/macOS) +//! - `/usr/local` (Linux/macOS) +//! +//! If you have installed the WasmEdge library in a different path, you can set the `WASMEDGE_INCLUDE_DIR` and `WASMEDGE_LIB_DIR` environment variables to the path of the WasmEdge library. +//! +//! **Notice:** The minimum supported Rust version is 1.68. +//! +//! ## Examples +//! +//! The [Examples of WasmEdge RustSDK](https://github.com/second-state/wasmedge-rustsdk-examples) repo contains a number of examples that demonstrate how to use the WasmEdge Rust SDK. +//! +//! ## Contributing +//! +//! Please read the [contribution guidelines](https://github.com/WasmEdge/wasmedge-rust-sdk/blob/main/CONTRIBUTING.md) on how to contribute code. +//! +//! ## License +//! +//! This project is licensed under the terms of the [Apache 2.0 license](https://github.com/tensorflow/rust/blob/HEAD/LICENSE). +//! #[doc(hidden)] pub mod caller; From 2082a7802b18aa5360be3f8e5b8f7cc51ab5ded8 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Wed, 28 Jun 2023 14:09:08 +0000 Subject: [PATCH 16/20] chore(rust-macro): update rustdoc Signed-off-by: Xin Liu --- crates/wasmedge-macro/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/wasmedge-macro/src/lib.rs b/crates/wasmedge-macro/src/lib.rs index 0a7ef8bea..075d058a8 100644 --- a/crates/wasmedge-macro/src/lib.rs +++ b/crates/wasmedge-macro/src/lib.rs @@ -185,6 +185,7 @@ fn expand_async_host_func_with_three_args(item_fn: &syn::ItemFn) -> proc_macro2: // ================== macros for wasmedge-sys ================== +#[doc(hidden)] #[proc_macro_attribute] pub fn sys_host_function(_attr: TokenStream, item: TokenStream) -> TokenStream { let body_ast = parse_macro_input!(item as Item); @@ -228,6 +229,7 @@ fn sys_expand_host_func(item_fn: &syn::ItemFn) -> syn::Result TokenStream { let body_ast = parse_macro_input!(item as Item); From 8192f187b697e1313f7ed9a37a354dde02b5c0a6 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Wed, 28 Jun 2023 14:09:27 +0000 Subject: [PATCH 17/20] chore(rust-sdk): update rustdoc Signed-off-by: Xin Liu --- src/lib.rs | 70 +++++++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 4d8e2aefe..c9c4aae21 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,55 +7,55 @@ #![allow(clippy::vec_init_then_push)] //! # Overview -//! +//! //! WasmEdge Rust SDK provides idiomatic [Rust](https://www.rust-lang.org/) language bindings for [WasmEdge](https://wasmedge.org/) -//! +//! //! **Notice:** This project is still under active development and not guaranteed to have a stable API. -//! +//! //! - [Documentation](https://wasmedge.org/docs/) //! - [WasmEdge website](https://wasmedge.org/) //! - [WasmEdge GitHub Page](https://github.com/WasmEdge/WasmEdge) //! - [WasmEdge Rust SDK GitHub Page](https://github.com/WasmEdge/wasmedge-rust-sdk) //! - [WasmEdge Rust SDK Examples](https://github.com/second-state/wasmedge-rustsdk-examples) -//! +//! //! ## Get Started -//! +//! //! Since this crate depends on the WasmEdge C API, it needs to be installed in your system first. Please refer to [WasmEdge Installation and Uninstallation](https://wasmedge.org/book/en/quick_start/install.html) to install the WasmEdge library. The versioning table below shows the version of the WasmEdge library required by each version of the `wasmedge-sdk` crate. -//! -//! | wasmedge-sdk | WasmEdge lib | wasmedge-sys | wasmedge-types| wasmedge-macro| async-wasi| -//! | :-----------: | :-----------: | :-----------: | :-----------: | :-----------: | :-------: | -//! | 0.9.0 | 0.13.0 | 0.14.0 | 0.4.2 | 0.4.0 | 0.0.1 | -//! | 0.8.1 | 0.12.1 | 0.13.1 | 0.4.1 | 0.3.0 | - | -//! | 0.8.0 | 0.12.0 | 0.13.0 | 0.4.1 | 0.3.0 | - | -//! | 0.7.1 | 0.11.2 | 0.12.2 | 0.3.1 | 0.3.0 | - | -//! | 0.7.0 | 0.11.2 | 0.12 | 0.3.1 | 0.3.0 | - | -//! | 0.6.0 | 0.11.2 | 0.11 | 0.3.0 | 0.2.0 | - | -//! | 0.5.0 | 0.11.1 | 0.10 | 0.3.0 | 0.1.0 | - | -//! | 0.4.0 | 0.11.0 | 0.9 | 0.2.1 | - | - | -//! | 0.3.0 | 0.10.1 | 0.8 | 0.2 | - | - | -//! | 0.1.0 | 0.10.0 | 0.7 | 0.1 | - | - | -//! +//! +//! | wasmedge-sdk | WasmEdge lib | wasmedge-sys | wasmedge-types| wasmedge-macro| async-wasi| +//! | :-----------: | :-----------: | :-----------: | :-----------: | :-----------: | :-------: | +//! | 0.9.0 | 0.13.0 | 0.14.0 | 0.4.2 | 0.4.0 | 0.0.1 | +//! | 0.8.1 | 0.12.1 | 0.13.1 | 0.4.1 | 0.3.0 | - | +//! | 0.8.0 | 0.12.0 | 0.13.0 | 0.4.1 | 0.3.0 | - | +//! | 0.7.1 | 0.11.2 | 0.12.2 | 0.3.1 | 0.3.0 | - | +//! | 0.7.0 | 0.11.2 | 0.12 | 0.3.1 | 0.3.0 | - | +//! | 0.6.0 | 0.11.2 | 0.11 | 0.3.0 | 0.2.0 | - | +//! | 0.5.0 | 0.11.1 | 0.10 | 0.3.0 | 0.1.0 | - | +//! | 0.4.0 | 0.11.0 | 0.9 | 0.2.1 | - | - | +//! | 0.3.0 | 0.10.1 | 0.8 | 0.2 | - | - | +//! | 0.1.0 | 0.10.0 | 0.7 | 0.1 | - | - | +//! //! WasmEdge Rust SDK can automatically search the following paths for the WasmEdge library: -//! +//! //! - `$HOME/.wasmedge` (Linux/macOS) //! - `/usr/local` (Linux/macOS) -//! +//! //! If you have installed the WasmEdge library in a different path, you can set the `WASMEDGE_INCLUDE_DIR` and `WASMEDGE_LIB_DIR` environment variables to the path of the WasmEdge library. -//! +//! //! **Notice:** The minimum supported Rust version is 1.68. -//! +//! //! ## Examples -//! +//! //! The [Examples of WasmEdge RustSDK](https://github.com/second-state/wasmedge-rustsdk-examples) repo contains a number of examples that demonstrate how to use the WasmEdge Rust SDK. -//! +//! //! ## Contributing -//! +//! //! Please read the [contribution guidelines](https://github.com/WasmEdge/wasmedge-rust-sdk/blob/main/CONTRIBUTING.md) on how to contribute code. -//! +//! //! ## License -//! +//! //! This project is licensed under the terms of the [Apache 2.0 license](https://github.com/tensorflow/rust/blob/HEAD/LICENSE). -//! +//! #[doc(hidden)] pub mod caller; @@ -121,23 +121,29 @@ pub use wasmedge_macro::{async_host_function, host_function}; /// WebAssembly value type. pub type WasmValue = wasmedge_sys::types::WasmValue; +/// This is a workaround solution to the [`never`](https://doc.rust-lang.org/std/primitive.never.html) type in Rust. It will be replaced by `!` once it is stable. pub type NeverType = wasmedge_types::NeverType; +#[doc(hidden)] pub type CallingFrame = wasmedge_sys::CallingFrame; +/// Defines the signature of a host function. pub type HostFn = wasmedge_sys::HostFn; +/// Defines the signature of a finalizer funtion that is used to free the host data. pub type Finalizer = wasmedge_sys::plugin::Finalizer; +/// Defines the types used in the `async` scenarios. #[cfg(all(feature = "async", target_os = "linux"))] pub mod r#async { + /// The state of an asynchronous task. pub type AsyncState = wasmedge_sys::r#async::AsyncState; + /// Defines the signature of an asynchronous host function. pub type AsyncHostFn = wasmedge_sys::AsyncHostFn; + /// Type of wasi context that is used to configure the wasi environment. + pub type WasiCtx = wasmedge_sys::WasiCtx; } -#[cfg(all(feature = "async", target_os = "linux"))] -pub type WasiCtx = wasmedge_sys::WasiCtx; - /// The object that is used to perform a [host function](crate::Func) is required to implement this trait. pub trait Engine { /// Runs a host function instance and returns the results. From 1cecc2809afa594d01be74131aa3ca2642e3e4ba Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Wed, 28 Jun 2023 14:14:49 +0000 Subject: [PATCH 18/20] chore(rust-sys): update rustdoc Signed-off-by: Xin Liu --- crates/wasmedge-sys/src/instance/function.rs | 2 ++ crates/wasmedge-sys/src/instance/module.rs | 1 + crates/wasmedge-sys/src/lib.rs | 1 + 3 files changed, 4 insertions(+) diff --git a/crates/wasmedge-sys/src/instance/function.rs b/crates/wasmedge-sys/src/instance/function.rs index 7afebc433..a2ca54c54 100644 --- a/crates/wasmedge-sys/src/instance/function.rs +++ b/crates/wasmedge-sys/src/instance/function.rs @@ -12,6 +12,7 @@ use std::pin::Pin; use std::{convert::TryInto, sync::Arc}; use wasmedge_types::{NeverType, ValType}; +/// Defines the signature of an asynchronous host function. #[cfg(all(feature = "async", target_os = "linux"))] pub type AsyncHostFn = fn( @@ -20,6 +21,7 @@ pub type AsyncHostFn = Option<&'static mut T>, ) -> Box, HostFuncError>> + Send>; +/// Defines the signature of a host function. pub type HostFn = fn( CallingFrame, Vec, diff --git a/crates/wasmedge-sys/src/instance/module.rs b/crates/wasmedge-sys/src/instance/module.rs index 8835dd668..8d68fa5df 100644 --- a/crates/wasmedge-sys/src/instance/module.rs +++ b/crates/wasmedge-sys/src/instance/module.rs @@ -907,6 +907,7 @@ impl AsImport for WasiModule { } } +/// A [AsyncWasiModule] is a module instance for the WASI specification and used in the `async` scenario. #[cfg(all(feature = "async", target_os = "linux"))] #[derive(Debug, Clone)] pub struct AsyncWasiModule { diff --git a/crates/wasmedge-sys/src/lib.rs b/crates/wasmedge-sys/src/lib.rs index b63e13aa9..90909fe86 100644 --- a/crates/wasmedge-sys/src/lib.rs +++ b/crates/wasmedge-sys/src/lib.rs @@ -115,6 +115,7 @@ pub use types::WasmValue; pub use validator::Validator; use wasmedge_types::{error, WasmEdgeResult}; +/// Type of wasi context that is used to configure the wasi environment. #[cfg(all(feature = "async", target_os = "linux"))] pub type WasiCtx = ::async_wasi::snapshots::WasiCtx; From 6d1870fc12d3d5026a87b4d4764f83a2b5b894ed Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Thu, 29 Jun 2023 07:18:14 +0000 Subject: [PATCH 19/20] ci(test): rename `bindings-rust` to `test` Signed-off-by: Xin Liu --- .github/workflows/{bindings-rust.yml => test.yml} | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) rename .github/workflows/{bindings-rust.yml => test.yml} (98%) diff --git a/.github/workflows/bindings-rust.yml b/.github/workflows/test.yml similarity index 98% rename from .github/workflows/bindings-rust.yml rename to .github/workflows/test.yml index 6451e0b65..cedb60942 100644 --- a/.github/workflows/bindings-rust.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: binding-rust +name: Continuous integration concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} @@ -6,15 +6,6 @@ concurrency: on: push: - branches: - - main - - "feat/*" - - "refactor/*" - - "test/*" - - "fix/*" - - "doc/*" - - "ci/*" - - "release/*" paths: - ".github/workflows/bindings-rust.yml" - "src/**" From 95bc9a48ec53bc7420eb20a95998720736cd039c Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Thu, 29 Jun 2023 07:34:06 +0000 Subject: [PATCH 20/20] ci(standalone): update `build_fedora` job Signed-off-by: Xin Liu --- .github/workflows/standalone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/standalone.yml b/.github/workflows/standalone.yml index 96197ec4b..02e6f02e8 100644 --- a/.github/workflows/standalone.yml +++ b/.github/workflows/standalone.yml @@ -78,8 +78,8 @@ jobs: wasmedge --version build_fedora: - name: Fedora latest - runs-on: Fedora-latest + name: Fedora + runs-on: ubuntu-latest strategy: matrix: rust: [1.70.0, 1.69, 1.68]