Rust's async/await: Why and How

Why async in the first place Before touching any Rust-specific detail, it is worth asking why async exists at all. In synchronous code, when you issue an I/O operation, the thread that issued it simply stops and waits. If the request takes 100ms, that is 100ms of pure waste from …
Read more...

Static vs Dynamic Dispatch in Rust

Why do we need dispatch? Say we want to write a function that returns the length of a string. The most straightforward version looks like this: fn strlen(s: String) -> usize { s.len() } This works, but it's quite rigid. What if I want to pass a &str? Or a Cow<str>…
Read more...

Your Code Doesn't Run the Way You Read It

I recently watched a stream on Rust's std::sync::atomic module, and honestly, most of it went over my head on the first pass. But there's one insight from the session I think it's worth sharing even as I'm still wrapping my head around the rest. A test that shouldn't fail Here's …
Read more...

Building a Rust Channel from Scratch

Channels are a fundamental concurrency primitive in Rust, allowing threads to communicate safely by passing messages. At a high level, the concept is simple: senders transmit data, and receivers consume it. But what actually happens under the hood? In this post, we will demystify…
Read more...

Making Sense of Send and Sync in Rust

It's common to encounter Send + Sync bounds when working with various Rust codebases. But what do they actually mean, and how do they work under the hood? When exactly is a type Send or Sync, and when is it not? Send A type is Send if it is safe to send, or transfer ownership to …
Read more...