Skip to content

Commit

Permalink
chore(rust-sdk): bump to 0.9.0
Browse files Browse the repository at this point in the history
Signed-off-by: Xin Liu <[email protected]>
  • Loading branch information
apepkuss committed Jun 28, 2023
1 parent 8f6fa2e commit 0fb2295
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 107 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
35 changes: 19 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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).
This project is licensed under the terms of the [Apache 2.0 license](https://github.com/tensorflow/rust/blob/HEAD/LICENSE).
137 changes: 50 additions & 87 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,93 +7,56 @@
#![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<T>(_caller: Caller, _args: Vec<WasmValue>, _data: Option<&mut T>) -> Result<Vec<WasmValue>, 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::<NeverType>::new()
//! .with_func::<(), ()>("say_hello", say_hello, None)?
//! .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::<NeverType>()?
//! .register_import_module(import)?
//! .register_module(Some("extern"), module)?
//! .run_func(Some("extern"), "run", params!())?;
//! }
//!
//! Ok(())
//! }
//!
//! ```
//!
//! # WasmEdge Rust SDK
//!
//! 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;
Expand Down

0 comments on commit 0fb2295

Please sign in to comment.