Struct coroutines::promise::Promise
[−]
[src]
pub struct Promise<T: Send + 'static> { /* fields omitted */ }
A representation of a "suspended" coroutine.
Methods
impl<T: Send + 'static> Promise<T>
[src]
fn await<F: FnOnce(Promise<T>) + Send + 'static>(f: F) -> T
[src]
Suspends the execution of the current coroutine,
calls the provided function with a Promise
representing
the current coroutine, and waits until the Promise
gets
resolved.
If the Promise
is dropped before resolving, Drop
will panic and the coroutine will leak.
If called outside of a coroutine, the current thread will be suspended instead.
fn resolve(self, result: T)
[src]
Resolves a Promise
with the provided result
.