Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: hyperium/tonic
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.12.0
Choose a base ref
...
head repository: hyperium/tonic
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.12.1
Choose a head ref
  • 13 commits
  • 24 files changed
  • 5 contributors

Commits on Jul 8, 2024

  1. chore: fix changelog date (#1780)

    LucioFranco authored Jul 8, 2024
    Copy the full SHA
    67ef39c View commit details

Commits on Jul 9, 2024

  1. Note breaking change for TLS client configuration (#1781)

    djc authored Jul 9, 2024
    Copy the full SHA
    941726c View commit details

Commits on Jul 13, 2024

  1. chore(server): Change serve_connection to take hyper trait (#1793)

    * chore(server): change serve_connection to take hyper service
    
    * chore(server): Change serve_connection to take hyper io
    tottoto authored Jul 13, 2024
    Copy the full SHA
    e5505a4 View commit details
  2. chore(examples): Remove clone on copy value (#1794)

    tottoto authored Jul 13, 2024
    Copy the full SHA
    b2e5665 View commit details
  3. chore: Reduce tokio-stream feature (#1795)

    tottoto authored Jul 13, 2024
    Copy the full SHA
    90356f6 View commit details
  4. chore(server): Remove unnecessary Connected trait bound (#1796)

    tottoto authored Jul 13, 2024
    Copy the full SHA
    819c390 View commit details
  5. chore(codec): Remove redundant trim (#1797)

    tottoto authored Jul 13, 2024
    Copy the full SHA
    dd313db View commit details
  6. fixed hello world and route guide tutorials (#1791)

    lukem570 authored Jul 13, 2024
    Copy the full SHA
    4aad5af View commit details

Commits on Jul 15, 2024

  1. chore(channel): Remove duplicate heap pin (#1798)

    tottoto authored Jul 15, 2024
    Copy the full SHA
    539d6f7 View commit details
  2. chore(server): Remove unnecessary bound from TlsAcceptor::accept (#1799)

    tottoto authored Jul 15, 2024
    Copy the full SHA
    b6ad603 View commit details
  3. chore(server): Remove unnecessary trait bound from ServerIo::connect_…

    …info (#1801)
    tottoto authored Jul 15, 2024
    Copy the full SHA
    ad1a95d View commit details
  4. tonic-reflection: Restructure crate to prep reintroducing v1alpha (#1802

    )
    
    To simplify API verification, this is a prepatory change to shift
    around the v1 support to allow for a cleaner v1alpha reintroduction.
    
    * Created a multi-file version of the server.rs module
    * Added mod.rs containing the base error with associated imports
    * Added v1.rs containing the v1 version of the reflection server
    ttkjesper authored Jul 15, 2024
    Copy the full SHA
    aa57ffe View commit details

Commits on Jul 17, 2024

  1. chore: release v0.12.1 (#1806)

    LucioFranco authored Jul 17, 2024
    Copy the full SHA
    e0b6caf View commit details
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# [v0.12.0](https://github.com/hyperium/tonic/compare/v0.11.0...v0.12.0) (2024-06-20)
# [0.12.1](https://github.com/hyperium/tonic/compare/v0.12.0...v0.12.1) (2024-07-17)

### Bug Fixes

* Reduce tokio-stream feature (#1795)

# [0.12.0](https://github.com/hyperium/tonic/compare/v0.11.0...v0.12.0) (2024-07-08)

This breaking release updates tonic to the hyper `1.0` ecosystem and also updates
to prost `v0.13.0`.
@@ -30,6 +36,7 @@ to prost `v0.13.0`.
* `tonic_reflection::server` is updated to use the generated
`tonic_reflection::pb::v1` code.
* Make compression encoding configuration more malleable (#1757)
* Removed implicit configuration of client TLS roots setup (#1731)


[v1.8.8]: https://github.com/fullstorydev/grpcurl/releases/tag/v1.8.8
2 changes: 1 addition & 1 deletion examples/helloworld-tutorial.md
Original file line number Diff line number Diff line change
@@ -113,7 +113,7 @@ path = "src/client.rs"

[dependencies]
tonic = "0.12"
prost = "0.12"
prost = "0.13"
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }

[build-dependencies]
4 changes: 2 additions & 2 deletions examples/routeguide-tutorial.md
Original file line number Diff line number Diff line change
@@ -175,7 +175,7 @@ Edit `Cargo.toml` and add all the dependencies we'll need for this example:
```toml
[dependencies]
tonic = "0.12"
prost = "0.12"
prost = "0.13"
tokio = { version = "1.0", features = ["rt-multi-thread", "macros", "sync", "time"] }
tokio-stream = "0.1"

@@ -498,7 +498,7 @@ async fn route_chat(
while let Some(note) = stream.next().await {
let note = note?;

let location = note.location.clone().unwrap();
let location = note.location.unwrap();

let location_notes = notes.entry(location).or_insert(vec![]);
location_notes.push(note);
2 changes: 1 addition & 1 deletion examples/src/routeguide/server.rs
Original file line number Diff line number Diff line change
@@ -116,7 +116,7 @@ impl RouteGuide for RouteGuideService {
while let Some(note) = stream.next().await {
let note = note?;

let location = note.location.clone().unwrap();
let location = note.location.unwrap();

let location_notes = notes.entry(location).or_insert(vec![]);
location_notes.push(note);
4 changes: 2 additions & 2 deletions tonic-build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -4,15 +4,15 @@ categories = ["network-programming", "asynchronous"]
description = """
Codegen module of `tonic` gRPC implementation.
"""
documentation = "https://docs.rs/tonic-build/0.12.0"
documentation = "https://docs.rs/tonic-build/0.12.1"
edition = "2021"
homepage = "https://github.com/hyperium/tonic"
keywords = ["rpc", "grpc", "async", "codegen", "protobuf"]
license = "MIT"
name = "tonic-build"
readme = "README.md"
repository = "https://github.com/hyperium/tonic"
version = "0.12.0"
version = "0.12.1"

[dependencies]
prettyplease = { version = "0.2" }
2 changes: 1 addition & 1 deletion tonic-build/src/lib.rs
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/website/master/public/img/icons/tonic.svg"
)]
#![deny(rustdoc::broken_intra_doc_links)]
#![doc(html_root_url = "https://docs.rs/tonic-build/0.12.0")]
#![doc(html_root_url = "https://docs.rs/tonic-build/0.12.1")]
#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]
#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
4 changes: 2 additions & 2 deletions tonic-health/Cargo.toml
Original file line number Diff line number Diff line change
@@ -4,15 +4,15 @@ categories = ["network-programming", "asynchronous"]
description = """
Health Checking module of `tonic` gRPC implementation.
"""
documentation = "https://docs.rs/tonic-health/0.12.0"
documentation = "https://docs.rs/tonic-health/0.12.1"
edition = "2021"
homepage = "https://github.com/hyperium/tonic"
keywords = ["rpc", "grpc", "async", "healthcheck"]
license = "MIT"
name = "tonic-health"
readme = "README.md"
repository = "https://github.com/hyperium/tonic"
version = "0.12.0"
version = "0.12.1"

[features]
default = ["transport"]
2 changes: 1 addition & 1 deletion tonic-health/src/lib.rs
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/website/master/public/img/icons/tonic.svg"
)]
#![deny(rustdoc::broken_intra_doc_links)]
#![doc(html_root_url = "https://docs.rs/tonic-health/0.12.0")]
#![doc(html_root_url = "https://docs.rs/tonic-health/0.12.1")]
#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]
#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
4 changes: 2 additions & 2 deletions tonic-reflection/Cargo.toml
Original file line number Diff line number Diff line change
@@ -9,13 +9,13 @@ Server Reflection module of `tonic` gRPC implementation.
"""
edition = "2021"
homepage = "https://github.com/hyperium/tonic"
documentation = "https://docs.rs/tonic-reflection/0.12.0"
documentation = "https://docs.rs/tonic-reflection/0.12.1"
keywords = ["rpc", "grpc", "async", "reflection"]
license = "MIT"
name = "tonic-reflection"
readme = "README.md"
repository = "https://github.com/hyperium/tonic"
version = "0.12.0"
version = "0.12.1"

[package.metadata.docs.rs]
all-features = true
2 changes: 1 addition & 1 deletion tonic-reflection/src/lib.rs
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
html_logo_url = "https://github.com/hyperium/tonic/raw/master/.github/assets/tonic-docs.png"
)]
#![deny(rustdoc::broken_intra_doc_links)]
#![doc(html_root_url = "https://docs.rs/tonic-reflection/0.12.0")]
#![doc(html_root_url = "https://docs.rs/tonic-reflection/0.12.1")]
#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]
#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
36 changes: 36 additions & 0 deletions tonic-reflection/src/server/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
pub use crate::pb::v1::server_reflection_server::{ServerReflection, ServerReflectionServer};

use prost::DecodeError;
use std::fmt::{Display, Formatter};

mod v1;

pub use v1::Builder;

/// Represents an error in the construction of a gRPC Reflection Service.
#[derive(Debug)]
pub enum Error {
/// An error was encountered decoding a `prost_types::FileDescriptorSet` from a buffer.
DecodeError(prost::DecodeError),
/// An invalid `prost_types::FileDescriptorProto` was encountered.
InvalidFileDescriptorSet(String),
}

impl From<DecodeError> for Error {
fn from(e: DecodeError) -> Self {
Error::DecodeError(e)
}
}

impl std::error::Error for Error {}

impl Display for Error {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
Error::DecodeError(_) => f.write_str("error decoding FileDescriptorSet from buffer"),
Error::InvalidFileDescriptorSet(s) => {
write!(f, "invalid FileDescriptorSet - {}", s)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,50 +1,23 @@
pub use crate::pb::v1::server_reflection_server::{ServerReflection, ServerReflectionServer};
use crate::pb::v1::server_reflection_server::{ServerReflection, ServerReflectionServer};

use crate::pb::v1::server_reflection_request::MessageRequest;
use crate::pb::v1::server_reflection_response::MessageResponse;
use crate::pb::v1::{
ExtensionNumberResponse, FileDescriptorResponse, ListServiceResponse, ServerReflectionRequest,
ServerReflectionResponse, ServiceResponse,
};
use prost::{DecodeError, Message};
use prost::Message;
use prost_types::{
DescriptorProto, EnumDescriptorProto, FieldDescriptorProto, FileDescriptorProto,
FileDescriptorSet,
};
use std::collections::HashMap;
use std::fmt::{Display, Formatter};
use std::sync::Arc;
use tokio::sync::mpsc;
use tokio_stream::{wrappers::ReceiverStream, StreamExt};
use tonic::{Request, Response, Status, Streaming};

/// Represents an error in the construction of a gRPC Reflection Service.
#[derive(Debug)]
pub enum Error {
/// An error was encountered decoding a `prost_types::FileDescriptorSet` from a buffer.
DecodeError(prost::DecodeError),
/// An invalid `prost_types::FileDescriptorProto` was encountered.
InvalidFileDescriptorSet(String),
}

impl From<DecodeError> for Error {
fn from(e: DecodeError) -> Self {
Error::DecodeError(e)
}
}

impl std::error::Error for Error {}

impl Display for Error {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
Error::DecodeError(_) => f.write_str("error decoding FileDescriptorSet from buffer"),
Error::InvalidFileDescriptorSet(s) => {
write!(f, "invalid FileDescriptorSet - {}", s)
}
}
}
}
use crate::server::Error;

/// A builder used to construct a gRPC Reflection Service.
#[derive(Debug)]
4 changes: 2 additions & 2 deletions tonic-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -7,15 +7,15 @@ categories = ["web-programming", "network-programming", "asynchronous"]
description = """
A collection of useful protobuf types that can be used with `tonic`.
"""
documentation = "https://docs.rs/tonic-types/0.12.0"
documentation = "https://docs.rs/tonic-types/0.12.1"
edition = "2021"
homepage = "https://github.com/hyperium/tonic"
keywords = ["rpc", "grpc", "protobuf"]
license = "MIT"
name = "tonic-types"
readme = "README.md"
repository = "https://github.com/hyperium/tonic"
version = "0.12.0"
version = "0.12.1"

[dependencies]
prost = "0.13"
2 changes: 1 addition & 1 deletion tonic-types/src/lib.rs
Original file line number Diff line number Diff line change
@@ -150,7 +150,7 @@
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/website/master/public/img/icons/tonic.svg"
)]
#![deny(rustdoc::broken_intra_doc_links)]
#![doc(html_root_url = "https://docs.rs/tonic-types/0.12.0")]
#![doc(html_root_url = "https://docs.rs/tonic-types/0.12.1")]
#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]

mod generated {
4 changes: 2 additions & 2 deletions tonic-web/Cargo.toml
Original file line number Diff line number Diff line change
@@ -4,15 +4,15 @@ categories = ["network-programming", "asynchronous"]
description = """
grpc-web protocol translation for tonic services.
"""
documentation = "https://docs.rs/tonic-web/0.12.0"
documentation = "https://docs.rs/tonic-web/0.12.1"
edition = "2021"
homepage = "https://github.com/hyperium/tonic"
keywords = ["rpc", "grpc", "grpc-web"]
license = "MIT"
name = "tonic-web"
readme = "README.md"
repository = "https://github.com/hyperium/tonic"
version = "0.12.0"
version = "0.12.1"

[dependencies]
base64 = "0.22"
2 changes: 1 addition & 1 deletion tonic-web/src/lib.rs
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@
rust_2018_idioms,
unreachable_pub
)]
#![doc(html_root_url = "https://docs.rs/tonic-web/0.12.0")]
#![doc(html_root_url = "https://docs.rs/tonic-web/0.12.1")]
#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]

pub use call::GrpcWebCall;
7 changes: 4 additions & 3 deletions tonic/Cargo.toml
Original file line number Diff line number Diff line change
@@ -13,14 +13,14 @@ categories = ["web-programming", "network-programming", "asynchronous"]
description = """
A gRPC over HTTP/2 implementation focused on high performance, interoperability, and flexibility.
"""
documentation = "https://docs.rs/tonic/0.12.0"
documentation = "https://docs.rs/tonic/0.12.1"
edition = "2021"
homepage = "https://github.com/hyperium/tonic"
keywords = ["rpc", "grpc", "async", "futures", "protobuf"]
license = "MIT"
readme = "../README.md"
repository = "https://github.com/hyperium/tonic"
version = "0.12.0"
version = "0.12.1"

[features]
codegen = ["dep:async-trait"]
@@ -40,6 +40,7 @@ server = [
"dep:hyper-util", "hyper-util?/service", "hyper-util?/server-auto",
"dep:socket2",
"dep:tokio", "tokio?/macros", "tokio?/net", "tokio?/time",
"tokio-stream/net",
"dep:tower", "tower?/util", "tower?/limit",
]
channel = [
@@ -67,6 +68,7 @@ percent-encoding = "2.1"
pin-project = "1.0.11"
tower-layer = "0.3"
tower-service = "0.3"
tokio-stream = {version = "0.1", default-features = false}

# prost
prost = {version = "0.13", default-features = false, features = ["std"], optional = true}
@@ -81,7 +83,6 @@ hyper = {version = "1", features = ["http1", "http2"], optional = true}
hyper-util = { version = "0.1.4", features = ["tokio"], optional = true }
socket2 = { version = "0.5", optional = true, features = ["all"] }
tokio = {version = "1", default-features = false, optional = true}
tokio-stream = { version = "0.1", features = ["net"] }
tower = {version = "0.4.7", default-features = false, optional = true}
axum = {version = "0.7", default-features = false, optional = true}

2 changes: 1 addition & 1 deletion tonic/src/codec/compression.rs
Original file line number Diff line number Diff line change
@@ -188,7 +188,7 @@ impl fmt::Display for CompressionEncoding {
}

fn split_by_comma(s: &str) -> impl Iterator<Item = &str> {
s.trim().split(',').map(|s| s.trim())
s.split(',').map(|s| s.trim())
}

/// Compress `len` bytes from `decompressed_buf` into `out_buf`.
2 changes: 1 addition & 1 deletion tonic/src/lib.rs
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@
#![doc(
html_logo_url = "https://raw.githubusercontent.com/tokio-rs/website/master/public/img/icons/tonic.svg"
)]
#![doc(html_root_url = "https://docs.rs/tonic/0.12.0")]
#![doc(html_root_url = "https://docs.rs/tonic/0.12.1")]
#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]
#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
4 changes: 2 additions & 2 deletions tonic/src/transport/channel/mod.rs
Original file line number Diff line number Diff line change
@@ -157,7 +157,7 @@ impl Channel {

let svc = Connection::lazy(connector, endpoint);
let (svc, worker) = Buffer::pair(Either::A(svc), buffer_size);
executor.execute(Box::pin(worker));
executor.execute(worker);

Channel { svc }
}
@@ -176,7 +176,7 @@ impl Channel {
.await
.map_err(super::Error::from_source)?;
let (svc, worker) = Buffer::pair(Either::A(svc), buffer_size);
executor.execute(Box::pin(worker));
executor.execute(worker);

Ok(Channel { svc })
}
6 changes: 3 additions & 3 deletions tonic/src/transport/server/incoming.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::service::ServerIo;
#[cfg(feature = "tls")]
use super::service::TlsAcceptor;
use super::{service::ServerIo, Connected};
use std::{
net::{SocketAddr, TcpListener as StdTcpListener},
pin::{pin, Pin},
@@ -20,7 +20,7 @@ pub(crate) fn tcp_incoming<IO, IE>(
incoming: impl Stream<Item = Result<IO, IE>>,
) -> impl Stream<Item = Result<ServerIo<IO>, crate::Error>>
where
IO: AsyncRead + AsyncWrite + Connected + Unpin + Send + 'static,
IO: AsyncRead + AsyncWrite + Unpin + Send + 'static,
IE: Into<crate::Error>,
{
async_stream::try_stream! {
@@ -38,7 +38,7 @@ pub(crate) fn tcp_incoming<IO, IE>(
tls: Option<TlsAcceptor>,
) -> impl Stream<Item = Result<ServerIo<IO>, crate::Error>>
where
IO: AsyncRead + AsyncWrite + Connected + Unpin + Send + 'static,
IO: AsyncRead + AsyncWrite + Unpin + Send + 'static,
IE: Into<crate::Error>,
{
async_stream::try_stream! {
Loading