-
Notifications
You must be signed in to change notification settings - Fork 1k
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
'ready' function for client services clashes with 'ready' rpc method #162
Comments
Do you have an example error message I could see, there should only be one ready generated per struct which as far as I know shouldn't violate rust's model. |
Yep, here's the original compilation failure I hit: error[E0201]: duplicate definitions with name `ready`:
--> /home/rib/src/realfit-server/target/debug/build/realfit-server-808a11d4a9ed943b/out/agones.dev.sdk.rs:133:9
|
124 | / pub async fn ready(&mut self) -> Result<(), tonic::Status> {
125 | | self.inner.ready().await.map_err(|e| {
126 | | tonic::Status::new(
127 | | tonic::Code::Unknown,
... |
130 | | })
131 | | }
| |_________- previous definition of `ready` here
132 | #[doc = " Call when the GameServer is ready"]
133 | / pub async fn ready(
134 | | &mut self,
135 | | request: impl tonic::IntoRequest<super::Empty>,
136 | | ) -> Result<tonic::Response<super::Empty>, tonic::Status> {
... |
140 | | self.inner.unary(request.into_request(), path, codec).await
141 | | }
| |_________^ duplicate definition
error: aborting due to previous error
For more information about this error, try `rustc --explain E0201`.
error: could not compile `realfit-server`. So, the issue is that there can be an rpc method named 'ready' which tonic isn't in control of, which can be in addition to the one generated by tonic. This is the workaround I'm currently using, which fixes the issue for me: |
Ah I see the rpc name is clashing...fun...I'll have to think about this one. It may not be worth it to expose a async fn ready. The solution might be to actually just expose the |
Could you put |
@pruthvikar that is an interesting idea! That could work, we could also just expose it as |
Bug Report
Version
├── tonic v0.1.0-alpha.6
└── tonic-build v0.1.0-alpha.6
Crates
tonic-build
Description
I started looking at using tonic with this Agones SDK protocol today and found that the generated code wouldn't compile because there were multiple 'ready' functions for the service. (ref:
tonic/tonic-build/src/client.rs
Line 33 in 4471a5f
I guess it's going to be relatively likely for "ready" to conflict with more than just this protocol, so I wonder if it's possible for this to be changed to a less common name?
The text was updated successfully, but these errors were encountered: