Rust newtypes make wrong states unrepresentable at compile time, for free
A single-field wrapper struct catches unit-mixing bugs and type confusion without adding a single byte of overhead.
Pass a user ID to a function that expects an order ID, and Rust will not complain. Both are . The compiler sees identical types, so it cannot help you. You…