4 extra exos

This commit is contained in:
Script_Kitty 2024-03-03 12:15:18 +00:00
parent bc75421cda
commit 9a66482902
4 changed files with 13 additions and 10 deletions

View File

@ -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() {

View File

@ -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();

View File

@ -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...
}
}

View File

@ -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!")));