mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-11 13:19:18 +00:00
enums done
This commit is contained in:
parent
8654e318a7
commit
ef264b86e4
@ -1,7 +1,6 @@
|
|||||||
// enums3.rs
|
// enums3.rs
|
||||||
// Address all the TODOs to make the tests pass!
|
// Address all the TODOs to make the tests pass!
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum Message {
|
enum Message {
|
||||||
// TODO: implement the message variant types based on their usage below
|
// TODO: implement the message variant types based on their usage below
|
||||||
@ -49,7 +48,9 @@ impl State {
|
|||||||
Message::ChangeColor((a,b,c))=>{
|
Message::ChangeColor((a,b,c))=>{
|
||||||
self.color=(a,b,c);
|
self.color=(a,b,c);
|
||||||
},
|
},
|
||||||
Message::Move(Point)=>(),
|
Message::Move(Point)=>{self.position=Point;},
|
||||||
|
Message::Echo(str)=>{println!("{}",str);},
|
||||||
|
Message::Quit=>{self.quit=true;},
|
||||||
_=>(),
|
_=>(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user