Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumRustBox<dyn Trait> dynamic dispatchSingle-choice MCQ

Why does the vector declaration fail, and what is the standard fix?

trait Shape { fn area(&self) -> f64; } struct Circle; struct Square; // ... impls for both ... let shapes = vec![Circle, Square];