The Power of the "Where" Clause
summary
Explains exactly what a where clause can express: use Debug bound to make one print function compile for Point and Square, show that monomorphization generates separate functions per type, use associated type bounds to restrict Iterator::Item, require Send + 'static so a spawned thread safely takes ownership, build a trait-based state-machine traits system that forbids illegal transitions, and implement a storage trait where only declared models are queryable — examples compile and demonstrate refactor and API-evolution patterns.
AI-written summary · about
chapters (14)
- 0:00Introduction
- 1:41The Where Clause
- 7:31Constraints
- 9:43Thread API
- 17:16Generic code
- 18:10Finding the right level
- 18:53Advanced examples
- 19:31Traits
- 20:16State Machines
- 20:46Transition to Loop
- 22:19Database Query
- 22:53The Problem
- 23:50Example
- 25:19Conclusion
related talks
15mSupercharging Your Code With Five Little-Known Attributes
36mThe language that isn't
01h 01mthe Concepts of concepts
16mWeird Expressions and Where to Find Them
25mType System Tips for the Real World
01h 27mDeclarative thinking, declarative practice
54mSubtyping in Rust and Clarke's Third Law
01h 01mEmbracing PODs Safely Until They Die
