hush-macros 0.1.11

Proc macros for Hush workflow engine — #[hush_op] auto-registration
Documentation

Proc macros for the Hush workflow engine.

Provides:

  • #[hush_op] — auto-register Rust ops via inventory
  • #[hush_model] — shorthand for #[derive(Serialize, Deserialize, Debug, Clone)]

Usage

use hush_serve::{hush_op, hush_model};

#[hush_model]
struct Conversation { vads: Vec<Vad> }

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

// Typed style (auto-generates serde wrapper):
#[hush_op]
fn classify(conversation: Conversation, threshold: f64) -> ClassifyResult {
    // Pure business logic — no JSON parsing
}

#[hush_op(generator)]
fn each_item(inputs: &Value) -> Value {
    let items = inputs["items"].as_array().unwrap();
    Value::Array(items.iter().map(|i| serde_json::json!({"value": i})).collect())
}