Repository navigation
adds stream::enumerate combinator - #178
Merged
Merged
Conversation
yoshuawuyts
reviewed
Sep 10, 2019
| /// c += 1; | ||
| /// } | ||
| /// # | ||
| /// # }) } |
Contributor
There was a problem hiding this comment.
This is a great test! But I feel like the example from Iterator::enumerate was a little clearer in its intent:
let a = ['a', 'b', 'c'];
let mut iter = a.iter().enumerate();
assert_eq!(iter.next(), Some((0, &'a')));
assert_eq!(iter.next(), Some((1, &'b')));
assert_eq!(iter.next(), Some((2, &'c')));
assert_eq!(iter.next(), None);Perhaps manually calling next().await might make it easier to follow?
yoshuawuyts
approved these changes
Sep 10, 2019
yoshuawuyts
left a comment
Contributor
There was a problem hiding this comment.
The implementation is looking 💯 -- thanks so much!
yoshuawuyts
approved these changes
Sep 12, 2019
yoshuawuyts
left a comment
Contributor
There was a problem hiding this comment.
LGTM -- going to leave it to @stjepang for the final review. We're two weeks out from needing to stabilize our full API so this might be held up for a little bit.
ghost
reviewed
Sep 17, 2019
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
|
bors r+ |
bors Bot
added a commit
that referenced
this pull request
Sep 17, 2019
178: adds stream::enumerate combinator r=stjepang a=montekki enumerate might be handy. --- Stdlib: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.enumerate Ref: #129 Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>
Contributor
Build succeeded
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
enumerate might be handy.
Stdlib: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.enumerate
Ref: #129