Start Coding in Rust: Your First Program in 15 Minutes

C…
crusty.rustacean
Published on October 25, 2025 • Updated October 25, 2025

New to Rust? Learn to write your first working program in under 15 minutes. Step-by-step guide for beginners with zero Rust experience. Start building today.

rust-installation beginner-setup cargo-basics first-rust-program
0 likes

steps up the side of a mountain

Remember the frustration of reading yet another “intro to Rust” article that throws lifetime annotations at you on page one? Or the tutorials that assume you already know what a borrow checker is?

I’ve been there. After bouncing between frameworks and languages for months, I finally cracked the code on actually starting with Rust without the overwhelm.

In the next 15 minutes, you’ll:

  • Install Rust and understand what you’re actually installing (not just copy-pasting commands)
  • Write and run your first working Rust program
  • Understand why Cargo matters (and why you should never skip it)
  • Have a foundation to build real projects

This isn’t a comprehensive Rust course. It’s your launchpad—the absolute minimum you need to go from “I’m curious about Rust” to “I just ran my first Rust program.” Everything else can come later.

What Makes Rust Worth Learning?

You’ve probably heard Rust is “the most loved language” on Stack Overflow for eight years running. But what does that actually mean for you as someone just starting out?

Rust combines performance with safety, giving you the speed of C++ with compiler guardrails that catch bugs before they reach production. The compiler is famously helpful, acting more like a pair programming partner than a cryptic error machine.

The reality check: Yes, Rust has a learning curve. But here’s what nobody tells beginners—you don’t need to understand ownership, borrowing, and lifetimes to write your first program. Those concepts matter, but not today.

Today, you just need to see Rust work.

Before You Start: What You’ll Need

Keep these assumptions in mind:

  • Basic programming knowledge - You’ve written code in at least one language before (Python, JavaScript, C++, doesn’t matter)
  • Command line comfort - You can navigate directories and run commands without panic
  • A code editor - I’ll use VS Code in examples, but any editor works

Time investment: 15-20 minutes to read and code along

Understanding Rust’s Building Blocks (Without the Jargon)

Before writing code, let’s demystify three things you’ll see everywhere:

Compiled vs Interpreted

Rust is a compiled language, meaning your code gets translated into machine code your computer can run directly. Think of it like translating a recipe from English to instructions a robot chef can follow. This translation happens once (when you compile), then the robot can cook the dish instantly every time.

Why this matters: Rust programs are fast because they’re pre-translated. The tradeoff? You need an extra step (compiling) before running your code.

For a deeper dive into compiled versus interpreted languages, check out this article on freeCodeCamp.

Cargo: Your New Best Friend

Cargo is Rust’s package manager and build tool. It creates project structure, manages dependencies, compiles your code, and runs tests.

Think of Cargo as:

  • The foreman at a construction site (organizes everything)
  • Your project’s filing system (keeps code organized)
  • The “run” button for your programs

The bottom line: You could compile Rust programs manually with rustc, but that’s like refusing to use a dishwasher. Cargo handles the tedious parts so you can focus on writing code.

Modules and Organization

Rust uses packages, crates, and modules to organize code, controlling what’s public versus private. For now, just know that Cargo creates this structure for you automatically. You’ll learn the details as you build bigger projects.

Installing Rust (The 5-Minute Version)

Head to the official Rust installation page and follow the instructions for your operating system.

What you’re actually installing:

  • rustc - The Rust compiler (the translator)
  • cargo - The build tool and package manager
  • rustup - Keeps everything updated

Verify it worked:

cargo --version

If you see a version number, you’re golden. If not, revisit the installation guide.

Your First Rust Program: Hello, Your Name

Most tutorials stop at “Hello, World” which is…fine? But let’s make something slightly more interesting that actually demonstrates basic Rust concepts.

What we’re building: A program that greets you by name.

Step 1: Create Your Project

Open your terminal and run:

cargo new hello_name
cd hello_name
code .

This creates a new binary project called hello_name. Cargo generates a complete project structure with a src folder containing main.rs—your program’s entry point.

What just happened:

  • cargo new created a project folder with all necessary files
  • cd hello_name moved you into that folder
  • code . opened VS Code (skip if using another editor)

Step 2: Write the Code

Open src/main.rs and replace the boilerplate with:

fn main() {
    let name = "Jeff";  // Change this to your name!
    println!("Hello, {}!", name);
}

Breaking it down:

  • fn main() - Every Rust program starts here (like main() in C++ or if __name__ == "__main__" in Python)
  • let name = "Jeff" - Creates a variable called name and binds the string “Jeff” to it
  • println!("Hello, {}!", name) - Prints to console, inserting name where the {} is

Step 3: Run It

Back in your terminal:

cargo run

You should see:

   Compiling hello_name v0.1.0
    Finished dev [unoptimized + debuginfo] target(s) in 0.50s
     Running `target/debug/hello_name`
Hello, Jeff!

Congratulations! You just wrote, compiled, and ran your first Rust program.

What You Just Learned (And Why It Matters)

In 15 minutes, you’ve:

✓ Installed a complete Rust development environment
✓ Used Cargo to create a project structure
✓ Written valid Rust code with variables and output
✓ Compiled and ran a binary program

The concepts you encountered:

  • Functions - Code blocks that do specific tasks (fn main())
  • Variables - Named storage for data (let name)
  • String formatting - Inserting values into text ({})
  • Macros - Special commands ending in ! (println!)

Note that Rust expressions end with semicolons, and code inside functions lives within curly braces. These braces become especially important when learning about ownership—a core Rust feature we’ll cover in future posts.

Where to Go From Here

You’ve crossed the starting line. Here’s your roadmap for the next steps:

Immediate next projects:

  1. Modify your program to greet multiple people (hint: use a loop)
  2. Make it interactive—ask for the user’s name instead of hardcoding it
  3. Add error handling for empty inputs

Learning path from here:

  • Variables and mutability - Understanding let vs let mut
  • Data types - Numbers, strings, booleans
  • Functions - Writing your own reusable code blocks
  • Control flow - If statements and loops

I’ve written beginner-friendly guides on all of these topics. Check out Just Say No to Magic Values next to learn about constants, or Pouring the Footings for variables and mutability.

Resources that actually helped me:

The Reality Check

I started this post by saying I’m “far from an expert” in Rust. That’s still true. But here’s what I’ve learned after almost four years of learning this language: you don’t need to be an expert to start building.

Every programmer you admire started exactly where you are now—running their first “Hello, World” and wondering if they’d ever understand pointers, ownership, or whatever scary concept they’d just read about.

The difference between someone who learns Rust and someone who gives up? The learner writes code. They compile. They see errors. They fix them. They build tiny projects that barely work. And slowly, the scary concepts become familiar friends.

Your challenge: Before closing this tab, change something in your program. Make it greet two people. Add an emoji. Break something and fix it. Just do something with what you learned.

Because that’s how you go from reading about Rust to actually knowing Rust.

C…
crusty.rustacean

Comments

Loading comments...