Skip to content

Commit 750bcce

Browse files
authored
Merge branch 'master' into rename-interceptor-call-method-to-intercept
2 parents 6b3880c + 3009cf5 commit 750bcce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+203
-194
lines changed

examples/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ tonic-types = { path = "../tonic-types", optional = true }
300300
async-stream = { version = "0.3", optional = true }
301301
tokio-stream = { version = "0.1", optional = true }
302302
tokio-util = { version = "0.7.8", optional = true }
303-
tower = { version = "0.4", optional = true }
303+
tower = { version = "0.5", optional = true }
304304
rand = { version = "0.8", optional = true }
305305
serde = { version = "1.0", features = ["derive"], optional = true }
306306
serde_json = { version = "1.0", optional = true }
@@ -318,7 +318,7 @@ h2 = { version = "0.4", optional = true }
318318
tokio-rustls = { version = "0.26", optional = true, features = ["ring", "tls12"], default-features = false }
319319
hyper-rustls = { version = "0.27.0", features = ["http2", "ring", "tls12"], optional = true, default-features = false }
320320
rustls-pemfile = { version = "2.0.0", optional = true }
321-
tower-http = { version = "0.5", optional = true }
321+
tower-http = { version = "0.6", optional = true }
322322
pin-project = { version = "1.0.11", optional = true }
323323

324324
[build-dependencies]

examples/helloworld-tutorial.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ name = "helloworld-client"
112112
path = "src/client.rs"
113113

114114
[dependencies]
115-
tonic = "0.12"
115+
tonic = "0.13"
116116
prost = "0.13"
117117
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
118118

119119
[build-dependencies]
120-
tonic-build = "0.12"
120+
tonic-build = "0.13"
121121
```
122122

123123
We include `tonic-build` as a useful way to incorporate the generation of our client and server gRPC code into the build process of our application. We will setup this build process now:

examples/routeguide-tutorial.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ Edit `Cargo.toml` and add all the dependencies we'll need for this example:
174174

175175
```toml
176176
[dependencies]
177-
tonic = "0.12"
177+
tonic = "0.13"
178178
prost = "0.13"
179179
tokio = { version = "1.0", features = ["rt-multi-thread", "macros", "sync", "time"] }
180180
tokio-stream = "0.1"
@@ -185,7 +185,7 @@ serde_json = "1.0"
185185
rand = "0.8"
186186

