You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-3Lines changed: 12 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -137,12 +137,21 @@ For error reporting to the runtime APIs the library defines the `RuntimeApiError
137
137
138
138
## lambda-runtime
139
139
140
-
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:
140
+
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:
141
141
142
-
```rust,ignore
143
-
pub type Handler<E, O> = fn(E, Context) -> Result<O, error::HandlerError>;
142
+
```rust
143
+
pubtraitHandler<E, O> {
144
+
/// Run the handler.
145
+
fnrun(
146
+
&mutself,
147
+
event:E,
148
+
ctx:Context
149
+
) ->Result<O, HandlerError>;
150
+
}
144
151
```
145
152
153
+
`Handler` provides a default implementation that enables you to provide a Rust closure or function pointer to the `lambda!()` macro.
154
+
146
155
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)
0 commit comments