Skip to main content

run

Function run 

Source
pub async fn run<'a, R, S, E>(handler: S) -> Result<(), Error>
where S: Service<Request, Response = R, Error = E>, S::Future: Send + 'a, R: IntoResponse, E: Debug + Into<Diagnostic>,
Expand description

Starts the Lambda Rust runtime and begins polling for events on the Lambda Runtime APIs.

This takes care of transforming the LambdaEvent into a Request and then converting the result into a LambdaResponse.

§Managed concurrency

If AWS_LAMBDA_MAX_CONCURRENCY is set, a warning is logged. If your handler can satisfy Clone + Send + 'static, prefer run_concurrent (requires the concurrency-tokio feature), which honors managed concurrency and falls back to sequential behavior when unset.

§Panics

This function panics if required Lambda environment variables are missing (AWS_LAMBDA_FUNCTION_NAME, AWS_LAMBDA_FUNCTION_MEMORY_SIZE, AWS_LAMBDA_FUNCTION_VERSION, AWS_LAMBDA_RUNTIME_API).