Everwhy Open Everwhy
Computing

Can a language be as fast as C and still stop whole families of memory bugs?

Rust 101 · about 13 minutes a level

Learn Rust, a systems programming language that runs as fast as C and C++ but checks memory safety before your program ever runs. You'll start with Cargo, variables, types and functions, then learn ownership and borrowing, structs and enums, pattern matching, error handling with Result, collections, traits and generics, modules and testing with cargo test, and threads, and see why systems tools and blockchains use Rust.

Open in Everwhy Continue on the web

Go deeper, level by level

  1. First steps in Rust: Hello, Rust: Cargo and your first program, Variables, mutability and basic types, Functions, if and loops
  2. Ownership: The stack, the heap and String, The ownership rules and moves, Clone and Copy
  3. Borrowing and references: References and borrowing, Mutable references and the one-writer rule, Slices: borrowing part of a collection, A first look at lifetimes
  4. Structs and enums: Structs: grouping related data, Methods and associated functions with impl, Enums and Option
  5. Pattern matching and errors: match and exhaustive patterns, if let, let else and destructuring, Result, the ? operator and panics
  6. Collections, traits and generics: Vectors and hash maps, Strings in depth: String, &str and UTF-8, Traits: shared behaviour, Generics and trait bounds, Iterators and closures
  7. Cargo, crates and testing: Modules, packages and crates, Cargo: dependencies, builds and tools, Writing tests with cargo test
  8. Rust in the real world: Fearless concurrency: threads and channels, Why systems tools and blockchains use Rust, Project: a command-line word counter

Every lesson shows its sources and how sure we are, and is checked by Everwhy.