100 days of code - Rust – Telegram
Channel created
Channel photo updated
Day 1 of Learning Rust

Hey friends! Welcome to my series on learning Rust in 100 days. Over the next 100 days, I'll share what I've learned each day, explain key concepts so you can follow along, provide helpful resources, and even create a GitHub repo where we can collaborate. Feel free to create issues there to request more resources, share your progress, or ask questions.

Today, we'll start with the basics: installing Rust on your system (it works on macOS, Linux, or Windows). We'll also cover a quick introduction to Rust, set up a simple project, and run your first "Hello, World!" program. By the end, you'll officially be a Rustacean (that's what Rust enthusiasts call themselves)!

What is Rust?

Before we dive in, let's add some context. Rust is a modern systems programming language designed for performance, reliability, and safety. It prevents common bugs like null pointer dereferences, data races, and buffer overflows through its ownership system, borrow checker, and strong type system—all at compile time, without sacrificing speed. It's great for web assembly, embedded systems, CLI tools, and even replacing C/C++ in performance-critical apps. Companies like Mozilla, AWS, and Microsoft use it extensively. If you're coming from languages like C++, Python, or JavaScript, Rust might feel strict at first, but it teaches you to write safer code.

For more depth, check out the official Rust book: The Rust Programming Language

—it's free and beginner-friendly.

Installing Rust

Rust uses a tool called rustup for installation and management. It handles multiple Rust versions (stable, beta, nightly) and sets up everything you need, including the compiler (rustc), package manager (cargo), and documentation tools.

On macOS or Linux:

Open your terminal and run:

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


Follow the prompts. It will download and install Rust, and automatically configure your environment variables (like adding Cargo to your PATH). Restart your terminal after installation.

On Windows:

1. Go to the official site:
https://www.rust-lang.org/tools/install

if you did not find the installer use this link too -> https://forge.rust-lang.org/infra/other-installation-methods.html



2. Download and run the rustup-init.exe installer.

3. Follow the instructions—it will set up Rust and add it to your PATH automatically.

4. Use PowerShell or Command Prompt for the rest of this guide.

After installation, verify it worked by running:

rustc --version


You should see something like rustc 1.82.0 (or whatever the latest version is). No need to manually configure environment variables— rustup handles that for you.

If you run into issues, refer to the official installation guide: https://www.rust-lang.org/learn/get-started

Setting Up Your Development Environment

Choose an IDE or editor you're comfortable with. I recommend Visual Studio Code (VS Code) because it's free, lightweight, and has excellent Rust support:

1. Download VS Code from https://code.visualstudio.com.
2. Install the rust-analyzer extension (search for it in the Extensions tab). It provides auto-completion, error checking, and debugging right in the editor.

Alternatives: IntelliJ IDEA with the Rust plugin, Vim/Neovim with rust.vim, or even just a text editor like Notepad++ if you're starting simple.

Congrats! You're now officially a Rustacean. 🦀

Your First "Hello, World!" Project

Let's create and run a simple program to print "Hello, World!" This introduces Cargo, Rust's build system and package manager.
What is Cargo?

Cargo is Rust’s official build system and package manager. It handles:

- Creating new projects with a standard structure
- Building your code (uses rustc under the hood)
- Downloading and managing dependencies (called crates) from https://crates.io
- Running tests, benchmarks, and generating documentation
- Packaging your project for distribution

Project metadata lives in a Cargo.toml file (similar to package.json in Node.js or pom.xml in Maven). Cargo ensures builds are *repeatable*, *reliable*, and easy to share.

Learn more: https://doc.rust-lang.org/cargo

Steps to Create Your First Rust Project

1️⃣ Open a terminal

- PowerShell on Windows
- Terminal on macOS or Linux

2️⃣ Create a directory for our Rust journey

mkdir RustJourney
cd RustJourney


3️⃣ Create a new project using Cargo

cargo new hello_world
cd hello_world


Cargo generates this structure:

- src/main.rs → main source file
- Cargo.toml → project configuration
- .gitignore → Git ignore rules



4️⃣ Open src/main.rs

Cargo pre-fills it with:

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


Explanation:

- fn main() → entry point of every Rust executable
- println! → a macro (note the !) that prints to the console
- ; ends statements (Rust is strict)
- 4 spaces indentation is the convention



5️⃣ Build and run the project

cargo run


Output:

Hello, world!


Build without running:

cargo build


Optimized release build:


cargo build --release


Congrats! You’ve completed your first Rust project.

If you see errors, don’t panic—Rust’s compiler messages are very helpful.


Resources

- 📘 Rust by Example: https://doc.rust-lang.org/rust-by-example
- 💬 Community: r/rust (Reddit), Rust Discord


Summary

- Installed Rust using rustup
- Learned what Cargo is
- Created a Hello World project
- Ran Rust code with cargo run

Practice: Change "Hello, world!" to print your name.
Day 2 of Learning Rust

Hey friends
Today we’ll cover basic data types in Rust.

Data types in Rust are used to store and organize values.
Rust is a strongly typed language, meaning every value has a specific type, and Rust checks this at compile time.

There are two main categories of data types in Rust:

1. Built-in (primitive) data types
2. Custom data types



1. Built-in (Primitive) Data Types

These are data types provided by Rust out of the box.

A. Integer Types

Used to store whole numbers.
i8, i16, i32, i64, i128 => Signed integers
u8, u16, u32, u64, u128 => Unsigned integers
isize, usize => Depends on system architecture

let age: u8 = 25;
let balance: i32 = -1000;



B. Floating-Point Types

Used to store decimal numbers.
f32 => 32-bit float
f64 => 64-bit float (default)

let pi: f64 = 3.14159;



3. Boolean Type

Used for true/false values.

let is_rust_fun: bool = true;


C. Character Type

Stores a single Unicode character.

let grade: char = 'A';
let emoji: char = '😄';

D. String Types

Rust has two string types (very important):

&str (String slice)

- Immutable
- Usually used for fixed text

let name: &str = "Rust";


String

- Growable
- Stored on the heap

let language: String = String::from("Rust");


E. Tuple

A fixed-size collection of values of different types.

let user: (i32, &str, bool) = (1, "Dawit", true);


F. Array

A fixed-size collection of values of the same type.

let numbers: [i32; 3] = [1, 2, 3];



2. Custom Data Types

We’ll cover these deeply later, but here’s a sneak peek:

- struct
- enum
- union

Example:

struct User {
name: String,
age: u8,
}


Summary

- Rust has strong and safe data types
- Primitive types are fast and memory-safe
- Understanding data types is key to mastering Rust
Signed integers (`i` types)

Can store both positive and negative numbers

Examples: i8, i16, i32, i64, i128

let temperature: i32 = -10;
let profit: i32 = 500;


Range example (i8):

- Minimum: -128
- Maximum: 127

Why?
Because 1 bit is used for the sign (+ or -).



Unsigned integers (u types)

Can store only non-negative numbers (0 and up).

Examples: u8, u16, u32, u64, u128

let age: u8 = 25;
let score: u32 = 1000;


Range example (u8):

- Minimum: 0
- Maximum: 255

No bit is wasted on the sign, so you get a larger positive range.