Struct promising_future::FutureStream [] [src]

pub struct FutureStream<T: Send> {
    // some fields omitted
}

Stream of multiple Futures

A FutureStream can be used to wait for multiple Futures, and return them incrementally as they are resolved.

It implements an iterator over completed Futures, and can be constructed from an iterator of Futures.

May be cloned and the clones passed to other threads so that Futures may be added from multiple threads.

Methods

impl<T: Send> FutureStream<T>
[src]

fn new() -> FutureStream<T>

fn add(&self, fut: Future<T>) where T: 'static

Add a Future to the stream.

fn outstanding(&self) -> usize

Return number of outstanding Futures.

fn waiter<'fs>(&'fs self) -> FutureStreamWaiter<'fs, T>

Return a singleton FutureStreamWaiter. If one already exists, block until it is released.

fn try_waiter<'fs>(&'fs self) -> Option<FutureStreamWaiter<'fs, T>>

Return a singleton FutureStreamWaiter. Returns None if one already exists.

fn poll(&self) -> Option<Future<T>>

Return a resolved Future if any, but don't wait for more to resolve.

fn wait(&self) -> Option<Future<T>>

Return resolved Futures. Blocks if there are outstanding Futures which are not yet resolved. Returns None when there are no more outstanding Futures.

Trait Implementations

impl<T: Clone + Send> Clone for FutureStream<T>
[src]

fn clone(&self) -> FutureStream<T>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl<'a, T: Send + 'a> IntoIterator for &'a FutureStream<T>
[src]

type Item = T

The type of the elements being iterated over.

type IntoIter = FutureStreamIter<'a, T>

Which kind of iterator are we turning this into?

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

impl<T: Send + 'static> FromIterator<Future<T>> for FutureStream<T>
[src]

fn from_iter<I>(iterator: I) -> Self where I: IntoIterator<Item=Future<T>>

Creates a value from an iterator. Read more