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

Well-known-types support #276

mvlabat opened this Issue Jan 21, 2019 · 3 comments


None yet
4 participants
Copy link

commented Jan 21, 2019

Consider the following Service:

service Crow {
    rpc Hello (google.protobuf.Empty) returns (Caw);

This is what compiler generates for it:

pub trait Crow {
    fn hello(&mut self, ctx: ::grpcio::RpcContext, req: super::empty::Empty, sink: ::grpcio::UnarySink<super::hello::Caw>);

^ And compilation obviously fails, because super has no empty module in its scope.

rust-protobuf seems to have support for well-known-types, and I think it's possible to reuse it. Haven't dug too much into the code, but if I'm not mistaken all the needed modules and methods are public, so maybe it won't be very painful to implement.


This comment has been minimized.

Copy link

commented Jan 23, 2019

Agree, it is nice to have, would you like to try @mvlabat ?


This comment has been minimized.

Copy link

commented Jan 23, 2019

Not having too much free time lately, but if nobody else will, I'll give it a try. Would be glad to help, not sure it'll happen soon though :)


This comment has been minimized.

Copy link

commented Mar 1, 2019

You can work around this problem by:

  1. Generate your proto rust files in a common directory.
  2. Adding a file to that directory.
  3. In that file map empty::Empty to protobuf::well_known_types::Empty:
use protobuf; mods...

mod empty {
  pub use protobuf::well_known_types::Empty;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.