Releases: awslabs/aws-lambda-rust-runtime
Releases · awslabs/aws-lambda-rust-runtime
Release 0.3.0
0.3.0
New: Almost everything!
-
Heavy restructuring was done in order to simplify the runtime and to enable asynchronous handlers by default.
-
The
lambda
crate has been renamed tolambda_runtime
, and the originallambda_runtime
has been removed from the project.lambda_http
remains the same. -
The
lambda_http
crate now supports API Gateway HTTP API Lambda triggers. -
Both
lambda_runtime
andlambda_http
have noteworthy, breaking API changes. The following is a rough approximation of what a transition to the new runtime API will be:note: the runtime is based on
std::future::Future
based and relies on Tokio via Hyper.→
main.rs
-use lambda_runtime::{error::HandlerError, lambda, Context}; +use lambda_runtime::{handler_fn, Context}; use serde_json::Value; +type Error = Box<dyn std::error::Error + Sync + Send + 'static>; -fn main() { - lambda!(handler) +#[tokio::main] +async fn main() -> Result<(), Error> { + lambda_runtime::run(handler_fn(handler)).await?; + Ok(()) } -fn handler( - event: Value, - _: Context, -) -> Result<Value, HandlerError> { +async fn handler( + event: Value, + _:Context +) -> Result<Value, Error> { Ok(event) }
Please refer to the examples in (lambda-runtime/examples; lambda-http/examples) for more detail.
Release 0.2.0
Features
- New: We created
lambda_runtime_core
crate that implements the runtime's main loop and supports handlers that accept and returnVec<u8>
. (#53) - New: The primary
lambda_runtime
crate is a wrapper on top of thelambda_runtime_core
handler (#53). - New: The
lambda_http
crate, which enables support for API Gateway or ALB requests, treating them asRequest
structs from thehttp
crate (#18 by @softprops). - New: The
lambda_runtime_errors
crate introduces theLambdaErrorExt
trait that enables the ability to specify customerrorType
values for the Lambda Runtime API. The change also includes a companionderive
crate that makes it easy to automatically generateLambdaErrorExt
implementations for crate-local error types (#63). - Fix: Handlers can now return any error type (#54).
- Fix: Support for closures as handlers (#19 by @srijs).
- Fix: Multiple bug fixes and performance improvements (thanks @Sh4rK).