Binary Musings

Welcome! Musings on technology, learning actively, and thinking independently in the age of AI.

Rust Type System & Generics: Complete Guide to Polymorphism

Dive deep into Rust’s powerful type system and generic programming. Learn about strong typing vs weak typing, static vs dynamic type checking, type inference rules, and how to build generic data structures and functions. Explore parametric polymorphism, monomorphization, lifetime constraints, and best practices for writing flexible, reusable Rust code.

August 31, 2025 · 16 min · Garry Chen

Rust Memory Management: Value Lifecycle & Drop Trait

Follow a value’s complete journey in Rust memory management: from creation with optimal struct layouts, through usage with Copy/Move semantics, to destruction with the Drop trait. Learn memory layouts, alignment rules, and automatic resource cleanup in this comprehensive deep dive.

August 24, 2025 · 13 min · Garry Chen

Rust Lifetimes: 'static, Annotations and Elision Rules

Learn how Rust models lifetimes for stack and heap, and how the compiler enforces constraints across function calls. Walk through ‘static vs dynamic lifetimes, lifetime parameters and elision rules, fixing the classic max example, a strtok exercise, and annotating structs—plus when to annotate vs rely on inference.

August 17, 2025 · 11 min · Garry Chen

Rust Rc, Arc, RefCell: Shared Ownership & Concurrency

Master Rust’s shared ownership and runtime checks. Use Rc/Arc for multiple owners, RefCell for interior mutability, and Mutex/RwLock for thread-safe state. Includes a DAG example and a clear look at Box::leak, plus when to prefer static checks vs dynamic checks.

August 11, 2025 · 11 min · Garry Chen

Rust Borrowing & References: Lifetimes and Borrow Checker

Hands-on guide to Rust borrowing. See how pass-by-value differs from explicit references, when to use read-only vs mutable borrows, and why borrows can’t outlive owners. Includes address demos, lifetimes, and practical fixes for borrow checker errors.

August 9, 2025 · 11 min · Garry Chen