Step Into Labs

Step Into Rust · Lesson 3 · Ownership & Types

Where Your Data Lives

The stack, the heap, how big every type really is, and what a String looks like in memory. The picture that makes ownership obvious.

Part of Step Into Rust. The full lesson, its missions and the real compiler and debugger are in the course. Try a free lesson first to see how it works.

Every value your program uses sits somewhere in memory, an enormous array of bytes. A byte's index is its address, and a reference or pointer is simply an address. Rust gives you precise control over where values live and how big they are. Once you can picture that, ownership and borrowing stop feeling like arbitrary rules.

In this lesson

Missions

  1. Measure the types
  2. Room to grow
  3. A move does not copy the text
  4. Big value, small handle