Struct await::examples::promise::Future [] [src]

pub struct Future<T> {
    // some fields omitted
}

At some point in time, it will hold a value T

Methods

impl<T: 'static + Send> Future<Result<T, PromiseDroppedError>>

fn new() -> (Future<Result<T, PromiseDroppedError>>, Promise<T>)

Create a promise from anything that can be await'ed

XXX: this could use mio for non-"thread"-blocking

impl<T> Future<T>

fn constant(value: T) -> Self

Create a Future that holds a constant value... it's a present! (no pun intended...)

fn deferred<A: Await<T> + 'static + Send>(x: A) -> Self

Create a Future from an Await

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

Returns a ref to the value T if present

fn value(&mut self) -> &T

Returns a ref to the value T, awaits for the value if it's not available

XXX: should we use inner mutability to get rid of &mut?

Trait Implementations

impl<T> Await<T> for Future<T>

fn await(self) -> T