Rust Get Started

Rust Tutorial

🦀 Rust Get Started

Rust Get Started

This section will help you Rust Get Started from zero — installation, first program, and running it step by step.


🔽 Step 1: Install Rust

Rust is installed using a tool called rustup.

 Windows

  1. Go to 👉 https://www.rust-lang.org

  2. Click Install

  3. Download and run rustup-init.exe

  4. Choose option 1 (default installation)

 Linux / macOS

Open terminal and run:

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

Restart your terminal after installation.


✔️ Step 2: Verify Installation

Check if Rust is installed correctly:

rustc --version
cargo --version

You should see version numbers like:

rustc 1.xx.x
cargo 1.xx.x

📁 Step 3: Create Your First Rust Project

Rust uses Cargo (its build system & package manager).

Run:

cargo new hello_rust
cd hello_rust

Project structure:

hello_rust/
│── Cargo.toml
└── src/
└── main.rs

✍️ Step 4: Write Your First Rust Program

Open src/main.rs:



▶️ Step 5: Run the Program

Inside the project folder:

cargo run

Output:

Hello, Rust!

🎉 Congratulations! Your first Rust program is running.


🔨 Useful Cargo Commands

Command Purpose
cargo build Compile project
cargo run Build + Run
cargo check Check errors without building
cargo clean Remove build files

🧠 How Rust Programs Work

  • Execution starts from main()

  • Rust is compiled, not interpreted

  • Errors are caught at compile time

  • No garbage collector — memory handled safely by Rust

You may also like...