Rust Essential Course – Lesson 1

Lesson 1: Introduction to Rust

What is Rust?

Rust is a modern programming language focused on safety, speed, and concurrency. Its design prevents common bugs seen in other languages, such as null pointer dereferences and data races, making it an excellent choice for both beginners and experienced developers aiming to build reliable software.

Key features:

  • Memory safety without needing a garbage collector
  • Performance on par with C and C++
  • Concurrency made easy and safe

Why Use Rust?

  • Safe Code: Eliminates entire classes of bugs by design.
  • Fast: Compiled to machine code for top-notch speed.
  • Productive: Great tooling, detailed error messages, and a helpful community.

“Rust is empowering everyone to build reliable and efficient software.”
— Rust mission statement

Setting Up Your Rust Environment

Let’s get ready to write Rust code!

1. Install Rust

  • Visit the official Rust website.
  • Follow the installation steps for your operating system.
  • Open your terminal or command prompt.
  • Run:
rustc --version

You should see the installed version of Rust, something like below:

rustc 1.86.0 (05f9846f8 2025-03-31)

2. The Rust Playground

Don’t want to install just yet?


Try Rust in your browser with the Rust Playground.

Interactive Task 1: Check Your Setup

  • Open your terminal or the Rust Playground.
  • Type in first.rs (if you are on terminal using your favorite text editor):
fn main() {
    println!("Rust is ready!");
}
  • Run the code (if you are on terminal, follow the following instruction). If you are using Rust playground website, just hit RUN.
$ rustc first.rs
$ ./first
Rust is ready!

Mini-Challenge

Can you change the message to print your own name?

fn main() {
    // Replace the text below with your name!
    println!("Hello, Rustacean!");
}

Try it out, and share your output!

Recap

  • Your Rust environment can be set up locally or used online.
  • You wrote your very first lines of Rust code!

Go to Course Structure or Navigate to next blog!

Leave a Comment

Your email address will not be published. Required fields are marked *