Struct std::sync::Future [-] [src]

pub struct Future<A> {
    // some fields omitted
}
Unstable

: futures as-is have yet to be deeply reevaluated with recent core changes to Rust's synchronization story, and will likely become stable in the future but are unstable until that time

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

Unstable

: futures as-is have yet to be deeply reevaluated with recent core changes to Rust's synchronization story, and will likely become stable in the future but are unstable until that time

Get the value of the future.

impl<A> Future<A>

fn into_inner(self) -> A

Unstable

: futures as-is have yet to be deeply reevaluated with recent core changes to Rust's synchronization story, and will likely become stable in the future but are unstable until that time

Gets the value from this future, forcing evaluation.

fn get_ref<'a>(&'a mut self) -> &'a A

Unstable

: futures as-is have yet to be deeply reevaluated with recent core changes to Rust's synchronization story, and will likely become stable in the future but are unstable until that time

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>

Unstable

: futures as-is have yet to be deeply reevaluated with recent core changes to Rust's synchronization story, and will likely become stable in the future but are unstable until that time

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

Unstable

: futures as-is have yet to be deeply reevaluated with recent core changes to Rust's synchronization story, and will likely become stable in the future but are unstable until that time

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>

Unstable

: futures as-is have yet to be deeply reevaluated with recent core changes to Rust's synchronization story, and will likely become stable in the future but are unstable until that time

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

Unstable

: futures as-is have yet to be deeply reevaluated with recent core changes to Rust's synchronization story, and will likely become stable in the future but are unstable until that time

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.