
Learn Rust fundamentals and WebAssembly by building a browser snake game, from primitive types and memory layout to Rust code compiled to WebAssembly and bridged to JavaScript and TypeScript.
Learn practical error resolution by reading error messages, googling solutions, and checking code against the provided JSX examples and root element guidelines.
Explore the course structure for Rust and WebAssembly with JS, emphasizing optional information lectures marked with i that provide bonus content without new code; access code in resources.
Install and configure the Rust toolchain across mac, linux, and Windows, verify the setup with rustup and cargo, and set up Visual Studio Code with Rust and WebAssembly extensions.
Learn to manage rust versions with rustup, switching between stable, beta, and nightly toolchains, and verify versions using rustc --version and rustup show.
Initialize a Rust project, define the main function with fn, declare a message using let, and print it with the print line macro and curly bracket placeholders.
Introduce mutable variables in Rust by using let mut to modify values, explain immutable by default, show shadowing, and demonstrate printing and basic variable usage in the main function.
Initialize and manage Rust projects with cargo, verify your cargo installation, and create a binary crate. Understand Cargo.toml, toml to json representations, and how to run code with cargo run.
Create a new Rust function print_welcome as a wrapper for print_line, accepting a message parameter of type string or str, and explore returning values with or without a semicolon.
Explore primitive types: booleans and various numbers, including unsigned types like u8 and signed types like i32, with architecture dependent isize and usize determining their size.
Explore Rust number formats by printing decimal, hex, binary, and a byte with utf encoding, using underscores for readability, and learn binary and hex to decimal conversions.
Explore primitive types in Rust, including f32 and f64 floats, i32 and u8 integers, strings, and how to use tuples and arrays with destructuring, indexing, and fixed sizes.
Explore how a simple Rust program adds two numbers using a u32 add function, prints the result, and then demystifies stack and heap memory, code compilation, and memory layouts.
Understand how the call stack tracks main and nested functions, predict the print order (C, D, A, E, F, B), and see how recursive calls can overflow the stack.
Discover Rust's string move semantics: understand moving heap-allocated strings from one variable to another, differentiate copying on the stack from moving dynamic types, and avoid double free errors.
Explore Rust memory management through moving values between stack and heap, and how drop clears heap memory when going out of scope.
Explore Rust ownership and move semantics by moving values, retrieving moved values, and using mutable strings with push operations, returning values, and displaying hello world via cargo run.
This lecture demonstrates copying an integer on the stack in Rust, showing that a value is copied rather than moved when passed to a function.
Learn to distinguish moving and copying, then borrow data via references to avoid ownership transfer, while exploring heap and stack, references, and drop semantics.
Learn to mutate data behind a reference in Rust by converting to a mutable reference and using dereferencing with push_str to modify a heap-allocated string.
Explore Rust's mutable and immutable borrows through an unpredictable mutate function. See how a helper mutates a string and why the compiler flags conflicts when borrows overlap.
Explore dereferencing in Rust, handling immutable and mutable references, automatic dereferencing, and calling string methods like push_str by dereferencing behind a reference.
Explore Rust references and dereferencing through stack frame demonstrations, showing how variables A, B, C, and D point to the same value, and how to inspect addresses and pointers.
Explore the difference between String and &str by creating a String from a string and a string literal, then compare mutability, push_str, heap versus read-only memory with capacity and length.
Learn how string slices work in Rust by extracting ranges from a string, learning inclusive versus exclusive indexes, and checking slice length and memory references.
Explore how a string slice interacts with borrowing and moving in Rust, including immutable and mutable references and what you cannot do when a slice is in use.
Demonstrate cloning in Rust by creating a new heap-allocated string via the clone trait, comparing it to the original, and explaining deep cloning and its memory and performance implications.
Learn how the box type stores data on the heap by creating a box pointing to a heap-allocated value, contrasting with stack storage and printing the result.
Define a person struct with name, last name, and age, instantiate it with braces, and access fields using dot syntax for printing.
Learn how to define associated functions and methods on a person struct using an impl block, including self, moving and borrowing, and calling patterns on instances.
Explore how to implement constructors in Rust by creating with new and from functions and updating fields with a mutable self.
define a person id enum with passport or identity card variants, assign it in the person struct, and derive debug to print the variants.
Explore enum values by attaching associated data to each variant, such as a passport's string id or an identity card's triple numbers, and see how type governs access.
Explore pattern matching with enums in Rust by extracting associated values for identity card and passport using match arms, printing results, and returning extracted values.
Explore using if let for pattern matching in Rust to selectively match passport IDs within an if statement, with else handling and practical examples shown via cargo run.
Learn to define a Rust struct with no fields, instantiate it, access its values by index, and implement associated functions, methods, and trait-based behavior.
Explore traits in Rust by defining a shared behavior with a display function, implementing it for types like person and animal, and using default versus overridden implementations.
Explore trait narrowing by using a log trait with implementations for different types, and compare dynamic dispatch versus compile-time dispatch, highlighting performance and binary size trade-offs.
Explore modularity by moving code into a library and making structs and functions public, then importing with use to organize a snake game into a dedicated src library.
Explore Rust import options, from changing cargo.toml package names to using the use keyword, wildcards, and selective imports, and see how std and embedded string integrate.
Use the mod keyword to encapsulate functionality into a module in Rust. Organize code under a learning Rust module, and expose items by marking them public while controlling visibility.
Define and use nested modules in Rust with a top level and a low level module, exposing public functions like hi there and hello world via relative and absolute imports.
Learn how to access struct fields and enum variants in a Rust–wasm setup, make fields public or expose them via getters, and print with debug format.
Explore the super keyword for accessing items outside the current module, and see how module visibility and crate access enable outsider functions through public education modules.
Explore modularity in Rust by creating a new library file, defining a module, making it public, and using mod and use to import and access its functions.
Learn how to implement the display trait for a custom Rust type, choosing between debug and user-facing output, and printing structured data like passport and identity card IDs.
What is Rust?
Rust is a programing language. Rust is blazingly fast and memory-efficient: with no runtime or garbage collector, it can power performance-critical services, run on embedded devices, and easily integrate with other languages.
What is WebAssembly?
WebAssembly is a new type of code that can be run in modern web browsers — it is a low-level assembly-like language with a compact binary format that runs with near-native performance and provides languages such as C/C++, C#, and Rust with a compilation target so that they can run on the web. It is also designed to run alongside JavaScript, allowing both to work together.
Is this course right for you?
If you plan to start your career as a developer or improve your programming skills, this course is right for you. Learn how to build a browser game with minimal JS and Rust code compiled into WebAssembly instructions.
You will get the confidence and skills required to start your projects during this course. In addition, you will get the right mindset to apply for a developer career.
What are you going to work on?
You will build the Snake game from scratch. You will learn to write code in Rust language, static type, compiled language.
The course starts with an explanation and practical examples of the Rust language. You will learn Rust-specific features such as "moving" and "copying"
Rust doesn't have a garbage collector. Memory is cleared when the values are getting out of the scope. You will learn how to manage this concept with ease.
The next feature you will learn of is borrowing and references. Through references, you will be able to access values without owning them.
In the beginning lectures, we will also talk about memory management in Stack and the Heap structures, modularity, strings, and other essential topics.
After Rust's introduction lectures, you will start building your Snake game. You will learn how to structure the application modular and cleanly.
You will build your own JS frontend, exposed through a simple Webpack development server. Later, you will transform JS implementation into TS (Typescript). This will specify types and be on the same page as Rust code.
You will build your rust backend code, the backbone of our game. You will learn how to compile Rust code into WebAssembly code. WebAssembly is code that can run in the browser. It's faster (almost Native speed) and more efficient than JS.
At the end of the course, we will create a production server and deploy our game to Heroku, so anybody on the internet can play our game.