mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-09 20:29:18 +00:00
add the enum variants
This commit is contained in:
parent
3a5aa2baf5
commit
435d485978
@ -6,6 +6,10 @@
|
||||
#[derive(Debug)]
|
||||
enum Message {
|
||||
// TODO: define the different variants used below
|
||||
Move,
|
||||
Echo,
|
||||
ChangeColor,
|
||||
Quit,
|
||||
}
|
||||
|
||||
impl Message {
|
||||
@ -17,7 +21,7 @@ impl Message {
|
||||
fn main() {
|
||||
let messages = [
|
||||
Message::Move { x: 10, y: 30 },
|
||||
Message::Echo(String::from("hello world")),
|
||||
Message::Echo(String::from("hello world")),
|
||||
Message::ChangeColor(200, 255, 255),
|
||||
Message::Quit,
|
||||
];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user