-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Assorted iterator fixes in libstd #8265
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
Conversation
|
} | ||
} | ||
|
||
/// Return a consuming iterator over the possibly contained value | ||
#[inline] | ||
pub fn consume_iter(self) -> OptionIterator<T> { |
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.
To follow the pattern of HashMap
, could this be called consume
?
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.
Well I don't agree -- there are still many consume_iter
around too -- but that's just how my mind is set.
Thanks for the comments! Updated to address them. I removed the commit to remove uint::iterate because it conflicts with the snapshot PR. |
|
uint::iterate removal is back, because the snapshot landed. |
Rebased. Still a branch of "assorted changes", I'm happy to hear if this can go in, or what can be improved. |
I guess it will conflict with the std::result PR |
Let Option be a base for a widely useful one- or zero- item iterator. Refactor OptionIterator to support any generic element type, so the same iterator impl can be used for both &T, &mut T and T iterators.
convert iter() and iter_err() for Result. Use OptionIterator.
Implement clone, bidirectionality and random access for this iterator
Use the Repeat iterator to carry the "explicit closure capture" that was previously done with the custom EnvFilterIterator.
With Option as the simplest container, `consume` is the way to turn it into a by-value iterator.
ChunkIter .idx() didn't handle overflow correctly, even though it tried.
Fix #8228 by replacing .iter() and .iter_err() in Result by external iterators. Implement random access for `iterator::Invert` and `vec::ChunkIter` (and bidirectionality). Implement Repeat iterator.
Cache rustfmt path changelog: none Call `rustup which rustfmt` and use the output. This shaves off ~0.7 seconds for `cargo dev fmt` for me.
Fix #8228 by replacing .iter() and .iter_err() in Result by external iterators.
Implement random access for
iterator::Invert
andvec::ChunkIter
(and bidirectionality).Implement Repeat iterator.