From f1ca90f2882925c30f96ef60ccfd4fe39bc2c93b Mon Sep 17 00:00:00 2001 From: Lucio Franco Date: Mon, 4 Apr 2022 15:31:40 -0400 Subject: [PATCH] feat(transport): Add `channel` feature flag (#960) --- tonic/Cargo.toml | 3 +++ tonic/src/lib.rs | 4 +++- tonic/src/transport/mod.rs | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tonic/Cargo.toml b/tonic/Cargo.toml index 92ba4d453..c104f8c9b 100644 --- a/tonic/Cargo.toml +++ b/tonic/Cargo.toml @@ -33,6 +33,9 @@ tls-roots-common = ["tls"] tls-webpki-roots = ["tls-roots-common", "webpki-roots"] transport = [ "axum", + "channel" +] +channel = [ "h2", "hyper", "tokio", diff --git a/tonic/src/lib.rs b/tonic/src/lib.rs index c53f2601b..c4c0f188c 100644 --- a/tonic/src/lib.rs +++ b/tonic/src/lib.rs @@ -17,7 +17,9 @@ //! # Feature Flags //! //! - `transport`: Enables the fully featured, batteries included client and server -//! implementation based on [`hyper`], [`tower`] and [`tokio`]. Enabled by default. +//! implementation based on [`hyper`], [`tower`] and [`tokio`]. Enabled by default. +//! - `channel`: Enables just the full featured channel/client portion of the `transport` +//! feature. //! - `codegen`: Enables all the required exports and optional dependencies required //! for [`tonic-build`]. Enabled by default. //! - `tls`: Enables the `rustls` based TLS options for the `transport` feature. Not diff --git a/tonic/src/transport/mod.rs b/tonic/src/transport/mod.rs index 80db95605..e83b4c424 100644 --- a/tonic/src/transport/mod.rs +++ b/tonic/src/transport/mod.rs @@ -94,6 +94,8 @@ mod service; mod tls; #[doc(inline)] +#[cfg(feature = "channel")] +#[cfg_attr(docsrs, doc(cfg(feature = "channel")))] pub use self::channel::{Channel, Endpoint}; pub use self::error::Error; #[doc(inline)]