Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Async Runtime

This Runtime design is to understand async Rust internals properly.

Most tutorials and even Tokio's own documentation use helpers like ArcWake from the futures crate — which hides the hard parts. This project skips all of that and goes straight to RawWakerVTable, four raw function pointers, manual Arc::into_raw and Arc::from_raw ownership, and unsafe Rust at the boundary between the executor and the future.

It's not the easy path but it's the right one. Once you build a waker from scratch you understand why async Rust is designed the way it is. why Pin exists, what the executor is actually doing between every .await, and why Waker is just a vtable over a raw pointer.

What it does

  • Custom Waker built directly from RawWaker and RawWakerVTable — no helpers
  • TimerFuture — async sleep using a background thread and a shared waker
  • MiniRuntime — single-threaded executor that polls futures to completion
  • Multiple futures running concurrently on one thread

Run it

cargo run

What you learn building this

  • The full FuturePollWaker → executor contract
  • Why Pin exists and what self-referential structs have to do with it
  • unsafe Rust at a real boundary — not toy examples
  • What Tokio does under the hood on every single .await

Credits

Built as part of the tokio-lessons series by Freddie Haddad.

About

Single-threaded async executor built from scratch, custom Waker, RawWakerVTable, and TimerFuture with no Tokio

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages