Logo
Back to tutorials
BeginnerBackend Fundamentals

Rust Basics for Beginners

Learn ownership, borrowing, and project structure with practical examples from a web engineer perspective.

Duration

1h 30m

Technologies

3

Outcomes

3

Technologies

RustCargoCLI

What you will learn

  • Understand ownership and borrowing
  • Create and run cargo projects
  • Build confidence reading Rust compiler feedback

Prerequisites

  • Comfortable with JavaScript/TypeScript
  • Basic command-line usage
  • Willingness to learn strict compile-time checks

Tutorial content

🦀 Learn Rust
Zero to Rustacean
Progress0%
Chapter 1 of 8

🦀 What is Rust?

Meet your new favorite language

Rust is a systems programming language created by Mozilla in 2010. It's designed to be:

Fast — as fast as C and C++
Safe — it prevents common bugs like crashes and memory errors *at compile time*
Concurrent — great for modern multi-core programs

Think of Rust as C++ with a safety harness. You get the raw power of low-level programming, but Rust's compiler acts like a strict-but-caring teacher that catches your mistakes before they become disasters.

🧠 The Rust Analogy

Imagine you're building with LEGO bricks, but there's a robot assistant watching you. Before you can place a piece, the robot checks: "Is this piece available? Are you the only one using it? Will it fit here without breaking the structure?" If something's wrong, the robot stops you immediately — before the whole structure collapses. That robot is Rust's compiler.

Your First Rust Program

Every Rust program starts with a 'main' function. Think of it as the front door of your program — execution always begins here. 'println!' is a macro (notice the '!') that prints text to the screen.

main.rs
fn main() {
    println!("Hello, world! 🦀");
}
🔍 Breaking It Down
fnShort for 'function'. This keyword declares a new function.
mainThe special name for the entry point. Every Rust program needs a main function.
()Empty parentheses mean this function takes no parameters (inputs).
{ }Curly braces wrap the function body — the code that runs.
println!("...")A macro that prints text followed by a newline. The '!' marks it as a macro, not a regular function.

Continue learning

Suggested next tutorials