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
13 changes: 3 additions & 10 deletions lambda-http/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
//! your function's execution path.
//!
//! ```rust,no_run
//! use lambda_http::{handler, lambda_runtime};
//!
//! type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
//! use lambda_http::{handler, lambda_runtime::{self, Error}};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Error> {
Expand All @@ -36,9 +34,7 @@
//! with the [`RequestExt`](trait.RequestExt.html) trait.
//!
//! ```rust,no_run
//! use lambda_http::{handler, lambda_runtime::{self, Context}, IntoResponse, Request, RequestExt};
//!
//! type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
//! use lambda_http::{handler, lambda_runtime::{self, Context, Error}, IntoResponse, Request, RequestExt};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Error> {
Expand Down Expand Up @@ -66,8 +62,8 @@
extern crate maplit;

pub use http::{self, Response};
use lambda_runtime::Handler as LambdaHandler;
pub use lambda_runtime::{self, Context};
use lambda_runtime::{Error, Handler as LambdaHandler};

mod body;
pub mod ext;
Expand All @@ -85,9 +81,6 @@ use std::{
task::{Context as TaskContext, 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
6 changes: 1 addition & 5 deletions lambda-runtime/examples/basic.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
// This example requires the following input to succeed:
// { "command": "do something" }

use lambda_runtime::{handler_fn, Context};
use lambda_runtime::{handler_fn, Context, Error};
use log::LevelFilter;
use serde::{Deserialize, Serialize};
use simple_logger::SimpleLogger;

/// A shorthand for `Box<dyn std::error::Error + Send + Sync + 'static>`
/// type required by aws-lambda-rust-runtime.
pub type Error = Box<dyn std::error::Error + Send + Sync + 'static>;

/// This is also a made-up example. Requests come into the runtime as unicode
/// strings in json format, which can map to any structure that implements `serde::Deserialize`
/// The runtime pays no attention to the contents of the request payload.
Expand Down
5 changes: 1 addition & 4 deletions lambda-runtime/examples/error-handling.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/// See https://github.com/awslabs/aws-lambda-rust-runtime for more info on Rust runtime for AWS Lambda
use lambda_runtime::handler_fn;
use lambda_runtime::{handler_fn, Error};
use log::LevelFilter;
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
use simple_logger::SimpleLogger;
use std::fs::File;

/// A shorthand for `Box<dyn std::error::Error + Send + Sync + 'static>` type required by aws-lambda-rust-runtime.
pub type Error = Box<dyn std::error::Error + Send + Sync + 'static>;

/// A simple Lambda request structure with just one field
/// that tells the Lambda what is expected of it.
#[derive(Deserialize)]
Expand Down
2 changes: 1 addition & 1 deletion lambda-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use requests::{EventCompletionRequest, EventErrorRequest, IntoRequest, NextEvent
use types::Diagnostic;

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

/// Configuration derived from environment variables.
#[derive(Debug, Default, Clone, PartialEq)]
Expand Down