一、定义枚举
enum Message {
Quit,
Move {x:i32,y:i32},
Write(String),
ChangeColor(i32,i32,i32),
}
fn main() {
let q = Message::Quit;
let m = Message::Move{x:12,y:24};
let w = Message::Write(String::from("Hello"));
let c = Message::ChangeColor(0,255,255);
}