Open RustyNova016 opened 7 months ago
So, Clone
trait would probably be OK. But for structs, I wouldn't include traits PartialEq
and Eq
. For enums, that's fine. Go for it in terms of enums.
:+1: Clone
would be nice to have, not sure about the added benefit of PartialEq
/Eq
The benefits of PartialEq
/Eq
for enums in particular would allow for conditionals to work. Such as if response == ResponseType::Whatever { /* do something */
.
As is my understanding.
PartialEq
/Eq
would work awesomely for request caching without needing to use a costly hash
and/or creating your own struct.
Like I can imagine an app that has a vector of listens that hold all of the user's listens, then periodically send a request to fetch new ones. If the request return the same listen, don't reinsert it. If not, insert.
Its also not costing any runtime cost as it would be tree shaken if unused.
I noticed that a lot of the models lack the classic
Clone, PartialEq, Eq
combo that most API do implement. Is this intentional? I could see having use cases for those derives, expecialyClone
.I can do a pull request, but I do want to know whether I should do it before wasting my time.