Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ jobs:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2025-03-27
toolchain: nightly-2025-10-18
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@cargo-udeps
- name: Restore protoc and plugin from cache
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ members = [
resolver = "2"

[workspace.package]
rust-version = "1.75"
rust-version = "1.88"

[workspace.lints.rust]
missing_debug_implementations = "warn"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ may be a good resource as it shows examples of many of the gRPC features.

### Rust Version

`tonic`'s MSRV is `1.75`.
`tonic`'s MSRV is `1.88`.

### Dependencies

Expand Down
3 changes: 2 additions & 1 deletion codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
name = "codegen"
authors = ["Lucio Franco <luciofranco14@gmail.com>"]
license = "MIT"
edition = "2021"
edition = "2024"
rust-version = { workspace = true }

[dependencies]
protox = "0.9"
Expand Down
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
authors = ["Lucio Franco <luciofranco14@gmail.com>"]
edition = "2021"
edition = "2024"
license = "MIT"
name = "examples"

Expand Down
4 changes: 2 additions & 2 deletions examples/src/authentication/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ pub mod pb {
tonic::include_proto!("grpc.examples.unaryecho");
}

use pb::{echo_client::EchoClient, EchoRequest};
use tonic::{metadata::MetadataValue, transport::Channel, Request};
use pb::{EchoRequest, echo_client::EchoClient};
use tonic::{Request, metadata::MetadataValue, transport::Channel};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
Expand Down
2 changes: 1 addition & 1 deletion examples/src/authentication/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub mod pb {
}

use pb::{EchoRequest, EchoResponse};
use tonic::{metadata::MetadataValue, transport::Server, Request, Response, Status};
use tonic::{Request, Response, Status, metadata::MetadataValue, transport::Server};

type EchoResult<T> = Result<Response<T>, Status>;

Expand Down
2 changes: 1 addition & 1 deletion examples/src/autoreload/server.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use tonic::{transport::Server, Request, Response, Status};
use tonic::{Request, Response, Status, transport::Server};

use hello_world::greeter_server::{Greeter, GreeterServer};
use hello_world::{HelloReply, HelloRequest};
Expand Down
2 changes: 1 addition & 1 deletion examples/src/blocking/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub mod hello_world {
tonic::include_proto!("helloworld");
}

use hello_world::{greeter_client::GreeterClient, HelloReply, HelloRequest};
use hello_world::{HelloReply, HelloRequest, greeter_client::GreeterClient};

type StdError = Box<dyn std::error::Error + Send + Sync + 'static>;
type Result<T, E = StdError> = ::std::result::Result<T, E>;
Expand Down
2 changes: 1 addition & 1 deletion examples/src/blocking/server.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use tonic::{transport::Server, Request, Response, Status};
use tonic::{Request, Response, Status, transport::Server};

use hello_world::greeter_server::{Greeter, GreeterServer};
use hello_world::{HelloReply, HelloRequest};
Expand Down
4 changes: 2 additions & 2 deletions examples/src/cancellation/client.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use hello_world::greeter_client::GreeterClient;
use hello_world::HelloRequest;
use hello_world::greeter_client::GreeterClient;

use tokio::time::{timeout, Duration};
use tokio::time::{Duration, timeout};

pub mod hello_world {
tonic::include_proto!("helloworld");
Expand Down
4 changes: 2 additions & 2 deletions examples/src/cancellation/server.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use std::future::Future;

use tokio_util::sync::CancellationToken;
use tonic::{transport::Server, Request, Response, Status};
use tonic::{Request, Response, Status, transport::Server};

use hello_world::greeter_server::{Greeter, GreeterServer};
use hello_world::{HelloReply, HelloRequest};

use tokio::select;
use tokio::time::sleep;
use tokio::time::Duration;
use tokio::time::sleep;

pub mod hello_world {
tonic::include_proto!("helloworld");
Expand Down
4 changes: 2 additions & 2 deletions examples/src/codec_buffers/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
//! The generated code assumes that a module `crate::common` exists which defines
//! `SmallBufferCodec`, and `SmallBufferCodec` must have a Default implementation.

use tonic::{transport::Server, Request, Response, Status};
use tonic::{Request, Response, Status, transport::Server};

pub mod common;

pub mod small_buf {
include!(concat!(env!("OUT_DIR"), "/smallbuf/helloworld.rs"));
}
use small_buf::{
greeter_server::{Greeter, GreeterServer},
HelloReply, HelloRequest,
greeter_server::{Greeter, GreeterServer},
};

#[derive(Default)]
Expand Down
2 changes: 1 addition & 1 deletion examples/src/compression/client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use hello_world::greeter_client::GreeterClient;
use hello_world::HelloRequest;
use hello_world::greeter_client::GreeterClient;
use tonic::codec::CompressionEncoding;
use tonic::transport::Channel;

Expand Down
2 changes: 1 addition & 1 deletion examples/src/compression/server.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use tonic::{transport::Server, Request, Response, Status};
use tonic::{Request, Response, Status, transport::Server};

use hello_world::greeter_server::{Greeter, GreeterServer};
use hello_world::{HelloReply, HelloRequest};
Expand Down
2 changes: 1 addition & 1 deletion examples/src/dynamic/server.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::env;
use tonic::{service::RoutesBuilder, transport::Server, Request, Response, Status};
use tonic::{Request, Response, Status, service::RoutesBuilder, transport::Server};

use hello_world::greeter_server::{Greeter, GreeterServer};
use hello_world::{HelloReply, HelloRequest};
Expand Down
4 changes: 2 additions & 2 deletions examples/src/dynamic_load_balance/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ pub mod pb {
tonic::include_proto!("grpc.examples.unaryecho");
}

use pb::{echo_client::EchoClient, EchoRequest};
use tonic::transport::channel::Change;
use pb::{EchoRequest, echo_client::EchoClient};
use tonic::transport::Channel;
use tonic::transport::Endpoint;
use tonic::transport::channel::Change;

use std::sync::Arc;

Expand Down
2 changes: 1 addition & 1 deletion examples/src/dynamic_load_balance/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub mod pb {

use std::net::SocketAddr;
use tokio::sync::mpsc;
use tonic::{transport::Server, Request, Response, Status};
use tonic::{Request, Response, Status, transport::Server};

use pb::{EchoRequest, EchoResponse};

Expand Down
4 changes: 2 additions & 2 deletions examples/src/gcp/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ pub mod api {
tonic::include_proto!("google.pubsub.v1");
}

use api::{publisher_client::PublisherClient, ListTopicsRequest};
use api::{ListTopicsRequest, publisher_client::PublisherClient};
use tonic::{
Request,
metadata::MetadataValue,
transport::{Certificate, Channel, ClientTlsConfig},
Request,
};

const ENDPOINT: &str = "https://pubsub.googleapis.com";
Expand Down
2 changes: 1 addition & 1 deletion examples/src/grpc-web/client.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use hello_world::{greeter_client::GreeterClient, HelloRequest};
use hello_world::{HelloRequest, greeter_client::GreeterClient};
use hyper_util::rt::TokioExecutor;
use tonic_web::GrpcWebClientLayer;

Expand Down
2 changes: 1 addition & 1 deletion examples/src/grpc-web/server.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use tonic::{service::LayerExt as _, transport::Server, Request, Response, Status};
use tonic::{Request, Response, Status, service::LayerExt as _, transport::Server};

use hello_world::greeter_server::{Greeter, GreeterServer};
use hello_world::{HelloReply, HelloRequest};
Expand Down
4 changes: 2 additions & 2 deletions examples/src/h2c/client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use hello_world::greeter_client::GreeterClient;
use hello_world::HelloRequest;
use hello_world::greeter_client::GreeterClient;
use http::Uri;
use hyper_util::client::legacy::Client;
use hyper_util::rt::TokioExecutor;
Expand Down Expand Up @@ -36,7 +36,7 @@ mod h2c {

use hyper::body::Incoming;
use hyper_util::{
client::legacy::{connect::HttpConnector, Client},
client::legacy::{Client, connect::HttpConnector},
rt::TokioExecutor,
};
use tonic::body::Body;
Expand Down
2 changes: 1 addition & 1 deletion examples/src/h2c/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use hyper_util::rt::{TokioExecutor, TokioIo};
use hyper_util::server::conn::auto::Builder;
use hyper_util::service::TowerToHyperService;
use tokio::net::TcpListener;
use tonic::{service::Routes, Request, Response, Status};
use tonic::{Request, Response, Status, service::Routes};

use hello_world::greeter_server::{Greeter, GreeterServer};
use hello_world::{HelloReply, HelloRequest};
Expand Down
2 changes: 1 addition & 1 deletion examples/src/health/server.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use tonic::{transport::Server, Request, Response, Status};
use tonic::{Request, Response, Status, transport::Server};

use hello_world::greeter_server::{Greeter, GreeterServer};
use hello_world::{HelloReply, HelloRequest};
Expand Down
2 changes: 1 addition & 1 deletion examples/src/helloworld/client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use hello_world::greeter_client::GreeterClient;
use hello_world::HelloRequest;
use hello_world::greeter_client::GreeterClient;

pub mod hello_world {
tonic::include_proto!("helloworld");
Expand Down
2 changes: 1 addition & 1 deletion examples/src/helloworld/server.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use tonic::{transport::Server, Request, Response, Status};
use tonic::{Request, Response, Status, transport::Server};

use hello_world::greeter_server::{Greeter, GreeterServer};
use hello_world::{HelloReply, HelloRequest};
Expand Down
4 changes: 2 additions & 2 deletions examples/src/interceptor/client.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use hello_world::greeter_client::GreeterClient;
use hello_world::HelloRequest;
use hello_world::greeter_client::GreeterClient;
use tonic::{
Request, Status,
codegen::InterceptedService,
service::Interceptor,
transport::{Channel, Endpoint},
Request, Status,
};

pub mod hello_world {
Expand Down
2 changes: 1 addition & 1 deletion examples/src/interceptor/server.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use tonic::{transport::Server, Request, Response, Status};
use tonic::{Request, Response, Status, transport::Server};

use hello_world::greeter_server::{Greeter, GreeterServer};
use hello_world::{HelloReply, HelloRequest};
Expand Down
2 changes: 1 addition & 1 deletion examples/src/json-codec/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use bytes::{Buf, BufMut};
use serde::{Deserialize, Serialize};
use std::marker::PhantomData;
use tonic::{
codec::{Codec, DecodeBuf, Decoder, EncodeBuf, Encoder},
Status,
codec::{Codec, DecodeBuf, Decoder, EncodeBuf, Encoder},
};

#[derive(Debug, Deserialize, Serialize)]
Expand Down
2 changes: 1 addition & 1 deletion examples/src/json-codec/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! in the `examples/build.rs` file. As defined there, the generated code assumes that a module
//! `crate::common` exists which defines `HelloRequest`, `HelloResponse`, and `JsonCodec`.

use tonic::{transport::Server, Request, Response, Status};
use tonic::{Request, Response, Status, transport::Server};

pub mod common;
use common::{HelloRequest, HelloResponse};
Expand Down
2 changes: 1 addition & 1 deletion examples/src/load_balance/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pub mod pb {
tonic::include_proto!("grpc.examples.unaryecho");
}

use pb::{echo_client::EchoClient, EchoRequest};
use pb::{EchoRequest, echo_client::EchoClient};
use tonic::transport::Channel;

#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion examples/src/load_balance/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub mod pb {

use std::net::SocketAddr;
use tokio::sync::mpsc;
use tonic::{transport::Server, Request, Response, Status};
use tonic::{Request, Response, Status, transport::Server};

use pb::{EchoRequest, EchoResponse};

Expand Down
4 changes: 2 additions & 2 deletions examples/src/mock/mock.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use hyper_util::rt::TokioIo;
use tonic::{
transport::{Endpoint, Server, Uri},
Request, Response, Status,
transport::{Endpoint, Server, Uri},
};
use tower::service_fn;

Expand All @@ -10,9 +10,9 @@ pub mod hello_world {
}

use hello_world::{
HelloReply, HelloRequest,
greeter_client::GreeterClient,
greeter_server::{Greeter, GreeterServer},
HelloReply, HelloRequest,
};

#[tokio::main]
Expand Down
4 changes: 2 additions & 2 deletions examples/src/multiplex/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ pub mod echo {
tonic::include_proto!("grpc.examples.unaryecho");
}

use echo::{echo_client::EchoClient, EchoRequest};
use hello_world::{greeter_client::GreeterClient, HelloRequest};
use echo::{EchoRequest, echo_client::EchoClient};
use hello_world::{HelloRequest, greeter_client::GreeterClient};
use tonic::transport::Endpoint;

#[tokio::main]
Expand Down
6 changes: 3 additions & 3 deletions examples/src/multiplex/server.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use tonic::{transport::Server, Request, Response, Status};
use tonic::{Request, Response, Status, transport::Server};

pub mod hello_world {
tonic::include_proto!("helloworld");
Expand All @@ -9,13 +9,13 @@ pub mod echo {
}

use hello_world::{
greeter_server::{Greeter, GreeterServer},
HelloReply, HelloRequest,
greeter_server::{Greeter, GreeterServer},
};

use echo::{
echo_server::{Echo, EchoServer},
EchoRequest, EchoResponse,
echo_server::{Echo, EchoServer},
};

#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion examples/src/richer-error/client.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use tonic_types::StatusExt;

use hello_world::greeter_client::GreeterClient;
use hello_world::HelloRequest;
use hello_world::greeter_client::GreeterClient;

pub mod hello_world {
tonic::include_proto!("helloworld");
Expand Down
2 changes: 1 addition & 1 deletion examples/src/richer-error/client_vec.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use tonic_types::{ErrorDetail, StatusExt};

use hello_world::greeter_client::GreeterClient;
use hello_world::HelloRequest;
use hello_world::greeter_client::GreeterClient;

pub mod hello_world {
tonic::include_proto!("helloworld");
Expand Down
2 changes: 1 addition & 1 deletion examples/src/richer-error/server.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use tonic::{transport::Server, Code, Request, Response, Status};
use tonic::{Code, Request, Response, Status, transport::Server};
use tonic_types::{ErrorDetails, StatusExt};

use hello_world::greeter_server::{Greeter, GreeterServer};
Expand Down
2 changes: 1 addition & 1 deletion examples/src/richer-error/server_vec.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use tonic::{transport::Server, Code, Request, Response, Status};
use tonic::{Code, Request, Response, Status, transport::Server};
use tonic_types::{BadRequest, Help, LocalizedMessage, StatusExt};

use hello_world::greeter_server::{Greeter, GreeterServer};
Expand Down
4 changes: 2 additions & 2 deletions examples/src/routeguide/client.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::error::Error;
use std::time::Duration;

use rand::rngs::ThreadRng;
use rand::Rng;
use rand::rngs::ThreadRng;
use tokio::time;
use tonic::transport::Channel;
use tonic::Request;
use tonic::transport::Channel;

use routeguide::route_guide_client::RouteGuideClient;
use routeguide::{Point, Rectangle, RouteNote};
Expand Down
Loading
Loading