S

Sajiron

14 min readPublished on Feb 17, 2025

Rust Programming: A Beginner's Guide to Getting Started

DALL·E 2025-02-17 11.22.12 - A modern developer setup with a laptop displaying Rust code on the screen. The workspace is clean, featuring a mechanical keyboard, a mouse, and a not.webp

1. Introduction

Rust is a systems programming language focused on safety, performance, and concurrency. It is designed to be memory-safe without needing a garbage collector, making it an excellent choice for applications like:

Operating Systems (e.g., Redox OS)

WebAssembly (Wasm)

Embedded Systems

Networking & High-Performance APIs

Game Development (e.g., Bevy game engine)

2. History of Rust

Rust was originally developed by Graydon Hoare at Mozilla Research in 2006 to address memory safety and concurrency issues common in C and C++. It was later officially released in 2015 as an open-source language backed by a strong community.

Key Milestones in Rust’s Development:

2006 – Rust project started by Graydon Hoare at Mozilla.

2010 – Rust was announced publicly as an experimental language.

2015 – Rust 1.0 was released, marking its first stable version.

2018 – Rust 2018 Edition introduced major improvements, including better async support.

2021 – The Rust Foundation was formed to support independent development.

2024 & Beyond – Rust continues to be widely adopted for systems programming, WebAssembly, and cloud-native applications.

Rust's development is community-driven, with contributions from companies like Mozilla, Microsoft, Google, and Amazon.

3. Why Learn Rust?

Key Advantages

Memory Safety without Garbage Collection

Rust prevents null pointer dereferences, buffer overflows, and data races.

Uses ownership and borrowing to manage memory.

High Performance (Like C & C++)

Rust compiles to machine code, making it as fast as C.

Zero-cost abstractions ensure efficient execution.

Concurrency Without Fear

Built-in support for thread safety and message-passing concurrency.

No data races at compile-time.

Great Developer Experience

Cargo: Built-in package manager and build tool.

Rust Analyzer: Provides amazing IDE support.

Rich Ecosystem: Libraries (crates) available via crates.io.

4. Prerequisites

Before installing Rust, ensure you have:

Basic knowledge of command-line interfaces (CLI)

An editor like VS Code, Neovim, RustRover or IntelliJ Rust Plugin

5. Setting Up Rust

5.1 Installing Rust

Windows Installation

Download the Rust installer from the official website: Rustup.

Run the installer (rustup-init.exe).

Follow the on-screen instructions, choosing the default installation.

Restart your terminal or Command Prompt.

Verify the installation by running:

rustc --version

Linux & macOS Installation

To install Rust, run the following command in your terminal:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Then, add Rust to your environment:

source $HOME/.cargo/env

To verify the installation, run:

rustc --version

5.2 Understanding Cargo (Rust’s Build System)

Cargo is Rust’s package manager and build system. It helps you:

Create new projects

Manage dependencies

Compile and run Rust applications

To install Cargo (if not installed by default), run:

rustup component add cargo

Check the version:

cargo --version

5.3 Creating a New Rust Project

Run:

cargo new my-first-rust-project
cd ./my-first-rust-project

5.4 Writing Your First Rust Program

By default, when you create a new Rust project using Cargo, it generates a basic project structure, including a src/main.rs file containing a simple Hello, World! function.

fn main() {
println!("Hello, world!");
}

Run it with:

cargo run

Expected output

Hello, world!

6. Next Steps

Now that Rust is installed and running, check out the next article on Rust’s basic syntax and data types.