Expand description
hush-plugin — Macro for building Hush workflow op plugins as cdylib crates.
Provides the hush_plugin! macro that generates the C ABI exports
required for hush-serve to load your ops at runtime via libloading.
§Usage
ⓘ
// In your Cargo.toml:
// [lib]
// crate-type = ["cdylib"]
//
// [dependencies]
// serde_json = "1"
// hush-plugin = { path = "../../rust/hush-plugin" }
mod math;
mod text;
hush_plugin::hush_plugin! {
call: {
"double" => math::double,
"clean_text" => text::clean_text,
},
call_generator: {
"range_gen" => math::range_gen,
}
}§C ABI Contract
The macro generates three extern "C" functions:
hush_call(name, inputs_json) -> *mut c_char— call a regular ophush_call_generator(name, inputs_json) -> *mut c_char— call a generator ophush_free_str(ptr)— free a string returned by the above
Data crosses the FFI boundary as null-terminated JSON strings. Returns null if the op name is not found.
Re-exports§
pub use serde_json;
Macros§
- hush_
plugin - Generate the cdylib FFI exports for a set of ops and generators.