mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-05-09 16:28:05 +08:00
18 lines
275 B
Rust
Executable File
18 lines
275 B
Rust
Executable File
pub trait Draw {
|
|
fn draw(&self);
|
|
}
|
|
|
|
pub struct Screen {
|
|
pub components: Vec<Box<dyn Draw>>,
|
|
}
|
|
|
|
// ANCHOR: here
|
|
impl Screen {
|
|
pub fn run(&self) {
|
|
for component in self.components.iter() {
|
|
component.draw();
|
|
}
|
|
}
|
|
}
|
|
// ANCHOR_END: here
|