Skip to main content

durable_lambda_closure/
lib.rs

1//! Closure-native API approach for durable Lambda handlers.
2//!
3//! This crate provides a closure-based API for writing durable Lambda functions
4//! with minimal boilerplate. Use [`run`] as the single entry point — it handles
5//! all `lambda_runtime` and `DurableContext` wiring internally.
6//!
7//! # Quick Start
8//!
9//! ```no_run
10//! use durable_lambda_closure::prelude::*;
11//!
12//! async fn handler(
13//!     event: serde_json::Value,
14//!     mut ctx: ClosureContext,
15//! ) -> Result<serde_json::Value, DurableError> {
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//!
22//! #[tokio::main]
23//! async fn main() -> Result<(), lambda_runtime::Error> {
24//!     durable_lambda_closure::run(handler).await
25//! }
26//! ```
27
28pub mod context;
29pub mod handler;
30pub mod prelude;
31
32pub use context::ClosureContext;
33pub use handler::run;