Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Made the derive macros automatically implement the required traits on generic arguments#454

Merged
VictorKoenders merged 1 commit intotrunkfrom
fix/derive_automatic_traits
Dec 14, 2021
Merged

Made the derive macros automatically implement the required traits on generic arguments#454
VictorKoenders merged 1 commit intotrunkfrom
fix/derive_automatic_traits

Conversation

@VictorKoenders
Copy link
Contributor

Fixed #451

This PR builds upon a new function in virtue: modify_generic_constraints

The derive macros will now automatically assume any generic argument implements the required traits.

If a user is in a situation where this isn't required, a solution is:

  • They can implement the BorrowDecode/Decode/Encode manually
  • We can add a #[bincode(bounds = "T: Decode")] attribute in the future to override the current type check logic, similar to https://serde.rs/container-attrs.html#bound

@VictorKoenders VictorKoenders requested a review from a user December 14, 2021 10:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Encode/Decode/BorrowDecode constraints for struct generic type parameters in derive macro's outputs

1 participant