Function lambda_runtime::run [−][src]
pub async fn run<A, B, F>(handler: F) -> Result<(), Error> where
F: Handler<A, B> + Send + Sync + 'static,
<F as Handler<A, B>>::Fut: Future<Output = Result<B, <F as Handler<A, B>>::Error>> + Send + 'static,
<F as Handler<A, B>>::Error: Display + Send + Sync + 'static,
A: for<'de> Deserialize<'de> + Send + Sync + 'static,
B: Serialize + Send + Sync + 'static,
Starts the Lambda Rust runtime and begins polling for events on the Lambda Runtime APIs.
Example
use lambda_runtime::{handler_fn, Context}; use serde_json::Value; type Error = Box<dyn std::error::Error + Send + Sync + 'static>; #[tokio::main] async fn main() -> Result<(), Error> { let func = handler_fn(func); lambda_runtime::run(func).await?; Ok(()) } async fn func(event: Value, _: Context) -> Result<Value, Error> { Ok(event) }