Implemented DoubleEndedIterator for EnumIter. #60
Conversation
Thanks for the PR! It looks pretty good as an initial implementation. :) The big thing is that iterating forward and backward shouldn't overlap. If you pull some from the back, then they shouldn't show up again when you pull from the front. |
Simply using an iterator to an array is an interesting option. It would require an additional Iterators to arrays return references to the items in the array. EnumIter returns values which means we would need to clone the values returned by the array's iterator to pass them back to the user, and that requires the type be You can definitely look at that code to see how they avoid overlapping forward and backward iteration though! |
Thank you for the feedback! I did not notice the intended overlapping behaviour on my first reading of the DoubleEndedIterator trait. Unfortunately I will be offline for the rest of the week and will not be able to fix this before tuesday. |
@Nevsor, are you still working on this? |
@Peternator7, sorry for the delay. Here is my implementation of dbc7a25 is not strictly related to this Pull Request, should it be merged seperately? |
Looks great!! Thanks for finishing this up. |
8db6a31
into
Peternator7:master
This is a first working implementation of #59.
All the tests pass including a new one to test the
DoubleEndedIterator
.I have never used Rust macros before, so please tell me if something could be implemented better or something is missing.
Maybe it would be more elegant (and performant?) to generate a
static
orconst
array instead of the match arms and just return the arrays iterator initer
.