Idioms & API Design
This map collects the Rust idioms and API-design notes for predictable, type-driven, edition 2024 library surfaces.
Concepts
Patterns
- Newtype Pattern
- Builder Pattern
- From and Into
- TryFrom and TryInto
- AsRef for Flexible Arguments
- Borrow for Equivalent Keys
- Sealed Traits
- Making Invalid States Unrepresentable
- Naming Conventions (Rust API Guidelines)
- Type-State Pattern
- Accepting impl Trait vs Generics
- Conversion Method Prefixes
- Constructor Naming
Antipatterns
Related Domains
Advanced Types & Features · Error Handling · Collections & Strings · Ownership & Memory · Cargo & Dependencies · Anti-patterns & Footguns
