The Complete Rust Learning Guide

Rust is a compiled systems programming language designed to help developers build fast software while preventing many common memory and concurrency mistakes.

How Rust works

Rust checks how values are owned and borrowed at compile time. These rules help determine when memory can be safely used and released, often without a garbage collector.

What you will learn

You will start with a small program, then learn ownership, borrowing, types, collections, error handling, modules, traits, and larger applications.

How to use this guide

  1. Start with Chapter 1 and move through the chapters in order. New ideas build on the earlier ones.
  2. Type each example yourself, make a small change, and predict what will happen before running it.
  3. When a chapter is ready, its lesson will appear at the chapter link. These pages are currently blank lesson starters.

A step-by-step learning path

  1. Chapters 1-7: Learn the Rust foundations. Compile a program, work with typed values, handle input and output, control flow, and functions.
  2. Chapters 8-12: Learn to represent and use data. Work with vectors and slices, process strings, practice borrowing, understand ownership, and define structs and enums.
  3. Chapters 13-18: Organize reliable programs. Learn visibility, modules and crates, the standard library, files, Result and other error tools, debugging, and tests.
  4. Chapters 19-24: Build larger systems. Study algorithms, traits and generics, safe performance, Cargo workflows, and guided projects.

Rust ideas you will meet early

Your first Rust program

Save this program as main.rs:

fn main() {
    println!("Hello, world!");
}

fn starts a function definition. main is the starting function for this program. println! is a macro that prints text and a new line. With Rust installed, compile and run the standalone file:

rustc main.rs
./main

On Windows, the compiled program is named main.exe. For projects, Cargo is usually more convenient: cargo new hello creates a project and cargo run builds and runs it from that project folder.

A simple way to study

First file: save a standalone program as main.rs and compile it with rustc main.rs, or create a Cargo project to manage a larger program.

Course chapters

Follow the 24 chapters in order, or choose a topic to revisit. Each chapter opens its own lesson page.

  1. What Rust is and how a program runs
  2. Your first program
  3. Values, types, and variables
  4. Input and output
  5. Expressions and operators
  6. Decisions and loops
  7. Functions and program structure
  8. Collections: arrays, lists, and slices
  9. Strings and text
  10. References, pointers, and memory
  11. Memory and resource management
  12. User-defined types and data modeling
  13. Scope, lifetime, and visibility
  14. Modules, imports, and declarations
  15. Multi-file programs, packages, and libraries
  16. The standard library and ecosystem
  17. File input and output
  18. Errors, debugging, and testing
  19. Data structures and algorithms
  20. Advanced language topics
  21. Safety, portability, and performance
  22. Build systems and professional workflow
  23. A project ladder
  24. Further study checklist
0% read