rust-async-examples
                                
                                
                                
                                    rust-async-examples copied to clipboard
                            
                            
                            
                        Examples of asynchronous programming in Rust
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.
- Asynchronous streams in Rust (part 1) - Futures, buffering and mysterious compilation error messages
 - Asynchronous streams in Rust (part 2) - Cancelling expired requests
 
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.