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

Add Hash for SpecialFields , in order to enable derive hash in… #648

Closed
wants to merge 1 commit into from

Conversation

eyalsatori
Copy link

messag in CustomizeCallback during codegen

@eyalsatori
Copy link
Author

following #211 , I tried to implement Hash and Eq with CustomizeCallback but i need Hash to be implement on SpecialFields (and some other structs) . In hash I don't have something equivalent to #[serde(skip)] like in the example in the serde example

@stepancheg
Copy link
Owner

Added hash to SpecialFields in 6890eba, but Timestamp is generated, it should not be changed manually.

@eyalsatori
Copy link
Author

eyalsatori commented Sep 27, 2022

So if I have proto object that include well-known type and I need to implement hash on this object .

what I need to do is to fetch the proto definition from google , and do my customize code generation also on google proto ?

@stepancheg
Copy link
Owner

Rust-protobuf can be patched to derive Hash for well-known types.

But well known types are generated. Generator need to be patched to patch these files. With some local hack.

Resulting change is correct. But it would be overwritten on next code regeneration if generator is not patched.

@eyalsatori
Copy link
Author

cool , thanks !

@eyalsatori eyalsatori closed this Sep 29, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants