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

#[must_use = "streams do nothing unless polled"]
pub struct FuturesUnordered<F> { /* 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 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 wakeups for new Futures.

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

Methods

impl<T> FuturesUnordered<T> where
    T: Future
[src]

[src]

Constructs a new, empty FuturesUnordered

The returned FuturesUnordered does not contain any futures and, in this state, FuturesUnordered::poll_next will return Ok(Async::Ready(None)).

impl<T> FuturesUnordered<T>
[src]

[src]

Returns the number of futures contained in the set.

This represents the total number of in-flight futures.

[src]

Returns true if the set contains no futures

[src]

Push a future into the set.

This function submits the given future to the set for managing. This function will not call poll on the submitted future. The caller must ensure that FuturesUnordered::poll_next is called in order to receive task notifications.

[src]

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

Trait Implementations

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

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

impl<T> Stream for FuturesUnordered<T> where
    T: Future
[src]

Values yielded by the stream.

Errors yielded by the stream.

[src]

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<T: Debug> Debug for FuturesUnordered<T>
[src]

[src]

Formats the value using the given formatter. Read more

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

[src]

Executes the destructor for this type. Read more

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

[src]

Creates a value from an iterator. Read more