Skip to content
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

Implement IntoIterator for Receiver #24633

Merged
merged 1 commit into from
Apr 24, 2015
Merged

Implement IntoIterator for Receiver #24633

merged 1 commit into from
Apr 24, 2015

Conversation

rapha
Copy link
Contributor

@rapha rapha commented Apr 20, 2015

No description provided.

@rust-highfive
Copy link
Collaborator

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member

This seems like a good idea to me, so thanks @rapha! This does, however, probably force our hand in having this new functionality be insta-#[stable]. I'm personally OK with that, however.

Could you change the imports of core::iter::IntoIterator to just iter::IntoIterator as well?

@rapha
Copy link
Contributor Author

rapha commented Apr 20, 2015

Thanks. I added doc and stability annotations to match those on the Iter type, adding that it was an "owning" iterator.

@rapha
Copy link
Contributor Author

rapha commented Apr 22, 2015

Do you need me to do anything more on this?

@alexcrichton alexcrichton assigned alexcrichton and unassigned brson Apr 22, 2015
@alexcrichton
Copy link
Member

Ah thanks for the reminder @rapha! I intended on just running this by some others to get their opinion as well. I believe now this is good to go! In the meantime, however, we've bumped the version number, so could you update the since tag here to 1.1.0 instead of 1.0.0? After that I'll r+

@bluss
Copy link
Member

bluss commented Apr 22, 2015

Shouldn't it have another IntoIterator impl to match the fn iter(&self) method too?

@alexcrichton
Copy link
Member

@bluss in theory, yes, but it's not necessarily required one way or another as it's backwards compatible to add. @rapha would you be interested in adding this, however?

@rapha ah I forgot this part, but you'll also need to choose a unique feature name for this as the same feature name can't have multiple versions it became stable in (e.g. the rust1 feature here was stable as of 1.0.0, not 1.1.0

@rapha
Copy link
Contributor Author

rapha commented Apr 23, 2015

@bluss Is this the implementation of IntoIterator for &Receiver what you had in mind?

/// An owning iterator over messages on a receiver, this iterator will block
/// whenever `next` is called, waiting for a new message, and `None` will be
/// returned when the corresponding channel has hung up.
#[stable(feature = "rust1_1", since = "1.1.0")]
Copy link
Member

Choose a reason for hiding this comment

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

Ah sorry by new feature name I meant more something along the lines of receiver_into_iter or something like that

@alexcrichton
Copy link
Member

@rapha looks good to me! Could you also squash the commits together?

@rapha
Copy link
Contributor Author

rapha commented Apr 23, 2015

Done

@@ -899,6 +907,29 @@ impl<'a, T> Iterator for Iter<'a, T> {
fn next(&mut self) -> Option<T> { self.rx.recv().ok() }
}

#[stable(feature = "rust1_1", since = "1.1.0")]
Copy link
Member

Choose a reason for hiding this comment

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

One last instance of rust1_1

@bluss
Copy link
Member

bluss commented Apr 23, 2015

Yes that's great. It's consistent now that the .iter() method has a corresponding IntoIterator impl, thank you!

@alexcrichton
Copy link
Member

@bors: r+ 47ebc48

bors added a commit that referenced this pull request Apr 23, 2015
@bors
Copy link
Contributor

bors commented Apr 23, 2015

⌛ Testing commit 47ebc48 with merge 21f278a...

@bors bors merged commit 47ebc48 into rust-lang:master Apr 24, 2015
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.

6 participants