Rust best practices Distilled from five Rust style and design guides, with a digest of each in . Where they disagree, this file says which to follow and why. 1. Mindset - Write Rust-shaped code. Don't port C++, Java, C#, or Python constructs one-to-one. Model errors with , resources with ownership and , polymorphism with traits and enums, and nullability with . Inheritance-flavored tricks ( to a "base" struct, / types, helpers) are smells. - Make invalid states unrepresentable. Push invariants into types: enums instead of bool flags and "must be X if Y" comments, newtypes for units and IDs, f…