diff --git a/README.md b/README.md index af3753fe..d0e45dc2 100644 --- a/README.md +++ b/README.md @@ -94,12 +94,21 @@ For error reporting to the runtime APIs the library defines the `RuntimeApiError ## lambda-runtime -This library makes it easy to create Rust executables for AWS lambda. The library defines a `lambda!()` macro. Call the `lambda!()` macro from your main method with a function that matches the `Handler` type: +This library makes it easy to create Rust executables for AWS lambda. The library defines a `lambda!()` macro. Call the `lambda!()` macro from your main method with an implementation the `Handler` type: -```rust,ignore -pub type Handler = fn(E, Context) -> Result; +```rust +pub trait Handler { + /// Run the handler. + fn run( + &mut self, + event: E, + ctx: Context + ) -> Result; +} ``` +`Handler` provides a default implementation that enables you to provide a Rust closure or function pointer to the `lambda!()` macro. + Optionally, you can pass your own instance of Tokio runtime to the `lambda!()` macro. See our [`with_custom_runtime.rs` example](https://github.com/awslabs/aws-lambda-rust-runtime/tree/master/lambda-runtime/examples/with_custom_runtime.rs) ## AWS event objects