Crate futures [] [src]

Abstractions for asynchronous programming

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

  • Futures (sometimes called promises), which represent a single asychronous computation that may result in a final value or an error.

  • Streams, which represent a series of values or errors produced asynchronously.

  • Sinks, which support asynchronous writing of data.

  • Executors, which are responsible for running asynchronous tasks.

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 communciation.

executor

Task execution.

future

Asynchronous values.

io

Asynchronous I/O.

never

This module contains the Never type.

prelude

A "prelude" for crates using the futures crate.

sink

Asynchronous sinks.

stream

Asynchronous streams.

task

Tools for working with tasks.

Macros

task_local

A macro to create a static of type LocalKey

try_ready

A macro for extracting the successful type of a Poll<T, E>.

Enums

Async

Indicates whether a value is available, or if the current task has been scheduled for later wake-up instead.

Never

A type with no possible values.

Traits

Future

A future represents an asychronous computation that may fail.

FutureExt

An extension trait for Futures that provides a variety of convenient combinator functions.

IntoFuture

Types that can be converted into a future.

Sink

A Sink is a value into which other values can be sent, asynchronously.

SinkExt

An extension trait for Sinks that provides a variety of convenient combinator functions.

Stream

A stream of values produced asynchronously.

StreamExt

An extension trait for Streams that provides a variety of convenient combinator functions.

Type Definitions

Poll

A convenience wrapper for Result<Async<T>, E>.