generic types, traits and lifetimes

- get claude to create rustlings style exercises based on chapter 10 of the book
- update CLAUDE.md to prevent it from producing incorrect exercises
- complete exercises/01-generic-cache-system
This commit is contained in:
2026-01-22 11:58:33 +00:00
parent f55039411e
commit 02fbf819e4
14 changed files with 567 additions and 0 deletions

View File

@@ -35,6 +35,31 @@
**Stretch goal:** [Optional extension]
```
### Exercise Validation (CRITICAL)
**BEFORE providing any exercise, I MUST:**
1. **Mental trace-through** - Mentally implement the solution to verify it's solvable
2. **Signature verification** - Check all function signatures are correct for the requirements
3. **Trait bound validation** - Ensure trait bounds match what the implementation actually needs
4. **Test compatibility** - Verify the test cases will work with correct implementations
5. **Compilation check** - Ensure starter code compiles (even with todo!() placeholders)
### File Structure (REQUIRED - Rustlings Style)
**README.md contains:**
- 2-3 sentence concept explanation (like Rustlings)
- What you'll practice (bullet points)
- Links to relevant documentation
- KEEP IT MINIMAL - no dense walls of text
- NO starter code templates or expected output
**Code files contain:**
- ONLY clean starter code with correct function signatures
- ONLY necessary imports and trait bounds
- ONLY test functions using #[cfg(test)] for verification
- Minimal TODO comments explaining what to implement
- NO explanations or tutorials in comments
**Rustlings principle:** Minimal README, focus on code. Student learns by making tests pass.
### Exercise Types Per Milestone
- 2 general exercises (core programming concepts)
- 1 crypto-specific exercise (domain building)
@@ -76,6 +101,8 @@
## Learning Constraints to Respect
- Student quits when frustrated - keep exercises achievable
- **Incorrect exercise design destroys confidence - ALWAYS validate before providing**
- **Unsolvable exercises are worse than no exercises - verify signatures and bounds**
- Avoid "copy-paste progress" - ensure understanding
- Exercises must be tightly coupled to building (not random drills)
- Prefer modifying existing code over starting from scratch