diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ce2a9ce59..1007ebfc3 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -29,7 +29,7 @@ jobs: - name: Install Protoc uses: arduino/setup-protoc@v1 with: - repo-token: ${{ secrets.GITHUB_TOKEN }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - uses: Swatinem/rust-cache@v1 - name: Check fmt run: cargo fmt -- --check @@ -66,7 +66,7 @@ jobs: - name: Install Protoc uses: arduino/setup-protoc@v1 with: - repo-token: ${{ secrets.GITHUB_TOKEN }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - uses: Swatinem/rust-cache@v1 - uses: actions/checkout@master - name: Run tests @@ -93,7 +93,7 @@ jobs: - name: Install Protoc uses: arduino/setup-protoc@v1 with: - repo-token: ${{ secrets.GITHUB_TOKEN }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - uses: Swatinem/rust-cache@v1 - name: Run interop tests run: ./interop/test.sh diff --git a/tonic-health/Cargo.toml b/tonic-health/Cargo.toml index b1dcb44b8..049c29676 100644 --- a/tonic-health/Cargo.toml +++ b/tonic-health/Cargo.toml @@ -16,7 +16,7 @@ version = "0.7.1" [features] default = ["transport"] -transport = ["tonic/transport"] +transport = [] [dependencies] async-stream = "0.3" @@ -24,8 +24,8 @@ bytes = "1.0" prost = "0.11" tokio = {version = "1.0", features = ["sync"]} tokio-stream = "0.1" -tonic = {version = "0.8", path = "../tonic", features = ["codegen", "prost"]} +tonic = { version = "0.8", path = "../tonic", default-features = false, features = ["codegen", "prost"] } [dev-dependencies] tokio = {version = "1.0", features = ["rt-multi-thread", "macros"]} -tonic-build = {version = "0.8", path = "../tonic-build", features = ["prost"]} +tonic-build = { version = "0.8", path = "../tonic-build", default-features = false, features = ["prost"] } diff --git a/tonic-health/README.md b/tonic-health/README.md index 7e8112938..b386668d4 100644 --- a/tonic-health/README.md +++ b/tonic-health/README.md @@ -7,4 +7,8 @@ Please follow the example in the [main repo](https://github.com/hyperium/tonic/t ## Features - transport: Provides the ability to set the service by using the type system and the -`NamedService` trait. +`NamedService` trait. You can use it like that: +```rust + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + let client = HealthClient::new(conn); +``` diff --git a/tonic-health/src/generated/grpc.health.v1.rs b/tonic-health/src/generated/grpc.health.v1.rs index 22f73b388..30dd88531 100644 --- a/tonic-health/src/generated/grpc.health.v1.rs +++ b/tonic-health/src/generated/grpc.health.v1.rs @@ -53,17 +53,6 @@ pub mod health_client { pub struct HealthClient { inner: tonic::client::Grpc, } - impl HealthClient { - /// Attempt to create a new client by connecting to a given endpoint. - pub async fn connect(dst: D) -> Result - where - D: std::convert::TryInto, - D::Error: Into, - { - let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; - Ok(Self::new(conn)) - } - } impl HealthClient where T: tonic::client::GrpcService, diff --git a/tonic-health/src/server.rs b/tonic-health/src/server.rs index 53e4ef9e2..10ec38a0e 100644 --- a/tonic-health/src/server.rs +++ b/tonic-health/src/server.rs @@ -9,7 +9,7 @@ use std::sync::Arc; use tokio::sync::{watch, RwLock}; use tokio_stream::Stream; #[cfg(feature = "transport")] -use tonic::transport::NamedService; +use tonic::server::NamedService; use tonic::{Request, Response, Status}; /// Creates a `HealthReporter` and a linked `HealthServer` pair. Together, diff --git a/tonic-health/tests/bootstrap.rs b/tonic-health/tests/bootstrap.rs index bbf4f9cfa..bb3241aa0 100644 --- a/tonic-health/tests/bootstrap.rs +++ b/tonic-health/tests/bootstrap.rs @@ -12,6 +12,7 @@ fn bootstrap() { tonic_build::configure() .build_client(true) .build_server(true) + .build_transport(false) .out_dir(format!("{}", out_dir.display())) .compile(iface_files, dirs) .unwrap(); diff --git a/tonic-reflection/Cargo.toml b/tonic-reflection/Cargo.toml index ad7987b99..66da8889f 100644 --- a/tonic-reflection/Cargo.toml +++ b/tonic-reflection/Cargo.toml @@ -21,13 +21,14 @@ version = "0.5.0" bytes = "1.0" prost = "0.11" prost-types = "0.11" -tokio = {version = "1.0", features = ["sync"]} +tokio = {version = "1.0", features = ["sync", "rt"]} tokio-stream = {version = "0.1", features = ["net"]} -tonic = {version = "0.8", path = "../tonic", features = ["codegen", "prost"]} +tonic = { version = "0.8", path = "../tonic", default-features = false, features = ["codegen", "prost"] } [build-dependencies] -tonic-build = {version = "0.8", path = "../tonic-build", features = ["transport", "prost"]} +tonic-build = { version = "0.8", path = "../tonic-build", default-features = false, features = ["prost"] } [dev-dependencies] +tonic = { version = "0.8", path = "../tonic", default-features = false, features = ["transport"] } futures = "0.3" futures-util = "0.3"