Struct promising_future::FutureStream
[−]
[src]
pub struct FutureStream<T> { // some fields omitted }
Stream of multiple Future
s
A FutureStream
can be used to wait for multiple Future
s, and return them incrementally as
they are resolved.
It implements an iterator over completed Future
s, and can be constructed from an iterator of
Future
s.
May be cloned and the clones passed to other threads so that Future
s may be added from multiple
threads.
Methods
impl<T> FutureStream<T>
fn new() -> FutureStream<T>
fn add(&self, fut: Future<T>) where T: Send + 'static
Add a Future
to the stream.
fn outstanding(&self) -> usize
Return number of outstanding Future
s.
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 Future
s. Blocks if there are outstanding Futures
which are not yet
resolved. Returns None
when there are no more outstanding Future
s.