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

Support for adding derive annotations for traits outside prost? #1064

Open
andrew-otiv opened this issue May 17, 2024 · 2 comments
Open

Support for adding derive annotations for traits outside prost? #1064

andrew-otiv opened this issue May 17, 2024 · 2 comments

Comments

@andrew-otiv
Copy link

Prost already can generate types supporting Clone and PartialEq, which is great. We'd like to also be able to derive other traits, like Default, or the various traits used by fuzzers like cargo fuzz. Rust's orphan rules make this hard in the context of code generation.

We currently only have ~50 code generated types, so we could write our own impls manually, but maybe it would possible to add trait derivations to the generated code via configuration? Theres already a mechanism for switching ~off the already supported traits; I am interested in going the other direction.

Related: #493

@romac
Copy link

romac commented May 17, 2024

@andrew-otiv
Copy link
Author

That looks very promising, thanks! We're trying to set this up from bazel rules_rust; hopefully we can drive this through keyword arguments to https://bazelbuild.github.io/rules_rust/rust_proto.html#rust_prost_library.

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

2 participants