libr0

Building Rust's Standard Library from Scratch

Learn by building. Understand Rust's core types by implementing them yourself, from simple enums to async runtime internals.

8
Chapters
191
Tests
100%
Safe APIs

Learn by Building

libr0 takes you through Rust's fundamental types from scratch. Each chapter builds on the previous one, showing you exactly how Option, Box, Vec, Rc, and more work under the hood.

Option

The simplest enum. Pattern matching with Some(T) and None.

Result

Error handling with Ok(T) and Err(E). The ? operator.

Box

First heap allocation. Stack vs heap, Deref trait.

Vec

Growable arrays. Why String is just Vec<u8>.

Cell

Interior mutability with UnsafeCell under the hood.

RefCell

Runtime borrow checking with guard types.

Rc

Reference counting for shared ownership.

Rc + RefCell

Shared mutable state. Build graphs and trees.

What Makes libr0 Different?

De-abstract the Abstractions

Box? Just alloc + dealloc in a struct. RefCell? Just a counter and panic! We show you exactly how it works.

Show the Memory

What's in memory? Show the layout. What does the CPU do? Explain the instruction.

Working Code

Every concept has runnable examples. Understanding comes from code, not theory.

Address Confusion

We call out common misunderstandings explicitly with clear explanations.

Ready to understand Rust deeply?

Start Learning →