From c328bd6f5ec603868978245de38d78b923e496c4 Mon Sep 17 00:00:00 2001
From: Emre AYDIN <aeaydin1@gmail.com>
Date: Tue, 5 Jan 2021 17:07:42 +0300
Subject: [PATCH] Enum exercises complete

---
 exercises/enums/enums1.rs |  6 ++++--
 exercises/enums/enums2.rs |  6 ++++--
 exercises/enums/enums3.rs | 12 ++++++++++--
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/exercises/enums/enums1.rs b/exercises/enums/enums1.rs
index a2223d3..2baa8f2 100644
--- a/exercises/enums/enums1.rs
+++ b/exercises/enums/enums1.rs
@@ -1,11 +1,13 @@
 // enums1.rs
 // Make me compile! Execute `rustlings hint enums1` for hints!
 
-// I AM NOT DONE
-
 #[derive(Debug)]
 enum Message {
     // TODO: define a few types of messages as used below
+    Quit,
+    Echo,
+    Move,
+    ChangeColor,
 }
 
 fn main() {
diff --git a/exercises/enums/enums2.rs b/exercises/enums/enums2.rs
index ec32d95..adc25a8 100644
--- a/exercises/enums/enums2.rs
+++ b/exercises/enums/enums2.rs
@@ -1,11 +1,13 @@
 // enums2.rs
 // Make me compile! Execute `rustlings hint enums2` for hints!
 
-// I AM NOT DONE
-
 #[derive(Debug)]
 enum Message {
     // TODO: define the different variants used below
+    Move { x: i32, y: i32 },
+    Echo(String),
+    ChangeColor(i32, i32, i32),
+    Quit,
 }
 
 impl Message {
diff --git a/exercises/enums/enums3.rs b/exercises/enums/enums3.rs
index 178b40c..bc04472 100644
--- a/exercises/enums/enums3.rs
+++ b/exercises/enums/enums3.rs
@@ -1,10 +1,12 @@
 // enums3.rs
 // Address all the TODOs to make the tests pass!
 
-// I AM NOT DONE
-
 enum Message {
     // TODO: implement the message variant types based on their usage below
+    Move(Point),
+    Echo(String),
+    ChangeColor((u8, u8, u8)),
+    Quit,
 }
 
 struct Point {
@@ -37,6 +39,12 @@ impl State {
 
     fn process(&mut self, message: Message) {
         // TODO: create a match expression to process the different message variants
+        match message {
+            Message::Move(point) => self.move_position(point),
+            Message::ChangeColor(color) => self.change_color(color),
+            Message::Quit => self.quit(),
+            Message::Echo(s) => self.echo(s),
+        };
     }
 }