feat: completed solutions

This commit is contained in:
2026-03-23 03:36:33 -04:00
parent 2279bea6f1
commit f568c094cb
65 changed files with 424 additions and 139 deletions
+5
View File
@@ -1,6 +1,11 @@
#[derive(Debug)]
enum Message {
// TODO: Define a few types of messages as used below.
Resize,
Move,
Echo,
ChangeColor,
Quit,
}
fn main() {
+5
View File
@@ -7,6 +7,11 @@ struct Point {
#[derive(Debug)]
enum Message {
// TODO: Define the different variants used below.
Resize { width: usize, height: usize },
Move(Point),
Echo(String),
ChangeColor(u8, u8, u8),
Quit,
}
impl Message {
+7
View File
@@ -46,6 +46,13 @@ impl State {
fn process(&mut self, message: Message) {
// TODO: Create a match expression to process the different message
// variants using the methods defined above.
match message {
Message::Resize { width, height } => self.resize(width, height),
Message::Move(point) => self.move_position(point),
Message::Echo(string) => self.echo(string),
Message::ChangeColor(red, green, blue) => self.change_color(red, green, blue),
Message::Quit => self.quit(),
}
}
}