From a1d6daacc587d7fedc40d4694ff2941dd5c558a9 Mon Sep 17 00:00:00 2001 From: A L Manning <10554686+A-Manning@users.noreply.github.com> Date: Thu, 25 Jan 2024 23:01:17 +0800 Subject: [PATCH] tonic-reflection: feature-gate server impl (#1605) * tonic-reflection: feature-gate server impl * Update tonic-reflection/Cargo.toml --------- Co-authored-by: Lucio Franco --- tonic-reflection/Cargo.toml | 12 ++++++++++-- tonic-reflection/src/lib.rs | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tonic-reflection/Cargo.toml b/tonic-reflection/Cargo.toml index 6b764354a..302107432 100644 --- a/tonic-reflection/Cargo.toml +++ b/tonic-reflection/Cargo.toml @@ -17,11 +17,19 @@ readme = "README.md" repository = "https://github.com/hyperium/tonic" version = "0.10.2" +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + +[features] +server = ["dep:tokio", "dep:tokio-stream"] +default = ["server"] + [dependencies] prost = "0.12" prost-types = "0.12" -tokio = {version = "1.0", features = ["sync", "rt"]} -tokio-stream = {version = "0.1", features = ["net"]} +tokio = { version = "1.0", features = ["sync", "rt"], optional = true } +tokio-stream = {version = "0.1", features = ["net"], optional = true } tonic = { version = "0.10", path = "../tonic", default-features = false, features = ["codegen", "prost"] } [dev-dependencies] diff --git a/tonic-reflection/src/lib.rs b/tonic-reflection/src/lib.rs index 01d011083..c15f23229 100644 --- a/tonic-reflection/src/lib.rs +++ b/tonic-reflection/src/lib.rs @@ -43,4 +43,6 @@ pub mod pb { } /// Implementation of the server component of gRPC Server Reflection. +#[cfg(feature = "server")] +#[cfg_attr(docsrs, doc(cfg(feature = "server")))] pub mod server;