Rust Bindings
The definitions of WasmEdge Rust SDK involve two Rust crates, and wasmedge-sdk. They are designed based on different principles and for different purposes. The crate defines a group of low-level Rust APIs, which simply wrap WasmEdge C APIs and provide the safe counterpart, while the wasmedge-sdk
crate provides more elegant and ergonomic APIs, which are more suitable for application development.
The crate defines a group of low-level Rust APIs, which simply wrap WasmEdge C APIs and provide the safe counterparts. The APIs in wasmedge-sys should be used to construct high-level libraries. For the details of the APIs, please visit .
The wasmedge-sdk crate is based on the wasmedge-sys crate and provides a more elegant and idiomatic Rust APIs. These APIs are more suitable for business-oriented design and development. The wasmedge-sdk crate is still under active development and coming soon.
wasmedge-sys
depends on the dynamic library and the header files of WasmEdge
. To cargo build
wasmedge-sys
there are several choices to specify the dependencies:
By specifying
WASMEDGE_BUILD_DIR
Suppose that you
git clone
WasmEdge repo in~/workspace/me/WasmEdge
, and follow the to build WasmEdge native library. The generatedinclude
andlib
directories should be in~/workspace/me/WasmEdge/build
.Then, set
WASMEDGE_BUILD_DIR
environment variable to specify the directory. After that, go to thewasmedge-sys
directory andcargo build
the crate.
By WasmEdge docker image
If you choose WasmEdge docker image to build your own container for development, the pre-built WasmEdge binary package is located in
$HOME/.wasmedge
directory by default. The build script (build.rs
) ofwasmedge-sys
crate can detect the package and build the crate automatically.