Skip to content

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

Closed
wants to merge 12 commits into from
Closed

Assorted iterator fixes in libstd #8265

wants to merge 12 commits into from

Conversation

bluss
Copy link
Member

@bluss bluss commented Aug 3, 2013

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.

@bluss
Copy link
Member Author

bluss commented Aug 3, 2013

Needs to go in after the snapshot pull #8264

}
}

/// Return a consuming iterator over the possibly contained value
#[inline]
pub fn consume_iter(self) -> OptionIterator<T> {
Copy link
Member

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?

Copy link
Member Author

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.

@bluss
Copy link
Member Author

bluss commented Aug 3, 2013

Thanks for the comments! Updated to address them.

I removed the commit to remove uint::iterate because it conflicts with the snapshot PR.

@bluss
Copy link
Member Author

bluss commented Aug 3, 2013

um my hashmap change is not that brilliant. it's probably even better to just use .scan()

@bluss
Copy link
Member Author

bluss commented Aug 4, 2013

uint::iterate removal is back, because the snapshot landed.

@bluss
Copy link
Member Author

bluss commented Aug 6, 2013

Rebased. Still a branch of "assorted changes", I'm happy to hear if this can go in, or what can be improved.

@bluss
Copy link
Member Author

bluss commented Aug 6, 2013

I guess it will conflict with the std::result PR

blake2-ppc added 12 commits August 6, 2013 03:59
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.
bors added a commit that referenced this pull request Aug 6, 2013
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.
@bors bors closed this Aug 6, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jan 13, 2022
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace internal iteration functions in std::either and std::result
3 participants