Abstractions for asynchronous programming.
This crate provides a number of core abstractions for writing asynchronous code:
- Streams represent a series of values produced asynchronously.
- Sinks provide support for asynchronous writing of data.
- Executors are responsible for running asynchronous tasks.
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.
The following example describes how the task system context is built and used within macros and keywords such as async and await!.
# use mpsc; # use executor; ///standard executors to provide a context for futures and streams # use ThreadPool; # use StreamExt;
The majority of examples and code snippets in this crate assume that they are inside an async block as written above.