Expand description
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 Vec<u8> and
outputs a Result with a Vec<u8> successful output.
Unless you have specific requirements to consume/produce raw bytes, you should look at the
lambda_runtime crate.
TODO: Add example
Macros§
- lambda
- Starts an event listener which will parse incoming events into the even type requested by
handlerand will invokehandleron each incoming event. Can optionally be passed a Tokioruntimeto build the listener on. If none is provided, it creates its own.
Structs§
- Context
- 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
Contextobject is passed to each handler invocation. - EnvConfig
Provider - Implementation of the
ConfigProvidertrait that reads the settings from environment variables in the Lambda execution environment. This is the config used by thestart()method of this module. - Handler
Error - The
HandlerErrorstruct can be use to abstract anyErrof the handler methodResult. TheHandlerErrorobject can be generatedFromany object that supportsDisplay,Send,Sync, andDebug. 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.
Traits§
- Config
Provider - Trait used by the
RustRuntimemodule to retrieve configuration information about the environement. This is implemented by theEnvConfigProviderusing the environment variables. We also have a mock implementation for the unit tests - Handler
- Functions acting as a handler must conform to this type.
- Lambda
Error Ext - The
LambdaErrorExttrait defines theerror_type()method used by the AWS Lambda runtime client to generateErrorResponseobjects. The value returned by theerror_type()method is used to populate theerrorTypefield 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. - Lambda
Result Ext Resulttype extension for AWS that makes it easy to generate aHandlerErrorobject or aCompat<Error>from the failure crate using an existing result. This trait should be imported from thelambda_runtime_coreorlambda_runtimecrates.
Functions§
- runtime_
release - returns metdata information about the Lambda runtime
- start
- Creates a new runtime and begins polling for events using Lambda’s Runtime APIs.
- start_
with_ config - 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
HttpRuntimeClientwhich is then passed to thestart_with_runtime_client()function.