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 dd0238a9f..094035a56 100644 --- a/grpc-protobuf/src/client/bidi.rs +++ b/grpc-protobuf/src/client/bidi.rs @@ -30,9 +30,9 @@ use grpc::client::InvokeOnce; use grpc::client::RequestHeaders; use protobuf::Message; -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 1e0c43dcd..514e847f7 100644 --- a/grpc-protobuf/src/client/client_streaming.rs +++ b/grpc-protobuf/src/client/client_streaming.rs @@ -37,11 +37,11 @@ use protobuf::AsMut; use protobuf::AsView; use protobuf::Message; -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 6939a1e0e..7c38c8afa 100644 --- a/grpc-protobuf/src/client/mod.rs +++ b/grpc-protobuf/src/client/mod.rs @@ -22,6 +22,22 @@ * */ +//! Client-side types and call builders for RPCs (Remote Procedure Calls). +//! +//! # Basic usage +//! +//! There are four basic RPCs 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; @@ -49,10 +65,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 1ce6c8f2a..ed37e1f77 100644 --- a/grpc-protobuf/src/client/server_streaming.rs +++ b/grpc-protobuf/src/client/server_streaming.rs @@ -33,9 +33,9 @@ use grpc::client::SendStream as _; use protobuf::AsView; use protobuf::Message; -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 7af85a27e..a3599b772 100644 --- a/grpc-protobuf/src/client/unary.rs +++ b/grpc-protobuf/src/client/unary.rs @@ -37,11 +37,11 @@ use protobuf::AsMut; use protobuf::AsView; use protobuf::Message; -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..7f81098c3 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: [`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. +//! * [`client`] - Client-side types and call builders for RPCs. use std::any::TypeId; @@ -58,14 +47,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 930659a00..e5162fe52 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 @@ -398,6 +398,7 @@ static void GenerateClient(const Service &service, Printer &printer, )] use grpc::client::*; use grpc_protobuf::*; + use grpc_protobuf::client::*; $service_doc$ #[derive(Debug, Clone)]