1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! Trait-based API approach for durable Lambda handlers.
//!
//! This crate provides a trait-based API for writing durable Lambda functions
//! with a structured, object-oriented approach. Implement [`DurableHandler`] on
//! your struct, then use [`run`] as the single entry point — it handles all
//! `lambda_runtime` and `DurableContext` wiring internally.
//!
//! # Quick Start
//!
//! ```no_run
//! use durable_lambda_trait::prelude::*;
//! use async_trait::async_trait;
//!
//! struct OrderProcessor;
//!
//! #[async_trait]
//! impl DurableHandler for OrderProcessor {
//! async fn handle(
//! &self,
//! event: serde_json::Value,
//! mut ctx: TraitContext,
//! ) -> Result<serde_json::Value, DurableError> {
//! let order = ctx.step("validate_order", || async {
//! Ok::<_, String>(serde_json::json!({"id": 123, "valid": true}))
//! }).await?;
//! Ok(serde_json::json!({"order": order}))
//! }
//! }
//!
//! #[tokio::main]
//! async fn main() -> Result<(), lambda_runtime::Error> {
//! durable_lambda_trait::run(OrderProcessor).await
//! }
//! ```
pub use TraitContext;
pub use ;