You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Getting started with Rust is straightforward thanks to rustup, the official Rust toolchain installer. This lesson covers installation, your first program, and an introduction to Cargo.
The recommended way to install Rust is via rustup, which manages Rust versions and associated tools:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
After installation, verify:
rustc --version
cargo --version
| Component | Description |
|---|---|
| rustc | The Rust compiler |
| cargo | Build system and package manager |
| rustfmt | Code formatter |
| clippy | Linter |
| rust-docs | Offline documentation |
| rust-std | Standard library |
# Update Rust to the latest stable version
rustup update
# Install the nightly toolchain
rustup install nightly
# Set the default toolchain
rustup default stable
# Show installed toolchains
rustup show
Rust has three release channels: stable (every 6 weeks), beta, and nightly.
Create a file called main.rs:
fn main() {
println!("Hello, world!");
}
Compile and run it:
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.