Struct promising_future::Promise [] [src]

pub struct Promise<T: Send>(_);

A box for resolving a Future.

A Promise is a write-once box which corresponds with a Future and may be used to resolve it.

A Promise is initially pending, and is completed once it is consumed, either by its set method, or by going out of scope. The former is "fulfilling" the Promise; the latter is leaving it "unfulfilled".

It may only be created in a pair with a Future using the function future_promise().

Methods

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

fn set(self, v: T)

Fulfill the Promise by resolving the corresponding Future with a value.

fn canceled(&self) -> bool

Return true if the corresponding Future no longer exists, and so any value set would be discarded.

Trait Implementations

impl<T: Send> Drop for Promise<T>
[src]

fn drop(&mut self)

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

impl<T: Send> Debug for Promise<T>
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.