hush-plugin 0.1.3

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: 11.11 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: 32s 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

Plugin SDK for writing custom Rust ops that load into hush-serve at runtime.

crates.io

Quick Start

Create a cdylib crate:

# Cargo.toml
[lib]
crate-type = ["cdylib"]

[dependencies]
hush-plugin = "0.1"

Write your ops:

use hush_plugin::{hush_plugin, serde_json};
use serde_json::Value;

fn double(inputs: &Value) -> Value {
    let x = inputs["x"].as_i64().unwrap();
    serde_json::json!({"result": x * 2})
}

fn range_gen(inputs: &Value) -> Vec<Value> {
    let n = inputs["n"].as_i64().unwrap_or(3);
    (0..n).map(|i| serde_json::json!({"value": i})).collect()
}

hush_plugin!(double, range_gen);

Reference from Python:

@op(rust="./my_crate::double")
def double(x: int):
    return {"result": x * 2}  # Python fallback

Op Signatures

  • Regular op: fn(&Value) -> Value
  • Generator op: fn(&Value) -> Vec<Value>

The hush_plugin! macro auto-generates the C ABI exports and OpRegistry implementation.

License

Apache 2.0