Skip to content

adds stream::enumerate combinator - #178

Merged
bors[bot] merged 6 commits into
async-rs:masterfrom
montekki:fs-stream-enumerate
Sep 17, 2019
Merged

bors[bot] merged 6 commits into
async-rs:masterfrom
montekki:fs-stream-enumerate

Conversation

@montekki

Copy link
Copy Markdown
Member

Comment thread src/stream/stream/mod.rs
/// c += 1;
/// }
/// #
/// # }) }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, makes sense

@yoshuawuyts yoshuawuyts left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation is looking 💯 -- thanks so much!

@yoshuawuyts yoshuawuyts left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ghost left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! :) I only have a small nit.

Comment thread src/stream/stream/enumerate.rs Outdated
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
@ghost

ghost commented Sep 17, 2019

Copy link
Copy Markdown

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>
@bors

bors Bot commented Sep 17, 2019

Copy link
Copy Markdown
Contributor

Build succeeded

  • continuous-integration/travis-ci/push

@bors
bors Bot merged commit 9487b73 into async-rs:master Sep 17, 2019
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.

2 participants