
Introduce myself and Rust!
In this video:
Understand why Rust is such an awesome language
Know the goals of Rust
Learn where Rust came from
Show how to find the repository containing the exercises and how to get started.
Give a rundown of Cargo and how to use it.
In this video:
Learn what Cargo is capable of
Use Cargo to create, compile, and run a project
Learn all about variables!
In this video:
Declare and initialize immutable and mutable variables
Declare and initialize constants
First brush with compiler errors
Variables can only be used within a certain scope. This becomes very important later when we discuss ownership.
In this video:
Scope
Blocks
Shadowing variables
Memory safety is guaranteed at compile time.
In this video:
Declaration separate from initialization
Exercise A gives you an opportunity to try out using variables without violating scope and memory safety rules.
Functions are foundational to re-using code.
In this video:
Function declaration
Parameters and return values
Tail expressions
Exercise B gives you an opportunity to try out creating and calling function that return values.
A well-organized library is like sunshine and daisies.
In this video:
How to create a library module
"use" statements
Project dependencies
Scalar types are what everything else is built on.
In this video:
Integers
Floats
Booleans
Characters
The most primitive way to combine primitives.
In this video:
Tuples
Arrays
Exercise C gives you an opportunity to use simple scalar and compound types.
Controlling the flow of execution in Rust.
In this video:
if / else if / else - as an expression
loop
while
continue / break
for
More than you ever wanted to know about Strings in Rust, so you can stop running into walls and get on with your life.
In this video:
Strings and borrowed string slices
How a string is implemented, high-level
UTF-8
Bytes
Unicode scalars
Graphemes
Iterators (a little bit) and .nth()
Exercise D gives you an opportunity to use control flow and strings.
The very core of Rust. What makes it special and interesting compared to other systems programming languages.
In this video:
The 3 Rules of Ownership
Stack & Heap refresher
How ownership works under the hood, with Strings as an example
Drop
How to get things done despite the ownership rules. Borrow it and refer to it.
In this video:
Immutable references
Mutable references
Reference values vs. reference types
The 2 rules of references
Exercise E gives you an opportunity to run through ownership & reference concepts in function calls.
Rust's take on classes (but better, naturally).
In this video:
Struct definition & implementation
Struct fields
Struct methods and associated functions
Object-Oriented? (Hint: That's the wrong question)
Composition over inheritance. Rust's approach to interfaces/protocols.
In this video:
Trait definition
Trait implementation
Trait inheritance
Default behavior
Generic functions
Exercise F gives you an opportunity to get some experience with Structs and Traits.
Structs in the standard library that implement common collection types.
In this video:
Vec
VecDeque
HashMap / BTreeMap
HashSet / BTreeSet
BinaryHeap
LinkedList
The unexpected power tool of Rust. The reason you don't need null.
In this video:
Enum definition
Enum variants
Methods and associated functions for enums
Famous enums from the standard library: Option & Result
Exercise G gives you an opportunity to play with collections and enums.
An anonymous function that captures state and can be passed around.
In this video:
Closure syntax
Borrowing context
Capturing context by move
Examples with iterators
The way to burn CPU cores in parallel. (For *waiting* for I/O in parallel, see Async/Await)
In this video:
Spawning a thread
Closure considerations
Join handles
Exercise H gives you an opportunity to explore closures and threads.
Create the "invaders" project
Set up dependencies
Set up and play audio
NOTE: If you are on Linux, you will need to install some dependencies if you want to run this code! (See the external resources links for this video).
Set up terminal handling & mode
Create a library
Add a frame library module to handle the logic of a single frame
Add a render library module to render a frame to the terminal
Launch a child thread with a render loop
Create a frame and send it to the render thread each iteration of the game loop
Create a player module
Create a player struct definition
Implement associated functions and methods for Player
Implement the Drawable trait for Player
Add a Player, input handling, and drawing into the frame to our game loop
Create a shot module
Create a Shot struct with associated functions and methods
Implement the Drawable trait for Shot
Update Player to manage a vector of Shot
Add shot input handling and timer updating to our game loop
Create an invaders module
Create Invader and Invaders structs with associated functions and methods
Implement the Drawable trait for Invaders
Add the invaders to our game loop
Add methods on the Invaders struct to detect win and loss conditions
Add a method on the Invaders struct to attempt to kill an alien
Wire the Player up to attempting to shoot aliens with his shots
In our gameloop, wire the player up to shooting aliens and detect our win and loss conditions
Playtesting!
Thank you for taking my course! Send me a message letting me know your thoughts! You can find out what I'm up to on my personal web site or on GitHub.
Join Nathan Stocks for a fast-paced, entertaining, and curiously informative hands-on crash course in the Rust programming language.
This course will provide you with the fundamentals you need to boost you up Rust's steep learning curve. This is a hands-on course with targeted exercises for each subject and projects for you to use your combined knowledge. From using cargo to creating a project, to writing your code, to compiling and running it, this course has everything you need to get started. This course is kept up-to-date when Rust is updated with new features or major editions.
Rust is a systems programming language that eliminates entire classes of bugs and security vulnerabilities, has zero-cost abstractions like C and C++, is fun to program in, and lets systems programmers have nice things. No wonder Rust is gaining traction in spaces as diverse as game engines, high-performance computing, embedded devices, and web programming! Learn how to write high-performance code without the worry of crashes or security vulnerabilities. Join a vibrant community of developers where diversity, inclusion, and just plain being nice are all first-class objectives.
This course is the first in the Ultimate Rust series. If you like this course, then you'll love Ultimate Rust 2: Intermediate Concepts afterwards!