Struct std::sync::FutureUnstable
[-] [+]
[src]
pub struct Future<A> { // some fields omitted }
A type encapsulating the result of a computation which may not be complete
Methods
impl<A: Clone> Future<A>
Methods on the future
type
fn get(&mut self) -> A
Get the value of the future.
impl<A> Future<A>
fn into_inner(self) -> A
Gets the value from this future, forcing evaluation.
fn get_ref<'a>(&'a mut self) -> &'a A
Executes the future's closure and then returns a reference to the result. The reference lasts as long as the future.
fn from_value(val: A) -> Future<A>
Create a future from a value.
The value is immediately available and calling get
later will
not block.
fn from_fn<F>(f: F) -> Future<A> where F: FnOnce() -> A, F: Send + 'static
Create a future from a function.
The first time that the value is requested it will be retrieved by calling the function. Note that this function is a local function. It is not spawned into another task.
impl<A: Send + 'static> Future<A>
fn from_receiver(rx: Receiver<A>) -> Future<A>
Create a future from a port
The first time that the value is requested the task will block waiting for the result to be received on the port.
fn spawn<F>(blk: F) -> Future<A> where F: FnOnce() -> A, F: Send + 'static
Create a future from a unique closure.
The closure will be run in a new task and its result used as the value of the future.