From 131f2f72f4ec53ddfc2950882ca44751c5f1a463 Mon Sep 17 00:00:00 2001 From: Arjan Bal Date: Wed, 19 Aug 2026 15:39:03 +0530 Subject: [PATCH 1/4] avoid exporting client symbols from crate root --- examples/generated/helloworld/helloworld_grpc.pb.rs | 1 + .../generated/routeguide/route_guide_grpc.pb.rs | 1 + grpc-protobuf/src/client/bidi.rs | 6 +++--- grpc-protobuf/src/client/client_streaming.rs | 2 +- grpc-protobuf/src/client/mod.rs | 13 +++++++++---- grpc-protobuf/src/client/server_streaming.rs | 4 ++-- grpc-protobuf/src/client/unary.rs | 2 +- grpc-protobuf/src/lib.rs | 7 +------ interop/src/client_protobuf.rs | 2 +- .../src/cpp_source/src/grpc_rust_generator.cc | 1 + 10 files changed, 21 insertions(+), 18 deletions(-) diff --git a/examples/generated/helloworld/helloworld_grpc.pb.rs b/examples/generated/helloworld/helloworld_grpc.pb.rs index c3efdb6a9..82e1996d4 100644 --- a/examples/generated/helloworld/helloworld_grpc.pb.rs +++ b/examples/generated/helloworld/helloworld_grpc.pb.rs @@ -2,6 +2,7 @@ pub mod greeter_client { use grpc::client::*; use grpc_protobuf::*; + use grpc_protobuf::client::*; /// The greeting service definition. #[derive(Debug, Clone)] pub struct GreeterClient { diff --git a/examples/generated/routeguide/route_guide_grpc.pb.rs b/examples/generated/routeguide/route_guide_grpc.pb.rs index 4caa057a0..56cf27759 100644 --- a/examples/generated/routeguide/route_guide_grpc.pb.rs +++ b/examples/generated/routeguide/route_guide_grpc.pb.rs @@ -2,6 +2,7 @@ pub mod route_guide_client { use grpc::client::*; use grpc_protobuf::*; + use grpc_protobuf::client::*; /// Interface exported by the server. #[derive(Debug, Clone)] pub struct RouteGuideClient { diff --git a/grpc-protobuf/src/client/bidi.rs b/grpc-protobuf/src/client/bidi.rs index 561f10a46..890fdff05 100644 --- a/grpc-protobuf/src/client/bidi.rs +++ b/grpc-protobuf/src/client/bidi.rs @@ -33,9 +33,9 @@ use protobuf::Message; use protobuf::MessageMut; use protobuf::MessageView; -use crate::CallBuilder; -use crate::GrpcStreamingRequest; -use crate::GrpcStreamingResponse; +use crate::client::CallBuilder; +use crate::client::GrpcStreamingRequest; +use crate::client::GrpcStreamingResponse; use crate::private::Internal; /// Configures a bidirectional call for gRPC Protobuf. Implements diff --git a/grpc-protobuf/src/client/client_streaming.rs b/grpc-protobuf/src/client/client_streaming.rs index 57c6d8972..b161b8236 100644 --- a/grpc-protobuf/src/client/client_streaming.rs +++ b/grpc-protobuf/src/client/client_streaming.rs @@ -40,11 +40,11 @@ use protobuf::Message; use protobuf::MessageMut; use protobuf::MessageView; -use crate::CallBuilder; use crate::ProtoRecvMessage; use crate::ProtoSendMessage; use crate::Status; use crate::StatusOr; +use crate::client::CallBuilder; use crate::client::Internal; use crate::trailers_conv::status_from_trailers; diff --git a/grpc-protobuf/src/client/mod.rs b/grpc-protobuf/src/client/mod.rs index c0af96238..d94199b7e 100644 --- a/grpc-protobuf/src/client/mod.rs +++ b/grpc-protobuf/src/client/mod.rs @@ -51,10 +51,15 @@ use crate::Status; use crate::private::Internal; use crate::trailers_conv::status_from_trailers; -pub(crate) mod bidi; -pub(crate) mod client_streaming; -pub(crate) mod server_streaming; -pub(crate) mod unary; +mod bidi; +mod client_streaming; +mod server_streaming; +mod unary; + +pub use bidi::*; +pub use client_streaming::*; +pub use server_streaming::*; +pub use unary::*; /// Allows sending streaming RPC protobuf request messages. /// diff --git a/grpc-protobuf/src/client/server_streaming.rs b/grpc-protobuf/src/client/server_streaming.rs index 188f0eb17..3d5217f5d 100644 --- a/grpc-protobuf/src/client/server_streaming.rs +++ b/grpc-protobuf/src/client/server_streaming.rs @@ -37,9 +37,9 @@ use protobuf::MessageMut; use protobuf::MessageView; use protobuf::Proxied; -use crate::CallBuilder; -use crate::GrpcStreamingResponse; use crate::ProtoSendMessage; +use crate::client::CallBuilder; +use crate::client::GrpcStreamingResponse; use crate::client::Internal; /// Configures a server-streaming call for gRPC Protobuf. Implements diff --git a/grpc-protobuf/src/client/unary.rs b/grpc-protobuf/src/client/unary.rs index 08757a3e2..ed30d6979 100644 --- a/grpc-protobuf/src/client/unary.rs +++ b/grpc-protobuf/src/client/unary.rs @@ -40,11 +40,11 @@ use protobuf::Message; use protobuf::MessageView; use protobuf::Proxied; -use crate::CallBuilder; use crate::ProtoRecvMessage; use crate::ProtoSendMessage; use crate::Status; use crate::StatusError; +use crate::client::CallBuilder; use crate::client::Internal; use crate::trailers_conv::status_from_trailers; diff --git a/grpc-protobuf/src/lib.rs b/grpc-protobuf/src/lib.rs index 70ffbd1f5..a7dfc0d46 100644 --- a/grpc-protobuf/src/lib.rs +++ b/grpc-protobuf/src/lib.rs @@ -58,14 +58,9 @@ use protobuf::MutProxied; use protobuf::Proxied; use protobuf::Serialize; -mod client; +pub mod client; mod status; mod trailers_conv; -pub use client::bidi::*; -pub use client::client_streaming::*; -pub use client::server_streaming::*; -pub use client::unary::*; -pub use client::*; pub use status::*; /// Implements [`SendMessage`] for protobuf message views. diff --git a/interop/src/client_protobuf.rs b/interop/src/client_protobuf.rs index b63506874..8c089f4d0 100644 --- a/interop/src/client_protobuf.rs +++ b/interop/src/client_protobuf.rs @@ -28,9 +28,9 @@ use grpc::client::metadata_utils::CaptureHeadersInterceptor; use grpc::client::metadata_utils::CaptureTrailersInterceptor; use grpc::metadata::MetadataMap; use grpc::metadata::MetadataValue; -use grpc_protobuf::CallBuilder; use grpc_protobuf::StatusCodeError; use grpc_protobuf::StatusOr; +use grpc_protobuf::client::CallBuilder; use protobuf::message_eq; use protobuf::proto; use tonic::async_trait; diff --git a/protoc-gen-rust-grpc/src/cpp_source/src/grpc_rust_generator.cc b/protoc-gen-rust-grpc/src/cpp_source/src/grpc_rust_generator.cc index 413c1836e..6435b21f1 100644 --- a/protoc-gen-rust-grpc/src/cpp_source/src/grpc_rust_generator.cc +++ b/protoc-gen-rust-grpc/src/cpp_source/src/grpc_rust_generator.cc @@ -393,6 +393,7 @@ static void GenerateClient(const Service &service, Printer &printer, pub mod $client_mod$ { use grpc::client::*; use grpc_protobuf::*; + use grpc_protobuf::client::*; $service_doc$ #[derive(Debug, Clone)] From 57ded5157f4daee550ce94f5efbf64fb3a34bebe Mon Sep 17 00:00:00 2001 From: Arjan Bal Date: Wed, 19 Aug 2026 16:49:22 +0530 Subject: [PATCH 2/4] fix docs --- grpc-protobuf/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/grpc-protobuf/src/lib.rs b/grpc-protobuf/src/lib.rs index a7dfc0d46..e2c392dad 100644 --- a/grpc-protobuf/src/lib.rs +++ b/grpc-protobuf/src/lib.rs @@ -33,12 +33,12 @@ //! There are four basic RPC (Remote Procedure Call) types and a corresponding //! call builder for each. //! -//! * Unary: [`UnaryCallBuilder`] -//! * Client Streaming: [`ClientStreamingCallBuilder`] -//! * Server Streaming: [`ServerStreamingCallBuilder`] -//! * Bidirectional Streaming: [`BidiCallBuilder`] +//! * Unary: [`client::UnaryCallBuilder`] +//! * Client Streaming: [`client::ClientStreamingCallBuilder`] +//! * Server Streaming: [`client::ServerStreamingCallBuilder`] +//! * Bidirectional Streaming: [`client::BidiCallBuilder`] //! -//! Each call builder implements [`CallBuilder`] which can be used to configure +//! Each call builder implements [`client::CallBuilder`] which can be used to configure //! the call. Each one also provides an [`IntoFuture`] implementation to //! actually begin the call. See the documentation for each type for additional //! usage information. From ff7818775380fcc24820d7f4ab72d46a7a95063d Mon Sep 17 00:00:00 2001 From: Arjan Bal Date: Thu, 20 Aug 2026 00:04:53 +0530 Subject: [PATCH 3/4] update docs --- grpc-protobuf/src/client/mod.rs | 17 +++++++++++++++++ grpc-protobuf/src/lib.rs | 15 ++------------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/grpc-protobuf/src/client/mod.rs b/grpc-protobuf/src/client/mod.rs index d94199b7e..09a1de023 100644 --- a/grpc-protobuf/src/client/mod.rs +++ b/grpc-protobuf/src/client/mod.rs @@ -22,6 +22,23 @@ * */ +//! Types and call builders for client-side RPCs. +//! +//! # Basic usage +//! +//! There are four basic RPC (Remote Procedure Call) types and a corresponding +//! call builder for each. +//! +//! * Unary: [`UnaryCallBuilder`] +//! * Client Streaming: [`ClientStreamingCallBuilder`] +//! * Server Streaming: [`ServerStreamingCallBuilder`] +//! * Bidirectional Streaming: [`BidiCallBuilder`] +//! +//! Each call builder implements [`CallBuilder`] which can be used to configure +//! the call. Each one also provides an [`IntoFuture`] implementation to +//! actually begin the call. See the documentation for each type for additional +//! usage information. + use std::marker::PhantomData; use std::time::Duration; use std::time::Instant; diff --git a/grpc-protobuf/src/lib.rs b/grpc-protobuf/src/lib.rs index e2c392dad..d9d2f9a9b 100644 --- a/grpc-protobuf/src/lib.rs +++ b/grpc-protobuf/src/lib.rs @@ -28,20 +28,9 @@ //! [`protoc-gen-rust-grpc`](https://docs.rs/protoc-gen-rust-grpc). See our //! [Quick Start Guide](docs/languages/rust/quickstart/) for more information. //! -//! ## Basic usage +//! # Modules //! -//! There are four basic RPC (Remote Procedure Call) types and a corresponding -//! call builder for each. -//! -//! * Unary: [`client::UnaryCallBuilder`] -//! * Client Streaming: [`client::ClientStreamingCallBuilder`] -//! * Server Streaming: [`client::ServerStreamingCallBuilder`] -//! * Bidirectional Streaming: [`client::BidiCallBuilder`] -//! -//! Each call builder implements [`client::CallBuilder`] which can be used to configure -//! the call. Each one also provides an [`IntoFuture`] implementation to -//! actually begin the call. See the documentation for each type for additional -//! usage information. +//! * [`client`] - Types and call builders for client-side RPCs use std::any::TypeId; From 3bbcd78a248f26f1eb7921998795d13754d7b63a Mon Sep 17 00:00:00 2001 From: Arjan Bal Date: Tue, 25 Aug 2026 15:50:11 +0530 Subject: [PATCH 4/4] rustdocs --- grpc-protobuf/src/client/mod.rs | 5 ++--- grpc-protobuf/src/lib.rs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/grpc-protobuf/src/client/mod.rs b/grpc-protobuf/src/client/mod.rs index c40998196..7c38c8afa 100644 --- a/grpc-protobuf/src/client/mod.rs +++ b/grpc-protobuf/src/client/mod.rs @@ -22,12 +22,11 @@ * */ -//! Types and call builders for client-side RPCs. +//! Client-side types and call builders for RPCs (Remote Procedure Calls). //! //! # Basic usage //! -//! There are four basic RPC (Remote Procedure Call) types and a corresponding -//! call builder for each. +//! There are four basic RPCs types and a corresponding call builder for each. //! //! * Unary: [`UnaryCallBuilder`] //! * Client Streaming: [`ClientStreamingCallBuilder`] diff --git a/grpc-protobuf/src/lib.rs b/grpc-protobuf/src/lib.rs index d9d2f9a9b..7f81098c3 100644 --- a/grpc-protobuf/src/lib.rs +++ b/grpc-protobuf/src/lib.rs @@ -30,7 +30,7 @@ //! //! # Modules //! -//! * [`client`] - Types and call builders for client-side RPCs +//! * [`client`] - Client-side types and call builders for RPCs. use std::any::TypeId;