Closed jwodder closed 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.
@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.
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
EnumIter
types (usize
andPhantomData
) all implementClone
,Copy
,Eq
, andPartialEq
, so we can derive all of those on the iterator types.Once an
EnumIter
reaches the end of its values, it only ever yieldsNone
. This means we can implementFusedIterator
on it.