187187
[build-dependencies]
188-
tonic-build = "0.12"
188+
tonic-build = "0.13"
189189
```
190190

191191
Create a `build.rs` file at the root of your crate:

examples/src/tower/client.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
1515

1616
let channel = ServiceBuilder::new()
1717
// Interceptors can be also be applied as middleware
18-
.layer(tonic::service::interceptor(intercept))
18+
.layer(tonic::service::InterceptorLayer::new(intercept))
1919
.layer_fn(AuthSvc::new)
2020
.service(channel);
2121

examples/src/tower/server.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
4747
// Apply our own middleware
4848
.layer(MyMiddlewareLayer::default())
4949
// Interceptors can be also be applied as middleware
50-
.layer(tonic::service::interceptor(intercept))
50+
.layer(tonic::service::InterceptorLayer::new(intercept))
5151
.into_inner();
5252

5353
Server::builder()

interop/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ prost = "0.13"
2626
tokio = {version = "1.0", features = ["rt-multi-thread", "time", "macros"]}
2727
tokio-stream = "0.1"
2828
tonic = {path = "../tonic", features = ["tls"]}
29-
tower = {version = "0.4"}
29+
tower = "0.5"
3030
tracing-subscriber = {version = "0.3"}
3131

3232
[build-dependencies]

tests/compression/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ prost = "0.13"
1919
tokio = {version = "1.0", features = ["macros", "rt-multi-thread", "net"]}
2020
tokio-stream = "0.1"
2121
tonic = {path = "../../tonic", features = ["gzip", "zstd"]}
22-
tower = {version = "0.4", features = []}
23-
tower-http = {version = "0.5", features = ["map-response-body", "map-request-body"]}
22+
tower = "0.5"
23+
tower-http = {version = "0.6", features = ["map-response-body", "map-request-body"]}
2424

2525
[build-dependencies]
2626
tonic-build = {path = "../../tonic-build" }

tests/integration_tests/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ http = "1"
2121
http-body = "1"
2222
hyper-util = "0.1"
2323
tokio-stream = {version = "0.1.5", features = ["net"]}
24-
tower = {version = "0.4", features = []}
25-
tower-http = { version = "0.5", features = ["set-header", "trace"] }
24+
tower = "0.5"
25+
tower-http = { version = "0.6", features = ["set-header", "trace"] }
2626
tower-service = "0.3"
2727
tracing = "0.1"
2828

tonic-build/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ categories = ["network-programming", "asynchronous"]
44
description = """
55
Codegen module of `tonic` gRPC implementation.
66
"""
7-
documentation = "https://docs.rs/tonic-build/0.12.3"
7+
documentation = "https://docs.rs/tonic-build/0.13.0"
88
edition = "2021"
99
homepage = "https://github.com/hyperium/tonic"
1010
keywords = ["rpc", "grpc", "async", "codegen", "protobuf"]
1111
license = "MIT"
1212
name = "tonic-build"
1313
readme = "README.md"
1414
repository = "https://github.com/hyperium/tonic"
15-
version = "0.12.3"
15+
version = "0.13.0"
1616

1717
[dependencies]
1818
prettyplease = { version = "0.2" }

tonic-build/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/website/master/public/img/icons/tonic.svg"
7171
)]
7272
#![deny(rustdoc::broken_intra_doc_links)]
73-
#![doc(html_root_url = "https://docs.rs/tonic-build/0.12.3")]
73+
#![doc(html_root_url = "https://docs.rs/tonic-build/0.13.0")]
7474
#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]
7575
#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))]
7676
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

tonic-health/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ categories = ["network-programming", "asynchronous"]
44
description = """
55
Health Checking module of `tonic` gRPC implementation.
66
"""
7-
documentation = "https://docs.rs/tonic-health/0.12.3"
7+
documentation = "https://docs.rs/tonic-health/0.13.0"
88
edition = "2021"
99
homepage = "https://github.com/hyperium/tonic"
1010
keywords = ["rpc", "grpc", "async", "healthcheck"]
1111
license = "MIT"
1212
name = "tonic-health"
1313
readme = "README.md"
1414
repository = "https://github.com/hyperium/tonic"
15-
version = "0.12.3"
15+
version = "0.13.0"
1616

1717
[features]
1818
default = ["transport"]
@@ -23,12 +23,12 @@ async-stream = "0.3"
2323
prost = "0.13"
2424
tokio = {version = "1.0", features = ["sync"]}
2525
tokio-stream = "0.1"
26-
tonic = { version = "0.12", path = "../tonic", default-features = false, features = ["codegen", "prost"] }
26+
tonic = { version = "0.13.0", path = "../tonic", default-features = false, features = ["codegen", "prost"] }
2727

2828
[dev-dependencies]
2929
tokio = {version = "1.0", features = ["rt-multi-thread", "macros"]}
3030
tokio-stream = "0.1"
31-
prost-types = "0.13"
31+
prost-types = "0.13.0"
3232

3333
[package.metadata.cargo_check_external_types]
3434
allowed_external_types = [

tonic-health/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/website/master/public/img/icons/tonic.svg"
1717
)]
1818
#![deny(rustdoc::broken_intra_doc_links)]
19-
#![doc(html_root_url = "https://docs.rs/tonic-health/0.12.3")]
19+
#![doc(html_root_url = "https://docs.rs/tonic-health/0.13.0")]
2020
#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]
2121
#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))]
2222
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

tonic-reflection/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ Server Reflection module of `tonic` gRPC implementation.
99
"""
1010
edition = "2021"
1111
homepage = "https://github.com/hyperium/tonic"
12-
documentation = "https://docs.rs/tonic-reflection/0.12.3"
12+
documentation = "https://docs.rs/tonic-reflection/0.13.0"
1313
keywords = ["rpc", "grpc", "async", "reflection"]
1414
license = "MIT"
1515
name = "tonic-reflection"
1616
readme = "README.md"
1717
repository = "https://github.com/hyperium/tonic"
18-
version = "0.12.3"
18+
version = "0.13.0"
1919

2020
[package.metadata.docs.rs]
2121
all-features = true
@@ -30,10 +30,10 @@ prost = "0.13"
3030
prost-types = {version = "0.13", optional = true}
3131
tokio = { version = "1.0", features = ["sync", "rt"], optional = true }
3232
tokio-stream = {version = "0.1", features = ["net"], optional = true }
33-
tonic = { version = "0.12", path = "../tonic", default-features = false, features = ["codegen", "prost"] }
33+
tonic = { version = "0.13.0", path = "../tonic", default-features = false, features = ["codegen", "prost"] }
3434

3535
[dev-dependencies]
36-
tonic = { version = "0.12", path = "../tonic", default-features = false, features = ["transport"] }
36+
tonic = { version = "0.13.0", path = "../tonic", default-features = false, features = ["transport"] }
3737

3838
[package.metadata.cargo_check_external_types]
3939
allowed_external_types = [

tonic-reflection/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
html_logo_url = "https://github.com/hyperium/tonic/raw/master/.github/assets/tonic-docs.png"
1111
)]
1212
#![deny(rustdoc::broken_intra_doc_links)]
13-
#![doc(html_root_url = "https://docs.rs/tonic-reflection/0.12.3")]
13+
#![doc(html_root_url = "https://docs.rs/tonic-reflection/0.13.0")]
1414
#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]
1515
#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))]
1616
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

tonic-types/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ categories = ["web-programming", "network-programming", "asynchronous"]
77
description = """
88
A collection of useful protobuf types that can be used with `tonic`.
99
"""
10-
documentation = "https://docs.rs/tonic-types/0.12.3"
10+
documentation = "https://docs.rs/tonic-types/0.13.0"
1111
edition = "2021"
1212
homepage = "https://github.com/hyperium/tonic"
1313
keywords = ["rpc", "grpc", "protobuf"]
1414
license = "MIT"
1515
name = "tonic-types"
1616
readme = "README.md"
1717
repository = "https://github.com/hyperium/tonic"
18-
version = "0.12.3"
18+
version = "0.13.0"
1919

2020
[dependencies]
2121
prost = "0.13"
2222
prost-types = "0.13"
23-
tonic = { version = "0.12", path = "../tonic", default-features = false }
23+
tonic = { version = "0.13.0", path = "../tonic", default-features = false }
2424

2525
[package.metadata.cargo_check_external_types]
2626
allowed_external_types = [

tonic-types/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/website/master/public/img/icons/tonic.svg"
151151
)]
152152
#![deny(rustdoc::broken_intra_doc_links)]
153-
#![doc(html_root_url = "https://docs.rs/tonic-types/0.12.3")]
153+
#![doc(html_root_url = "https://docs.rs/tonic-types/0.13.0")]
154154
#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]
155155

156156
mod generated {

tonic-web/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ categories = ["network-programming", "asynchronous"]
44
description = """
55
grpc-web protocol translation for tonic services.
66
"""
7-
documentation = "https://docs.rs/tonic-web/0.12.3"
7+
documentation = "https://docs.rs/tonic-web/0.13.0"
88
edition = "2021"
99
homepage = "https://github.com/hyperium/tonic"
1010
keywords = ["rpc", "grpc", "grpc-web"]
1111
license = "MIT"
1212
name = "tonic-web"
1313
readme = "README.md"
1414
repository = "https://github.com/hyperium/tonic"
15-
version = "0.12.3"
15+
version = "0.13.0"
1616

1717
[dependencies]
1818
base64 = "0.22"
@@ -22,10 +22,10 @@ http = "1"
2222
http-body = "1"
2323
http-body-util = "0.1"
2424
pin-project = "1"
25-
tonic = { version = "0.12", path = "../tonic", default-features = false }
25+
tonic = { version = "0.13.0", path = "../tonic", default-features = false }
2626
tower-service = "0.3"
2727
tower-layer = "0.3"
28-
tower-http = { version = "0.5", features = ["cors"] }
28+
tower-http = { version = "0.6", features = ["cors"] }
2929
tracing = "0.1"
3030

3131
[dev-dependencies]

tonic-web/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
rust_2018_idioms,
9595
unreachable_pub
9696
)]
97-
#![doc(html_root_url = "https://docs.rs/tonic-web/0.12.3")]
97+
#![doc(html_root_url = "https://docs.rs/tonic-web/0.13.0")]
9898
#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]
9999

100100
pub use call::GrpcWebCall;

tonic/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ categories = ["web-programming", "network-programming", "asynchronous"]
1313
description = """
1414
A gRPC over HTTP/2 implementation focused on high performance, interoperability, and flexibility.
1515
"""
16-
documentation = "https://docs.rs/tonic/0.12.3"
16+
documentation = "https://docs.rs/tonic/0.13.0"
1717
edition = "2021"
1818
homepage = "https://github.com/hyperium/tonic"
1919
keywords = ["rpc", "grpc", "async", "futures", "protobuf"]
2020
license = "MIT"
2121
readme = "../README.md"
2222
repository = "https://github.com/hyperium/tonic"
23-
version = "0.12.3"
23+
version = "0.13.0"
2424

2525
[features]
2626
codegen = ["dep:async-trait"]
@@ -84,7 +84,7 @@ hyper = {version = "1", features = ["http1", "http2"], optional = true}
8484
hyper-util = { version = "0.1.4", features = ["tokio"], optional = true }
8585
socket2 = { version = "0.5", optional = true, features = ["all"] }
8686
tokio = {version = "1", default-features = false, optional = true}
87-
tower = {version = "0.4.7", default-features = false, optional = true}
87+
tower = {version = "0.5", default-features = false, optional = true}
8888
axum = {version = "0.7", default-features = false, optional = true}
8989

9090
# rustls
@@ -107,7 +107,7 @@ quickcheck_macros = "1.0"
107107
rand = "0.8"
108108
static_assertions = "1.0"
109109
tokio = {version = "1.0", features = ["rt", "macros"]}
110-
tower = {version = "0.4.7", features = ["full"]}
110+
tower = {version = "0.5", features = ["full"]}
111111

112112
[package.metadata.docs.rs]
113113
all-features = true

tonic/src/body.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub type BoxBody = http_body_util::combinators::UnsyncBoxBody<bytes::Bytes, crat
99
pub fn boxed<B>(body: B) -> BoxBody
1010
where
1111
B: http_body::Body<Data = bytes::Bytes> + Send + 'static,
12-
B::Error: Into<crate::Error>,
12+
B::Error: Into<crate::BoxError>,
1313
{
1414
body.map_err(crate::Status::map_error).boxed_unsync()
1515
}

tonic/src/client/grpc.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl<T> Grpc<T> {
213213
where
214214
T: GrpcService<BoxBody>,
215215
T::ResponseBody: Body + Send + 'static,
216-
<T::ResponseBody as Body>::Error: Into<crate::Error>,
216+
<T::ResponseBody as Body>::Error: Into<crate::BoxError>,
217217
C: Codec<Encode = M1, Decode = M2>,
218218
M1: Send + Sync + 'static,
219219
M2: Send + Sync + 'static,
@@ -232,7 +232,7 @@ impl<T> Grpc<T> {
232232
where
233233
T: GrpcService<BoxBody>,
234234
T::ResponseBody: Body + Send + 'static,
235-
<T::ResponseBody as Body>::Error: Into<crate::Error>,
235+
<T::ResponseBody as Body>::Error: Into<crate::BoxError>,
236236
S: Stream<Item = M1> + Send + 'static,
237237
C: Codec<Encode = M1, Decode = M2>,
238238
M1: Send + Sync + 'static,
@@ -269,7 +269,7 @@ impl<T> Grpc<T> {
269269
where
270270
T: GrpcService<BoxBody>,
271271
T::ResponseBody: Body + Send + 'static,
272-
<T::ResponseBody as Body>::Error: Into<crate::Error>,
272+
<T::ResponseBody as Body>::Error: Into<crate::BoxError>,
273273
C: Codec<Encode = M1, Decode = M2>,
274274
M1: Send + Sync + 'static,
275275
M2: Send + Sync + 'static,
@@ -288,7 +288,7 @@ impl<T> Grpc<T> {
288288
where
289289
T: GrpcService<BoxBody>,
290290
T::ResponseBody: Body + Send + 'static,
291-
<T::ResponseBody as Body>::Error: Into<crate::Error>,
291+
<T::ResponseBody as Body>::Error: Into<crate::BoxError>,
292292
S: Stream<Item = M1> + Send + 'static,
293293
C: Codec<Encode = M1, Decode = M2>,
294294
M1: Send + Sync + 'static,
@@ -328,7 +328,7 @@ impl<T> Grpc<T> {
328328
where
329329
T: GrpcService<BoxBody>,
330330
T::ResponseBody: Body + Send + 'static,
331-
<T::ResponseBody as Body>::Error: Into<crate::Error>,
331+
<T::ResponseBody as Body>::Error: Into<crate::BoxError>,
332332
{
333333
let encoding = CompressionEncoding::from_encoding_header(
334334
response.headers(),

tonic/src/client/service.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub trait GrpcService<ReqBody> {
1414
/// Responses body given by the service.
1515
type ResponseBody: Body;
1616
/// Errors produced by the service.
17-
type Error: Into<crate::Error>;
17+
type Error: Into<crate::BoxError>;
1818
/// The future response value.
1919
type Future: Future<Output = Result<http::Response<Self::ResponseBody>, Self::Error>>;
2020

@@ -32,9 +32,9 @@ pub trait GrpcService<ReqBody> {
3232
impl<T, ReqBody, ResBody> GrpcService<ReqBody> for T
3333
where
3434
T: Service<http::Request<ReqBody>, Response = http::Response<ResBody>>,
35-
T::Error: Into<crate::Error>,
35+
T::Error: Into<crate::BoxError>,
3636
ResBody: Body,
37-
<ResBody as Body>::Error: Into<crate::Error>,
37+
<ResBody as Body>::Error: Into<crate::BoxError>,
3838
{
3939
type ResponseBody = ResBody;
4040
type Error = T::Error;

0 commit comments

Comments
 (0)