-
Notifications
You must be signed in to change notification settings - Fork 361
/
Copy pathlib.rs
39 lines (34 loc) · 1.31 KB
/
lib.rs
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
#![deny(clippy::all, clippy::cargo)]
#![allow(clippy::multiple_crate_versions, clippy::type_complexity)]
#![warn(missing_docs, nonstandard_style, rust_2018_idioms)]
//! This module includes utilities to create Lambda Runtime Extensions.
//!
//! Create a type that conforms to the [`Extension`] trait. This type can then be passed
//! to the the `lambda_extension::run` function, which launches and runs the Lambda runtime extension.
use std::{fmt, future::Future};
pub use tower::{self, make::Shared as SharedService, service_fn, Service};
mod error;
pub use error::*;
mod extension;
pub use extension::*;
mod events;
pub use events::*;
mod logs;
pub use logs::*;
mod telemetry;
pub use telemetry::*;
/// Include several request builders to interact with the Extension API.
pub mod requests;
/// Utilities to initialize and use `tracing` and `tracing-subscriber` in Lambda Functions.
#[cfg(feature = "tracing")]
pub use lambda_runtime_api_client::tracing;
/// Execute the given events processor
pub async fn run<E>(events_processor: E) -> Result<(), Error>
where
E: Service<LambdaEvent>,
E::Future: Future<Output = Result<(), E::Error>>,
E::Error: Into<Box<dyn std::error::Error + Send + Sync>> + fmt::Display + fmt::Debug,
{
let ext = Extension::new().with_events_processor(events_processor);
ext.run().await
}