Loading lesson…
Level 1 · Apprentice0 XP
Shared behaviour with traits, generic functions, and static versus dynamic dispatch.
Step 1 / 6
ProblemAn app can call a cloud model, a local model or a fake. The code that summarises should not care which.
← → step
Before this: Error handling with Result and ?
🛠️ Your turn
Reading is not the skill, doing is. Try for ten minutes before you open the hint. Getting stuck first is what makes the solution stick.
1.Define a Summariser trait with two implementations (a simple first-sentence one and a keyword one). Write a generic function and a Vec<Box<dyn Summariser>> version, and benchmark both with criterion.