Skip to content
Paladin spell

Rust

Ranks 1-3

The paladin's Divine Shield: systems speed behind a ward of memory safety. The compiler refuses the programs that would corrupt themselves. The discipline is the feature.

Wears the Classic spell Divine Shield.

Coming from Python: Control flow and functions arrive with you. The new school is ownership: every value has exactly one owner, borrowing is temporary and checked, and the compiler explains itself in surprisingly human messages.

Advertisement

Summoning the language

Rank 1

First summoning

cargo new hello && cargo run: the toolchain is one command from install to binary. Variables are permanent by default; mut opts in on purpose. The exclamation mark on the print macro is the first honest sign this language reads carefully.

fn main() {
    let mut casts = 0;
    for _ in 0..3 {
        casts += 1;
    }
    println!("cast x{casts}");
}
Rank 2

The temper

Meet ownership with a vector of spells: borrowing a reference lets you read without taking, and match forces you to handle every case. When the borrow checker refuses you, it is describing a real bug you have not had yet.

let spells = vec!["fireball", "frostbolt"];
let first = &spells[0];
match first {
    "fireball" => println!("burn"),
    _ => println!("chill"),
}
Rank 3

First real chore

Work through the official book (free, online, genuinely good) with cargo clippy watching, then rewrite one small Python CLI in Rust. Expect the compiler to fight you for a week and then, abruptly, to start being right.

$ cargo new habit-tracker
$ cargo clippy   # the strict tutor speaks
$ cargo build --release  # one fast binary
Back to the grimoireThe Programmer's GrimoirePython, the eight ranks, and every second spell.