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

derive: provide a way to customize prost path. #128

Open
carllerche opened this issue Oct 11, 2018 · 2 comments
Open

derive: provide a way to customize prost path. #128

carllerche opened this issue Oct 11, 2018 · 2 comments

Comments

@carllerche
Copy link
Member

tower-grpc is based on Prost. I would like to improve the ergonomics of using it by not requiring an explicit dependency on Prost.

To do this, similar to #127, I will re-export prost from tower-grpc. The problem is that the generated derives require the prost crate to be added as a dependency.

One way to do this would be to:

  • Allow the extern crate to be customized.
  • Allow the path to prost to be customized.

This could be done with an extra attribute

#[derive(Message)]
#[prost(extern = "extern crate tower_grpc as _grpc", path = "_grpc::codegen::prost")]
pub struct PhoneNumber {
    // ...
}
@carllerche
Copy link
Member Author

prost-build already supports the ability to specify custom type attributes, so tower-grpc's codegen could use that to inject that extra attribute.

@carllerche
Copy link
Member Author

If this sounds good to you, I can work on a PR.

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

No branches or pull requests

1 participant