mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-10 12:49:18 +00:00
Merge branch 'main' of https://github.com/blacktoast/rustlings into main
This commit is contained in:
commit
36b377587b
@ -6,12 +6,20 @@
|
||||
#[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 {
|
||||
fn call(&self) {
|
||||
println!("{:?}", &self);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fn main() {
|
||||
@ -21,7 +29,7 @@ fn main() {
|
||||
Message::ChangeColor(200, 255, 255),
|
||||
Message::Quit,
|
||||
];
|
||||
|
||||
|
||||
for message in &messages {
|
||||
message.call();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user