[−][src]Function netlify_lambda::run
pub async fn run<A, B, F>(
handler: F
) -> Result<(), Box<dyn Error + Send + Sync + 'static>> where
F: Handler<A, B>,
<F as Handler<A, B>>::Error: Debug,
A: for<'de> Deserialize<'de>,
B: Serialize,
Starts the Lambda Rust runtime and begins polling for events on the Lambda Runtime APIs.
Example
use netlify_lambda::{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); netlify_lambda::run(func).await?; Ok(()) } async fn func(event: Value, _: Context) -> Result<Value, Error> { Ok(event) }