Rust

Rust in Practice #1 Project Design and clap: Structuring a Subcommand CLI
4 min read

Rust in Practice #1 Project Design and clap: Structuring a Subcommand CLI

An eight-part practice course that turns the grammar from the basics course into a real tool. We build loglens, an access-log analysis CLI. Why CLI tools are Rust's signature stage (single binary, startup speed), declaring subcommands (stats, top, errors) as one enum with clap's derive style, the auto-generated --help, and the design map for all eight parts.

Rust Basics #9 Lifetimes and Modules: When Lifetime Annotations Are Needed, Finishing with Crates
5 min read

Rust Basics #9 Lifetimes and Modules: When Lifetime Annotations Are Needed, Finishing with Crates

The final part of the basics course. How Part 4's dangling-reference blocking actually worked, explained through lifetimes: the moment missing lifetime specifier appears, what the annotation really means (declaring a relationship, not extending a life), and why it is usually elided. Then the module system with mod and pub, using external crates from crates.io, and the learning path after this course.

Rust Basics #8 Traits and Generics: Shared Behavior in a Language Without Inheritance
4 min read

Rust Basics #8 Traits and Generics: Shared Behavior in a Language Without Inheritance

The part that settles the IOUs. Traits as definitions of shared behavior with default implementations, generics with trait bounds, the standard traits derive generates for you (Debug, Clone, Copy, PartialEq), monomorphization — why generics compile down to zero runtime cost — and the dynamic dispatch behind the dyn in Box<dyn Error>.

Rust Basics #7 Collections and Iterators: Vec, String, HashMap, and Chains Instead of for
4 min read

Rust Basics #7 Collections and Iterators: Vec, String, HashMap, and Chains Instead of for

The three collections that make up the body of practical code. Vec and why get is used instead of indexing, why String cannot be indexed at all (UTF-8 and the difference between bytes and characters), HashMap and the entry API, and the iterator style — map, filter, collect chains with lazy evaluation — that replaces for loops.

Rust Basics #6 Error Handling: Result, the ? Operator, and the Boundary Between panic and unwrap
5 min read

Rust Basics #6 Error Handling: Result, the ? Operator, and the Boundary Between panic and unwrap

Error handling in a language with no exceptions. Result, which puts the possibility of failure into the return type; the ? operator that collapses nested match blocks into one character and propagates errors; the practical form where main returns a Result; and the judgment calls for when unwrap, expect, and panic are acceptable and when they are not.

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.