Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumRusttrait objects dyn vs genericsSingle-choice MCQ

Why does this generic function fail where the trait-object version would succeed?

fn collect_all<T: Draw>(items: Vec<T>) {} // caller: let shapes = vec![circle, square]; // different concrete types