Skip to content

Conversation

@fredszaq
Copy link

This PR depends on #532 (I will mark this PR as non-draft once #532 is merged; for now, you will see changes from both PRs in the diff).

Synopsis

This adds the possibility to use custom functions to perform the equality check in PartialEq/Eq derives. This is quite useful when wrapping types without a PartialEq/Eq impl

Solution

This builds on #532 and reuse the FieldAttributes for Hash, I moved the struct to utils::attr and renamed it WithOrSkip.

I removed fields types that have a with attribute from the automatically added where Type: Eq bound automatically generated by the Eq derive. This seems like the thing to do as if you're using a custom function it most probably means the field doesn't implement Eq.

While this is not part of the roadmap for PartialEq, defined in #163 this is something that will be quite useful for people migrating form derivative as this was something supported by this crate

Checklist

  • Documentation is updated (if required)
  • Tests are added/updated (if required)
  • CHANGELOG entry is added (if required)

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.

1 participant