Rust Lesson 1: Install Rust and Cargo

Rust Lesson 1: Install Rust and Cargo featured illustration

πŸ“Ž This article includes 1 downloadable practice file ↓

⏱ 1 min read

πŸ“˜ Rust Beginner Course Β· Lesson 1 of 6

Advertisement
  1. Install from rustup.rs (on Windows it may ask for Visual Studio Build Tools).
  2. cargo new sales_tool then cd sales_tool.
  3. Replace src/main.rs with the lesson file and run cargo run.
fn main() {
    let customer = "Sharma Traders";
    let qty: u32 = 12;
    println!("{customer}: {qty} units");
}

Cargo builds, runs, tests and manages dependencies (crates) listed in Cargo.toml.

πŸ’‘ Install the rust-analyzer extension in VS Code for inline types and errors as you type.

Code for this course follows standard, current syntax; we test JavaScript and PowerShell scripts before publishing, and R/Java/Rust examples are kept to core language features. Tell us if anything fails on your setup.

Practice

Create a project and run the lesson file as src/main.rs.

Advertisement

πŸ“Ž Practice files for this article

Free to use for learning. Files with macros (.bas) are plain text β€” import them with Alt+F11 β†’ File β†’ Import File, and always test on a copy.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free Β· AI can be wrong

Leave a Comment