Skip to content

Generated code for client streaming methods forces the client type parameter to implement Debug #718

@mzabaluev

Description

@mzabaluev

Bug Report

When the RPC features client-streaming methods, generated code imposes a Debug bound on the client object's parameter type.

Version

tonic v0.5.0
tonic-build v0.5.0

Description

In the generated code, the gRPC client method for a client-streaming request looks like this:

        pub async fn push_headers(
            &mut self,
            request: impl tonic::IntoStreamingRequest<Message = super::Header>,
        ) -> Result<tonic::Response<super::PushHeadersResponse>, tonic::Status>
        where
            T: std::fmt::Debug,
        {
            self.inner.ready().await.map_err(|e| {
                tonic::Status::new(
                    tonic::Code::Unknown,
                    format!("Service was not ready: {}", e.into()),
                )
            })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static("/iohk.chain.node.Node/PushHeaders");
            self.inner
                .client_streaming(request.into_streaming_request(), path, codec)
                .await
        }

It's not clear what in this code would make the Debug bound necessary. Code generated for methods with other streaming signatures, including bidirectional methods, does not impose this bound.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions