📜  rust 匹配枚举 - Rust 代码示例

📅  最后修改于: 2022-03-11 14:49:25.607000             🧑  作者: Mango

代码示例1
//suppose this was passed by the user and you stored in a variable
    let choice = Choice::One; 
    match choice {
        Choice::One => println!("Option 1"),
        Choice::Two => println!("Option 2"),
        Choice::Three => println!("Option 3"),
    }