- 1. Introduction
❱
- 1.1. Translations
- 2. Idioms
❱
- 2.1. Use borrowed types for arguments
- 2.2. Concatenating Strings with format!
- 2.3. Constructor
- 2.4. The Default Trait
- 2.5. Collections Are Smart Pointers
- 2.6. Finalisation in Destructors
- 2.7. mem::{take(_), replace(_)}
- 2.8. On-Stack Dynamic Dispatch
- 2.9. Foreign function interface (FFI)
❱
- 2.9.1. Idiomatic Errors
- 2.9.2. Accepting Strings
- 2.9.3. Passing Strings
- 2.10. Iterating over an Option
- 2.11. Pass Variables to Closure
- 2.12. Privacy For Extensibility
- 2.13. Easy doc initialization
- 2.14. Temporary mutability
- 2.15. Return consumed arg on error
- 3. Design Patterns
❱
- 3.1. Behavioural
❱
- 3.1.1. Command
- 3.1.2. Interpreter
- 3.1.3. Newtype
- 3.1.4. RAII Guards
- 3.1.5. Strategy
- 3.1.6. Visitor
- 3.2. Creational
❱
- 3.2.1. Builder
- 3.2.2. Fold
- 3.3. Structural
❱
- 3.3.1. Compose Structs
- 3.3.2. Prefer Small Crates
- 3.3.3. Contain unsafety in small modules
- 3.3.4. Avoid complex type bounds with custom traits
- 3.4. Foreign function interface (FFI)
❱
- 3.4.1. Object-Based APIs
- 3.4.2. Type Consolidation into Wrappers
- 4. Anti-patterns
❱
- 4.1. Clone to satisfy the borrow checker
- 4.2. #[deny(warnings)]
- 4.3. Deref Polymorphism
- 5. Functional Programming
❱
- 5.1. Programming paradigms
- 5.2. Generics as Type Classes
- 5.3. Functional Optics
- 6. Additional Resources
❱
- 6.1. Design principles