6 Futures in Rust In Chapter 5, we covered one of the most popular ways of modeling concurrency in a programming language: fibers/green threads. Fibers/green threads are an example of stackful coroutines. The other popular way of modeling asynchronous program flow is by using what we call stackless coroutines, and combining Rust's futures with async/await is an example of that. We will cover this in detail in the next chapters. This first chapter will introduce Rust's futures to you, and the main goals of this chapter are to do the following: Give you a high-level introduction to concurrency in Rust Explain what Rust provides and not in the language and standard library when working with async code Get to know why we need a runtime library in Rust Understand the difference between a leaf future and a non-leaf future Get insight into how to handle CPU-intensive tasks To accomplish this, we'll divide this chapter into the following sections: What is a future? Leaf futures Non-leaf futures Runtimes A mental model of an async runtime What the Rust language and standard library take care of I/O vs CPU-intensive tasks Advantages and disadvantages of Rust's async model