-
Notifications
You must be signed in to change notification settings - Fork 161
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
Refactor: RaftError: serde derive #993
Refactor: RaftError: serde derive #993
Conversation
63379ed
to
8ba77d7
Compare
The problem is not the bound on the `E` generic, but rather, the fact that `NID` is receiving two different `Serialize/Deserialize` bounds; one from the derive annotation, and one from the `NID: NodeId` trait bound. This modification is from suggestions by @tvsfx about the serde bound: databendlabs#991 (comment)
8ba77d7
to
e09803c
Compare
Great! |
Thanks again! |
One more note; |
Thanks for the heads-up! 😊 Do you know of any specific scenarios where this current declaration might run into trouble? I'd love to whip up some tests to double-check that everything works smoothly in those cases. Any insights you have would be super helpful! |
The current specification is fine functionally speaking; what I tried to highlight is more of a usability issue. The issue is two-fold. Let me illustrate by inspecting the output of The derived
The
Any wrapping Additionally, any location that wants to The new derived
|
On a related note, I see some explicit serde bounds on structs without generics, which I do not think you need. For example: For some more info, see here: https://serde.rs/attr-bound.html |
Thank you for the detailed explanation. I believe the refinement you suggested will make the openraft more approachable and its behavior more predictable. Let me fix these issues. :D |
Thanks to @tvsfx for giving suggestions on serde trait bound optimization: databendlabs#993 (comment)
Thanks to @tvsfx for giving suggestions on serde trait bound optimization: databendlabs#993 (comment)
Thanks to @tvsfx for giving suggestions on serde trait bound optimization: #993 (comment)
Changelog
Refactor: RaftError: serde derive
The problem is not the bound on the
E
generic, but rather, the factthat
NID
is receiving two differentSerialize/Deserialize
bounds;one from the derive annotation, and one from the
NID: NodeId
traitbound.
This modification is from suggestions by @tvsfx about the serde bound:
#991 (comment)
This change is