Closed soywod closed 1 year ago
It makes sense to compare just the address but that would involve adding a breaking change as current library users expect Eq
to compare both address and name.
For your use case you could use a custom compare function or create your own Address struct.
It makes sense to compare just the address but that would involve adding a breaking change as current library users expect
Eq
to compare both address and name.
Then let's wait for your next breaking changes (in order to group them), it is not an important one.
For your use case you could use a custom compare function or create your own Address struct.
I used a custom compare function, but I need to destructure everything
before applying it, which makes the code not so clear (instead of just
using ==
).
The
Addr
struct derivesEq
andPartialEq
, which means that two addresses are equal if the name AND the email are equal. Would it make sense to compare addresses only on their email instead? Because technically,John Doe <john.doe@localhost>
is the same asJohn D. <john.doe@localhost>
or<john.doe@localhost>
orjohn.doe@localhost
.For the context: my use case right now is to transform a message into a reply template, which implies to reorder addresses, and I need to avoid duplicates (for example, having
Cc: john.doe@localhost, John Doe <john.doe@localhost>
).