Impl FusedIterator for EnumIter iterators#311
Impl FusedIterator for EnumIter iterators#311Peternator7 merged 1 commit intoPeternator7:masterfrom jwodder:iter-traits
Conversation
|
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. |
No, it just seemed appropriate.
Fair.
It doesn't seem unusual to me (though I happen to always derive Feel free to edit the PR to remove the traits you don't want. |
|
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! |
The fields within
EnumItertypes (usizeandPhantomData) all implementClone,Copy,Eq, andPartialEq, so we can derive all of those on the iterator types.Once an
EnumIterreaches the end of its values, it only ever yieldsNone. This means we can implementFusedIteratoron it.