From 41d0f6ac5ed11df9490b1d9f55aea2fd3c63cccf Mon Sep 17 00:00:00 2001 From: Lucio Franco Date: Tue, 24 Sep 2019 18:32:39 -0400 Subject: [PATCH] more feature flgs --- tonic/Cargo.toml | 13 ++++++------- tonic/src/lib.rs | 9 +++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/tonic/Cargo.toml b/tonic/Cargo.toml index 0ded4e1..8e0321c 100644 --- a/tonic/Cargo.toml +++ b/tonic/Cargo.toml @@ -18,10 +18,11 @@ tokio-codec = "=0.2.0-alpha.4" async-stream = "0.1.1" http-body = "0.2.0-alpha.1" pin-project = "=0.4.0-alpha.11" -async-trait = "0.1" -# optional -# hyper = { version = "=0.13.0-alpha.1", optional = true } +# codegen +async-trait = { version = "0.1.13", optional = true } + +# transport hyper = { git = "https://github.com/hyperium/hyper", features = ["unstable-stream"], optional = true, rev = "2b0405c48c10bca7893c30ea960ac20a41a8578f" } tokio = { version = "=0.2.0-alpha.4", default-features = false, features = ["tcp"], optional = true } tower = { version = "=0.3.0-alpha.1a", optional = true} @@ -38,13 +39,11 @@ openssl1 = { package = "openssl", version = "0.10", optional = true } tokio-rustls = { version = "0.12.0-alpha.2", optional = true } [features] -default = ["transport"] +default = ["transport", "codegen"] +codegen = ["async-trait"] transport = [ "hyper", - "tower-1", "tokio", -] -tower-1 = [ "tower", "tower-reconnect", "tower-balance", diff --git a/tonic/src/lib.rs b/tonic/src/lib.rs index 5124564..9e6cf1c 100644 --- a/tonic/src/lib.rs +++ b/tonic/src/lib.rs @@ -20,6 +20,11 @@ //! //! Examples can be found in the [`tonic-examples`] crate. //! +//! # Feature Flags +//! +//! - `transport`: Enables the fully featured, batteries included client and server +//! implementaiton based on [`hyper`], [`tower`] and [`tokio`]. +//! //! # Generic implementation //! //! TODO: write generic implementation docs @@ -45,7 +50,10 @@ mod request; mod response; mod status; +/// A re-export of [`async-trait`](https://docs.rs/async-trait) for use with codegen. +#[cfg(feature = "codegen")] pub use async_trait::async_trait; + #[doc(inline)] pub use codec::Streaming; pub use request::Request; @@ -55,4 +63,5 @@ pub use status::{Code, Status}; pub(crate) type Error = Box; #[doc(hidden)] +#[cfg(feature = "codegen")] pub mod codegen;