wasmedge_sys/lib.rs
1#![doc(
2 html_logo_url = "https://github.com/cncf/artwork/blob/master/projects/wasm-edge-runtime/icon/color/wasm-edge-runtime-icon-color.png?raw=true",
3 html_favicon_url = "https://raw.githubusercontent.com/cncf/artwork/49169bdbc88a7ce3c4a722c641cc2d548bd5c340/projects/wasm-edge-runtime/icon/color/wasm-edge-runtime-icon-color.svg"
4)]
5
6//! # Overview
7//! The [wasmedge-sys](https://crates.io/crates/wasmedge-sys) crate defines a group of low-level Rust APIs for WasmEdge, a light-weight, high-performance, and extensible WebAssembly runtime for cloud-native, edge, and decentralized applications.
8//!
9//! 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.
10//!
11//! * Notice that [wasmedge-sys](https://crates.io/crates/wasmedge-sys) requires **Rust v1.71 or above** in the **stable** channel.
12//!
13
14//! ## Build
15//!
16//! To use or build the `wasmedge-sys` 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.
17//!
18//! * The following table provides the versioning information about each crate of WasmEdge Rust bindings.
19//!
20//! | wasmedge-sdk | WasmEdge lib | wasmedge-sys | wasmedge-types| wasmedge-macro| async-wasi|
21//! | :-----------: | :-----------: | :-----------: | :-----------: | :-----------: | :-------: |
22//! | 0.17.1 | 0.17.1 | 0.21.0 | 0.6.1 | 0.6.1 | 0.2.2 |
23//! | 0.16.1 | 0.16.1 | 0.20.0 | 0.6.0 | 0.6.1 | 0.2.1 |
24//! | 0.14.0+ | 0.14.1 | 0.19.3 | 0.6.0 | 0.6.1 | 0.2.1 |
25//! | 0.14.0+ | 0.14.0 | 0.19.2 | 0.6.0 | 0.6.1 | 0.2.1 |
26//! | 0.13.2 | 0.13.5 | 0.17.5 | 0.4.4 | 0.6.1 | 0.1.0 |
27//! | 0.13.1 | 0.13.5 | 0.17.4 | 0.4.4 | 0.6.1 | 0.1.0 |
28//! | 0.13.0 | 0.13.5 | 0.17.3 | 0.4.4 | 0.6.1 | 0.1.0 |
29//! | 0.12.2 | 0.13.4 | 0.17.2 | 0.4.4 | 0.6.1 | 0.1.0 |
30//! | 0.12.1 | 0.13.4 | 0.17.1 | 0.4.4 | 0.6.1 | 0.1.0 |
31//! | 0.12.0 | 0.13.4 | 0.17.0 | 0.4.4 | 0.6.1 | 0.1.0 |
32//! | 0.11.2 | 0.13.3 | 0.16.2 | 0.4.3 | 0.6.1 | 0.1.0 |
33//! | 0.11.0 | 0.13.3 | 0.16.0 | 0.4.3 | 0.6.0 | 0.0.3 |
34//! | 0.10.1 | 0.13.3 | 0.15.1 | 0.4.2 | 0.5.0 | 0.0.2 |
35//! | 0.10.0 | 0.13.2 | 0.15.0 | 0.4.2 | 0.5.0 | 0.0.2 |
36//! | 0.9.0 | 0.13.1 | 0.14.0 | 0.4.2 | 0.4.0 | 0.0.1 |
37//! | 0.9.0 | 0.13.0 | 0.14.0 | 0.4.2 | 0.4.0 | 0.0.1 |
38//! | 0.8.1 | 0.12.1 | 0.13.1 | 0.4.1 | 0.3.0 | - |
39//! | 0.8.0 | 0.12.0 | 0.13.0 | 0.4.1 | 0.3.0 | - |
40//! | 0.7.1 | 0.11.2 | 0.12.2 | 0.3.1 | 0.3.0 | - |
41//! | 0.7.0 | 0.11.2 | 0.12 | 0.3.1 | 0.3.0 | - |
42//! | 0.6.0 | 0.11.2 | 0.11 | 0.3.0 | 0.2.0 | - |
43//! | 0.5.0 | 0.11.1 | 0.10 | 0.3.0 | 0.1.0 | - |
44//! | 0.4.0 | 0.11.0 | 0.9 | 0.2.1 | - | - |
45//! | 0.3.0 | 0.10.1 | 0.8 | 0.2 | - | - |
46//! | 0.1.0 | 0.10.0 | 0.7 | 0.1 | - | - |
47//!
48//! ## API Reference
49//!
50//! * [wasmedge-sys API Reference](https://wasmedge.github.io/wasmedge-rust-sdk/wasmedge_sys/index.html)
51//! * [wasmedge-sys Async API Reference](https://second-state.github.io/wasmedge-async-rust-sdk/wasmedge_sys/index.html)
52//!
53//! ## See also
54//!
55//! * [WasmEdge Runtime Official Website](https://wasmedge.org/)
56//! * [WasmEdge Docs](https://wasmedge.org/book/en/)
57//! * [WasmEdge C API Documentation](https://github.com/WasmEdge/WasmEdge/blob/master/docs/c_api.md)
58
59#![deny(rust_2018_idioms, unreachable_pub)]
60#![cfg_attr(docsrs, feature(doc_cfg))]
61
62#[allow(warnings)]
63/// Foreign function interfaces generated from WasmEdge C-API.
64pub mod ffi {
65 include!(concat!(env!("OUT_DIR"), "/wasmedge.rs"));
66}
67#[doc(hidden)]
68pub mod ast_module;
69#[cfg(all(feature = "async", target_os = "linux"))]
70#[cfg_attr(docsrs, doc(cfg(all(feature = "async", target_os = "linux"))))]
71pub mod r#async;
72#[doc(hidden)]
73#[cfg(feature = "aot")]
74pub mod compiler;
75#[doc(hidden)]
76pub mod config;
77#[doc(hidden)]
78pub mod executor;
79pub mod frame;
80pub mod instance;
81#[doc(hidden)]
82pub mod io;
83#[doc(hidden)]
84pub mod loader;
85pub mod plugin;
86#[doc(hidden)]
87pub mod statistics;
88#[doc(hidden)]
89pub mod store;
90pub mod types;
91pub mod utils;
92#[doc(hidden)]
93pub mod validator;
94
95#[doc(inline)]
96pub use ast_module::{ExportType, ImportType, Module};
97#[doc(inline)]
98#[cfg(feature = "aot")]
99#[cfg_attr(docsrs, doc(cfg(feature = "aot")))]
100pub use compiler::Compiler;
101#[doc(inline)]
102pub use config::Config;
103#[doc(inline)]
104pub use executor::Executor;
105#[doc(inline)]
106pub use frame::CallingFrame;
107#[doc(inline)]
108pub use instance::module::WasiModule;
109#[doc(inline)]
110pub use instance::{
111 function::{FuncRef, Function, SyncFn},
112 global::Global,
113 memory::Memory,
114 module::{AsInstance, ImportModule, Instance},
115 table::Table,
116 FuncType, GlobalType, MemoryType, TableType,
117};
118#[doc(inline)]
119pub use loader::Loader;
120#[doc(inline)]
121pub use statistics::Statistics;
122#[doc(inline)]
123pub use store::Store;
124#[doc(inline)]
125pub use types::WasmValue;
126#[doc(inline)]
127pub use validator::Validator;
128
129use wasmedge_types::WasmEdgeResult;
130
131/// Type of wasi context that is used to configure the wasi environment.
132#[cfg(all(feature = "async", target_os = "linux"))]
133#[cfg_attr(docsrs, doc(cfg(all(feature = "async", target_os = "linux"))))]
134pub type WasiCtx = ::async_wasi::snapshots::WasiCtx;