
Strict Types: Rust Enums and Contracts That Hold
··2475 words·12 mins
I use Rust enums to put the allowed values in the type, then let exhaustive match expressions tell me what I forgot. The same obsession follows me into generated clients, API contracts and database schemas: declare the set once, and make the rest of the code answer to it.