Starts the Lambda Rust runtime and begins polling for events on the [Lambda Runtime APIs](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-api.html). If you need more control over the runtime and add custom middleware, use the [Runtime] type directly. # Managed concurrency If `AWS_LAMBDA_MAX_CONCURRENCY` is set, a warning is logged. If your handler can satisfy `Clone + Send + 'static`, pref
(handler: F)
| 127 | /// (`AWS_LAMBDA_FUNCTION_NAME`, `AWS_LAMBDA_FUNCTION_MEMORY_SIZE`, |
| 128 | /// `AWS_LAMBDA_FUNCTION_VERSION`, `AWS_LAMBDA_RUNTIME_API`). |
| 129 | pub async fn run<A, F, R, B, S, D, E>(handler: F) -> Result<(), Error> |
| 130 | where |
| 131 | F: Service<LambdaEvent<A>, Response = R>, |
| 132 | F::Future: Future<Output = Result<R, F::Error>>, |
| 133 | F::Error: Into<Diagnostic> + fmt::Debug, |
| 134 | A: for<'de> Deserialize<'de>, |
| 135 | R: IntoFunctionResponse<B, S>, |
| 136 | B: Serialize, |
| 137 | S: Stream<Item = Result<D, E>> + Unpin + Send + 'static, |
| 138 | D: Into<bytes::Bytes> + Send, |
| 139 | E: Into<Error> + Send + Debug, |
| 140 | { |
| 141 | let runtime = Runtime::new(handler).layer(layers::TracingLayer::new()); |
| 142 | runtime.run().await |
| 143 | } |
| 144 | |
| 145 | /// Starts the Lambda Rust runtime in a mode that is compatible with |
| 146 | /// Lambda Managed Instances (concurrent invocations). |