From 9a6648290291a22315a79e05dbe120156bf6def0 Mon Sep 17 00:00:00 2001 From: Script_Kitty Date: Sun, 3 Mar 2024 12:15:18 +0000 Subject: [PATCH] 4 extra exos --- exercises/06_move_semantics/move_semantics4.rs | 2 +- exercises/06_move_semantics/move_semantics6.rs | 2 +- exercises/07_structs/structs3.rs | 4 ++-- exercises/08_enums/enums3.rs | 15 +++++++++------ 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/exercises/06_move_semantics/move_semantics4.rs b/exercises/06_move_semantics/move_semantics4.rs index c27a0f9c..b6bb16b0 100644 --- a/exercises/06_move_semantics/move_semantics4.rs +++ b/exercises/06_move_semantics/move_semantics4.rs @@ -7,7 +7,7 @@ // Execute `rustlings hint move_semantics4` or use the `hint` watch subcommand // for a hint. -// I AM NOT DONE + #[test] fn main() { diff --git a/exercises/06_move_semantics/move_semantics6.rs b/exercises/06_move_semantics/move_semantics6.rs index e3931422..7a2122e7 100644 --- a/exercises/06_move_semantics/move_semantics6.rs +++ b/exercises/06_move_semantics/move_semantics6.rs @@ -5,7 +5,7 @@ // Execute `rustlings hint move_semantics6` or use the `hint` watch subcommand // for a hint. -// I AM NOT DONE + fn main() { let data = "Rust is great!".to_string(); diff --git a/exercises/07_structs/structs3.rs b/exercises/07_structs/structs3.rs index 7cda5af1..005767b6 100644 --- a/exercises/07_structs/structs3.rs +++ b/exercises/07_structs/structs3.rs @@ -31,11 +31,11 @@ impl Package { } } - fn is_international(&self) -> ??? { + fn is_international(&self) -> u32 { // Something goes here... } - fn get_fees(&self, cents_per_gram: u32) -> ??? { + fn get_fees(&self, cents_per_gram: u32) -> u32 { // Something goes here... } } diff --git a/exercises/08_enums/enums3.rs b/exercises/08_enums/enums3.rs index 92d18c46..f7a695a0 100644 --- a/exercises/08_enums/enums3.rs +++ b/exercises/08_enums/enums3.rs @@ -5,10 +5,13 @@ // Execute `rustlings hint enums3` or use the `hint` watch subcommand for a // hint. -// I AM NOT DONE + enum Message { - // TODO: implement the message variant types based on their usage below + ChangeColor(i32, i32, i32), + Echo(String), + Move(Point), + Quit, } struct Point { @@ -54,10 +57,10 @@ mod tests { #[test] fn test_match_message_call() { let mut state = State { - quit: false, - position: Point { x: 0, y: 0 }, - color: (0, 0, 0), - message: "hello world".to_string(), + quit: true, + position: Point { x: 10, y: 15 }, + color: (255, 0, 255), + message: "Hello world!".to_string(), }; state.process(Message::ChangeColor(255, 0, 255)); state.process(Message::Echo(String::from("Hello world!")));