Peternator7 / strum

A small rust library for adding custom derives to enums
https://crates.io/crates/strum
MIT License
1.8k stars 151 forks source link

Impl FusedIterator for EnumIter iterators #311

Closed jwodder closed 1 year ago

jwodder commented 1 year ago
Peternator7 commented 1 year ago

Hey @jwodder, thanks for the PR! Is this blocking something specific that you're doing? I'm happy to add Clone, and FusedIterator; I'm skeptical of the rest however. Adding Copy will almost definitely cause someone to accidentally mutate a copy rather than the original, and semantically, PartialEq on an iterator seems like an unusual thing to do.

jwodder commented 1 year ago

@Peternator7

Is this blocking something specific that you're doing?

No, it just seemed appropriate.

Adding Copy will almost definitely cause someone to accidentally mutate a copy rather than the original

Fair.

and semantically, PartialEq on an iterator seems like an unusual thing to do.

It doesn't seem unusual to me (though I happen to always derive Eq and PartialEq when possible). On the other hand, I looked over some iterators in std, and the only ones I see that implement Eq are the range types from std::ops, which have non-iterator uses.

Feel free to edit the PR to remove the traits you don't want.

Peternator7 commented 1 year ago

Thanks for clarifying. After thinking about it, I've merged the FusedIterator addition, but decided to leave the other changes out. Thanks for the update!