Skip to content

Conversation

@ibraheemdev
Copy link
Member

@ibraheemdev ibraheemdev commented May 8, 2021

  • Remove IterPinRef. FuturesUnordered::iter_pin_ref is private for some reason, so it is impossible to create a IterPinRef. Of course, this means that no one used it. I don't see how iterating over a Pin<&Fut> is useful anyways. This is still a breaking change however, because the struct was public, albeit impossible to construct.
  • Implement IntoIterator for FuturesUnordered, &FuturesUnordered, and &mut FuturesUnordered, and add an IntoIter iterator struct for the first.

Resolves #1795.

@ibraheemdev ibraheemdev requested a review from taiki-e as a code owner May 8, 2021 02:17
@taiki-e
Copy link
Member

taiki-e commented May 8, 2021

I think it's fine to make iter_pin_ref public. The API it adds is very small.

If we remove IterPinRef from public API, I would prefer to remove only the export of it, instead of remove IterPinRef itself. Pin<&Self> itself has several use cases (though, the use cases are not related to future, in most cases), we can easily expose it when someone requests it.

@taiki-e taiki-e added 0.3-backport: pending The maintainer accepted to backport this to the 0.3 branch, but backport has not been done yet. A-stream Area: futures::stream labels May 8, 2021
@ibraheemdev ibraheemdev force-pushed the futures-unordered-intoiter branch from 26b7617 to 0aadc4b Compare May 8, 2021 08:31
@ibraheemdev ibraheemdev changed the title remove FuturesUnordered::iter_pin_ref, add into_iter addd FuturesUnordered::add into_iter, make iter_pin_ref public May 8, 2021
@taiki-e taiki-e changed the title addd FuturesUnordered::add into_iter, make iter_pin_ref public add FuturesUnordered::into_iter, make iter_pin_ref public May 8, 2021
Co-authored-by: Taiki Endo <te316e89@gmail.com>
Copy link
Member

@taiki-e taiki-e left a comment

Choose a reason for hiding this comment

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

Thanks!

@taiki-e taiki-e merged commit 0273188 into rust-lang:master May 10, 2021
@taiki-e taiki-e mentioned this pull request May 10, 2021
@taiki-e taiki-e added 0.3-backport: completed and removed 0.3-backport: pending The maintainer accepted to backport this to the 0.3 branch, but backport has not been done yet. labels May 10, 2021
@taiki-e taiki-e mentioned this pull request May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add FuturesUnordered into_iter method

2 participants