Rust: Asynchronous Programming with Tokio

Rust: Asynchronous Programming with Tokio

1h 15mIntermediate2023-05-09

Authors

Marcus Willock

Marcus Willock

Senior Software Engineer and Content Creator

Course details

Asynchronous programming is becoming the de facto coding paradigm of Rust. In this course, senior software engineer and content creator Marcus Willock covers what you need to know about using Tokio, the asynchronous primitives it offers, and the channels it provides. Find out what asynchronous programming is and when to use it. Learn the basics of the asynchronous runtime in Tokio, as well as how to spawn a task, how to test asynchronous code, and more. Explore asynchronous primitives, including mutex, semaphore, notify, barrier, and RwLock. Plus, go over channels, what they are, and how you can use them.

Skills covered

RustProgramming LanguagesOpen SourceSoftware DevelopmentDeep Dive (X:Y)

Concepts

Introduction

  • Use Tokio to put wasted CPU cycles to work
  • Exercise files

Foundational Knowledge

  • What is asynchronous programming
  • When to use asynchronous programming
  • How do the sync and await methods work in Rust

The Basics

  • Tokio's asynchronous runtime
  • How to spawn a task
  • How to spawn a synchronous task
  • How to test asynchronous code
  • Spawning task example

Asynchronous Primitives

  • What are asynchronous primitives
  • What is a mutex
  • Mutex example
  • What is a semaphore
  • Semaphore example
  • What is notify
  • Notify example
  • What is a barrier
  • Barrier example
  • What is RwLock
  • RwLock example

Channels

  • What are channels
  • Oneshot channel
  • Mpsc channel
  • Watch channel
  • Broadcast channel

Conclusion

  • Next steps
40,000 Toman