lambda_sqs/lib.rs
1#![cfg_attr(docsrs, feature(doc_cfg))]
2#![warn(missing_docs)]
3#![cfg_attr(docsrs, feature(rustdoc_missing_doc_code_examples))]
4#![cfg_attr(docsrs, warn(rustdoc::missing_doc_code_examples))]
5#![cfg_attr(docsrs, warn(rustdoc::invalid_codeblock_attributes))]
6
7//! lambda_sqs
8//!
9//! Specialised lambda_runtime to accept and process events from SQS.
10//!
11//! # SQS Events
12//!
13//! SQS dispatches events to the a lambda function in batches (often, it seems
14//! to my surprise). This crate provides a lambda_runtime implementation which
15//! expects to receive a batch of messages in the [SqsEvent] type and provides
16//! a method to transform the batch of events to a vector of your Struct.
17//!
18//! # Example
19//!
20//! In Cargo.toml add lambda_sqs as a dependency.
21//!
22//! ```toml
23//! [dependencies]
24//! lambda_sqs = " {0.2.37"
25//! ```
26//!
27//! ```no_run
28//! # type YourStruct = String;
29//! use lambda_sqs::{handler_fn, Context, Error};
30//! use lambda_sqs::SqsEvent;
31//!
32//! #[tokio::main]
33//! async fn main() -> Result<(), Error> {
34//! lambda_sqs::run(handler_fn(my_handler)).await?;
35//!
36//! Ok(())
37//! }
38//!
39//! async fn my_handler(e: SqsEvent, c: Context) -> Result<(), Error> {
40//! let events: Vec<YourStruct> = e.into_t();
41//!# // Process events
42//!# Ok(())
43//!# }
44//! ```
45//!
46
47mod domain;
48
49pub use domain::SqsEvent;
50pub use lambda_runtime::*;