hush-plugin 0.1.2

Macro for building Hush workflow op plugins as cdylib crates
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented0 out of 0 items with examples
  • Size
  • Source code size: 10 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.26 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 21s Average build duration of successful builds.
  • all releases: 26s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • batman1m2001-cyber

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 op
  • hush_call_generator(name, inputs_json) -> *mut c_char — call a generator op
  • hush_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.