Why this matters for Tauri
Tauri projects are still Rust projects. Before the framework, you need the basic Rust development loop: edit, format, check, run. Cargo is Rust’s package manager and build system; the official Cargo Book describes it as the tool that downloads dependencies, compiles packages, and makes distributable packages [Cargo Book]. Tauri’s setup also starts by installing Rust and system dependencies [Tauri prerequisites].
Your machine already has Rust available in this workspace: rustc 1.94.0 and cargo 1.94.0.
The project loop
cargo new hello-cargo --bin
cd hello-cargo
cargo run
cargo check
cargo fmt
cargo run compiles and executes. cargo check is the fast “is this valid Rust?” command you will use constantly. cargo fmt standardizes style so you do not waste taste on formatting.
I created a small exercise project for you here:
rust-tauri-sprint/exercises/hello-cargo
Skill: read a compiler error without panic
Open rust-tauri-sprint/exercises/hello-cargo/src/main.rs. It currently contains:
fn main() {
let app_name = "tiny-tauri-helper";
let mut command_count = 1;
println!("{app_name} has {command_count} command ready");
command_count = command_count + 1;
println!("after adding one: {command_count}");
}
Now deliberately break it:
- Change
let mut command_count = 1;tolet command_count = 1;. - Run
cargo checkinside the exercise folder. - Find the compiler’s suggested fix.
- Restore
mut, then runcargo run.
The rule
In Rust, let x = ... creates an immutable binding. If you want to assign a new value to the same binding, you must write let mut x = .... The Rust Book introduces this early because it shapes how Rust code communicates intent [Rust Book: Variables and Mutability].
| Rust | Read it as |
|---|---|
let count = 1; | This name should not be reassigned. |
let mut count = 1; | This name may be reassigned. |
count = count + 1; | This requires the binding to be mutable. |
Go comparison, but only once
Go default
count := 1
count = count + 1
Reassignment is ordinary unless the variable is not addressable or otherwise constrained.
Rust default
let mut count = 1;
count = count + 1;
Reassignment is opt-in at the binding site.
Retrieval check
Which command gives fast compiler feedback without running the program?
Which binding allows reassignment?
Your sprint task
- Run the deliberate
muterror. - Paste the key compiler line back to the agent.
- In one sentence, explain why Rust rejected the code.
Primary reading: The Rust Book, Chapter 3.1: Variables and Mutability. Ask follow-up questions whenever the compiler wording feels dense.
Next lesson preview
Next: ownership. We will make a value move, watch Rust reject a use-after-move, and connect that to why Tauri command boundaries often prefer borrowed input and owned output.