mirror of
https://git.aramjonghu.dev/AramJonghu/rustlings.git
synced 2026-09-07 02:13:29 +02:00
@@ -10,6 +10,12 @@ enum Message {
|
||||
// TODO: define the different variants used below
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Point {
|
||||
x: u8,
|
||||
y: u8,
|
||||
}
|
||||
|
||||
impl Message {
|
||||
fn call(&self) {
|
||||
println!("{:?}", self);
|
||||
@@ -18,7 +24,8 @@ impl Message {
|
||||
|
||||
fn main() {
|
||||
let messages = [
|
||||
Message::Move { x: 10, y: 30 },
|
||||
Message::Resize { w: 10, h: 30 },
|
||||
Message::Move(Point { x: 10, y: 15 }),
|
||||
Message::Echo(String::from("hello world")),
|
||||
Message::ChangeColor(200, 255, 255),
|
||||
Message::Quit,
|
||||
|
||||
Reference in New Issue
Block a user