-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented DoubleEndedIterator for EnumIter. #60
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
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
.