#Rust

17 posts

Rust Basics #5 Structs and Enums: match, Option, and Designing Without null
4 min read

Rust Basics #5 Structs and Enums: match, Option, and Designing Without null

The two axes of structuring data: structs and enums. Attaching methods with impl blocks, the expressiveness of Rust enums whose variants carry different data, match with compiler-enforced exhaustiveness, and Option — the type that expresses "there may be no value" instead of null. The tools that form the skeleton of Rust code.

Rust Basics #4 References and Borrowing: & and &mut, Solving Borrow-Rule Compile Errors
5 min read

Rust Basics #4 References and Borrowing: & and &mut, Solving Borrow-Rule Compile Errors

References (&) and mutable references (&mut) — using a value without moving ownership. What the borrow rule "any number of shared references, or exactly one mutable reference" actually prevents (mutation during iteration, data races), how to read and fix the cannot borrow as mutable error, how dangling references get blocked at compile time, and finally &str and slices.

Rust Basics #3 Ownership: Move by Default, and How Memory Is Freed Without a GC
5 min read

Rust Basics #3 Ownership: Move by Default, and How Memory Is Freed Without a GC

Head-on with the heart of Rust: ownership. The three rules that give every value exactly one owner, why a value moves on assignment or a function call and the original variable becomes unusable, the Copy privilege reserved for fixed-size stack types, clone as a copy whose cost is visible in the code, and drop at the end of scope — the structure that turns use-after-free into a compile error.

Rust Basics #2 Variables and Types: let and mut, Shadowing, Functions That End in Expressions
5 min read

Rust Basics #2 Variables and Types: let and mut, Shadowing, Functions That End in Expressions

Starting from what immutable-by-default let means and the explicit mut that opts out of it. Why shadowing — redeclaring the same name — is an everyday idiom, the scalar types (integers, floating point, bool, char) and overflow behavior, tuples and arrays, and the return rule where a single semicolon decides whether something is a statement or an expression.

Rust Basics #1 What Rust Is: Why Learn It, Installing rustup, First Steps with cargo
5 min read

Rust Basics #1 What Rust Is: Why Learn It, Installing rustup, First Steps with cargo

Starting from what "memory safety without GC" actually means — the reason Rust has spread so quickly from kernels to CLI tools. The difference from languages where safety and performance were a trade-off, the one-line rustup install, the basic cycle of creating and running a project with cargo, how to read your first compile error message, and a map of the whole course.