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>

fn new() -> FutureStream<T>

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

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<'a, T: Send + 'a> IntoIterator for &'a FutureStream<T>

type Item = T

type IntoIter = FutureStreamIter<'a, T>

fn into_iter(self) -> Self::IntoIter

impl<T: Send> FromIterator<Future<T>> for FutureStream<T>

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

Derived Implementations

impl<T: Clone + Send> Clone for FutureStream<T>

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

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