1 2 3 4 5 6 7 8 9 10 11
struct BazInput { r#type: String, } pub fn do_something(input: BazInput) { match input.r#type.as_str() { "a" => println!("First value"), "b" => println!("Second value"), _ => panic!("Unknown type: {}", input.r#type), } }