A Type Stronger than the Sum of its Components

· Richard Schneeman · Sept. 24, 2026, 8:17 p.m.
Summary
Have you ever written a type that you appreciated so much you still think about it? Like eating a really good meal, where if you try hard enough, you can still recall the taste in your mouth. I had a mini moment of Rust joy the other day and wanted to share the experience. TLDR: I turned an enum with N variants into N types. Nothing earth-shattering, but it made my life better. Specifically, std::path::Component is an enum that you can get from any std::path::Path reference. Where a path can be ...