/rust-async-examples

Examples of asynchronous programming in Rust

MIT LicenseMIT

Rust asynchronous examples

This repository contains examples of async programming in Rust, with the tokio and futures libraries. They show how to compose streams, in particular buffering and cancellation, to illustrate the following series of blog posts.

You can run each example with cargo run --example <example name>, and I've tested them with Rust 1.50.0.

$ cargo --version
cargo 1.50.0 (f04e7fab7 2021-02-04)

Examples files with the .ok.rs extension should work, whereas those finishing by .fail.rs illustrate some compilation error.

The plot example takes the output of other examples and displays a timeline of the asynchronous requests, exported in SVG format. It is built with the regex and plotters libraries.

Plot example