From 4c8fff0f2c4b21efa15a33a5ad623a9ee81d7dff Mon Sep 17 00:00:00 2001 From: sapessi Date: Thu, 24 Jan 2019 14:11:31 -0800 Subject: [PATCH 1/3] Added errors and derive crate to workspace and exported derive crate from errors crate --- Cargo.lock | 13 +++++++++++++ Cargo.toml | 4 +++- lambda-runtime-errors/Cargo.toml | 1 + lambda-runtime-errors/src/lib.rs | 13 +++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 61770fcc..69e7d07a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -342,10 +342,23 @@ version = "0.1.0" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "lambda_runtime_core 0.1.0", + "lambda_runtime_errors_derive 0.1.0", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "lambda_runtime_errors_derive" +version = "0.1.0" +dependencies = [ + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lambda_runtime_errors 0.1.0", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "lazy_static" version = "1.2.0" diff --git a/Cargo.toml b/Cargo.toml index a7dff3e7..255cc695 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,5 +3,7 @@ members = [ "lambda-runtime-client", "lambda-runtime-core", "lambda-runtime", - "lambda-http" + "lambda-http", + "lambda-runtime-errors", + "lambda-runtime-errors-derive" ] \ No newline at end of file diff --git a/lambda-runtime-errors/Cargo.toml b/lambda-runtime-errors/Cargo.toml index c23a2a92..00534efe 100644 --- a/lambda-runtime-errors/Cargo.toml +++ b/lambda-runtime-errors/Cargo.toml @@ -14,6 +14,7 @@ documentation = "https://docs.rs/lambda_runtime" log = "^0.4" failure = "^0.1" serde_json = "^1" +lambda_runtime_errors_derive = { path = "../lambda-runtime-errors-derive", version = "^0.1" } [dev-dependencies] lambda_runtime_core = { path = "../lambda-runtime-core", version = "^0.1"} diff --git a/lambda-runtime-errors/src/lib.rs b/lambda-runtime-errors/src/lib.rs index b4cce3c4..09645480 100644 --- a/lambda-runtime-errors/src/lib.rs +++ b/lambda-runtime-errors/src/lib.rs @@ -1,9 +1,22 @@ //! The Lambda runtime errors crate defines the `LambdaErrorExt` trait //! that can be used by libriaries to return errors compatible with the //! AWS Lambda Rust runtime. +//! +//! This crate also exports the `lambda_runtime_errors_derive` crate to +//! make it easy to automatically generate implementations of the `LambdaErrorExt` +//! trait. +//! +//! ```rust,no-run +//! use lambda_runtime_errors::*; +//! +//! // the error_type() method will return "your::mod::BasicCustomError". +//! #[derive(LambdaErrorExt)] +//! struct BasicCustomError; +//! ``` mod error_ext_impl; pub use crate::error_ext_impl::*; +pub use lambda_runtime_errors_derive::*; use failure::{format_err, Compat, Error, Fail}; use std::fmt; From f734b7b5309b8e7b0d8bdd10b0f812188f674900 Mon Sep 17 00:00:00 2001 From: sapessi Date: Thu, 24 Jan 2019 14:27:42 -0800 Subject: [PATCH 2/3] Doc updates from CR --- lambda-runtime-errors/src/lib.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lambda-runtime-errors/src/lib.rs b/lambda-runtime-errors/src/lib.rs index 09645480..13881331 100644 --- a/lambda-runtime-errors/src/lib.rs +++ b/lambda-runtime-errors/src/lib.rs @@ -3,15 +3,14 @@ //! AWS Lambda Rust runtime. //! //! This crate also exports the `lambda_runtime_errors_derive` crate to -//! make it easy to automatically generate implementations of the `LambdaErrorExt` -//! trait. +//! derive the `LambdaErrorExt` trait. //! //! ```rust,no-run //! use lambda_runtime_errors::*; //! -//! // the error_type() method will return "your::mod::BasicCustomError". +//! // the generated error_type() method returns "crate::LambdaError" //! #[derive(LambdaErrorExt)] -//! struct BasicCustomError; +//! struct LambdaError; //! ``` mod error_ext_impl; From b0f9c888d5e388472d3b04554c6b2a75ae17b66f Mon Sep 17 00:00:00 2001 From: sapessi Date: Thu, 24 Jan 2019 14:48:10 -0800 Subject: [PATCH 3/3] Updated docs links for crate --- lambda-runtime-core/Cargo.toml | 2 +- lambda-runtime-errors-derive/Cargo.toml | 2 +- lambda-runtime-errors/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lambda-runtime-core/Cargo.toml b/lambda-runtime-core/Cargo.toml index 95821ff4..459d3e41 100644 --- a/lambda-runtime-core/Cargo.toml +++ b/lambda-runtime-core/Cargo.toml @@ -7,7 +7,7 @@ keywords = ["AWS", "Lambda", "Runtime", "Rust"] license = "Apache-2.0" homepage = "https://github.com/awslabs/aws-lambda-rust-runtime" repository = "https://github.com/awslabs/aws-lambda-rust-runtime" -documentation = "https://docs.rs/lambda_runtime" +documentation = "https://docs.rs/lambda_runtime_core" edition = "2018" [dependencies] diff --git a/lambda-runtime-errors-derive/Cargo.toml b/lambda-runtime-errors-derive/Cargo.toml index 55a2fb6c..3a58585b 100644 --- a/lambda-runtime-errors-derive/Cargo.toml +++ b/lambda-runtime-errors-derive/Cargo.toml @@ -8,7 +8,7 @@ keywords = ["AWS", "Lambda", "Runtime", "Rust"] license = "Apache-2.0" homepage = "https://github.com/awslabs/aws-lambda-rust-runtime" repository = "https://github.com/awslabs/aws-lambda-rust-runtime" -documentation = "https://docs.rs/lambda_runtime" +documentation = "https://docs.rs/lambda_runtime_errors_derive" [dependencies] syn = "^0.15" diff --git a/lambda-runtime-errors/Cargo.toml b/lambda-runtime-errors/Cargo.toml index 00534efe..99f26d39 100644 --- a/lambda-runtime-errors/Cargo.toml +++ b/lambda-runtime-errors/Cargo.toml @@ -8,7 +8,7 @@ keywords = ["AWS", "Lambda", "Runtime", "Rust"] license = "Apache-2.0" homepage = "https://github.com/awslabs/aws-lambda-rust-runtime" repository = "https://github.com/awslabs/aws-lambda-rust-runtime" -documentation = "https://docs.rs/lambda_runtime" +documentation = "https://docs.rs/lambda_runtime_errors" [dependencies] log = "^0.4"