-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Conversation
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
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- Could you change the imports of |
Thanks. I added doc and stability annotations to match those on the Iter type, adding that it was an "owning" iterator. |
Do you need me to do anything more on this? |
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 |
Shouldn't it have another IntoIterator impl to match the |
@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 |
@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")] |
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.
Ah sorry by new feature name I meant more something along the lines of receiver_into_iter
or something like that
@rapha looks good to me! Could you also squash the commits together? |
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")] |
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.
One last instance of rust1_1
Yes that's great. It's consistent now that the .iter() method has a corresponding IntoIterator impl, thank you! |
No description provided.