From 086cedd3fb1db2b87a8e6c6d1beedae72f3d0515 Mon Sep 17 00:00:00 2001 From: softprops Date: Sun, 16 Dec 2018 13:59:53 +0900 Subject: [PATCH 1/2] update out of date readme doc on runtime handler type --- README.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index af3753fe..de3cb1df 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 a 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` is provides a default implementation that enables you to provide a Rust closure or function pointer. + 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 From f83f8a199c212b5679d6c811b04b21d49f2d5d95 Mon Sep 17 00:00:00 2001 From: softprops Date: Sun, 16 Dec 2018 14:04:28 +0900 Subject: [PATCH 2/2] typo --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index de3cb1df..d0e45dc2 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ 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 implementation 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 pub trait Handler { @@ -107,7 +107,7 @@ pub trait Handler { } ``` -`Handler` is provides a default implementation that enables you to provide a Rust closure or function pointer. +`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)