July 26, 2021

Async Rust From The Ground Up

Async Rust in its current state is notoriously difficult to learn. The way async interacts with the regular Rust is hard to grasp, and there is a lot you have to understand about what goes on under the hood to write async code effectively. In this article series, I want to approach learning async differently. Instead of starting by introducing async/await and learning about async-std and tokio, we'll start completely from scratch. We'll first learn about multitasking and concurrency through processes and threads. We'll discuss linux networking and non-blocking I/O. We'll progress to event-driven programming by building a Node.js-style event loop powered by epoll. We'll then write a Future trait, common combinators, and a tokio-style executor. Finally, we'll discuss async/await, and map what we learnt to the async Rust ecosystem as it stands today.

We'll take the viewpoint of someone writing an HTTP server, with nothing but the standard library at their disposal, starting small and building our way up. Every new concept we learn will be integrated into our server to improve it in some way.

This is an ambitious undertaking, and there is a lot of content to cover, so I'll try to keep posts small and focused. This post will serve as a table of contents for articles. The list below will be updated as new posts are written.

Table of Contents