A Rust Async Primer-Pt. 1

A short stroll through asynchronous concepts in Rust.

Clay Ratliff
4 min readJul 12, 2022
Computer monitor showing code
Photo by Markus Spiske on Unsplash

These days, if you’re writing code in a reasonably modern language, it’s difficult to escape the idea of asynchronous programming. If you search for the most popular programming languages of 2022, every single entry in the list supports asynchronous programming. Most of them even use the same keywords in their syntax, async, and await. This article will be the first in a series of articles that will present the general concepts, followed by a brief discussion of how async is implemented in Rust, and finally some sample code to demonstrate the concepts.

Intro to Asynchronicity

Let’s start by clearing up some common misunderstandings. First Concurrency is the act of performing multiple tasks simultaneously. For example, I can both walk and chew bubble gum at the same time (most days). A different example would be making a pot of coffee while I read the morning paper. Both of these are examples of concurrency but the means by which they are achieved differ. Walking and chewing gum at the same time is an example of parallelism since I can do both things simultaneously. Making a pot of coffee while reading the paper is an example of synchronicity since I can’t physically do both tasks simultaneously. Instead, I prep the coffee maker and start it…

--

--

Clay Ratliff

Looking for our dreams in the second half of our lives as a novice sailors as we learn to live on our floating home SV Fearless https://svfearless.substack.com/