Install rustup — it provides rustc, cargo, and stable/beta toolchains. Every Rust project is a Cargo crate.
Core concepts
- rustup & toolchain:
rustup update stablekeeps compiler fresh. — rustup basics - cargo new:
cargo new hello --binscaffoldssrc/main.rs+Cargo.toml. — The Rust Book: Hello, Cargo - cargo run / build / test: Default workflow — no separate install step for local binaries. — Cargo: cargo run
- Edition: Rust 2021 edition is default for new crates — syntax evolves with editions. — Rust edition guide
fn main() {
println!("Hello, iHateReading!");
}- Formatting:
cargo fmt— community-standard style enforced in CI. — rustfmt
Concept videos
YouTube lessons for these topics. On a large screen they open in the reading panel next to the roadmap, same as the article links on each core concept.
- Rust overview — Rust in 100 Seconds (Fireship)
Explanation
Rust’s toolchain is one installer, one workflow — rustup, cargo, fmt, clippy, test. That consistency is deliberate: less time debating build systems, more time fighting the borrow checker (productively).
rustup & toolchain
rustup installs stable/beta/nightly compilers side by side. rustup update stable keeps security fixes flowing. Think of rustup as Rust’s app store for compilers.
cargo new
cargo new creates opinionated structure: src/main.rs, Cargo.toml, gitignore. Binaries vs libraries (--lib) change the template. Cargo is npm + make + test runner combined.
cargo run / build / test
cargo run compiles and executes; cargo build --release optimizes for production speed/size. cargo test runs unit and integration tests. You rarely invoke rustc directly — Cargo orchestrates.
Edition
Editions are language eras that compile together — 2018, 2021, etc. New crates default to modern editions; older crates opt in when ready. Editions avoid breaking existing code while evolving syntax.
Formatting
cargo fmt applies community style automatically — no semicolon wars in code review. Teams enforce fmt in CI so diffs show logic, not whitespace.
What Is It?
rustup manages toolchains (stable/beta/nightly) and components like clippy.
Cargo builds, tests, and publishes crates; cargo run compiles and executes binaries.
Entry point is fn main() in src/main.rs for binaries.
Why Should I Care?
Cargo is the universal workflow — interviews assume you know build profiles and dependencies.
Correct toolchain setup avoids 'works on stable, fails on nightly' confusion.
Real World Analogy
rustup is a toolbox that installs the compiler, Cargo, and standard library versions side by side — like switching drill bits without buying a new drill.
Visual Mental Model
rustup -> rustc + cargo + std
cargo new -> src/main.rsBeginner Explanation
Install rustup, run cargo new hello, cargo run. Every project is a crate with Cargo.toml manifest.
Smallest Possible Example
fn main() {
let name = "iHateReading";
println!("Hello, {name}");
}Common Mistakes
❌ Installing rustc without rustup on macOS/Linux.
You lose easy updates and component management.
❌ Putting all code in main.rs forever.
Split modules early to learn mod and use rules.
❌ Ignoring cargo fmt and clippy warnings.
Teams treat clippy as CI gatekeepers.
Real Project Example
crates.io hosts Rust packages the way npm hosts JS.
Ripgrep and bat are popular Rust CLIs installed via cargo or brew.
Build This Mini Project
Create two crates with cargo new, add a dependency in one via crates.io, and run cargo tree to see the graph.
Interview Question
What is Cargo?
Rust's build system and package manager — it compiles crates, resolves dependencies, runs tests, and standardizes project layout.
Key Takeaways
- rustup + cargo is the default install.
- Every app is a crate with a manifest.
- cargo run/build/test daily.
- Split code into modules early.
Resources
The 60-second story
You are about to open a workshop, and the city inspector will not let you invent your own electrical code. Rust’s installer, rustup, is how you get the official wiring kit and how you update it with rustup update stable when the city publishes a new diagram. You do not download a random compiler from a forum and hope.
cargo new hello --bin builds the shop: a Cargo.toml that lists what you depend on, and src/main.rs where the work starts. Cargo is the shop manager. cargo run builds and opens the door. cargo build just builds. cargo test runs the checks you wrote. You do not invent a second install step for your own program. The manager already knows the layout.
An edition, like Rust 2021, is a rulebook version. New shops start on the current book. Old shops can stay on an older book so a new diagram does not silently rewire them. Editions are how the language grows without showing up at your door with a wrecking ball.
cargo fmt is the person who lines up the tools on the pegboard before review. Once it is in CI, nobody spends a pull request arguing about commas. The argument can be about whether the machine is safe.
Map the workshop.
- rustup is the official kit and its updates.
cargo newis framing the shop.Cargo.tomlis the list of parts.src/main.rsis the bench you actually work at.cargo run,build, andtestare the manager’s three buttons.- An edition is the rulebook year.
cargo fmtis the pegboard.
fn main() {
println!("shop is open");
}That is enough for the first afternoon. If it prints, the kit works. Then you add a dependency by telling the manager, not by copying a folder into src and hoping.
Cargo exists because C and C++ projects often arrive as a pile of flags and a README that says “it builds on my machine.” Rust’s bet was that the build, the test, and the format could be boring. Boring is a feature when you are new and the type system is already a lot.
Mental model: a shop with a manager who already knows where the tools hang. You learn the language in main.rs. You do not also invent a build system on day one.
You can explain the page if you say: rustup gets the compiler, Cargo runs the shop, editions keep old shops standing, and fmt ends the spacing debate.
