Skip to content

Added FuturesUnordered chapter#96

Closed
capnhawkbill wants to merge 2 commits intorust-lang:masterfrom
capnhawkbill:master
Closed

Added FuturesUnordered chapter#96
capnhawkbill wants to merge 2 commits intorust-lang:masterfrom
capnhawkbill:master

Conversation

@capnhawkbill
Copy link
Copy Markdown

I added the chapter about FuturesUnordered, it's a bit short but I think it gets the message across

Comment on lines +9 to +12
Because `FuturesUnordered` implements the `Stream` trait using `.next()`
on it will return a `Future` which returns the return value from one of
the futures inside of an `Option`.
It will return `None` when all futures are completed.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this could be even more concise, something like

Suggested change
Because `FuturesUnordered` implements the `Stream` trait using `.next()`
on it will return a `Future` which returns the return value from one of
the futures inside of an `Option`.
It will return `None` when all futures are completed.
`FuturesUnordered` implements a `Stream` trait over the
output of the futures in any order.

The example implies how to use that Stream (and hopefully we have dedicated docs for that too).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes I agree this is a lot clearer

@nrc
Copy link
Copy Markdown
Member

nrc commented Oct 5, 2024

Triage: closing due to age and conflicts

@nrc nrc closed this Oct 5, 2024
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.

3 participants