[][src]Crate futures

Abstractions for asynchronous programming.

This crate provides a number of core abstractions for writing asynchronous code:

The crate also contains abstractions for asynchronous I/O and cross-task communication.

Underlying all of this is the task system, which is a form of lightweight threading. Large asynchronous computations are built up using futures, streams and sinks, and then spawned as independent tasks that are run to completion, but do not block the thread running them.

Modules

channel

Cross-task communication.

compat

Interop between futures 0.1 and 0.3.

executor

Task execution.

future

Asynchronous values.

io

Asynchronous I/O.

lock

Futures-powered synchronization primitives.

prelude

A "prelude" for crates using the futures crate.

sink

Asynchronous sinks.

stream

Asynchronous streams.

task

Tools for working with tasks.

Macros

join

Polls multiple futures simultaneously, returning a tuple of all results once complete.

pending

A macro which yields to the event loop once.

poll

A macro which returns the result of polling a future once within the current async context.

ready

Extracts the successful type of a Poll<T>.

select

Polls multiple futures and streams simultaneously, executing the branch for the future that finishes first. Futures passed to select! must be Unpin and implement FusedFuture. Futures and streams which are not already fused can be fused using the .fuse() method. Note, though, that fusing a future or stream directly in the call to select! will not be enough to prevent it from being polled after completion if the select! call is in a loop, so when select!ing in a loop, users should take care to fuse() outside of the loop.

try_join

Polls multiple futures simultaneously, resolving to a Result containing either a tuple of the successful outputs or an error.

try_ready

Extracts the successful type of a Poll<Result<T, E>>.