Skip to main content

Crate durable_lambda_builder

Crate durable_lambda_builder 

Source
Expand description

Builder-pattern API approach for durable Lambda handlers.

This crate provides a builder-pattern API for writing durable Lambda functions with step-by-step configuration. Use [handler] to create a DurableHandlerBuilder, then call .run() to start the Lambda runtime.

§Quick Start

use durable_lambda_builder::prelude::*;

#[tokio::main]
async fn main() -> Result<(), lambda_runtime::Error> {
    durable_lambda_builder::handler(|event: serde_json::Value, mut ctx: BuilderContext| async move {
        let order = ctx.step("validate_order", || async {
            Ok::<_, String>(serde_json::json!({"id": 123, "valid": true}))
        }).await?;
        Ok(serde_json::json!({"order": order}))
    })
    .run()
    .await
}

Re-exports§

pub use context::BuilderContext;
pub use handler::handler;
pub use handler::DurableHandlerBuilder;

Modules§

context
Builder-specific context wrapper.
handler
Builder-pattern handler construction.
prelude
User-facing re-exports for the builder-pattern approach.