Introduction to Rust: Why You Should Start Right Now
Rust is a systems programming language that combines the performance of C++ with memory safety guaranteed at the compiler level. In 2025, Rust continues to actively evolve: it is used in the Linux kernel, the Firefox browser, command-line tools, and even in web development (via WebAssembly). If you haven't tried Rust yet, now is the perfect time — the community has become friendlier, the tooling more convenient, and the documentation even more comprehensive.
In this article, we will walk through the journey from installation to writing a meaningful program. You will learn how to set up your environment, write your first code, understand key concepts (ownership, borrowing, lifetimes), and immediately apply them in practice. By the end of the article, you will have a working project and an understanding of where to go next.
1. Installing Rust and Setting Up the Environment
1.1. Installation via rustup
The easiest way to install Rust is to use the official tool rustup. It manages compiler versions and allows for easy updates. Open a terminal and run the command:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shAfter installation, restart your terminal or run source $HOME/.cargo/env. Verify that everything works:
rustc --versioncargo --versionYou should see something like rustc 1.78.0 (2024-05-02) — the version may differ, but the important thing is that the commands execute without errors.
1.2. What is Cargo?
Cargo is the package manager and build system for Rust. It automatically downloads dependencies, compiles code, and manages projects. You won't need to manually invoke rustc — Cargo will do it all for you.
1.3. Editors and IDEs
For a comfortable workflow, I recommend using:
- VS Code with the
rust-analyzerextension — autocompletion, error checking, refactoring. - IntelliJ IDEA with the Rust plugin — a powerful tool, but requires more resources.
- Vim/Neovim with coc-rust-analyzer — for console developers.
After installing the extension, open the project folder — rust-analyzer will automatically pick up the settings.
2. Writing Your First Rust Program
2.1. Creating a Project with Cargo
Let's create a new project:
cargo new hello_rustcd hello_rustThe cargo new command creates a folder with a Cargo.toml file (project manifest) and a src subfolder containing main.rs. Open src/main.rs — there is already a template:
fn main() { println!("Hello, world!");}Run the program:
cargo runYou will see Hello, world! in the console. Congratulations — you have just compiled and executed your first Rust program!
2.2. Breaking Down the Code Structure
fn main()— the entry point of the program. All Rust programs start with this function.println!— a macro for printing text to the console. The exclamation mark distinguishes a macro from a regular function.- The line ends with a semicolon — this is mandatory (except for expressions that return a value).
3. Core Rust Concepts: Variables, Types, and Memory Management
3.1. Variables and Immutability
In Rust, variables are immutable by default. This is not a bug, but a feature — the compiler guarantees that data won't be changed accidentally. To make a variable mutable, use the mut keyword:
fn main() { let x = 5; // immutable // x = 6; // ERROR: cannot assign twice to immutable va