Skip to main content

durable_lambda_builder/
lib.rs

1//! Builder-pattern API approach for durable Lambda handlers.
2//!
3//! This crate provides a builder-pattern API for writing durable Lambda functions
4//! with step-by-step configuration. Use [`handler`] to create a
5//! [`DurableHandlerBuilder`], then call [`.run()`](DurableHandlerBuilder::run)
6//! to start the Lambda runtime.
7//!
8//! # Quick Start
9//!
10//! ```no_run
11//! use durable_lambda_builder::prelude::*;
12//!
13//! #[tokio::main]
14//! async fn main() -> Result<(), lambda_runtime::Error> {
15//!     durable_lambda_builder::handler(|event: serde_json::Value, mut ctx: BuilderContext| async move {
16//!         let order = ctx.step("validate_order", || async {
17//!             Ok::<_, String>(serde_json::json!({"id": 123, "valid": true}))
18//!         }).await?;
19//!         Ok(serde_json::json!({"order": order}))
20//!     })
21//!     .run()
22//!     .await
23//! }
24//! ```
25
26pub mod context;
27pub mod handler;
28pub mod prelude;
29
30pub use context::BuilderContext;
31pub use handler::{handler, DurableHandlerBuilder};