Rust Tutorial
This is a practical guide to Rust for people who are new to it. The lessons are short, every example is real code you can run, and I’ve tried to be honest about the parts that usually give beginners trouble.
Try Rust right now
Section titled “Try Rust right now”Here’s a full Rust program. Click Try it Yourself to run it and change the message — it opens in the official Rust Playground, so there’s nothing to install.
fn main() { println!("Hello, World!");}What you’ll learn
Section titled “What you’ll learn”Why Rust?
Section titled “Why Rust?”Rust is used for the same kind of work as C and C++ — operating systems, browsers, game engines, databases, and command-line tools — anywhere speed and control matter. What’s different is that the Rust compiler catches a whole category of memory bugs before your program runs, and it does that without a garbage collector.
The catch is that Rust is stricter than most languages. It will reject code that other compilers happily accept. In return, you get programs that run fast and don’t fall over the way C programs often do.
That’s the reason it shows up in production at Cloudflare, Discord, and Dropbox, and why the Linux kernel now takes drivers written in Rust.
One honest heads-up: the first couple of weeks can be rough. Ownership and borrowing are genuinely new ideas, and arguing with the compiler is a bit of a rite of passage. It clicks sooner than you’d expect, and this guide is written to get you there with as little pain as possible.
How to use this guide
Section titled “How to use this guide”If you’re starting from zero, work through the topics on the left roughly in order. If you already know some Rust, skip to whatever you need. Every code sample has a Try it Yourself button, so you can run it, break it, and see what happens as you read.
One tip worth knowing up front: read the compiler’s error messages. Rust’s are unusually good — they normally tell you what went wrong and how to fix it, so it pays to actually read them instead of skimming past.
Suggested order
Section titled “Suggested order”- Rust Intro — what Rust is and why it exists
- Get Started — install it and run your first program
- Syntax — how a Rust program is put together
- Variables and Data Types — storing and typing data
- Functions — organizing your code
- Ownership and Borrowing — the parts that make Rust, Rust
Quick check
Section titled “Quick check”See if that landed
1. When does Rust catch memory bugs?
2. Does Rust use a garbage collector?
3. What should you do when the compiler gives you an error?
Score: 0 / 3
Official docs worth bookmarking
Section titled “Official docs worth bookmarking”- The Rust Book — the free, official long-form guide
- Rust by Example — learn from annotated code
- Standard library docs — the day-to-day reference
- The Rust Playground — run Rust in the browser