niax / rust-email

Implementation of MIME Messages for Rust
MIT License
62 stars 34 forks source link

Add useful traits to errors #34

Open tredoe opened 7 years ago

tredoe commented 7 years ago

Please add #[derive(PartialEq, Eq, Copy, Clone, Debug)] so the error could be compared in tests of other libraries/apps that use your library, or be copied. Thanks in advance!

https://github.com/niax/rust-email/blob/master/src/results.rs#L4

untitaker commented 7 years ago

Not going to implement Copy, but fine with the rest

tredoe commented 7 years ago

https://www.reddit.com/r/rust/comments/5d8frm/traits_derived_in_errors/

untitaker commented 7 years ago

That post is simply wrong. The error contains a string and can't implement Copy (only Clone)

untitaker commented 7 years ago

Well, in general it's a good idea to encode the error reason as much into an enum as possible (and not a string), so in the ideal case Copy can be derived. But not for the general case.