This course offers an introduction to Rust, a popular open-source systems programming language that focuses on speed, memory safety, and parallelism.
Overview
Syllabus
Introduction
- Learn Rust programming
- What you should know
- What is Rust?
- Rust versions
- Installing Rust on Windows
- Installing Rust on Linux and macOS
- Anatomy of a Rust program
- Adding comments
- Building programs using Cargo
- Declaring variables
- Integer data types
- Floating-point data types
- Arithmetic operations
- Formatting print statements
- Bitwise operations
- Boolean data type and operations
- Comparison operations
- Char data types
- Challenge: Find the average
- Solution: Find the average
- Arrays
- Multidimensional arrays
- Tuples
- Function parameters
- Statements vs. expressions
- Function return values
- Challenge: Convert temperature
- Solution: Convert temperature
- Conditional execution
- Multiple conditions
- Conditional assignment
- Loops
- While loops
- For loops
- Nested loops
- Challenge: Max, min, mean
- Solution: Max, min, mean
- Variable scope
- Shadowing variables
- Stack and heap memory
- String data type
- Ownership
- Moving, cloning, and copying data
- Transferring ownership
- Borrowing references
- Mutable references
- Dangling references
- Slices
- Slices as function parameters
- Challenge: Trim spaces
- Solution: Trim spaces
- Rust Standard Library and prelude
- Standard input
- Parse strings
- Crates
- Challenge: Higher or lower
- Solution: Higher or lower
- Command-line arguments
- Reading from files
- Writing to files
- Challenge: Check the roster
- Solution: Check the roster
- Defining structs
- Struct update syntax
- Struct methods
- Associated functions
- Tuple structs
- Challenge: Represent shapes
- Solution: Represent shapes
- Generic struct definitions
- Generic method definitions
- Generic function definitions
- Box data type
- Challenge: Sum boxes
- Solution: Sum boxes
- Implement traits
- Default trait implementation
- Derive traits
- Trait bounds
- Multiple trait bounds
- Return types with implemented traits
- Challenge: Implement the display trait
- Solution: Implement the display trait
- The borrow checker
- Lifetime annotation syntax
- Multiple lifetime annotations
- Lifetime elision rules
- Struct lifetime annotations
- Static lifetime
- Define enums
- Match operator
- Match with default placeholder
- Enum methods
- Option enum
- Matching Option
- If-let syntax
- Challenge: Represent a location
- Solution: Represent a location
- Unrecoverable errors
- Result enum
- Matching Result to recover from errors
- Propagating errors
- Challenge: Handle errors
- Solution: Handle errors
- Vectors
- HashMaps
- Challenge: Count words
- Solution: Count words
- Where to go next
Taught by
Barron Stone