Skip to main content

nemo_wasm_guest/
lib.rs

1//! Nemo WASM Guest SDK.
2//!
3//! Plugin authors depend on this crate for access to `wit-bindgen` and the
4//! documentation on how to write Nemo WASM plugins.
5//!
6//! Each plugin crate must invoke `wit_bindgen::generate!` pointing at the
7//! `nemo-plugin.wit` file (shipped in this crate's `wit/` directory), implement
8//! the generated `Guest` trait, and call `export!(MyPlugin)`.
9//!
10//! # Example
11//!
12//! ```ignore
13//! wit_bindgen::generate!({
14//!     path: "wit/nemo-plugin.wit",
15//!     world: "nemo-plugin",
16//! });
17//!
18//! use nemo::plugin::host_api;
19//! use nemo::plugin::types::{LogLevel, PluginValue};
20//!
21//! struct MyPlugin;
22//!
23//! impl Guest for MyPlugin {
24//!     fn get_manifest() -> PluginManifest {
25//!         PluginManifest {
26//!             id: "my-plugin".into(),
27//!             name: "My Plugin".into(),
28//!             version: "0.1.0".into(),
29//!             description: "A sample plugin".into(),
30//!             author: Some("Author".into()),
31//!         }
32//!     }
33//!
34//!     fn init() {
35//!         host_api::log(LogLevel::Info, "Plugin initialized");
36//!     }
37//!
38//!     fn tick() -> u64 {
39//!         0
40//!     }
41//! }
42//!
43//! export!(MyPlugin);
44//! ```
45
46// Re-export wit-bindgen for plugin authors.
47pub use wit_bindgen;