Streams

A stream is an asynchronous series of values. It is the asynchronous equivalent to Rust’s std::iter::Iterator and is represented by the Stream trait. Streams can be iterated in async functions. They can also be transformed using adapters. Tokio provides a number of common adapters on the StreamExt trait.

Tokio provides stream support in a separate crate: tokio-stream.

  1. tokio-stream = "0.1

Currently, Tokio’s Stream utilities exist in the tokio-stream crate. Once the Stream trait is stabilized in the Rust standard library, Tokio’s stream utilities will be moved into the tokio crate.