Chih-Hung Hsieh | 92ff605 | 2020-06-10 20:18:39 -0700 | [diff] [blame] | 1 | #[derive(Debug, Copy, Clone, PartialEq, Eq)] |
2 | pub enum Syntax { | ||||
3 | PROTO2, | ||||
4 | PROTO3, | ||||
5 | } | ||||
6 | |||||
7 | impl Syntax { | ||||
8 | 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 | } |