Skip to content

Commit 0a713c6

Browse files
committed
refactor: Update test_func code
- Rust Edition 2021 - Latest lambda_runtime - tokio for async support
1 parent 0956326 commit 0a713c6

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

tests/test-func/Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/test-func/Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "test-func"
3-
version = "0.1.0"
4-
authors = ["softprops <d.tangren@gmail.com>"]
3+
version = "0.2.0"
4+
authors = ["softprops <d.tangren@gmail.com>", "jerusdp <jrussell@jerus.ie>"]
55
edition = "2021"
66

77
# users don't have to do this
@@ -11,5 +11,6 @@ name = "bootstrap"
1111
path = "src/main.rs"
1212

1313
[dependencies]
14-
lambda_runtime = "0.4.1"
15-
serde_json = "1.0"
14+
lambda_runtime = "0.4"
15+
serde_json = "1.0"
16+
tokio = "1.14"

tests/test-func/src/main.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
use lambda_runtime::{error::HandlerError, lambda, Context};
1+
use lambda_runtime::{Error,Context};
22
use serde_json::Value;
33

4-
fn main() {
5-
lambda!(handler)
4+
#[tokio::main]
5+
async fn main() -> Result<(), Error> {
6+
lambda_runtime::run(lambda_runtime::handler_fn(handler)).await?;
7+
Ok(())
68
}
79

8-
fn handler(
9-
event: Value,
10-
_: Context,
11-
) -> Result<Value, HandlerError> {
10+
async fn handler(event: Value, _: Context) -> Result<Value, Error> {
1211
Ok(event)
13-
}
12+
}

0 commit comments

Comments
 (0)