#wasm-plugin #plugin

wasm_plugin_guest

A low-ish level tool for easily writing WASM based plugins

6 releases

0.1.5 May 1, 2021
0.1.4 Apr 23, 2021
0.1.2 Mar 4, 2021

#1202 in WebAssembly

MIT license

9KB
118 lines

Crates.io Docs.rs license

A low-ish level tool for easily writing WASM based plugins to be hosted by wasm_plugin_host.

The goal of wasm_plugin is to make communicating across the host-plugin boundary as simple and idiomatic as possible while being unopinionated about how you actually use the plugin.

Plugins are meant to be run using wasm_plugin_host

Exporting a function is just a matter of adding an attribute.

#[wasm_plugin_guest::export_function]
fn hello() -> String {
    "Hello, host!".to_string()
}

API Stability

I am not currently guaranteeing any stability, expect all releases to include breaking changes.


lib.rs:

A low-ish level tool for easily writing WASM based plugins to be hosted by wasm_plugin_host.

The goal of wasm_plugin is to make communicating across the host-plugin boundary as simple and idiomatic as possible while being unopinionated about how you actually use the plugin.

This crate currently supports serialization either using bincode or json selected by feature: serialize_bincode: Uses serde and bincode. It is selected by default. serialize_json: Uses serde and serde_json. `serialize_nanoserde_json': Uses nanoserde.

Bincode is likely the best choice if all plugins the system uses will be written in Rust. Json is useful if a mix or languages will be used.

Plugins are meant to be run using wasm_plugin_host

Dependencies

~1.3–2MB
~46K SLoC