Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
walk back pub type alias for lambda::Error
  • Loading branch information
softprops committed May 27, 2020
commit 2278170de6fa5019cc62c8198c4a6a392a501c7e
4 changes: 3 additions & 1 deletion lambda-http/examples/hello-http-without-macros.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use lambda_http::{handler, lambda, Error, IntoResponse, Request, RequestExt, Response};
use lambda_http::{handler, lambda, IntoResponse, Request, RequestExt, Response};

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

#[tokio::main]
async fn main() -> Result<(), Error> {
Expand Down
4 changes: 3 additions & 1 deletion lambda-http/examples/hello-http.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use lambda_http::{lambda, Error, IntoResponse, Request};
use lambda_http::{lambda, IntoResponse, Request};

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

#[lambda(http)]
#[tokio::main]
Expand Down
4 changes: 3 additions & 1 deletion lambda-http/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ impl Error for PayloadError {
/// as well as `{"x":1, "y":2}` respectively.
///
/// ```rust,no_run
/// use lambda_http::{handler, lambda, Error, Body, IntoResponse, Request, Response, RequestExt};
/// use lambda_http::{handler, lambda, Body, IntoResponse, Request, Response, RequestExt};
/// use serde_derive::Deserialize;
///
/// type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
///
/// #[derive(Debug,Deserialize,Default)]
/// struct Args {
/// #[serde(default)]
Expand Down
19 changes: 14 additions & 5 deletions lambda-http/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
//! The full body of your `main` function will be executed on **every** invocation of your lambda task.
//!
//! ```rust,no_run
//! use lambda_http::{lambda, Error, Request, IntoResponse};
//! use lambda_http::{lambda, Request, IntoResponse};
//!
//! type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
//!
//! #[lambda(http)]
//! #[tokio::main]
Expand All @@ -38,7 +40,9 @@
//! Depending on the runtime cost of your dependency bootstrapping, this can reduce the overall latency of your functions execution path.
//!
//! ```rust,no_run
//! use lambda_http::{handler, lambda, Error};
//! use lambda_http::{handler, lambda};
//!
//! type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Error> {
Expand All @@ -56,7 +60,9 @@
//! with the [`RequestExt`](trait.RequestExt.html) trait.
//!
//! ```rust,no_run
//! use lambda_http::{handler, lambda, Error, IntoResponse, Request, RequestExt};
//! use lambda_http::{handler, lambda, IntoResponse, Request, RequestExt};
//!
//! type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Error> {
Expand Down Expand Up @@ -84,9 +90,9 @@ extern crate maplit;

pub use http::{self, Response};
use lambda::Handler as LambdaHandler;
pub use lambda::{self, Error};
pub use lambda::{self};
pub use lambda_attributes::lambda;
//pub use lambda_http_attributes::lambda_http;

mod body;
pub mod ext;
pub mod request;
Expand All @@ -100,6 +106,9 @@ use std::{
task::{Context, Poll},
};

/// Error type that lambdas may result in
pub(crate) type Error = Box<dyn std::error::Error + Send + Sync + 'static>;

/// Type alias for `http::Request`s with a fixed [`Body`](enum.Body.html) type
pub type Request = http::Request<Body>;

Expand Down
4 changes: 3 additions & 1 deletion lambda/examples/hello-with-ctx.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use lambda::{lambda, Error};
use lambda::lambda;
use serde_json::Value;

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

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

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

#[tokio::main]
async fn main() -> Result<(), Error> {
let func = handler_fn(func);
Expand Down
4 changes: 3 additions & 1 deletion lambda/examples/hello.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use lambda::{lambda, Error};
use lambda::lambda;
use serde_json::Value;

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

#[lambda]
#[tokio::main]
async fn main(event: Value) -> Result<Value, Error> {
Expand Down
10 changes: 7 additions & 3 deletions lambda/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
//! of [`lambda::LambdaCtx`].
//!
//! ```no_run
//! use lambda::{lambda, Error};
//! use lambda::{lambda};
//! use serde_json::Value;
//!
//! type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
//!
//! #[lambda]
//! #[tokio::main]
//! async fn main(event: Value) -> Result<Value, Error> {
Expand Down Expand Up @@ -56,7 +58,7 @@ use requests::{EventCompletionRequest, EventErrorRequest, IntoRequest, NextEvent
use types::Diagnostic;

/// Error type that lambdas may result in
pub type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
pub(crate) type Error = Box<dyn std::error::Error + Send + Sync + 'static>;

/// Configuration derived from environment variables.
#[derive(Debug, Default, Clone, PartialEq)]
Expand Down Expand Up @@ -134,9 +136,11 @@ where
///
/// # Example
/// ```no_run
/// use lambda::{handler_fn, Error};
/// use lambda::{handler_fn};
/// use serde_json::Value;
///
/// type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
///
/// #[tokio::main]
/// async fn main() -> Result<(), Error> {
/// let func = handler_fn(func);
Expand Down