Rust Type-Driven Design
Enforces robust software architecture by leveraging Rust's type system to make invalid application states unrepresentable at compile-time.
The m05-type-driven skill is a specialized architectural guide for Rust developers looking to move validation from runtime to the compiler. It provides structured patterns for implementing Type States, Newtypes, PhantomData, and Marker Traits to encode complex invariants directly into the type system. By following these patterns, developers can eliminate 'primitive obsession' and boolean flag-based logic, resulting in self-documenting code that prevents bugs through structural constraints rather than manual error handling.
주요 기능
01Guidance on using PhantomData and Marker traits for static capability tracking
02Implementation of Type State patterns for compile-time state machine validation
03Builder pattern templates for safe and gradual object construction
04Sealed trait patterns to prevent external implementation of internal interfaces
05Newtype pattern generation to wrap primitives in semantic, domain-specific types
06596 GitHub stars
사용 사례
01Designing robust API interfaces that prevent incorrect usage by consumers
02Building zero-cost abstractions that enforce safety invariants without performance overhead
03Refactoring legacy code to replace runtime checks with compile-time type safety