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
1. Write Your First Program
- Installing Rust on Windows
- Installing Rust on Linux and macOS
- Anatomy of a Rust program
- Adding comments
- Building programs using Cargo
2. Primitive Data Types
- 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
3. Compound Data Types
- Arrays
- Multidimensional arrays
- Tuples
4. Functions
- Function parameters
- Statements vs. expressions
- Function return values
- Challenge: Convert temperature
- Solution: Convert temperature
5. Program Flow Control
- Conditional execution
- Multiple conditions
- Conditional assignment
- Loops
- While loops
- For loops
- Nested loops
- Challenge: Max, min, mean
- Solution: Max, min, mean
6. Ownership
- Variable scope
- Shadowing variables
- Stack and heap memory
- String data type
- Ownership
- Moving, cloning, and copying data
- Transferring ownership
7. References
- Borrowing references
- Mutable references
- Dangling references
- Slices
- Slices as function parameters
- Challenge: Trim spaces
- Solution: Trim spaces
8. Modules
- Rust Standard Library and prelude
- Standard input
- Parse strings
- Crates
- Challenge: Higher or lower
- Solution: Higher or lower
9. Input and Output
- Command-line arguments
- Reading from files
- Writing to files
- Challenge: Check the roster
- Solution: Check the roster
10. Structs
- Defining structs
- Struct update syntax
- Struct methods
- Associated functions
- Tuple structs
- Challenge: Represent shapes
- Solution: Represent shapes
11. Generic Types
- Generic struct definitions
- Generic method definitions
- Generic function definitions
- Box data type
- Challenge: Sum boxes
- Solution: Sum boxes
12. Traits
- 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
13. Lifetimes
- The borrow checker
- Lifetime annotation syntax
- Multiple lifetime annotations
- Lifetime elision rules
- Struct lifetime annotations
- Static lifetime
14. Enums
- 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
15. Error Handling
- Unrecoverable errors
- Result<T, E> enum
- Matching Result<T, E> to recover from errors
- Propagating errors
- Challenge: Handle errors
- Solution: Handle errors
16. Collections
- Vectors
- HashMaps
- Challenge: Count words
- Solution: Count words
Conclusion
- Where to go next
Taught by
Barron Stone