Struct promising_future::FutureStreamWaiter [] [src]

pub struct FutureStreamWaiter<'a, T: Send + 'a> { /* fields omitted */ }

Waiter for Futures in a FutureStream.

A singleton waiter for Futures, associated with a specific FutureStream. This may be used in a multithreaded environment to wait for Futures to resolve while other threads fulfill Promises and add new Futures to the FutureStream.

let fs = FutureStream::new();
fs.add(future);
// ...
let mut waiter = fs.waiter();
while let Some(future) = waiter.wait() {
    match future.value() {
      None => (),         // Future unfulfilled
      Some(val) => val,
    }
}

It may also be converted into an Iterator over the values yielded by resolved Futures (unfulfilled Promises are ignored).

let fs = FutureStream::new();
fs.add(fut1);
for val in fs.waiter() {
   // ...
}

Methods

impl<'fs, T: Send> FutureStreamWaiter<'fs, T>
[src]

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

Return next resolved Future, but don't wait for more to resolve.

Trait Implementations

impl<'fs, T: Send> Drop for FutureStreamWaiter<'fs, T>
[src]

A method called when the value goes out of scope. Read more

impl<'fs, T: Send + 'fs> IntoIterator for FutureStreamWaiter<'fs, T>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more