blob: 63a8907d3673dd89f1b2d8f5fb5c805909af08e9 [file] [log] [blame]
pub trait Draw {
fn draw(&self);
}
// ANCHOR: here
pub struct Screen<T: Draw> {
pub components: Vec<T>,
}
impl<T> Screen<T>
where
T: Draw,
{
pub fn run(&self) {
for component in self.components.iter() {
component.draw();
}
}
}
// ANCHOR_END: here