Skip to main content

Crate sayiir_macros

Crate sayiir_macros 

Source
Expand description

Procedural macros for the Sayiir durable workflow engine.

Provides two macros that eliminate boilerplate when defining workflows:

  • #[task] — Transforms an async function into a CoreTask struct with automatic registration, metadata, and dependency injection.

  • workflow! — Builds a workflow pipeline with a concise DSL that desugars to WorkflowBuilder method calls.

§Quick Example

use sayiir_macros::task;

#[task(timeout = "30s", retries = 3, backoff = "100ms")]
async fn charge(order: Order, #[inject] stripe: Arc<Stripe>) -> Result<Receipt, BoxError> {
    stripe.charge(&order).await
}

let workflow = workflow!("order-process", JsonCodec, registry,
    validate(order: Order) { validate_order(order) }
    => charge
    => send_email || update_inventory
    => finalize
);

Macros§

workflow
Builds a workflow pipeline with a concise DSL.

Attribute Macros§

task
Transforms an async function into a CoreTask implementation.