Backend development

Stage 1 · Lesson 3 of 10

Ownership, borrowing and lifetimes

Your language and how HTTP works

is what makes Rust different, so give it real time. Every value has exactly one owner, and the value is freed when its owner goes out of scope. Assigning a String to another variable moves it, and the old name can no longer be used.

To use a value without taking it, you borrow it with a reference. You can have many shared references (&T) or one mutable reference (&mut T), but never both at once. The , part of the compiler, enforces these rules.

That is how Rust prevents use-after-free bugs and data races without a garbage collector. Lifetimes are how the compiler proves a reference never outlives the value it points to.

Common trapcalling .clone() on everything to make the errors go away, which hides the real question the compiler is asking: who owns this data?

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

  • BookFree
    The Rust Programming Language

    The Rust Project · Beginner

    The official book, free online: read ownership, enums, error handling and traits slowly

  • GuideFree
    Tokio Tutorial

    Tokio · Intermediate

    The official Tokio tutorial: tasks, shared state, channels and the async model Axum runs on

Practise

  • Small exercises that follow the book chapter by chapter, checked in your terminal

  • Your language track: small exercises with free mentor feedback on idiomatic code

Keep handy

  • Runnable examples to look up while you write: traits, generics, errors and Cargo

  • Read the HTTP overview, methods, headers and status code pages until they feel obvious

Also worth your time

Mark this stage as not done?