[][src]Crate lambda_runtime_core

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


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.


The HandlerError struct can be use to abstract any Err of the handler method Result. The HandlerError object can be generated From any object that supports Display, Send, Sync, 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 EnvConfigProvider using the environment variables. We also have a mock implementation for the unit tests


Functions acting as a handler must conform to this type.


The LambdaErrorExt trait defines the error_type() method used by the AWS Lambda runtime client to generate ErrorResponse objects. The value returned by the error_type() method is used to populate the 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 HandlerError object or a Compat<Error> from the failure crate using an existing result. This trait should be imported from the lambda_runtime_core or lambda_runtime crates.



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 start_with_runtime_client() function.