1 #[derive(Debug, Copy, Clone, PartialEq, Eq)] 2 pub enum Syntax { 3 PROTO2, 4 PROTO3, 5 } 6 7 impl Syntax { parse(s: &str) -> Self8 pub fn parse(s: &str) -> Self { 9 match s { 10 "" | "proto2" => Syntax::PROTO2, 11 "proto3" => Syntax::PROTO3, 12 _ => panic!("unsupported syntax value: {:?}", s), 13 } 14 } 15 } 16