The Lambda runtime core crate implements Lambda's custom runtime main loop.
The crate receives a
Handler type that consumed events in the form of
Result with a
Vec<u8> successful output.
Unless you have specific requirements to consume/produce raw bytes, you should look at the
TODO: Add example
pub use lambda_runtime_errors::LambdaErrorExt;
Starts an event listener which will parse incoming events into the even type requested by
handler and will invoke
handler on each incoming event. Can optionally be passed a Tokio
runtime to build the listener on. If none is provided, it creates its own.
The Lambda function execution context. The values in this struct
are populated using the Lambda environment variables
and the headers returned by the poll request to the Runtime APIs.
A new instance of the
Context object is passed to each handler invocation.
Implementation of the
ConfigProvider trait that reads the settings from
environment variables in the Lambda execution environment. This is the config
used by the
start() method of this module.
HandlerError struct can be use to abstract any
Err of the handler method
HandlerError object can be generated
From any object that supports
, and Debug
. This allows handler functions to return any error using the ?
syntax. For examplelet _age_num: u8 = e.age.parse()?;
will return the::Err` from the handler function.
Trait used by the
RustRuntime module to retrieve configuration information
about the environement. This is implemented by the
the environment variables. We also have a mock implementation for the unit tests
Functions acting as a handler must conform to this type.
LambdaErrorExt trait defines the
error_type() method used
by the AWS Lambda runtime client to generate
objects. The value returned by the
error_type() method is used to
errorType field in the Lambda response. This crate
includes an implementation of this trait for most errors in the
standard library. By default, error return their type name.
Result type extension for AWS that makes it easy to generate a
object or a
Compat<Error> from the failure crate using an existing result.
This trait should be imported from the
returns metdata information about the Lambda runtime
Creates a new runtime and begins polling for events using Lambda's Runtime APIs.
Internal implementation of the start method that receives a config provider. This method
is used for unit tests with a mock provider. The provider data is used to construct the
HttpRuntimeClient which is then passed to the