[][src]Struct futures_util::stream::FuturesUnordered

#[must_use = "streams do nothing unless polled"]
pub struct FuturesUnordered<Fut> { /* fields omitted */ }

A set of futures which may complete in any order.

This structure is optimized to manage a large number of futures. Futures managed by FuturesUnordered will only be polled when they generate wake-up notifications. This reduces the required amount of work needed to poll large numbers of futures.

FuturesUnordered can be filled by collecting an iterator of futures into a FuturesUnordered, or by pushing futures onto an existing FuturesUnordered. When new futures are added, poll_next must be called in order to begin receiving wake-ups for new futures.

Note that you can create a ready-made FuturesUnordered via the futures_unordered function, or you can start with an empty set with the FuturesUnordered::new constructor.

Methods

impl<Fut: Future> FuturesUnordered<Fut>
[src]

Constructs a new, empty FuturesUnordered.

The returned FuturesUnordered does not contain any futures. In this state, FuturesUnordered::poll_next will return Poll::Ready(None).

impl<Fut> FuturesUnordered<Fut>
[src]

Returns the number of futures contained in the set.

This represents the total number of in-flight futures.

Returns true if the set contains no futures.

Push a future into the set.

This method adds the given future to the set. This method will not call poll on the submitted future. The caller must ensure that FuturesUnordered::poll_next is called in order to receive wake-up notifications for the given future.

Returns an iterator that allows modifying each future in the set.

Returns an iterator that allows modifying each future in the set.

Trait Implementations

impl<Fut: Send> Send for FuturesUnordered<Fut>
[src]

impl<Fut: Sync> Sync for FuturesUnordered<Fut>
[src]

impl<Fut> Unpin for FuturesUnordered<Fut>
[src]

impl<Fut: Future> Default for FuturesUnordered<Fut>
[src]

Returns the "default value" for a type. Read more

impl<Fut: Future> Stream for FuturesUnordered<Fut>
[src]

Values yielded by the stream.

Attempt to pull out the next value of this stream, registering the current task for wakeup if the value is not yet available, and returning None if the stream is exhausted. Read more

impl<Fut> Debug for FuturesUnordered<Fut>
[src]

Formats the value using the given formatter. Read more

impl<Fut> Drop for FuturesUnordered<Fut>
[src]

Executes the destructor for this type. Read more

impl<Fut: Future> FromIterator<Fut> for FuturesUnordered<Fut>
[src]

Creates a value from an iterator. Read more