pub trait Draw { fn draw(&self); } pub struct Screen { pub components: Vec>, } impl Screen { pub fn run(&self) { for component in self.components.iter() { component.draw(); } } } pub struct Button { pub width: u32, pub height: u32, pub label: String, } impl Draw for Button { fn draw(&self) { dbg!("drew button"); } } pub struct SelectBox { pub width: u32, pub height: u32, pub options: Vec, } impl Draw for SelectBox { fn draw(&self) { dbg!("drew select box"); } }