Skip to content

Commit

Permalink
[Refactor] Disable Plugin::nn_preload (WasmEdge#72)
Browse files Browse the repository at this point in the history
* refactor(rust-sys): disable `nn_preload` API

Signed-off-by: Xin Liu <sam@secondstate.io>

* refactor(rust-sdk): disable `nn_preload` API

Signed-off-by: Xin Liu <sam@secondstate.io>

* version(rust-sdk): bump to `0.12.2`

Signed-off-by: Xin Liu <sam@secondstate.io>

* doc(rust-sys): update rustdoc and `README`

Signed-off-by: Xin Liu <sam@secondstate.io>

* doc(rust-sdk): update rustdoc and `README`

Signed-off-by: Xin Liu <sam@secondstate.io>

---------

Signed-off-by: Xin Liu <sam@secondstate.io>
  • Loading branch information
apepkuss authored Sep 22, 2023
1 parent ea83733 commit db28c21
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "Apache-2.0"
name = "wasmedge-sdk"
readme = "README.md"
repository = "https://github.com/WasmEdge/wasmedge-rust-sdk"
version = "0.12.2-dev"
version = "0.12.2"

[dependencies]
anyhow = "1.0"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This crate depends on the WasmEdge C API. In linux/macOS the crate can download

| wasmedge-sdk | WasmEdge lib | wasmedge-sys | wasmedge-types| wasmedge-macro| async-wasi|
| :-----------: | :-----------: | :-----------: | :-----------: | :-----------: | :-------: |
| 0.12.2 | 0.13.4 | 0.17.2 | 0.4.4 | 0.6.1 | 0.1.0 |
| 0.12.1 | 0.13.4 | 0.17.1 | 0.4.4 | 0.6.1 | 0.1.0 |
| 0.12.0 | 0.13.4 | 0.17.0 | 0.4.4 | 0.6.1 | 0.1.0 |
| 0.11.2 | 0.13.3 | 0.16.2 | 0.4.3 | 0.6.1 | 0.1.0 |
Expand Down Expand Up @@ -57,7 +58,7 @@ The following architectures are supported for automatic downloads:

This crate uses `rust-bindgen` during the build process. If you would like to use an external `rust-bindgen` you can set the `WASMEDGE_RUST_BINDGEN_PATH` environment variable to the `bindgen` executable path. This is particularly useful in systems like Alpine Linux (see [rust-lang/rust-bindgen#2360](https://github.com/rust-lang/rust-bindgen/issues/2360#issuecomment-1595869379), [rust-lang/rust-bindgen#2333](https://github.com/rust-lang/rust-bindgen/issues/2333)).

**Notice:** The minimum supported Rust version is 1.69.
**Notice:** The minimum supported Rust version is 1.70.

## API Reference

Expand Down
2 changes: 1 addition & 1 deletion crates/wasmedge-sys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The [wasmedge-sys](https://crates.io/crates/wasmedge-sys) crate defines a group

For developers, it is recommended that the APIs in `wasmedge-sys` are used to construct high-level libraries, while `wasmedge-sdk` is for building up business applications.

* Notice that [wasmedge-sys](https://crates.io/crates/wasmedge-sys) requires **Rust v1.69 or above** in the **stable** channel.
* Notice that [wasmedge-sys](https://crates.io/crates/wasmedge-sys) requires **Rust v1.70 or above** in the **stable** channel.

## Build

Expand Down
3 changes: 2 additions & 1 deletion crates/wasmedge-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//!
//! For developers, it is strongly recommended that the APIs in `wasmedge-sys` are used to construct high-level libraries, while `wasmedge-sdk` is for building up business applications.
//!
//! * Notice that [wasmedge-sys](https://crates.io/crates/wasmedge-sys) requires **Rust v1.69 or above** in the **stable** channel.
//! * Notice that [wasmedge-sys](https://crates.io/crates/wasmedge-sys) requires **Rust v1.70 or above** in the **stable** channel.
//!
//! ## Build
Expand All @@ -19,6 +19,7 @@
//!
//! | wasmedge-sdk | WasmEdge lib | wasmedge-sys | wasmedge-types| wasmedge-macro| async-wasi|
//! | :-----------: | :-----------: | :-----------: | :-----------: | :-----------: | :-------: |
//! | 0.12.2 | 0.13.4 | 0.17.2 | 0.4.4 | 0.6.1 | 0.1.0 |
//! | 0.12.1 | 0.13.4 | 0.17.1 | 0.4.4 | 0.6.1 | 0.1.0 |
//! | 0.12.0 | 0.13.4 | 0.17.0 | 0.4.4 | 0.6.1 | 0.1.0 |
//! | 0.11.2 | 0.13.3 | 0.16.2 | 0.4.3 | 0.6.1 | 0.1.0 |
Expand Down
22 changes: 11 additions & 11 deletions crates/wasmedge-sys/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ impl PluginManager {
Ok(())
}

#[cfg(feature = "wasi_nn")]
#[cfg_attr(docsrs, doc(cfg(feature = "wasi_nn")))]
pub fn nn_preload(preloads: Vec<&str>) {
let c_args: Vec<CString> = preloads
.iter()
.map(|&x| std::ffi::CString::new(x).unwrap())
.collect();
let c_strs: Vec<*const i8> = c_args.iter().map(|x| x.as_ptr()).collect();
let len = c_strs.len() as u32;
unsafe { ffi::WasmEdge_PluginInitWASINN(c_strs.as_ptr(), len) }
}
// #[cfg(feature = "wasi_nn")]
// #[cfg_attr(docsrs, doc(cfg(feature = "wasi_nn")))]
// pub fn nn_preload(preloads: Vec<&str>) {
// let c_args: Vec<CString> = preloads
// .iter()
// .map(|&x| std::ffi::CString::new(x).unwrap())
// .collect();
// let c_strs: Vec<*const i8> = c_args.iter().map(|x| x.as_ptr()).collect();
// let len = c_strs.len() as u32;
// unsafe { ffi::WasmEdge_PluginInitWASINN(c_strs.as_ptr(), len) }
// }

/// Returns the count of loaded plugins.
pub fn count() -> u32 {
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
//!
//! | wasmedge-sdk | WasmEdge lib | wasmedge-sys | wasmedge-types| wasmedge-macro| async-wasi|
//! | :-----------: | :-----------: | :-----------: | :-----------: | :-----------: | :-------: |
//! | 0.12.2 | 0.13.4 | 0.17.2 | 0.4.4 | 0.6.1 | 0.1.0 |
//! | 0.12.1 | 0.13.4 | 0.17.1 | 0.4.4 | 0.6.1 | 0.1.0 |
//! | 0.12.0 | 0.13.4 | 0.17.0 | 0.4.4 | 0.6.1 | 0.1.0 |
//! | 0.11.2 | 0.13.3 | 0.16.2 | 0.4.3 | 0.6.1 | 0.1.0 |
Expand Down Expand Up @@ -66,7 +67,7 @@
//!
//! This crate uses `rust-bindgen` during the build process. If you would like to use an external `rust-bindgen` you can set the `WASMEDGE_RUST_BINDGEN_PATH` environment variable to the `bindgen` executable path. This is particularly useful in systems like Alpine Linux (see [rust-lang/rust-bindgen#2360](https://github.com/rust-lang/rust-bindgen/issues/2360#issuecomment-1595869379), [rust-lang/rust-bindgen#2333](https://github.com/rust-lang/rust-bindgen/issues/2333)).
//!
//! **Notice:** The minimum supported Rust version is 1.69.
//! **Notice:** The minimum supported Rust version is 1.70.
//!
//! ## API Reference
//!
Expand Down
10 changes: 5 additions & 5 deletions src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ impl PluginManager {
}
}

#[cfg(feature = "wasi_nn")]
#[cfg_attr(docsrs, doc(cfg(feature = "wasi_nn")))]
pub fn nn_preload(preloads: Vec<&str>) {
sys::plugin::PluginManager::nn_preload(preloads);
}
// #[cfg(feature = "wasi_nn")]
// #[cfg_attr(docsrs, doc(cfg(feature = "wasi_nn")))]
// pub fn nn_preload(preloads: Vec<&str>) {
// sys::plugin::PluginManager::nn_preload(preloads);
// }

/// Returns the count of loaded plugins.
pub fn count() -> u32 {
Expand Down

0 comments on commit db28c21

Please sign in to comment.