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

Will this compile, and why?

trait Animal { fn name(&self) -> String; fn legs() -> u32; // no self } fn describe(a: &dyn Animal) -> String { a.name() }