Ugly tonic-build/protobuf problem

The Protobuf file I'm building, which is from a commercial software vendor (no changes to the server or interface possible), contains a service method called Connect:

	rpc Connect (ConnectRequest) returns (ConnectResponse);

The generated code then has a compile error due to a name conflict, as there is apparently a function of the same name in the framework:

**838** **|** **/** pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>

**839** **|** **|** where

**840** **|** **|** D: TryInto<tonic::transport::Endpoint>,

**841** **|** **|** D::Error: Into<StdError>,

**|** **|_____________________________________^** **duplicate definitions for `connect`**

**...**

**1045** **|** **/** pub async fn connect(

**1046** **|** **|** &mut self,

**1047** **|** **|** request: impl tonic::IntoRequest<super::ConnectRequest>,

**1048** **|** **|** ) -> std::result::Result<

**1049** **|** **|** tonic::Response<super::ConnectResponse>,

**1050** **|** **|** tonic::Status,

**1051** **|** **|** > {

**| |_________-** **other definition for `connect`**

I can change the generated code and rename the non-service method, but obviously a hack like that won't work in a pipeline.

Searching the tonic-build source, I'm not seeing a way to generate a qualified name or any other workaround.

I'm not familiar with tonic. Is one of the connects a function that's always generated as some kind of "boilerplate"?

If there's no way of changing the generated names, or putting them in a different module or anything, then that's a bug in tonic.

Yes, there's always a connect() on the generated client stub.

I'm not sure it's a bug, but it's not convenient.

Since most people using Protobuf are (as of now) unaware of Rust/tonic, no one knows to avoid that name in their services.

Fix: