Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mzabaluev opened this issue Jul 12, 2021 · 2 comments · Fixed by #719 or #737

Comments

@mzabaluev
Copy link

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.

@davidpdrsn
Copy link
Member

I see why https://github.com/hyperium/tonic/blob/master/tonic-build/src/client.rs#L227 😅 That definitely was committed by accident! Sorry about that.

I made a quick fix #719. Will try and get a release out quickly.

davidpdrsn added a commit that referenced this issue Jul 12, 2021
…719)

This was accidentally committed as part of
#692.

Fixes #718
@davidpdrsn
Copy link
Member

Fix is published as part of tonic-build 0.5.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants