Expand description
Minimal protocol for sending/receiving messages from and to a wasm host.
If you define a function accepting n
arguments of type &[u8]
, it will
internally be exported as a function accepting n
integers.
§Example
use wasm_minimal_protocol::wasm_func;
#[cfg(target_arch = "wasm32")]
wasm_minimal_protocol::initiate_protocol!();
#[cfg_attr(target_arch = "wasm32", wasm_func)]
fn concatenate(arg1: &[u8], arg2: &[u8]) -> Vec<u8> {
[arg1, arg2].concat()
}
§Protocol
The specification of the protocol can be found in the typst documentation: https://typst.app/docs/reference/foundations/plugin/#protocol
Macros§
- initiate_
protocol - Macro that sets up the correct imports and traits to be used by
wasm_func
.