Import protobuf-codegen-2.14.0
* Add OWNERS, Android.bp, and README.android.
* Hard code version number in src/lib.rs for now.
It could be in a smarter update_package.sh to get the
new version number from Cargo.tom. But until then,
the difference in lib.rs will be caught and fixed manually.
* Rename protoc_gen_rust to protoc-gen-rust for aprotoc plugin.
Bug: 143953733
Test: make
Change-Id: I9b3c3b9f2e7ad0eb203c26534f2b6ba5fac46eef
diff --git a/src/syntax.rs b/src/syntax.rs
new file mode 100644
index 0000000..d075063
--- /dev/null
+++ b/src/syntax.rs
@@ -0,0 +1,15 @@
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
+pub enum Syntax {
+ PROTO2,
+ PROTO3,
+}
+
+impl Syntax {
+ pub fn parse(s: &str) -> Self {
+ match s {
+ "" | "proto2" => Syntax::PROTO2,
+ "proto3" => Syntax::PROTO3,
+ _ => panic!("unsupported syntax value: {:?}", s),
+ }
+ }
+}