enum Message { Quit, Move { x: i32, y: i32 }, Write(String), } impl Message { fn call(&self) { match self { Message::Quit => println!("Quit"), Message::Move { x, y } => println!("Move to x: {}, y: {}", x, y), Message::Write(text) => println!("Write: {}", text), } } } fn main() { let m = Message::Write(String::from("hello")); m.call(); }