What is Rust?
Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. It was created by Mozilla and first released in 2015. Rust has been the "most loved programming language" in Stack Overflow Developer Survey for many consecutive years.
Where is Rust used?
- Systems programming — Operating systems, device drivers, embedded systems
- WebAssembly — High-performance browser code
- CLI tools — Fast command-line utilities (ripgrep, fd, bat)
- Game development — Game engines and graphics programming
- Backend services — High-performance web servers
Why learn Rust?
- 🔒 Memory safety without garbage collection
- ⚡ Performance comparable to C and C++
- 🛡️ No null pointer dereferences or data races
- 📦 Cargo — the best package manager in systems programming
Your first Rust program
fn main() {
println!("Hello, World!");
}
Every Rust program starts with the main() function. println! is a macro (note the !) that prints text to standard output.
Running Rust code
// Save as main.rs, then:
// rustc main.rs
// ./main
// Or use Cargo (recommended):
// cargo new my_project
// cd my_project
// cargo run
Install Rust with rustup: rustup.rs — the official toolchain installer. You can also use the Rust Playground at play.rust-lang.org.