Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lambda/examples/hello-with-ctx.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use lambda::lambda;
use serde_json::Value;

type Error = Box<dyn std::error::Error + Send + Sync + 'static>;

#[lambda]
#[tokio::main]
async fn main(event: String) -> Result<String, Error> {
async fn main(event: Value) -> Result<Value, Error> {
Ok(event)
}
3 changes: 2 additions & 1 deletion lambda/examples/hello-without-macro.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use lambda::handler_fn;
use serde_json::Value;

type Error = Box<dyn std::error::Error + Send + Sync + 'static>;

Expand All @@ -9,6 +10,6 @@ async fn main() -> Result<(), Error> {
Ok(())
}

async fn func(event: String) -> Result<String, Error> {
async fn func(event: Value) -> Result<Value, Error> {
Ok(event)
}
3 changes: 2 additions & 1 deletion lambda/examples/hello.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use lambda::lambda;
use serde_json::Value;

type Error = Box<dyn std::error::Error + Send + Sync + 'static>;

#[lambda]
#[tokio::main]
async fn main(event: String) -> Result<String, Error> {
async fn main(event: Value) -> Result<Value, Error> {
Ok(event)
}
8 changes: 5 additions & 3 deletions lambda/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
//!
//! ```no_run
//! use lambda::lambda;
//! use serde_json::Value;
//!
//! type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
//!
//! #[lambda]
//! #[tokio::main]
//! async fn main(event: String) -> Result<String, Error> {
//! async fn main(event: Value) -> Result<Value, Error> {
//! Ok(event)
//! }
//! ```
Expand Down Expand Up @@ -136,6 +137,7 @@ where
/// # Example
/// ```no_run
/// use lambda::handler_fn;
/// use serde_json::Value;
///
/// type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
///
Expand All @@ -146,8 +148,8 @@ where
/// Ok(())
/// }
///
/// async fn func(s: String) -> Result<String, Error> {
/// Ok(s)
/// async fn func(event: Value) -> Result<Value, Error> {
/// Ok(event)
/// }
/// ```
pub async fn run<A, B, F>(handler: F) -> Result<(), Err>
Expand Down