Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Learning Rust by Working Through the Rustlings Exercises



Rustlings is a set of exercises that serves as a great introduction to the Rust language. It covers many concepts from the Rust book by asking you to work through sets of exercises.
This collection walks you through Rustlings in a way that explains what's going on in each exercise. We cover everything from basic types to generics and threading.


  • Setup Rustlings
  • Rustlings variables1: Running the rustlings CLI and completing exercises
  • Rustlings variables2: Declaring types and assigning values to variables
  • Rustlings variables3: Using the mut keyword to declare a mutable variable
  • Rustlings variables4: Initializing a variable with a value
  • Rustlings variables5: Using block scopes to shadow previously declared variables
  • Rustlings if1: Using an if/else statement to implicitly (or explicitly) return a value
  • Rustlings functions1: Declaring your first function
  • Rustlings functions2: Adding a type to function arguments
  • Rustlings functions3: Passing an argument to a function
  • Rustlings functions4: Declaring the return type of a function
  • Rustlings functions5: Implicitly returning values from functions
  • Rustlings test1: Writing a function that passes a set of tests by reading error messages
  • Rustlings primitive_types1: Introducing boolean values
  • Rustlings primitive_types2: String and Character literals using different quote styles
  • Rustlings primitive_types3: Create an array of numbers using Ranges
  • Rustlings primitive_types4: Referencing contiguous slices of data we don't own using range
  • Rustlings Primitive_types5: Destructuring values from a tuple
  • Rustlings primitive_types6: Accessing specific values in a tuple by index
  • Rustlings structs1: Instantiating Classic, Tuple, and Unit structs
  • Rustlings structs2: Filling in the unspecified fields in structs with update syntax
  • Rustlings strings1: String literals are string slices, not String structs
  • Rustlings strings2: String structs can be turned into &str slices via referencing
  • Rustlings test2: Determining when a value is a String struct vs a string slice
  • Rustlings enums1: Declaring enums
  • Rustlings enums2: Defining enum variants using classic, unit, and tuple structs
  • Rustlings enums3: Working with enums by pattern matching variants
  • Rustlings tests1: Introducing the assert! macro
  • Rustlings tests2: Introducing the assert_eq! macro
  • Rustlings tests3: Writing tests for a function
  • Rustlings test3: Testing a function multiple times
  • Rustlings modules1: Declaring public functions in a module using the pub keyword
  • Rustlings modules2: Defining public interfaces for nested modules
  • Rustlings macros1: Writing your first macro
  • Rustlings macros2: What order you write macro definitions in matters
  • Rustlings macros3: Exporting a macro from a module
  • Rustlings macros4: Using rustfmt to fix common syntax issues
  • Rustlings test4: Defining macros that accept arguments
  • Rustlings move_semantics1: Borrowing vectors as mutable
  • Rustlings move_semantics2: Fixing the borrow of moved values with cloning or references
  • Rustlings move_semantics3: Specifying that a function argument is mutable
  • Rustlings move_semantics4: Initializing a vector with the vec! macro
  • Rustlings errors1: Propagating the reason something failed using Result, Err, and Ok
  • Rustlings errors2: Handling errors by unwrapping or early-returning with the `?` operator
  • Rustlings errors3: Using the `?` operator in the main function
  • Rustlings errorsn: Using Box to dynamically return one of multiple error types at runtime
  • Rustlings option1: Introducing the Option type
  • Rustlings option2: Using if let and while let to process Optional values
  • Rustlings result1: Using custom enum variants as errors in Result return types
  • Rustlings clippy1: Using Clippy linting to discover potentially dangerous code scenarios
  • Rustlings clippy2: Making code more readable with clippy linter suggestions
  • Rustlings arc1: Using Arc to share data safely among threads
  • Rustlings iterators2: Introducing Iterators by manually calling .next and using .iter()
  • Rustlings iterators3: Iterating and collecting values using the IntoIter trait
  • Rustlings iterators4: Implementing Factorial with Iterators
  • Rustlings traits1: Extending a type with additional functionality by implementing traits
  • Rustlings traits2: Implementing a Trait for a Vector of Strings
  • Rustlings generics1: Using Vectors, a struct that implements generics
  • Rustlings generics2: Converting concrete types to generic implementations
  • Rustlings generics3: Constraining generics using traits

Taught by

Chris Biscardi


4.7 rating at based on 8 ratings

Start your review of Learning Rust by Working Through the Rustlings Exercises

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.