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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//! A framework for AWS Lambda functions in Rust: fast, small and correct by
//! default, so the code you write is the business logic.
//!
//! `davidrs` is a thin layer over the official runtime crates: it keeps
//! [`lambda_runtime`]/[`lambda_http`] and the AWS SDK as the transport, adds
//! an ordered pipeline in the same process as your handler, and owns the
//! surrounding invocation logic:
//!
//! - **One absolute deadline per invocation.** [`Deadline`] is a monotonic
//! instant; child budgets cannot outlive their parent, and every adapter
//! keeps a cleanup margin before Lambda's own timeout.
//! - **One ordered pipeline per trigger.** HTTP requests ([`http::Api`]
//! buffered, [`http::stream::StreamApi`] streamed) run their boundary checks,
//! authorization and handler in order. Both render failures before the
//! response starts; a streamed body reports later errors through the stream. SQS ([`queue`]), EventBridge ([`event`]),
//! schedules ([`schedule`]) and direct invocations ([`runtime`]) decode
//! their payload before the handler and report its failures to Lambda.
//! - **Safe error rendering.** A [`http::Failure`] carries a public message
//! and a separate internal detail; the built-in renderers use a fixed
//! string for every 5xx.
//! - **Explicit limits.** Buffered requests, bounded upstream readers,
//! decompressed payloads, paginated reads, retries and stream producers
//! have limits and report when they hit them.
//! - **Honest partial outcomes.** SQS batches report failures per record,
//! `PutEvents` and `BatchWriteItem` per entry, a bounded read says whether it
//! is complete.
//! - **Access and limits by configuration.** [`http::access::Access`] decides
//! who is calling, for which tenant and with what permission;
//! [`http::RateLimited`] counts requests across every instance.
//!
//! It is deliberately not a web framework: one Lambda serves one operation, so
//! there is no router, no middleware stack, no dependency-injection container
//! and no ORM. Application state is an ordinary struct the handler receives as
//! `Arc<App>`; persistence uses the SDK's own builders.
//!
//! # Features
//!
//! `default = []`. The empty crate is [`RuntimeError`], [`Invocation`],
//! [`Deadline`], [`Context`] and the environment readers — value types with no
//! runtime, no HTTP and no AWS SDK. Every capability is additive, named after
//! what it enables, and never quietly enables an unrelated one: a binary
//! compiles exactly the capabilities its `Cargo.toml` asks for.
//!
//! | Feature | Enables |
//! | --- | --- |
//! | `runtime` | [`runtime::run`]: the native Lambda loop over a typed payload |
//! | `http` | [`http::Api`]: the buffered API Gateway / Function URL pipeline, [`http::access`], [`http::RateLimited`], [`http::fields`] |
//! | `http-stream` | [`http::stream`]: streamed JSON and server-sent events with CORS and content negotiation |
//! | `apigw-rest` | REST API proxy events next to HTTP API |
//! | `alb` | Application Load Balancer events in the buffered pipeline |
//! | `streaming` | [`streaming`]: response bodies that own their producer |
//! | `queue`, `queue-visibility` | [`queue`]: SQS partial-batch processing, visibility changes |
//! | `event`, `schedule` | [`event`], [`schedule`]: typed EventBridge and scheduled payloads |
//! | `aws` | [`aws::sdk_config`]: SDK configuration from the Lambda environment |
//! | `dynamo` | [`dynamo`]: bounded DynamoDB reads and writes, cursors, spans |
//! | `eventbridge` | [`eventbridge`]: EventBridge publishing with per-entry outcomes |
//! | `secrets` | [`secrets`]: typed Secrets Manager reads that never echo a value |
//! | `client` | [`client`]: an outbound `reqwest` client with byte and time limits |
//! | `auth` | [`auth`]: RS256 / JWKS token verification with a bounded refresh |
//! | `cache` | [`cache`]: in-process caches (Moka) |
//! | `compression` | [`compression`]: gzip with a cap on the decoded size |
//! | `digest` | [`digest`]: SHA-256 and hex for identifiers and cache keys |
//! | `validate`, `problem` | Garde validation and RFC 9457 problem details |
//! | `logs`, `metrics`, `otel` | [`telemetry`]: logs, EMF metrics and X-Ray traces |
//! | `test-support` | [`test_support`]: synthetic invocations and requests |
//! | `mcp`, `mcp-openapi` | [`mcp`]: an MCP server with hand-written tools, or tools from an OpenAPI document |
//!
//! # Where to start
//!
//! The [`guide`] is organized by the job in front of you. Read
//! [`guide::introduction`] to decide whether the crate
//! fits, then [`guide::getting_started`], which builds
//! one function and shows the JSON a caller receives. After that, open the
//! chapter for the trigger or service you are deploying. The guide's examples
//! are compiled and tested. `examples/` in the repository holds one runnable
//! program per trigger.
pub use ;
pub use ;
pub use ;
/// The README's examples, compiled and run as doctests so they cannot drift.
;