aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cargo_vcs_info.json5
-rw-r--r--Android.bp17
-rw-r--r--Cargo.toml42
-rw-r--r--Cargo.toml.orig28
l---------LICENSE1
-rw-r--r--LICENSE.txt19
-rw-r--r--METADATA19
-rw-r--r--MODULE_LICENSE_BSD_LIKE0
l---------NOTICE1
-rw-r--r--OWNERS1
-rw-r--r--README.md6
-rw-r--r--benches/coded_input_stream.rs104
-rw-r--r--benches/coded_output_stream.rs50
-rw-r--r--build.rs76
-rw-r--r--out/version.rs7
-rwxr-xr-xregenerate.sh66
-rw-r--r--src/any.rs114
-rw-r--r--src/buf_read_iter.rs516
-rw-r--r--src/cached_size.rs38
-rw-r--r--src/chars.rs96
-rw-r--r--src/clear.rs33
-rw-r--r--src/compiler_plugin.rs53
-rw-r--r--src/core.rs268
-rw-r--r--src/descriptor.rs9852
-rw-r--r--src/descriptorx.rs657
-rw-r--r--src/enums.rs32
-rw-r--r--src/error.rs151
-rw-r--r--src/ext.rs47
-rw-r--r--src/lazy.rs105
-rw-r--r--src/lib.rs126
-rw-r--r--src/misc.rs37
-rw-r--r--src/plugin.rs998
-rw-r--r--src/reflect/accessor.rs789
-rw-r--r--src/reflect/enums.rs127
-rw-r--r--src/reflect/field.rs191
-rw-r--r--src/reflect/find_message_or_enum.rs62
-rw-r--r--src/reflect/map.rs66
-rw-r--r--src/reflect/message.rs223
-rw-r--r--src/reflect/mod.rs27
-rw-r--r--src/reflect/optional.rs50
-rw-r--r--src/reflect/repeated.rs192
-rw-r--r--src/reflect/value.rs185
-rw-r--r--src/repeated.rs468
-rw-r--r--src/rt.rs933
-rw-r--r--src/rust.rs121
-rw-r--r--src/rustproto.rs200
-rw-r--r--src/singular.rs580
-rw-r--r--src/stream.rs1802
-rw-r--r--src/strx.rs34
-rw-r--r--src/text_format.rs328
-rw-r--r--src/types.rs685
-rw-r--r--src/unknown.rs325
-rw-r--r--src/varint.rs35
-rw-r--r--src/well_known_types/any.rs368
-rw-r--r--src/well_known_types/api.rs1296
-rw-r--r--src/well_known_types/duration.rs332
-rw-r--r--src/well_known_types/empty.rs217
-rw-r--r--src/well_known_types/field_mask.rs388
-rw-r--r--src/well_known_types/mod.rs26
-rw-r--r--src/well_known_types/source_context.rs258
-rw-r--r--src/well_known_types/struct_pb.rs1028
-rw-r--r--src/well_known_types/timestamp.rs335
-rw-r--r--src/well_known_types/type_pb.rs2254
-rw-r--r--src/well_known_types/wrappers.rs1597
-rw-r--r--src/zigzag.rs50
65 files changed, 29137 insertions, 0 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
new file mode 100644
index 0000000..d6337d5
--- /dev/null
+++ b/.cargo_vcs_info.json
@@ -0,0 +1,5 @@
+{
+ "git": {
+ "sha1": "09cb48471825c36fc5c8205f197eefbf664a10f7"
+ }
+}
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..e5bd1fa
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,17 @@
+// This file is generated by cargo2android.py --run --dependencies --features=bytes.
+
+rust_library_host_rlib {
+ name: "libprotobuf",
+ crate_name: "protobuf",
+ srcs: ["src/lib.rs"],
+ edition: "2015",
+ features: [
+ "bytes",
+ ],
+ rlibs: [
+ "libbytes",
+ ],
+}
+
+// dependent_library ["feature_list"]
+// bytes-0.5.4 "default,std"
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000..99a7f79
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,42 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
+[package]
+name = "protobuf"
+version = "2.14.0"
+authors = ["Stepan Koltsov <stepan.koltsov@gmail.com>"]
+description = "Rust implementation of Google protocol buffers\n"
+homepage = "https://github.com/stepancheg/rust-protobuf/"
+documentation = "https://github.com/stepancheg/rust-protobuf/blob/master/README.md"
+license = "MIT"
+repository = "https://github.com/stepancheg/rust-protobuf/"
+[package.metadata.docs.rs]
+all-features = true
+
+[lib]
+doctest = false
+bench = false
+[dependencies.bytes]
+version = "0.5"
+optional = true
+
+[dependencies.serde]
+version = "1.0"
+optional = true
+
+[dependencies.serde_derive]
+version = "1.0"
+optional = true
+
+[features]
+with-bytes = ["bytes"]
+with-serde = ["serde", "serde_derive"]
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
new file mode 100644
index 0000000..8f3b2b8
--- /dev/null
+++ b/Cargo.toml.orig
@@ -0,0 +1,28 @@
+[package]
+
+name = "protobuf"
+version = "2.14.0"
+authors = ["Stepan Koltsov <stepan.koltsov@gmail.com>"]
+license = "MIT"
+homepage = "https://github.com/stepancheg/rust-protobuf/"
+repository = "https://github.com/stepancheg/rust-protobuf/"
+documentation = "https://github.com/stepancheg/rust-protobuf/blob/master/README.md"
+description = """
+Rust implementation of Google protocol buffers
+"""
+
+[lib]
+doctest = false
+bench = false
+
+[features]
+with-bytes = ["bytes"]
+with-serde = ["serde", "serde_derive"]
+
+[dependencies]
+bytes = { version = "0.5", optional = true }
+serde = { version = "1.0", optional = true }
+serde_derive = { version = "1.0", optional = true }
+
+[package.metadata.docs.rs]
+all-features = true
diff --git a/LICENSE b/LICENSE
new file mode 120000
index 0000000..85de3d4
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1 @@
+LICENSE.txt \ No newline at end of file
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..acce639
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,19 @@
+Copyright (c) 2019 Stepan Koltsov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
+OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..50ef5ab
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,19 @@
+name: "protobuf"
+description: "Rust implementation of Google protocol buffers"
+third_party {
+ url {
+ type: HOMEPAGE
+ value: "https://crates.io/crates/protobuf"
+ }
+ url {
+ type: GIT
+ value: "https://github.com/stepancheg/rust-protobuf"
+ }
+ version: "2.14.0"
+ license_type: NOTICE
+ last_upgrade_date {
+ year: 2020
+ month: 6
+ day: 3
+ }
+}
diff --git a/MODULE_LICENSE_BSD_LIKE b/MODULE_LICENSE_BSD_LIKE
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_BSD_LIKE
diff --git a/NOTICE b/NOTICE
new file mode 120000
index 0000000..7a694c9
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1 @@
+LICENSE \ No newline at end of file
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..46fc303
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1 @@
+include platform/prebuilts/rust:/OWNERS
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..c16838b
--- /dev/null
+++ b/README.md
@@ -0,0 +1,6 @@
+## How to develop rust-protobuf itself
+
+`cargo test --all` to build everything.
+
+If code generator is changed, code needs to be regenerated, see
+`regenerate.sh`.
diff --git a/benches/coded_input_stream.rs b/benches/coded_input_stream.rs
new file mode 100644
index 0000000..ad78115
--- /dev/null
+++ b/benches/coded_input_stream.rs
@@ -0,0 +1,104 @@
+// `cargo test --benches` and `#[feature(test)]` work only in nightly
+#![cfg(rustc_nightly)]
+#![feature(test)]
+
+extern crate protobuf;
+extern crate test;
+
+use std::io;
+use std::io::Read;
+
+use protobuf::stream::CodedInputStream;
+
+use self::test::Bencher;
+
+fn make_bytes(len: usize) -> Vec<u8> {
+ let mut r = Vec::with_capacity(len);
+ for i in 0..len {
+ r.push((i % 10) as u8);
+ }
+ test::black_box(r)
+}
+
+#[bench]
+fn read_byte(b: &mut Bencher) {
+ let v = make_bytes(1_000);
+ b.iter(|| {
+ let mut is = CodedInputStream::from_bytes(test::black_box(&v));
+ while !is.eof().expect("eof") {
+ test::black_box(is.read_raw_byte().expect("read"));
+ }
+ });
+}
+
+#[bench]
+fn read_byte_no_eof(b: &mut Bencher) {
+ let v = make_bytes(1_000);
+ b.iter(|| {
+ let mut is = CodedInputStream::from_bytes(test::black_box(&v));
+ for _ in 0..v.len() {
+ test::black_box(is.read_raw_byte().expect("read"));
+ }
+ assert!(is.eof().expect("eof"));
+ });
+}
+
+#[bench]
+fn read_byte_from_vec(b: &mut Bencher) {
+ let v = make_bytes(1_000);
+ b.iter(|| {
+ let mut v = io::Cursor::new(test::black_box(&v));
+ loop {
+ let mut buf = [0];
+ let count = v.read(&mut buf).expect("read");
+ if count == 0 {
+ break;
+ }
+ test::black_box(buf);
+ }
+ });
+}
+
+#[bench]
+fn read_varint_12(b: &mut Bencher) {
+ let mut v = Vec::new();
+ {
+ let mut v = protobuf::CodedOutputStream::vec(&mut v);
+ for i in 0..1000 {
+ // one or two byte varints
+ v.write_raw_varint32((i * 7919) % (1 << 14)).expect("write");
+ }
+ v.flush().expect("flush");
+ }
+ b.iter(|| {
+ let mut is = CodedInputStream::from_bytes(test::black_box(&v));
+ let mut count = 0;
+ while !is.eof().expect("eof") {
+ test::black_box(is.read_raw_varint32().expect("read"));
+ count += 1;
+ }
+ assert_eq!(1000, count);
+ })
+}
+
+#[bench]
+fn read_varint_1(b: &mut Bencher) {
+ let mut v = Vec::new();
+ {
+ let mut v = protobuf::CodedOutputStream::vec(&mut v);
+ for i in 0..1000 {
+ // one or two byte varints
+ v.write_raw_varint32((i * 7919) % (1 << 7)).expect("write");
+ }
+ v.flush().expect("flush");
+ }
+ b.iter(|| {
+ let mut is = CodedInputStream::from_bytes(test::black_box(&v));
+ let mut count = 0;
+ while !is.eof().expect("eof") {
+ test::black_box(is.read_raw_varint32().expect("read"));
+ count += 1;
+ }
+ assert_eq!(1000, count);
+ })
+}
diff --git a/benches/coded_output_stream.rs b/benches/coded_output_stream.rs
new file mode 100644
index 0000000..438e980
--- /dev/null
+++ b/benches/coded_output_stream.rs
@@ -0,0 +1,50 @@
+// `cargo test --benches` and `#[feature(test)]` work only in nightly
+#![cfg(rustc_nightly)]
+#![feature(test)]
+
+extern crate protobuf;
+extern crate test;
+
+use protobuf::stream;
+
+use self::test::Bencher;
+
+#[inline]
+fn buffer_write_byte(os: &mut stream::CodedOutputStream) {
+ for i in 0..10 {
+ os.write_raw_byte(test::black_box(i as u8)).unwrap();
+ }
+ os.flush().unwrap();
+}
+
+#[inline]
+fn buffer_write_bytes(os: &mut stream::CodedOutputStream) {
+ for _ in 0..10 {
+ os.write_raw_bytes(test::black_box(b"1234567890")).unwrap();
+ }
+ os.flush().unwrap();
+}
+
+#[bench]
+fn bench_buffer(b: &mut Bencher) {
+ b.iter(|| {
+ let mut v = Vec::new();
+ {
+ let mut os = stream::CodedOutputStream::new(&mut v);
+ buffer_write_byte(&mut os);
+ }
+ v
+ });
+}
+
+#[bench]
+fn bench_buffer_bytes(b: &mut Bencher) {
+ b.iter(|| {
+ let mut v = Vec::new();
+ {
+ let mut os = stream::CodedOutputStream::new(&mut v);
+ buffer_write_bytes(&mut os);
+ }
+ v
+ });
+}
diff --git a/build.rs b/build.rs
new file mode 100644
index 0000000..b0b1010
--- /dev/null
+++ b/build.rs
@@ -0,0 +1,76 @@
+use std::env;
+use std::fs::File;
+use std::io::{Read, Write};
+use std::path::{Path, PathBuf};
+use std::process;
+
+// % rustc +stable --version
+// rustc 1.26.0 (a77568041 2018-05-07)
+// % rustc +beta --version
+// rustc 1.27.0-beta.1 (03fb2f447 2018-05-09)
+// % rustc +nightly --version
+// rustc 1.27.0-nightly (acd3871ba 2018-05-10)
+fn version_is_nightly(version: &str) -> bool {
+ version.contains("nightly")
+}
+
+fn main() {
+ let rustc = env::var("RUSTC").expect("RUSTC unset");
+
+ let mut child = process::Command::new(rustc)
+ .args(&["--version"])
+ .stdin(process::Stdio::null())
+ .stdout(process::Stdio::piped())
+ .spawn()
+ .expect("spawn rustc");
+
+ let mut rustc_version = String::new();
+
+ child
+ .stdout
+ .as_mut()
+ .expect("stdout")
+ .read_to_string(&mut rustc_version)
+ .expect("read_to_string");
+ assert!(child.wait().expect("wait").success());
+
+ if version_is_nightly(&rustc_version) {
+ println!("cargo:rustc-cfg=rustc_nightly");
+ }
+
+ write_version();
+}
+
+fn out_dir() -> PathBuf {
+ PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR"))
+}
+
+fn version() -> String {
+ env::var("CARGO_PKG_VERSION").expect("CARGO_PKG_VERSION")
+}
+
+fn write_version() {
+ let version = version();
+ let version_ident = format!(
+ "VERSION_{}",
+ version.replace(".", "_").replace("-", "_").to_uppercase()
+ );
+ let mut file = File::create(Path::join(&out_dir(), "version.rs")).expect("open");
+ writeln!(file, "/// protobuf crate version").unwrap();
+ writeln!(file, "pub const VERSION: &'static str = \"{}\";", version).unwrap();
+ writeln!(file, "/// This symbol is used by codegen").unwrap();
+ writeln!(file, "#[doc(hidden)]").unwrap();
+ writeln!(
+ file,
+ "pub const VERSION_IDENT: &'static str = \"{}\";",
+ version_ident
+ )
+ .unwrap();
+ writeln!(
+ file,
+ "/// This symbol can be referenced to assert that proper version of crate is used"
+ )
+ .unwrap();
+ writeln!(file, "pub const {}: () = ();", version_ident).unwrap();
+ file.flush().unwrap();
+}
diff --git a/out/version.rs b/out/version.rs
new file mode 100644
index 0000000..664b318
--- /dev/null
+++ b/out/version.rs
@@ -0,0 +1,7 @@
+/// protobuf crate version
+pub const VERSION: &'static str = "2.14.0";
+/// This symbol is used by codegen
+#[doc(hidden)]
+pub const VERSION_IDENT: &'static str = "VERSION_2_14_0";
+/// This symbol can be referenced to assert that proper version of crate is used
+pub const VERSION_2_14_0: () = ();
diff --git a/regenerate.sh b/regenerate.sh
new file mode 100755
index 0000000..a1e0dd9
--- /dev/null
+++ b/regenerate.sh
@@ -0,0 +1,66 @@
+#!/bin/sh -ex
+
+cd $(dirname $0)
+
+die() {
+ echo "$@" >&2
+ exit 1
+}
+
+protoc_ver=$(protoc --version)
+case "$protoc_ver" in
+ "libprotoc 3"*) ;;
+ *)
+ die "you need to use protobuf 3 to regenerate .rs from .proto"
+ ;;
+esac
+
+cargo build --manifest-path=../protobuf-codegen/Cargo.toml
+
+where_am_i=$(cd ..; pwd)
+
+rm -rf tmp-generated
+mkdir tmp-generated
+
+case `uname` in
+ Linux)
+ exe_suffix=""
+ ;;
+ MSYS_NT*)
+ exe_suffix=".exe"
+ ;;
+esac
+
+protoc \
+ --plugin=protoc-gen-rust="$where_am_i/target/debug/protoc-gen-rust$exe_suffix" \
+ --rust_out tmp-generated \
+ --rust_opt 'serde_derive=true inside_protobuf=true' \
+ -I../proto \
+ ../proto/google/protobuf/*.proto \
+ ../proto/google/protobuf/compiler/* \
+ ../proto/rustproto.proto
+
+mv tmp-generated/descriptor.rs tmp-generated/plugin.rs tmp-generated/rustproto.rs src/
+mv tmp-generated/*.rs src/well_known_types/
+(
+ cd src/well_known_types
+ exec > mod.rs
+ echo "// This file is generated. Do not edit"
+ echo '//! Generated code for "well known types"'
+ echo "//!"
+ echo "//! [This document](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) describes these types."
+
+ mod_list() {
+ ls | grep -v mod.rs | sed -e 's,\.rs$,,'
+ }
+
+ echo
+ mod_list | sed -e 's,^,mod ,; s,$,;,'
+
+ echo
+ mod_list | while read mod; do
+ echo "pub use self::$mod::*;"
+ done
+)
+
+# vim: set ts=4 sw=4 et:
diff --git a/src/any.rs b/src/any.rs
new file mode 100644
index 0000000..31ddd82
--- /dev/null
+++ b/src/any.rs
@@ -0,0 +1,114 @@
+use crate::parse_from_bytes;
+use crate::reflect::MessageDescriptor;
+use crate::well_known_types::Any;
+use crate::Message;
+use crate::ProtobufResult;
+
+impl Any {
+ fn type_url(type_url_prefix: &str, descriptor: &MessageDescriptor) -> String {
+ format!("{}/{}", type_url_prefix, descriptor.full_name())
+ }
+
+ fn get_type_name_from_type_url(type_url: &str) -> Option<&str> {
+ match type_url.rfind('/') {
+ Some(i) => Some(&type_url[i + 1..]),
+ None => None,
+ }
+ }
+
+ /// Pack any message into `well_known_types::Any` value.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// # use protobuf::Message;
+ /// # use protobuf::ProtobufResult;
+ /// use protobuf::well_known_types::Any;
+ ///
+ /// # fn the_test<MyMessage: Message>(message: &MyMessage) -> ProtobufResult<()> {
+ /// let message: &MyMessage = message;
+ /// let any = Any::pack(message)?;
+ /// assert!(any.is::<MyMessage>());
+ /// # Ok(())
+ /// # }
+ /// ```
+ pub fn pack<M: Message>(message: &M) -> ProtobufResult<Any> {
+ Any::pack_dyn(message)
+ }
+
+ /// Pack any message into `well_known_types::Any` value.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// use protobuf::Message;
+ /// # use protobuf::ProtobufResult;
+ /// use protobuf::well_known_types::Any;
+ ///
+ /// # fn the_test(message: &dyn Message) -> ProtobufResult<()> {
+ /// let message: &dyn Message = message;
+ /// let any = Any::pack_dyn(message)?;
+ /// assert!(any.is_dyn(message.descriptor()));
+ /// # Ok(())
+ /// # }
+ /// ```
+ pub fn pack_dyn(message: &dyn Message) -> ProtobufResult<Any> {
+ Any::pack_with_type_url_prefix(message, "type.googleapis.com")
+ }
+
+ fn pack_with_type_url_prefix(
+ message: &dyn Message,
+ type_url_prefix: &str,
+ ) -> ProtobufResult<Any> {
+ Ok(Any {
+ type_url: Any::type_url(type_url_prefix, message.descriptor()),
+ value: message.write_to_bytes()?,
+ ..Default::default()
+ })
+ }
+
+ /// Check if `Any` contains a message of given type.
+ pub fn is<M: Message>(&self) -> bool {
+ self.is_dyn(M::descriptor_static())
+ }
+
+ /// Check if `Any` contains a message of given type.
+ pub fn is_dyn(&self, descriptor: &MessageDescriptor) -> bool {
+ match Any::get_type_name_from_type_url(&self.type_url) {
+ Some(type_name) => type_name == descriptor.full_name(),
+ None => false,
+ }
+ }
+
+ /// Extract a message from this `Any`.
+ ///
+ /// # Returns
+ ///
+ /// * `Ok(None)` when message type mismatch
+ /// * `Err` when parse failed
+ pub fn unpack<M: Message>(&self) -> ProtobufResult<Option<M>> {
+ if !self.is::<M>() {
+ return Ok(None);
+ }
+ Ok(Some(parse_from_bytes(&self.value)?))
+ }
+
+ /// Extract a message from this `Any`.
+ ///
+ /// # Returns
+ ///
+ /// * `Ok(None)` when message type mismatch
+ /// * `Err` when parse failed
+ pub fn unpack_dyn(
+ &self,
+ descriptor: &MessageDescriptor,
+ ) -> ProtobufResult<Option<Box<dyn Message>>> {
+ if !self.is_dyn(descriptor) {
+ return Ok(None);
+ }
+ let mut message = descriptor.new_instance();
+ message.merge_from_bytes(&self.value)?;
+ message.check_initialized()?;
+ Ok(Some(message))
+ }
+}
diff --git a/src/buf_read_iter.rs b/src/buf_read_iter.rs
new file mode 100644
index 0000000..318185d
--- /dev/null
+++ b/src/buf_read_iter.rs
@@ -0,0 +1,516 @@
+use std::cmp;
+use std::io::BufRead;
+use std::io::BufReader;
+use std::io::Read;
+use std::mem;
+use std::u64;
+
+#[cfg(feature = "bytes")]
+use bytes::BufMut;
+#[cfg(feature = "bytes")]
+use bytes::Bytes;
+#[cfg(feature = "bytes")]
+use bytes::BytesMut;
+
+use error::WireError;
+use stream::READ_RAW_BYTES_MAX_ALLOC;
+use ProtobufError;
+use ProtobufResult;
+
+use std::mem::MaybeUninit;
+
+// If an input stream is constructed with a `Read`, we create a
+// `BufReader` with an internal buffer of this size.
+const INPUT_STREAM_BUFFER_SIZE: usize = 4096;
+
+const USE_UNSAFE_FOR_SPEED: bool = true;
+
+const NO_LIMIT: u64 = u64::MAX;
+
+/// Hold all possible combinations of input source
+enum InputSource<'a> {
+ BufRead(&'a mut BufRead),
+ Read(BufReader<&'a mut Read>),
+ Slice(&'a [u8]),
+ #[cfg(feature = "bytes")]
+ Bytes(&'a Bytes),
+}
+
+/// Dangerous implementation of `BufRead`.
+///
+/// Unsafe wrapper around BufRead which assumes that `BufRead` buf is
+/// not moved when `BufRead` is moved.
+///
+/// This assumption is generally incorrect, however, in practice
+/// `BufReadIter` is created either from `BufRead` reference (which
+/// cannot be moved, because it is locked by `CodedInputStream`) or from
+/// `BufReader` which does not move its buffer (we know that from
+/// inspecting rust standard library).
+///
+/// It is important for `CodedInputStream` performance that small reads
+/// (e. g. 4 bytes reads) do not involve virtual calls or switches.
+/// This is achievable with `BufReadIter`.
+pub struct BufReadIter<'a> {
+ input_source: InputSource<'a>,
+ buf: &'a [u8],
+ pos_within_buf: usize,
+ limit_within_buf: usize,
+ pos_of_buf_start: u64,
+ limit: u64,
+}
+
+impl<'a> Drop for BufReadIter<'a> {
+ fn drop(&mut self) {
+ match self.input_source {
+ InputSource::BufRead(ref mut buf_read) => buf_read.consume(self.pos_within_buf),
+ InputSource::Read(_) => {
+ // Nothing to flush, because we own BufReader
+ }
+ _ => {}
+ }
+ }
+}
+
+impl<'ignore> BufReadIter<'ignore> {
+ pub fn from_read<'a>(read: &'a mut dyn Read) -> BufReadIter<'a> {
+ BufReadIter {
+ input_source: InputSource::Read(BufReader::with_capacity(
+ INPUT_STREAM_BUFFER_SIZE,
+ read,
+ )),
+ buf: &[],
+ pos_within_buf: 0,
+ limit_within_buf: 0,
+ pos_of_buf_start: 0,
+ limit: NO_LIMIT,
+ }
+ }
+
+ pub fn from_buf_read<'a>(buf_read: &'a mut dyn BufRead) -> BufReadIter<'a> {
+ BufReadIter {
+ input_source: InputSource::BufRead(buf_read),
+ buf: &[],
+ pos_within_buf: 0,
+ limit_within_buf: 0,
+ pos_of_buf_start: 0,
+ limit: NO_LIMIT,
+ }
+ }
+
+ pub fn from_byte_slice<'a>(bytes: &'a [u8]) -> BufReadIter<'a> {
+ BufReadIter {
+ input_source: InputSource::Slice(bytes),
+ buf: bytes,
+ pos_within_buf: 0,
+ limit_within_buf: bytes.len(),
+ pos_of_buf_start: 0,
+ limit: NO_LIMIT,
+ }
+ }
+
+ #[cfg(feature = "bytes")]
+ pub fn from_bytes<'a>(bytes: &'a Bytes) -> BufReadIter<'a> {
+ BufReadIter {
+ input_source: InputSource::Bytes(bytes),
+ buf: &bytes,
+ pos_within_buf: 0,
+ limit_within_buf: bytes.len(),
+ pos_of_buf_start: 0,
+ limit: NO_LIMIT,
+ }
+ }
+
+ #[inline]
+ fn assertions(&self) {
+ debug_assert!(self.pos_within_buf <= self.limit_within_buf);
+ debug_assert!(self.limit_within_buf <= self.buf.len());
+ debug_assert!(self.pos_of_buf_start + self.pos_within_buf as u64 <= self.limit);
+ }
+
+ #[inline(always)]
+ pub fn pos(&self) -> u64 {
+ self.pos_of_buf_start + self.pos_within_buf as u64
+ }
+
+ /// Recompute `limit_within_buf` after update of `limit`
+ #[inline]
+ fn update_limit_within_buf(&mut self) {
+ if self.pos_of_buf_start + (self.buf.len() as u64) <= self.limit {
+ self.limit_within_buf = self.buf.len();
+ } else {
+ self.limit_within_buf = (self.limit - self.pos_of_buf_start) as usize;
+ }
+
+ self.assertions();
+ }
+
+ pub fn push_limit(&mut self, limit: u64) -> ProtobufResult<u64> {
+ let new_limit = match self.pos().checked_add(limit) {
+ Some(new_limit) => new_limit,
+ None => return Err(ProtobufError::WireError(WireError::Other)),
+ };
+
+ if new_limit > self.limit {
+ return Err(ProtobufError::WireError(WireError::Other));
+ }
+
+ let prev_limit = mem::replace(&mut self.limit, new_limit);
+
+ self.update_limit_within_buf();
+
+ Ok(prev_limit)
+ }
+
+ #[inline]
+ pub fn pop_limit(&mut self, limit: u64) {
+ assert!(limit >= self.limit);
+
+ self.limit = limit;
+
+ self.update_limit_within_buf();
+ }
+
+ #[inline]
+ pub fn remaining_in_buf(&self) -> &[u8] {
+ if USE_UNSAFE_FOR_SPEED {
+ unsafe {
+ &self
+ .buf
+ .get_unchecked(self.pos_within_buf..self.limit_within_buf)
+ }
+ } else {
+ &self.buf[self.pos_within_buf..self.limit_within_buf]
+ }
+ }
+
+ #[inline(always)]
+ pub fn remaining_in_buf_len(&self) -> usize {
+ self.limit_within_buf - self.pos_within_buf
+ }
+
+ #[inline(always)]
+ pub fn bytes_until_limit(&self) -> u64 {
+ if self.limit == NO_LIMIT {
+ NO_LIMIT
+ } else {
+ self.limit - (self.pos_of_buf_start + self.pos_within_buf as u64)
+ }
+ }
+
+ #[inline(always)]
+ pub fn eof(&mut self) -> ProtobufResult<bool> {
+ if self.pos_within_buf == self.limit_within_buf {
+ Ok(self.fill_buf()?.is_empty())
+ } else {
+ Ok(false)
+ }
+ }
+
+ #[inline(always)]
+ pub fn read_byte(&mut self) -> ProtobufResult<u8> {
+ if self.pos_within_buf == self.limit_within_buf {
+ self.do_fill_buf()?;
+ if self.remaining_in_buf_len() == 0 {
+ return Err(ProtobufError::WireError(WireError::UnexpectedEof));
+ }
+ }
+
+ let r = if USE_UNSAFE_FOR_SPEED {
+ unsafe { *self.buf.get_unchecked(self.pos_within_buf) }
+ } else {
+ self.buf[self.pos_within_buf]
+ };
+ self.pos_within_buf += 1;
+ Ok(r)
+ }
+
+ /// Read at most `max` bytes, append to `Vec`.
+ ///
+ /// Returns 0 when EOF or limit reached.
+ fn read_to_vec(&mut self, vec: &mut Vec<u8>, max: usize) -> ProtobufResult<usize> {
+ let len = {
+ let rem = self.fill_buf()?;
+
+ let len = cmp::min(rem.len(), max);
+ vec.extend_from_slice(&rem[..len]);
+ len
+ };
+ self.pos_within_buf += len;
+ Ok(len)
+ }
+
+ /// Read exact number of bytes into `Vec`.
+ ///
+ /// `Vec` is cleared in the beginning.
+ pub fn read_exact_to_vec(&mut self, count: usize, target: &mut Vec<u8>) -> ProtobufResult<()> {
+ // TODO: also do some limits when reading from unlimited source
+ if count as u64 > self.bytes_until_limit() {
+ return Err(ProtobufError::WireError(WireError::TruncatedMessage));
+ }
+
+ target.clear();
+
+ if count >= READ_RAW_BYTES_MAX_ALLOC && count > target.capacity() {
+ // avoid calling `reserve` on buf with very large buffer: could be a malformed message
+
+ target.reserve(READ_RAW_BYTES_MAX_ALLOC);
+
+ while target.len() < count {
+ let need_to_read = count - target.len();
+ if need_to_read <= target.len() {
+ target.reserve_exact(need_to_read);
+ } else {
+ target.reserve(1);
+ }
+
+ let max = cmp::min(target.capacity() - target.len(), need_to_read);
+ let read = self.read_to_vec(target, max)?;
+ if read == 0 {
+ return Err(ProtobufError::WireError(WireError::TruncatedMessage));
+ }
+ }
+ } else {
+ target.reserve_exact(count);
+
+ unsafe {
+ self.read_exact(&mut target.get_unchecked_mut(..count))?;
+ target.set_len(count);
+ }
+ }
+
+ debug_assert_eq!(count, target.len());
+
+ Ok(())
+ }
+
+ #[cfg(feature = "bytes")]
+ pub fn read_exact_bytes(&mut self, len: usize) -> ProtobufResult<Bytes> {
+ if let InputSource::Bytes(bytes) = self.input_source {
+ let end = match self.pos_within_buf.checked_add(len) {
+ Some(end) => end,
+ None => return Err(ProtobufError::WireError(WireError::UnexpectedEof)),
+ };
+
+ if end > self.limit_within_buf {
+ return Err(ProtobufError::WireError(WireError::UnexpectedEof));
+ }
+
+ let r = bytes.slice(self.pos_within_buf..end);
+ self.pos_within_buf += len;
+ Ok(r)
+ } else {
+ if len >= READ_RAW_BYTES_MAX_ALLOC {
+ // We cannot trust `len` because protobuf message could be malformed.
+ // Reading should not result in OOM when allocating a buffer.
+ let mut v = Vec::new();
+ self.read_exact_to_vec(len, &mut v)?;
+ Ok(Bytes::from(v))
+ } else {
+ let mut r = BytesMut::with_capacity(len);
+ unsafe {
+ let buf = Self::slice_get_mut(&mut r.bytes_mut()[..len]);
+ self.read_exact(buf)?;
+ r.advance_mut(len);
+ }
+ Ok(r.freeze())
+ }
+ }
+ }
+
+ /// Copy-paste of `MaybeUninit::slice_get_mut`
+ #[allow(dead_code)] // only used when bytes feature is on
+ unsafe fn slice_get_mut<T>(slice: &mut [MaybeUninit<T>]) -> &mut [T] {
+ &mut *(slice as *mut [MaybeUninit<T>] as *mut [T])
+ }
+
+ /// Returns 0 when EOF or limit reached.
+ pub fn read(&mut self, buf: &mut [u8]) -> ProtobufResult<usize> {
+ self.fill_buf()?;
+
+ let rem = &self.buf[self.pos_within_buf..self.limit_within_buf];
+
+ let len = cmp::min(rem.len(), buf.len());
+ &mut buf[..len].copy_from_slice(&rem[..len]);
+ self.pos_within_buf += len;
+ Ok(len)
+ }
+
+ pub fn read_exact(&mut self, buf: &mut [u8]) -> ProtobufResult<()> {
+ if self.remaining_in_buf_len() >= buf.len() {
+ let buf_len = buf.len();
+ buf.copy_from_slice(&self.buf[self.pos_within_buf..self.pos_within_buf + buf_len]);
+ self.pos_within_buf += buf_len;
+ return Ok(());
+ }
+
+ if self.bytes_until_limit() < buf.len() as u64 {
+ return Err(ProtobufError::WireError(WireError::UnexpectedEof));
+ }
+
+ let consume = self.pos_within_buf;
+ self.pos_of_buf_start += self.pos_within_buf as u64;
+ self.pos_within_buf = 0;
+ self.buf = &[];
+ self.limit_within_buf = 0;
+
+ match self.input_source {
+ InputSource::Read(ref mut buf_read) => {
+ buf_read.consume(consume);
+ buf_read.read_exact(buf)?;
+ }
+ InputSource::BufRead(ref mut buf_read) => {
+ buf_read.consume(consume);
+ buf_read.read_exact(buf)?;
+ }
+ _ => {
+ return Err(ProtobufError::WireError(WireError::UnexpectedEof));
+ }
+ }
+
+ self.pos_of_buf_start += buf.len() as u64;
+
+ self.assertions();
+
+ Ok(())
+ }
+
+ fn do_fill_buf(&mut self) -> ProtobufResult<()> {
+ debug_assert!(self.pos_within_buf == self.limit_within_buf);
+
+ // Limit is reached, do not fill buf, because otherwise
+ // synchronous read from `CodedInputStream` may block.
+ if self.limit == self.pos() {
+ return Ok(());
+ }
+
+ let consume = self.buf.len();
+ self.pos_of_buf_start += self.buf.len() as u64;
+ self.buf = &[];
+ self.pos_within_buf = 0;
+ self.limit_within_buf = 0;
+
+ match self.input_source {
+ InputSource::Read(ref mut buf_read) => {
+ buf_read.consume(consume);
+ self.buf = unsafe { mem::transmute(buf_read.fill_buf()?) };
+ }
+ InputSource::BufRead(ref mut buf_read) => {
+ buf_read.consume(consume);
+ self.buf = unsafe { mem::transmute(buf_read.fill_buf()?) };
+ }
+ _ => {
+ return Ok(());
+ }
+ }
+
+ self.update_limit_within_buf();
+
+ Ok(())
+ }
+
+ #[inline(always)]
+ pub fn fill_buf(&mut self) -> ProtobufResult<&[u8]> {
+ if self.pos_within_buf == self.limit_within_buf {
+ self.do_fill_buf()?;
+ }
+
+ Ok(if USE_UNSAFE_FOR_SPEED {
+ unsafe {
+ self.buf
+ .get_unchecked(self.pos_within_buf..self.limit_within_buf)
+ }
+ } else {
+ &self.buf[self.pos_within_buf..self.limit_within_buf]
+ })
+ }
+
+ #[inline(always)]
+ pub fn consume(&mut self, amt: usize) {
+ assert!(amt <= self.limit_within_buf - self.pos_within_buf);
+ self.pos_within_buf += amt;
+ }
+}
+
+#[cfg(all(test, feature = "bytes"))]
+mod test_bytes {
+ use super::*;
+ use std::io::Write;
+
+ fn make_long_string(len: usize) -> Vec<u8> {
+ let mut s = Vec::new();
+ while s.len() < len {
+ let len = s.len();
+ write!(&mut s, "{}", len).expect("unexpected");
+ }
+ s.truncate(len);
+ s
+ }
+
+ #[test]
+ fn read_exact_bytes_from_slice() {
+ let bytes = make_long_string(100);
+ let mut bri = BufReadIter::from_byte_slice(&bytes[..]);
+ assert_eq!(&bytes[..90], &bri.read_exact_bytes(90).unwrap()[..]);
+ assert_eq!(bytes[90], bri.read_byte().expect("read_byte"));
+ }
+
+ #[test]
+ fn read_exact_bytes_from_bytes() {
+ let bytes = Bytes::from(make_long_string(100));
+ let mut bri = BufReadIter::from_bytes(&bytes);
+ let read = bri.read_exact_bytes(90).unwrap();
+ assert_eq!(&bytes[..90], &read[..]);
+ assert_eq!(&bytes[..90].as_ptr(), &read.as_ptr());
+ assert_eq!(bytes[90], bri.read_byte().expect("read_byte"));
+ }
+}
+
+#[cfg(test)]
+mod test {
+ use super::*;
+ use std::io;
+ use std::io::BufRead;
+ use std::io::Read;
+
+ #[test]
+ fn eof_at_limit() {
+ struct Read5ThenPanic {
+ pos: usize,
+ }
+
+ impl Read for Read5ThenPanic {
+ fn read(&mut self, _buf: &mut [u8]) -> io::Result<usize> {
+ unreachable!();
+ }
+ }
+
+ impl BufRead for Read5ThenPanic {
+ fn fill_buf(&mut self) -> io::Result<&[u8]> {
+ assert_eq!(0, self.pos);
+ static ZERO_TO_FIVE: &'static [u8] = &[0, 1, 2, 3, 4];
+ Ok(ZERO_TO_FIVE)
+ }
+
+ fn consume(&mut self, amt: usize) {
+ if amt == 0 {
+ // drop of BufReadIter
+ return;
+ }
+
+ assert_eq!(0, self.pos);
+ assert_eq!(5, amt);
+ self.pos += amt;
+ }
+ }
+
+ let mut read = Read5ThenPanic { pos: 0 };
+ let mut buf_read_iter = BufReadIter::from_buf_read(&mut read);
+ assert_eq!(0, buf_read_iter.pos());
+ let _prev_limit = buf_read_iter.push_limit(5);
+ buf_read_iter.read_byte().expect("read_byte");
+ buf_read_iter
+ .read_exact(&mut [1, 2, 3, 4])
+ .expect("read_exact");
+ assert!(buf_read_iter.eof().expect("eof"));
+ }
+}
diff --git a/src/cached_size.rs b/src/cached_size.rs
new file mode 100644
index 0000000..350ddac
--- /dev/null
+++ b/src/cached_size.rs
@@ -0,0 +1,38 @@
+use std::sync::atomic::AtomicUsize;
+use std::sync::atomic::Ordering;
+
+/// Cached size field used in generated code.
+/// It is always equal to itself to simplify generated code.
+/// (Generated code can use `#[derive(Eq)]`).
+#[derive(Debug, Default)]
+pub struct CachedSize {
+ size: AtomicUsize,
+}
+
+impl CachedSize {
+ /// Get cached size
+ pub fn get(&self) -> u32 {
+ self.size.load(Ordering::Relaxed) as u32
+ }
+
+ /// Set cached size
+ pub fn set(&self, size: u32) {
+ self.size.store(size as usize, Ordering::Relaxed)
+ }
+}
+
+impl Clone for CachedSize {
+ fn clone(&self) -> CachedSize {
+ CachedSize {
+ size: AtomicUsize::new(self.size.load(Ordering::Relaxed)),
+ }
+ }
+}
+
+impl PartialEq<CachedSize> for CachedSize {
+ fn eq(&self, _other: &CachedSize) -> bool {
+ true
+ }
+}
+
+impl Eq for CachedSize {}
diff --git a/src/chars.rs b/src/chars.rs
new file mode 100644
index 0000000..bb5a025
--- /dev/null
+++ b/src/chars.rs
@@ -0,0 +1,96 @@
+use std::fmt;
+use std::ops::Deref;
+use std::str;
+
+use bytes::Bytes;
+
+use clear::Clear;
+
+/// Thin wrapper around `Bytes` which guarantees that bytes are valid UTF-8 string.
+#[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
+pub struct Chars(Bytes);
+
+impl Chars {
+ /// New empty object.
+ pub fn new() -> Chars {
+ Chars(Bytes::new())
+ }
+
+ /// Try convert from `Bytes`
+ pub fn from_bytes(bytes: Bytes) -> Result<Chars, str::Utf8Error> {
+ str::from_utf8(&bytes)?;
+
+ Ok(Chars(bytes))
+ }
+
+ /// Len in bytes.
+ pub fn len(&self) -> usize {
+ self.0.len()
+ }
+
+ /// Self-explanatory
+ pub fn is_empty(&self) -> bool {
+ self.0.is_empty()
+ }
+}
+
+impl<'a> From<&'a str> for Chars {
+ fn from(src: &'a str) -> Chars {
+ Chars(Bytes::copy_from_slice(src.as_bytes()))
+ }
+}
+
+impl From<String> for Chars {
+ fn from(src: String) -> Chars {
+ Chars(Bytes::from(src))
+ }
+}
+
+impl Default for Chars {
+ fn default() -> Self {
+ Chars::new()
+ }
+}
+
+impl Deref for Chars {
+ type Target = str;
+
+ fn deref(&self) -> &str {
+ unsafe { str::from_utf8_unchecked(&self.0) }
+ }
+}
+
+impl Clear for Chars {
+ fn clear(&mut self) {
+ self.0.clear();
+ }
+}
+
+impl fmt::Display for Chars {
+ #[inline]
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fmt::Display::fmt(&**self, f)
+ }
+}
+
+impl fmt::Debug for Chars {
+ #[inline]
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fmt::Debug::fmt(&**self, f)
+ }
+}
+
+#[cfg(test)]
+mod test {
+ use super::Chars;
+
+ #[test]
+ fn test_display_and_debug() {
+ let s = "test";
+ let string: String = s.into();
+ let chars: Chars = s.into();
+
+ assert_eq!(format!("{}", string), format!("{}", chars));
+ assert_eq!(format!("{:?}", string), format!("{:?}", chars));
+ }
+}
diff --git a/src/clear.rs b/src/clear.rs
new file mode 100644
index 0000000..712c492
--- /dev/null
+++ b/src/clear.rs
@@ -0,0 +1,33 @@
+#[cfg(feature = "bytes")]
+use bytes::Bytes;
+
+/// anything that can be cleared
+pub trait Clear {
+ /// Clear this make, make it equivalent to newly created object.
+ fn clear(&mut self);
+}
+
+impl<T> Clear for Option<T> {
+ fn clear(&mut self) {
+ self.take();
+ }
+}
+
+impl Clear for String {
+ fn clear(&mut self) {
+ String::clear(self);
+ }
+}
+
+impl<T> Clear for Vec<T> {
+ fn clear(&mut self) {
+ Vec::clear(self);
+ }
+}
+
+#[cfg(feature = "bytes")]
+impl Clear for Bytes {
+ fn clear(&mut self) {
+ Bytes::clear(self);
+ }
+}
diff --git a/src/compiler_plugin.rs b/src/compiler_plugin.rs
new file mode 100644
index 0000000..2a3b1d0
--- /dev/null
+++ b/src/compiler_plugin.rs
@@ -0,0 +1,53 @@
+// TODO: move into separate crate
+#![doc(hidden)]
+
+use plugin::*;
+use protobuf::descriptor::FileDescriptorProto;
+use protobuf::parse_from_reader;
+use protobuf::Message;
+use std::io::stdin;
+use std::io::stdout;
+use std::str;
+
+pub struct GenRequest<'a> {
+ pub file_descriptors: &'a [FileDescriptorProto],
+ pub files_to_generate: &'a [String],
+ pub parameter: &'a str,
+}
+
+pub struct GenResult {
+ pub name: String,
+ pub content: Vec<u8>,
+}
+
+pub fn plugin_main<F>(gen: F)
+where
+ F: Fn(&[FileDescriptorProto], &[String]) -> Vec<GenResult>,
+{
+ plugin_main_2(|r| gen(r.file_descriptors, r.files_to_generate))
+}
+
+pub fn plugin_main_2<F>(gen: F)
+where
+ F: Fn(&GenRequest) -> Vec<GenResult>,
+{
+ let req = parse_from_reader::<CodeGeneratorRequest>(&mut stdin()).unwrap();
+ let result = gen(&GenRequest {
+ file_descriptors: &req.get_proto_file(),
+ files_to_generate: &req.get_file_to_generate(),
+ parameter: req.get_parameter(),
+ });
+ let mut resp = CodeGeneratorResponse::new();
+ resp.set_file(
+ result
+ .iter()
+ .map(|file| {
+ let mut r = CodeGeneratorResponse_File::new();
+ r.set_name(file.name.to_string());
+ r.set_content(str::from_utf8(file.content.as_ref()).unwrap().to_string());
+ r
+ })
+ .collect(),
+ );
+ resp.write_to_writer(&mut stdout()).unwrap();
+}
diff --git a/src/core.rs b/src/core.rs
new file mode 100644
index 0000000..c577d44
--- /dev/null
+++ b/src/core.rs
@@ -0,0 +1,268 @@
+use std::any::Any;
+use std::any::TypeId;
+use std::fmt;
+use std::io::Read;
+use std::io::Write;
+
+#[cfg(feature = "bytes")]
+use bytes::Bytes;
+
+use clear::Clear;
+use error::ProtobufError;
+use error::ProtobufResult;
+use reflect::MessageDescriptor;
+use stream::with_coded_output_stream_to_bytes;
+use stream::CodedInputStream;
+use stream::CodedOutputStream;
+use stream::WithCodedInputStream;
+use stream::WithCodedOutputStream;
+use unknown::UnknownFields;
+
+/// Trait implemented for all generated structs for protobuf messages.
+///
+/// Also, generated messages implement `Clone + Default + PartialEq`
+pub trait Message: fmt::Debug + Clear + Any + Send + Sync {
+ /// Message descriptor for this message, used for reflection.
+ fn descriptor(&self) -> &'static MessageDescriptor;
+
+ /// True iff all required fields are initialized.
+ /// Always returns `true` for protobuf 3.
+ fn is_initialized(&self) -> bool;
+
+ /// Update this message object with fields read from given stream.
+ fn merge_from(&mut self, is: &mut CodedInputStream) -> ProtobufResult<()>;
+
+ /// Write message to the stream.
+ ///
+ /// Sizes of this messages and nested messages must be cached
+ /// by calling `compute_size` prior to this call.
+ fn write_to_with_cached_sizes(&self, os: &mut CodedOutputStream) -> ProtobufResult<()>;
+
+ /// Compute and cache size of this message and all nested messages
+ fn compute_size(&self) -> u32;
+
+ /// Get size previously computed by `compute_size`.
+ fn get_cached_size(&self) -> u32;
+
+ /// Write the message to the stream.
+ ///
+ /// Results in error if message is not fully initialized.
+ fn write_to(&self, os: &mut CodedOutputStream) -> ProtobufResult<()> {
+ self.check_initialized()?;
+
+ // cache sizes
+ self.compute_size();
+ // TODO: reserve additional
+ self.write_to_with_cached_sizes(os)?;
+
+ Ok(())
+ }
+
+ /// Write the message to the stream prepending the message with message length
+ /// encoded as varint.
+ fn write_length_delimited_to(&self, os: &mut CodedOutputStream) -> ProtobufResult<()> {
+ let size = self.compute_size();
+ os.write_raw_varint32(size)?;
+ self.write_to_with_cached_sizes(os)?;
+
+ // TODO: assert we've written same number of bytes as computed
+
+ Ok(())
+ }
+
+ /// Write the message to the vec, prepend the message with message length
+ /// encoded as varint.
+ fn write_length_delimited_to_vec(&self, vec: &mut Vec<u8>) -> ProtobufResult<()> {
+ let mut os = CodedOutputStream::vec(vec);
+ self.write_length_delimited_to(&mut os)?;
+ os.flush()?;
+ Ok(())
+ }
+
+ /// Update this message object with fields read from given stream.
+ fn merge_from_bytes(&mut self, bytes: &[u8]) -> ProtobufResult<()> {
+ let mut is = CodedInputStream::from_bytes(bytes);
+ self.merge_from(&mut is)
+ }
+
+ /// Check if all required fields of this object are initialized.
+ fn check_initialized(&self) -> ProtobufResult<()> {
+ if !self.is_initialized() {
+ Err(ProtobufError::message_not_initialized(
+ self.descriptor().name(),
+ ))
+ } else {
+ Ok(())
+ }
+ }
+
+ /// Write the message to the writer.
+ fn write_to_writer(&self, w: &mut Write) -> ProtobufResult<()> {
+ w.with_coded_output_stream(|os| self.write_to(os))
+ }
+
+ /// Write the message to bytes vec.
+ fn write_to_vec(&self, v: &mut Vec<u8>) -> ProtobufResult<()> {
+ v.with_coded_output_stream(|os| self.write_to(os))
+ }
+
+ /// Write the message to bytes vec.
+ fn write_to_bytes(&self) -> ProtobufResult<Vec<u8>> {
+ self.check_initialized()?;
+
+ let size = self.compute_size() as usize;
+ let mut v = Vec::with_capacity(size);
+ // skip zerofill
+ unsafe {
+ v.set_len(size);
+ }
+ {
+ let mut os = CodedOutputStream::bytes(&mut v);
+ self.write_to_with_cached_sizes(&mut os)?;
+ os.check_eof();
+ }
+ Ok(v)
+ }
+
+ /// Write the message to the writer, prepend the message with message length
+ /// encoded as varint.
+ fn write_length_delimited_to_writer(&self, w: &mut Write) -> ProtobufResult<()> {
+ w.with_coded_output_stream(|os| self.write_length_delimited_to(os))
+ }
+
+ /// Write the message to the bytes vec, prepend the message with message length
+ /// encoded as varint.
+ fn write_length_delimited_to_bytes(&self) -> ProtobufResult<Vec<u8>> {
+ with_coded_output_stream_to_bytes(|os| self.write_length_delimited_to(os))
+ }
+
+ /// Get a reference to unknown fields.
+ fn get_unknown_fields<'s>(&'s self) -> &'s UnknownFields;
+ /// Get a mutable reference to unknown fields.
+ fn mut_unknown_fields<'s>(&'s mut self) -> &'s mut UnknownFields;
+
+ /// Get type id for downcasting.
+ fn type_id(&self) -> TypeId {
+ TypeId::of::<Self>()
+ }
+
+ /// View self as `Any`.
+ fn as_any(&self) -> &Any;
+
+ /// View self as mutable `Any`.
+ fn as_any_mut(&mut self) -> &mut Any {
+ panic!()
+ }
+
+ /// Convert boxed self to boxed `Any`.
+ fn into_any(self: Box<Self>) -> Box<Any> {
+ panic!()
+ }
+
+ // Rust does not allow implementation of trait for trait:
+ // impl<M : Message> fmt::Debug for M {
+ // ...
+ // }
+
+ /// Create an empty message object.
+ ///
+ ///
+ /// ```
+ /// # use protobuf::Message;
+ /// # fn foo<MyMessage: Message>() {
+ /// let m = MyMessage::new();
+ /// # }
+ /// ```
+ fn new() -> Self
+ where
+ Self: Sized;
+
+ /// Get message descriptor for message type.
+ ///
+ /// ```
+ /// # use protobuf::Message;
+ /// # fn foo<MyMessage: Message>() {
+ /// let descriptor = MyMessage::descriptor_static();
+ /// assert_eq!("MyMessage", descriptor.name());
+ /// # }
+ /// ```
+ fn descriptor_static() -> &'static MessageDescriptor
+ where
+ Self: Sized,
+ {
+ panic!(
+ "descriptor_static is not implemented for message, \
+ LITE_RUNTIME must be used"
+ );
+ }
+
+ /// Return a pointer to default immutable message with static lifetime.
+ ///
+ /// ```
+ /// # use protobuf::Message;
+ /// # fn foo<MyMessage: Message>() {
+ /// let m: &MyMessage = MyMessage::default_instance();
+ /// # }
+ /// ```
+ fn default_instance() -> &'static Self
+ where
+ Self: Sized;
+}
+
+pub fn message_down_cast<'a, M: Message + 'a>(m: &'a Message) -> &'a M {
+ m.as_any().downcast_ref::<M>().unwrap()
+}
+
+/// Parse message from stream.
+pub fn parse_from<M: Message>(is: &mut CodedInputStream) -> ProtobufResult<M> {
+ let mut r: M = Message::new();
+ r.merge_from(is)?;
+ r.check_initialized()?;
+ Ok(r)
+}
+
+/// Parse message from reader.
+/// Parse stops on EOF or when error encountered.
+pub fn parse_from_reader<M: Message>(reader: &mut Read) -> ProtobufResult<M> {
+ reader.with_coded_input_stream(|is| parse_from::<M>(is))
+}
+
+/// Parse message from byte array.
+pub fn parse_from_bytes<M: Message>(bytes: &[u8]) -> ProtobufResult<M> {
+ bytes.with_coded_input_stream(|is| parse_from::<M>(is))
+}
+
+/// Parse message from `Bytes` object.
+/// Resulting message may share references to the passed bytes object.
+#[cfg(feature = "bytes")]
+pub fn parse_from_carllerche_bytes<M: Message>(bytes: &Bytes) -> ProtobufResult<M> {
+ // Call trait explicitly to avoid accidental construction from `&[u8]`
+ WithCodedInputStream::with_coded_input_stream(bytes, |is| parse_from::<M>(is))
+}
+
+/// Parse length-delimited message from stream.
+///
+/// Read varint length first, and read messages of that length then.
+///
+/// This function is deprecated and will be removed in the next major release.
+#[deprecated]
+pub fn parse_length_delimited_from<M: Message>(is: &mut CodedInputStream) -> ProtobufResult<M> {
+ is.read_message::<M>()
+}
+
+/// Parse length-delimited message from `Read`.
+///
+/// This function is deprecated and will be removed in the next major release.
+#[deprecated]
+pub fn parse_length_delimited_from_reader<M: Message>(r: &mut Read) -> ProtobufResult<M> {
+ // TODO: wrong: we may read length first, and then read exact number of bytes needed
+ r.with_coded_input_stream(|is| is.read_message::<M>())
+}
+
+/// Parse length-delimited message from bytes.
+///
+/// This function is deprecated and will be removed in the next major release.
+#[deprecated]
+pub fn parse_length_delimited_from_bytes<M: Message>(bytes: &[u8]) -> ProtobufResult<M> {
+ bytes.with_coded_input_stream(|is| is.read_message::<M>())
+}
diff --git a/src/descriptor.rs b/src/descriptor.rs
new file mode 100644
index 0000000..92ca34e
--- /dev/null
+++ b/src/descriptor.rs
@@ -0,0 +1,9852 @@
+// This file is generated by rust-protobuf 2.14.0-pre. Do not edit
+// @generated
+
+// https://github.com/rust-lang/rust-clippy/issues/702
+#![allow(unknown_lints)]
+#![allow(clippy::all)]
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
+#![allow(box_pointers)]
+#![allow(dead_code)]
+#![allow(missing_docs)]
+#![allow(non_camel_case_types)]
+#![allow(non_snake_case)]
+#![allow(non_upper_case_globals)]
+#![allow(trivial_casts)]
+#![allow(unsafe_code)]
+#![allow(unused_imports)]
+#![allow(unused_results)]
+//! Generated file from `google/protobuf/descriptor.proto`
+
+use protobuf::Message as Message_imported_for_functions;
+use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct FileDescriptorSet {
+ // message fields
+ file: ::protobuf::RepeatedField<FileDescriptorProto>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a FileDescriptorSet {
+ fn default() -> &'a FileDescriptorSet {
+ <FileDescriptorSet as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl FileDescriptorSet {
+ pub fn new() -> FileDescriptorSet {
+ ::std::default::Default::default()
+ }
+
+ // repeated .google.protobuf.FileDescriptorProto file = 1;
+
+
+ pub fn get_file(&self) -> &[FileDescriptorProto] {
+ &self.file
+ }
+ pub fn clear_file(&mut self) {
+ self.file.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_file(&mut self, v: ::protobuf::RepeatedField<FileDescriptorProto>) {
+ self.file = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_file(&mut self) -> &mut ::protobuf::RepeatedField<FileDescriptorProto> {
+ &mut self.file
+ }
+
+ // Take field
+ pub fn take_file(&mut self) -> ::protobuf::RepeatedField<FileDescriptorProto> {
+ ::std::mem::replace(&mut self.file, ::protobuf::RepeatedField::new())
+ }
+}
+
+impl ::protobuf::Message for FileDescriptorSet {
+ fn is_initialized(&self) -> bool {
+ for v in &self.file {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.file)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ for value in &self.file {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ for v in &self.file {
+ os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> FileDescriptorSet {
+ FileDescriptorSet::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<FileDescriptorProto>>(
+ "file",
+ |m: &FileDescriptorSet| { &m.file },
+ |m: &mut FileDescriptorSet| { &mut m.file },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<FileDescriptorSet>(
+ "FileDescriptorSet",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static FileDescriptorSet {
+ static mut instance: ::protobuf::lazy::Lazy<FileDescriptorSet> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(FileDescriptorSet::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for FileDescriptorSet {
+ fn clear(&mut self) {
+ self.file.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for FileDescriptorSet {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for FileDescriptorSet {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct FileDescriptorProto {
+ // message fields
+ name: ::protobuf::SingularField<::std::string::String>,
+ package: ::protobuf::SingularField<::std::string::String>,
+ dependency: ::protobuf::RepeatedField<::std::string::String>,
+ public_dependency: ::std::vec::Vec<i32>,
+ weak_dependency: ::std::vec::Vec<i32>,
+ message_type: ::protobuf::RepeatedField<DescriptorProto>,
+ enum_type: ::protobuf::RepeatedField<EnumDescriptorProto>,
+ service: ::protobuf::RepeatedField<ServiceDescriptorProto>,
+ extension: ::protobuf::RepeatedField<FieldDescriptorProto>,
+ options: ::protobuf::SingularPtrField<FileOptions>,
+ source_code_info: ::protobuf::SingularPtrField<SourceCodeInfo>,
+ syntax: ::protobuf::SingularField<::std::string::String>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a FileDescriptorProto {
+ fn default() -> &'a FileDescriptorProto {
+ <FileDescriptorProto as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl FileDescriptorProto {
+ pub fn new() -> FileDescriptorProto {
+ ::std::default::Default::default()
+ }
+
+ // optional string name = 1;
+
+
+ pub fn get_name(&self) -> &str {
+ match self.name.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_name(&mut self) {
+ self.name.clear();
+ }
+
+ pub fn has_name(&self) -> bool {
+ self.name.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_name(&mut self, v: ::std::string::String) {
+ self.name = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_name(&mut self) -> &mut ::std::string::String {
+ if self.name.is_none() {
+ self.name.set_default();
+ }
+ self.name.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_name(&mut self) -> ::std::string::String {
+ self.name.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional string package = 2;
+
+
+ pub fn get_package(&self) -> &str {
+ match self.package.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_package(&mut self) {
+ self.package.clear();
+ }
+
+ pub fn has_package(&self) -> bool {
+ self.package.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_package(&mut self, v: ::std::string::String) {
+ self.package = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_package(&mut self) -> &mut ::std::string::String {
+ if self.package.is_none() {
+ self.package.set_default();
+ }
+ self.package.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_package(&mut self) -> ::std::string::String {
+ self.package.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // repeated string dependency = 3;
+
+
+ pub fn get_dependency(&self) -> &[::std::string::String] {
+ &self.dependency
+ }
+ pub fn clear_dependency(&mut self) {
+ self.dependency.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_dependency(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) {
+ self.dependency = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_dependency(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> {
+ &mut self.dependency
+ }
+
+ // Take field
+ pub fn take_dependency(&mut self) -> ::protobuf::RepeatedField<::std::string::String> {
+ ::std::mem::replace(&mut self.dependency, ::protobuf::RepeatedField::new())
+ }
+
+ // repeated int32 public_dependency = 10;
+
+
+ pub fn get_public_dependency(&self) -> &[i32] {
+ &self.public_dependency
+ }
+ pub fn clear_public_dependency(&mut self) {
+ self.public_dependency.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_public_dependency(&mut self, v: ::std::vec::Vec<i32>) {
+ self.public_dependency = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_public_dependency(&mut self) -> &mut ::std::vec::Vec<i32> {
+ &mut self.public_dependency
+ }
+
+ // Take field
+ pub fn take_public_dependency(&mut self) -> ::std::vec::Vec<i32> {
+ ::std::mem::replace(&mut self.public_dependency, ::std::vec::Vec::new())
+ }
+
+ // repeated int32 weak_dependency = 11;
+
+
+ pub fn get_weak_dependency(&self) -> &[i32] {
+ &self.weak_dependency
+ }
+ pub fn clear_weak_dependency(&mut self) {
+ self.weak_dependency.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_weak_dependency(&mut self, v: ::std::vec::Vec<i32>) {
+ self.weak_dependency = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_weak_dependency(&mut self) -> &mut ::std::vec::Vec<i32> {
+ &mut self.weak_dependency
+ }
+
+ // Take field
+ pub fn take_weak_dependency(&mut self) -> ::std::vec::Vec<i32> {
+ ::std::mem::replace(&mut self.weak_dependency, ::std::vec::Vec::new())
+ }
+
+ // repeated .google.protobuf.DescriptorProto message_type = 4;
+
+
+ pub fn get_message_type(&self) -> &[DescriptorProto] {
+ &self.message_type
+ }
+ pub fn clear_message_type(&mut self) {
+ self.message_type.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_message_type(&mut self, v: ::protobuf::RepeatedField<DescriptorProto>) {
+ self.message_type = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_message_type(&mut self) -> &mut ::protobuf::RepeatedField<DescriptorProto> {
+ &mut self.message_type
+ }
+
+ // Take field
+ pub fn take_message_type(&mut self) -> ::protobuf::RepeatedField<DescriptorProto> {
+ ::std::mem::replace(&mut self.message_type, ::protobuf::RepeatedField::new())
+ }
+
+ // repeated .google.protobuf.EnumDescriptorProto enum_type = 5;
+
+
+ pub fn get_enum_type(&self) -> &[EnumDescriptorProto] {
+ &self.enum_type
+ }
+ pub fn clear_enum_type(&mut self) {
+ self.enum_type.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_enum_type(&mut self, v: ::protobuf::RepeatedField<EnumDescriptorProto>) {
+ self.enum_type = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_enum_type(&mut self) -> &mut ::protobuf::RepeatedField<EnumDescriptorProto> {
+ &mut self.enum_type
+ }
+
+ // Take field
+ pub fn take_enum_type(&mut self) -> ::protobuf::RepeatedField<EnumDescriptorProto> {
+ ::std::mem::replace(&mut self.enum_type, ::protobuf::RepeatedField::new())
+ }
+
+ // repeated .google.protobuf.ServiceDescriptorProto service = 6;
+
+
+ pub fn get_service(&self) -> &[ServiceDescriptorProto] {
+ &self.service
+ }
+ pub fn clear_service(&mut self) {
+ self.service.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_service(&mut self, v: ::protobuf::RepeatedField<ServiceDescriptorProto>) {
+ self.service = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_service(&mut self) -> &mut ::protobuf::RepeatedField<ServiceDescriptorProto> {
+ &mut self.service
+ }
+
+ // Take field
+ pub fn take_service(&mut self) -> ::protobuf::RepeatedField<ServiceDescriptorProto> {
+ ::std::mem::replace(&mut self.service, ::protobuf::RepeatedField::new())
+ }
+
+ // repeated .google.protobuf.FieldDescriptorProto extension = 7;
+
+
+ pub fn get_extension(&self) -> &[FieldDescriptorProto] {
+ &self.extension
+ }
+ pub fn clear_extension(&mut self) {
+ self.extension.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_extension(&mut self, v: ::protobuf::RepeatedField<FieldDescriptorProto>) {
+ self.extension = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_extension(&mut self) -> &mut ::protobuf::RepeatedField<FieldDescriptorProto> {
+ &mut self.extension
+ }
+
+ // Take field
+ pub fn take_extension(&mut self) -> ::protobuf::RepeatedField<FieldDescriptorProto> {
+ ::std::mem::replace(&mut self.extension, ::protobuf::RepeatedField::new())
+ }
+
+ // optional .google.protobuf.FileOptions options = 8;
+
+
+ pub fn get_options(&self) -> &FileOptions {
+ self.options.as_ref().unwrap_or_else(|| FileOptions::default_instance())
+ }
+ pub fn clear_options(&mut self) {
+ self.options.clear();
+ }
+
+ pub fn has_options(&self) -> bool {
+ self.options.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_options(&mut self, v: FileOptions) {
+ self.options = ::protobuf::SingularPtrField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_options(&mut self) -> &mut FileOptions {
+ if self.options.is_none() {
+ self.options.set_default();
+ }
+ self.options.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_options(&mut self) -> FileOptions {
+ self.options.take().unwrap_or_else(|| FileOptions::new())
+ }
+
+ // optional .google.protobuf.SourceCodeInfo source_code_info = 9;
+
+
+ pub fn get_source_code_info(&self) -> &SourceCodeInfo {
+ self.source_code_info.as_ref().unwrap_or_else(|| SourceCodeInfo::default_instance())
+ }
+ pub fn clear_source_code_info(&mut self) {
+ self.source_code_info.clear();
+ }
+
+ pub fn has_source_code_info(&self) -> bool {
+ self.source_code_info.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_source_code_info(&mut self, v: SourceCodeInfo) {
+ self.source_code_info = ::protobuf::SingularPtrField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_source_code_info(&mut self) -> &mut SourceCodeInfo {
+ if self.source_code_info.is_none() {
+ self.source_code_info.set_default();
+ }
+ self.source_code_info.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_source_code_info(&mut self) -> SourceCodeInfo {
+ self.source_code_info.take().unwrap_or_else(|| SourceCodeInfo::new())
+ }
+
+ // optional string syntax = 12;
+
+
+ pub fn get_syntax(&self) -> &str {
+ match self.syntax.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_syntax(&mut self) {
+ self.syntax.clear();
+ }
+
+ pub fn has_syntax(&self) -> bool {
+ self.syntax.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_syntax(&mut self, v: ::std::string::String) {
+ self.syntax = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_syntax(&mut self) -> &mut ::std::string::String {
+ if self.syntax.is_none() {
+ self.syntax.set_default();
+ }
+ self.syntax.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_syntax(&mut self) -> ::std::string::String {
+ self.syntax.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+}
+
+impl ::protobuf::Message for FileDescriptorProto {
+ fn is_initialized(&self) -> bool {
+ for v in &self.message_type {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.enum_type {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.service {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.extension {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.options {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.source_code_info {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.name)?;
+ },
+ 2 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.package)?;
+ },
+ 3 => {
+ ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.dependency)?;
+ },
+ 10 => {
+ ::protobuf::rt::read_repeated_int32_into(wire_type, is, &mut self.public_dependency)?;
+ },
+ 11 => {
+ ::protobuf::rt::read_repeated_int32_into(wire_type, is, &mut self.weak_dependency)?;
+ },
+ 4 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.message_type)?;
+ },
+ 5 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.enum_type)?;
+ },
+ 6 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.service)?;
+ },
+ 7 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.extension)?;
+ },
+ 8 => {
+ ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.options)?;
+ },
+ 9 => {
+ ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.source_code_info)?;
+ },
+ 12 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.syntax)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(ref v) = self.name.as_ref() {
+ my_size += ::protobuf::rt::string_size(1, &v);
+ }
+ if let Some(ref v) = self.package.as_ref() {
+ my_size += ::protobuf::rt::string_size(2, &v);
+ }
+ for value in &self.dependency {
+ my_size += ::protobuf::rt::string_size(3, &value);
+ };
+ for value in &self.public_dependency {
+ my_size += ::protobuf::rt::value_size(10, *value, ::protobuf::wire_format::WireTypeVarint);
+ };
+ for value in &self.weak_dependency {
+ my_size += ::protobuf::rt::value_size(11, *value, ::protobuf::wire_format::WireTypeVarint);
+ };
+ for value in &self.message_type {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ for value in &self.enum_type {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ for value in &self.service {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ for value in &self.extension {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ if let Some(ref v) = self.options.as_ref() {
+ let len = v.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ }
+ if let Some(ref v) = self.source_code_info.as_ref() {
+ let len = v.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ }
+ if let Some(ref v) = self.syntax.as_ref() {
+ my_size += ::protobuf::rt::string_size(12, &v);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(ref v) = self.name.as_ref() {
+ os.write_string(1, &v)?;
+ }
+ if let Some(ref v) = self.package.as_ref() {
+ os.write_string(2, &v)?;
+ }
+ for v in &self.dependency {
+ os.write_string(3, &v)?;
+ };
+ for v in &self.public_dependency {
+ os.write_int32(10, *v)?;
+ };
+ for v in &self.weak_dependency {
+ os.write_int32(11, *v)?;
+ };
+ for v in &self.message_type {
+ os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ for v in &self.enum_type {
+ os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ for v in &self.service {
+ os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ for v in &self.extension {
+ os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ if let Some(ref v) = self.options.as_ref() {
+ os.write_tag(8, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ }
+ if let Some(ref v) = self.source_code_info.as_ref() {
+ os.write_tag(9, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ }
+ if let Some(ref v) = self.syntax.as_ref() {
+ os.write_string(12, &v)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> FileDescriptorProto {
+ FileDescriptorProto::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "name",
+ |m: &FileDescriptorProto| { &m.name },
+ |m: &mut FileDescriptorProto| { &mut m.name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "package",
+ |m: &FileDescriptorProto| { &m.package },
+ |m: &mut FileDescriptorProto| { &mut m.package },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "dependency",
+ |m: &FileDescriptorProto| { &m.dependency },
+ |m: &mut FileDescriptorProto| { &mut m.dependency },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "public_dependency",
+ |m: &FileDescriptorProto| { &m.public_dependency },
+ |m: &mut FileDescriptorProto| { &mut m.public_dependency },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "weak_dependency",
+ |m: &FileDescriptorProto| { &m.weak_dependency },
+ |m: &mut FileDescriptorProto| { &mut m.weak_dependency },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<DescriptorProto>>(
+ "message_type",
+ |m: &FileDescriptorProto| { &m.message_type },
+ |m: &mut FileDescriptorProto| { &mut m.message_type },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<EnumDescriptorProto>>(
+ "enum_type",
+ |m: &FileDescriptorProto| { &m.enum_type },
+ |m: &mut FileDescriptorProto| { &mut m.enum_type },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<ServiceDescriptorProto>>(
+ "service",
+ |m: &FileDescriptorProto| { &m.service },
+ |m: &mut FileDescriptorProto| { &mut m.service },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<FieldDescriptorProto>>(
+ "extension",
+ |m: &FileDescriptorProto| { &m.extension },
+ |m: &mut FileDescriptorProto| { &mut m.extension },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<FileOptions>>(
+ "options",
+ |m: &FileDescriptorProto| { &m.options },
+ |m: &mut FileDescriptorProto| { &mut m.options },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<SourceCodeInfo>>(
+ "source_code_info",
+ |m: &FileDescriptorProto| { &m.source_code_info },
+ |m: &mut FileDescriptorProto| { &mut m.source_code_info },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "syntax",
+ |m: &FileDescriptorProto| { &m.syntax },
+ |m: &mut FileDescriptorProto| { &mut m.syntax },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<FileDescriptorProto>(
+ "FileDescriptorProto",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static FileDescriptorProto {
+ static mut instance: ::protobuf::lazy::Lazy<FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(FileDescriptorProto::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for FileDescriptorProto {
+ fn clear(&mut self) {
+ self.name.clear();
+ self.package.clear();
+ self.dependency.clear();
+ self.public_dependency.clear();
+ self.weak_dependency.clear();
+ self.message_type.clear();
+ self.enum_type.clear();
+ self.service.clear();
+ self.extension.clear();
+ self.options.clear();
+ self.source_code_info.clear();
+ self.syntax.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for FileDescriptorProto {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for FileDescriptorProto {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct DescriptorProto {
+ // message fields
+ name: ::protobuf::SingularField<::std::string::String>,
+ field: ::protobuf::RepeatedField<FieldDescriptorProto>,
+ extension: ::protobuf::RepeatedField<FieldDescriptorProto>,
+ nested_type: ::protobuf::RepeatedField<DescriptorProto>,
+ enum_type: ::protobuf::RepeatedField<EnumDescriptorProto>,
+ extension_range: ::protobuf::RepeatedField<DescriptorProto_ExtensionRange>,
+ oneof_decl: ::protobuf::RepeatedField<OneofDescriptorProto>,
+ options: ::protobuf::SingularPtrField<MessageOptions>,
+ reserved_range: ::protobuf::RepeatedField<DescriptorProto_ReservedRange>,
+ reserved_name: ::protobuf::RepeatedField<::std::string::String>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a DescriptorProto {
+ fn default() -> &'a DescriptorProto {
+ <DescriptorProto as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl DescriptorProto {
+ pub fn new() -> DescriptorProto {
+ ::std::default::Default::default()
+ }
+
+ // optional string name = 1;
+
+
+ pub fn get_name(&self) -> &str {
+ match self.name.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_name(&mut self) {
+ self.name.clear();
+ }
+
+ pub fn has_name(&self) -> bool {
+ self.name.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_name(&mut self, v: ::std::string::String) {
+ self.name = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_name(&mut self) -> &mut ::std::string::String {
+ if self.name.is_none() {
+ self.name.set_default();
+ }
+ self.name.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_name(&mut self) -> ::std::string::String {
+ self.name.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // repeated .google.protobuf.FieldDescriptorProto field = 2;
+
+
+ pub fn get_field(&self) -> &[FieldDescriptorProto] {
+ &self.field
+ }
+ pub fn clear_field(&mut self) {
+ self.field.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_field(&mut self, v: ::protobuf::RepeatedField<FieldDescriptorProto>) {
+ self.field = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_field(&mut self) -> &mut ::protobuf::RepeatedField<FieldDescriptorProto> {
+ &mut self.field
+ }
+
+ // Take field
+ pub fn take_field(&mut self) -> ::protobuf::RepeatedField<FieldDescriptorProto> {
+ ::std::mem::replace(&mut self.field, ::protobuf::RepeatedField::new())
+ }
+
+ // repeated .google.protobuf.FieldDescriptorProto extension = 6;
+
+
+ pub fn get_extension(&self) -> &[FieldDescriptorProto] {
+ &self.extension
+ }
+ pub fn clear_extension(&mut self) {
+ self.extension.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_extension(&mut self, v: ::protobuf::RepeatedField<FieldDescriptorProto>) {
+ self.extension = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_extension(&mut self) -> &mut ::protobuf::RepeatedField<FieldDescriptorProto> {
+ &mut self.extension
+ }
+
+ // Take field
+ pub fn take_extension(&mut self) -> ::protobuf::RepeatedField<FieldDescriptorProto> {
+ ::std::mem::replace(&mut self.extension, ::protobuf::RepeatedField::new())
+ }
+
+ // repeated .google.protobuf.DescriptorProto nested_type = 3;
+
+
+ pub fn get_nested_type(&self) -> &[DescriptorProto] {
+ &self.nested_type
+ }
+ pub fn clear_nested_type(&mut self) {
+ self.nested_type.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_nested_type(&mut self, v: ::protobuf::RepeatedField<DescriptorProto>) {
+ self.nested_type = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_nested_type(&mut self) -> &mut ::protobuf::RepeatedField<DescriptorProto> {
+ &mut self.nested_type
+ }
+
+ // Take field
+ pub fn take_nested_type(&mut self) -> ::protobuf::RepeatedField<DescriptorProto> {
+ ::std::mem::replace(&mut self.nested_type, ::protobuf::RepeatedField::new())
+ }
+
+ // repeated .google.protobuf.EnumDescriptorProto enum_type = 4;
+
+
+ pub fn get_enum_type(&self) -> &[EnumDescriptorProto] {
+ &self.enum_type
+ }
+ pub fn clear_enum_type(&mut self) {
+ self.enum_type.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_enum_type(&mut self, v: ::protobuf::RepeatedField<EnumDescriptorProto>) {
+ self.enum_type = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_enum_type(&mut self) -> &mut ::protobuf::RepeatedField<EnumDescriptorProto> {
+ &mut self.enum_type
+ }
+
+ // Take field
+ pub fn take_enum_type(&mut self) -> ::protobuf::RepeatedField<EnumDescriptorProto> {
+ ::std::mem::replace(&mut self.enum_type, ::protobuf::RepeatedField::new())
+ }
+
+ // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;
+
+
+ pub fn get_extension_range(&self) -> &[DescriptorProto_ExtensionRange] {
+ &self.extension_range
+ }
+ pub fn clear_extension_range(&mut self) {
+ self.extension_range.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_extension_range(&mut self, v: ::protobuf::RepeatedField<DescriptorProto_ExtensionRange>) {
+ self.extension_range = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_extension_range(&mut self) -> &mut ::protobuf::RepeatedField<DescriptorProto_ExtensionRange> {
+ &mut self.extension_range
+ }
+
+ // Take field
+ pub fn take_extension_range(&mut self) -> ::protobuf::RepeatedField<DescriptorProto_ExtensionRange> {
+ ::std::mem::replace(&mut self.extension_range, ::protobuf::RepeatedField::new())
+ }
+
+ // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;
+
+
+ pub fn get_oneof_decl(&self) -> &[OneofDescriptorProto] {
+ &self.oneof_decl
+ }
+ pub fn clear_oneof_decl(&mut self) {
+ self.oneof_decl.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_oneof_decl(&mut self, v: ::protobuf::RepeatedField<OneofDescriptorProto>) {
+ self.oneof_decl = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_oneof_decl(&mut self) -> &mut ::protobuf::RepeatedField<OneofDescriptorProto> {
+ &mut self.oneof_decl
+ }
+
+ // Take field
+ pub fn take_oneof_decl(&mut self) -> ::protobuf::RepeatedField<OneofDescriptorProto> {
+ ::std::mem::replace(&mut self.oneof_decl, ::protobuf::RepeatedField::new())
+ }
+
+ // optional .google.protobuf.MessageOptions options = 7;
+
+
+ pub fn get_options(&self) -> &MessageOptions {
+ self.options.as_ref().unwrap_or_else(|| MessageOptions::default_instance())
+ }
+ pub fn clear_options(&mut self) {
+ self.options.clear();
+ }
+
+ pub fn has_options(&self) -> bool {
+ self.options.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_options(&mut self, v: MessageOptions) {
+ self.options = ::protobuf::SingularPtrField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_options(&mut self) -> &mut MessageOptions {
+ if self.options.is_none() {
+ self.options.set_default();
+ }
+ self.options.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_options(&mut self) -> MessageOptions {
+ self.options.take().unwrap_or_else(|| MessageOptions::new())
+ }
+
+ // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;
+
+
+ pub fn get_reserved_range(&self) -> &[DescriptorProto_ReservedRange] {
+ &self.reserved_range
+ }
+ pub fn clear_reserved_range(&mut self) {
+ self.reserved_range.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_reserved_range(&mut self, v: ::protobuf::RepeatedField<DescriptorProto_ReservedRange>) {
+ self.reserved_range = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_reserved_range(&mut self) -> &mut ::protobuf::RepeatedField<DescriptorProto_ReservedRange> {
+ &mut self.reserved_range
+ }
+
+ // Take field
+ pub fn take_reserved_range(&mut self) -> ::protobuf::RepeatedField<DescriptorProto_ReservedRange> {
+ ::std::mem::replace(&mut self.reserved_range, ::protobuf::RepeatedField::new())
+ }
+
+ // repeated string reserved_name = 10;
+
+
+ pub fn get_reserved_name(&self) -> &[::std::string::String] {
+ &self.reserved_name
+ }
+ pub fn clear_reserved_name(&mut self) {
+ self.reserved_name.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_reserved_name(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) {
+ self.reserved_name = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_reserved_name(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> {
+ &mut self.reserved_name
+ }
+
+ // Take field
+ pub fn take_reserved_name(&mut self) -> ::protobuf::RepeatedField<::std::string::String> {
+ ::std::mem::replace(&mut self.reserved_name, ::protobuf::RepeatedField::new())
+ }
+}
+
+impl ::protobuf::Message for DescriptorProto {
+ fn is_initialized(&self) -> bool {
+ for v in &self.field {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.extension {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.nested_type {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.enum_type {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.extension_range {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.oneof_decl {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.options {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.reserved_range {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.name)?;
+ },
+ 2 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.field)?;
+ },
+ 6 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.extension)?;
+ },
+ 3 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.nested_type)?;
+ },
+ 4 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.enum_type)?;
+ },
+ 5 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.extension_range)?;
+ },
+ 8 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.oneof_decl)?;
+ },
+ 7 => {
+ ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.options)?;
+ },
+ 9 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.reserved_range)?;
+ },
+ 10 => {
+ ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.reserved_name)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(ref v) = self.name.as_ref() {
+ my_size += ::protobuf::rt::string_size(1, &v);
+ }
+ for value in &self.field {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ for value in &self.extension {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ for value in &self.nested_type {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ for value in &self.enum_type {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ for value in &self.extension_range {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ for value in &self.oneof_decl {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ if let Some(ref v) = self.options.as_ref() {
+ let len = v.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ }
+ for value in &self.reserved_range {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ for value in &self.reserved_name {
+ my_size += ::protobuf::rt::string_size(10, &value);
+ };
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(ref v) = self.name.as_ref() {
+ os.write_string(1, &v)?;
+ }
+ for v in &self.field {
+ os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ for v in &self.extension {
+ os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ for v in &self.nested_type {
+ os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ for v in &self.enum_type {
+ os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ for v in &self.extension_range {
+ os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ for v in &self.oneof_decl {
+ os.write_tag(8, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ if let Some(ref v) = self.options.as_ref() {
+ os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ }
+ for v in &self.reserved_range {
+ os.write_tag(9, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ for v in &self.reserved_name {
+ os.write_string(10, &v)?;
+ };
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> DescriptorProto {
+ DescriptorProto::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "name",
+ |m: &DescriptorProto| { &m.name },
+ |m: &mut DescriptorProto| { &mut m.name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<FieldDescriptorProto>>(
+ "field",
+ |m: &DescriptorProto| { &m.field },
+ |m: &mut DescriptorProto| { &mut m.field },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<FieldDescriptorProto>>(
+ "extension",
+ |m: &DescriptorProto| { &m.extension },
+ |m: &mut DescriptorProto| { &mut m.extension },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<DescriptorProto>>(
+ "nested_type",
+ |m: &DescriptorProto| { &m.nested_type },
+ |m: &mut DescriptorProto| { &mut m.nested_type },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<EnumDescriptorProto>>(
+ "enum_type",
+ |m: &DescriptorProto| { &m.enum_type },
+ |m: &mut DescriptorProto| { &mut m.enum_type },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<DescriptorProto_ExtensionRange>>(
+ "extension_range",
+ |m: &DescriptorProto| { &m.extension_range },
+ |m: &mut DescriptorProto| { &mut m.extension_range },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<OneofDescriptorProto>>(
+ "oneof_decl",
+ |m: &DescriptorProto| { &m.oneof_decl },
+ |m: &mut DescriptorProto| { &mut m.oneof_decl },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<MessageOptions>>(
+ "options",
+ |m: &DescriptorProto| { &m.options },
+ |m: &mut DescriptorProto| { &mut m.options },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<DescriptorProto_ReservedRange>>(
+ "reserved_range",
+ |m: &DescriptorProto| { &m.reserved_range },
+ |m: &mut DescriptorProto| { &mut m.reserved_range },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "reserved_name",
+ |m: &DescriptorProto| { &m.reserved_name },
+ |m: &mut DescriptorProto| { &mut m.reserved_name },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<DescriptorProto>(
+ "DescriptorProto",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static DescriptorProto {
+ static mut instance: ::protobuf::lazy::Lazy<DescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(DescriptorProto::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for DescriptorProto {
+ fn clear(&mut self) {
+ self.name.clear();
+ self.field.clear();
+ self.extension.clear();
+ self.nested_type.clear();
+ self.enum_type.clear();
+ self.extension_range.clear();
+ self.oneof_decl.clear();
+ self.options.clear();
+ self.reserved_range.clear();
+ self.reserved_name.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for DescriptorProto {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for DescriptorProto {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct DescriptorProto_ExtensionRange {
+ // message fields
+ start: ::std::option::Option<i32>,
+ end: ::std::option::Option<i32>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a DescriptorProto_ExtensionRange {
+ fn default() -> &'a DescriptorProto_ExtensionRange {
+ <DescriptorProto_ExtensionRange as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl DescriptorProto_ExtensionRange {
+ pub fn new() -> DescriptorProto_ExtensionRange {
+ ::std::default::Default::default()
+ }
+
+ // optional int32 start = 1;
+
+
+ pub fn get_start(&self) -> i32 {
+ self.start.unwrap_or(0)
+ }
+ pub fn clear_start(&mut self) {
+ self.start = ::std::option::Option::None;
+ }
+
+ pub fn has_start(&self) -> bool {
+ self.start.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_start(&mut self, v: i32) {
+ self.start = ::std::option::Option::Some(v);
+ }
+
+ // optional int32 end = 2;
+
+
+ pub fn get_end(&self) -> i32 {
+ self.end.unwrap_or(0)
+ }
+ pub fn clear_end(&mut self) {
+ self.end = ::std::option::Option::None;
+ }
+
+ pub fn has_end(&self) -> bool {
+ self.end.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_end(&mut self, v: i32) {
+ self.end = ::std::option::Option::Some(v);
+ }
+}
+
+impl ::protobuf::Message for DescriptorProto_ExtensionRange {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_int32()?;
+ self.start = ::std::option::Option::Some(tmp);
+ },
+ 2 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_int32()?;
+ self.end = ::std::option::Option::Some(tmp);
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(v) = self.start {
+ my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint);
+ }
+ if let Some(v) = self.end {
+ my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(v) = self.start {
+ os.write_int32(1, v)?;
+ }
+ if let Some(v) = self.end {
+ os.write_int32(2, v)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> DescriptorProto_ExtensionRange {
+ DescriptorProto_ExtensionRange::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "start",
+ |m: &DescriptorProto_ExtensionRange| { &m.start },
+ |m: &mut DescriptorProto_ExtensionRange| { &mut m.start },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "end",
+ |m: &DescriptorProto_ExtensionRange| { &m.end },
+ |m: &mut DescriptorProto_ExtensionRange| { &mut m.end },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<DescriptorProto_ExtensionRange>(
+ "DescriptorProto.ExtensionRange",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static DescriptorProto_ExtensionRange {
+ static mut instance: ::protobuf::lazy::Lazy<DescriptorProto_ExtensionRange> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(DescriptorProto_ExtensionRange::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for DescriptorProto_ExtensionRange {
+ fn clear(&mut self) {
+ self.start = ::std::option::Option::None;
+ self.end = ::std::option::Option::None;
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for DescriptorProto_ExtensionRange {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for DescriptorProto_ExtensionRange {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct DescriptorProto_ReservedRange {
+ // message fields
+ start: ::std::option::Option<i32>,
+ end: ::std::option::Option<i32>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a DescriptorProto_ReservedRange {
+ fn default() -> &'a DescriptorProto_ReservedRange {
+ <DescriptorProto_ReservedRange as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl DescriptorProto_ReservedRange {
+ pub fn new() -> DescriptorProto_ReservedRange {
+ ::std::default::Default::default()
+ }
+
+ // optional int32 start = 1;
+
+
+ pub fn get_start(&self) -> i32 {
+ self.start.unwrap_or(0)
+ }
+ pub fn clear_start(&mut self) {
+ self.start = ::std::option::Option::None;
+ }
+
+ pub fn has_start(&self) -> bool {
+ self.start.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_start(&mut self, v: i32) {
+ self.start = ::std::option::Option::Some(v);
+ }
+
+ // optional int32 end = 2;
+
+
+ pub fn get_end(&self) -> i32 {
+ self.end.unwrap_or(0)
+ }
+ pub fn clear_end(&mut self) {
+ self.end = ::std::option::Option::None;
+ }
+
+ pub fn has_end(&self) -> bool {
+ self.end.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_end(&mut self, v: i32) {
+ self.end = ::std::option::Option::Some(v);
+ }
+}
+
+impl ::protobuf::Message for DescriptorProto_ReservedRange {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_int32()?;
+ self.start = ::std::option::Option::Some(tmp);
+ },
+ 2 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_int32()?;
+ self.end = ::std::option::Option::Some(tmp);
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(v) = self.start {
+ my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint);
+ }
+ if let Some(v) = self.end {
+ my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(v) = self.start {
+ os.write_int32(1, v)?;
+ }
+ if let Some(v) = self.end {
+ os.write_int32(2, v)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> DescriptorProto_ReservedRange {
+ DescriptorProto_ReservedRange::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "start",
+ |m: &DescriptorProto_ReservedRange| { &m.start },
+ |m: &mut DescriptorProto_ReservedRange| { &mut m.start },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "end",
+ |m: &DescriptorProto_ReservedRange| { &m.end },
+ |m: &mut DescriptorProto_ReservedRange| { &mut m.end },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<DescriptorProto_ReservedRange>(
+ "DescriptorProto.ReservedRange",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static DescriptorProto_ReservedRange {
+ static mut instance: ::protobuf::lazy::Lazy<DescriptorProto_ReservedRange> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(DescriptorProto_ReservedRange::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for DescriptorProto_ReservedRange {
+ fn clear(&mut self) {
+ self.start = ::std::option::Option::None;
+ self.end = ::std::option::Option::None;
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for DescriptorProto_ReservedRange {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for DescriptorProto_ReservedRange {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct FieldDescriptorProto {
+ // message fields
+ name: ::protobuf::SingularField<::std::string::String>,
+ number: ::std::option::Option<i32>,
+ label: ::std::option::Option<FieldDescriptorProto_Label>,
+ field_type: ::std::option::Option<FieldDescriptorProto_Type>,
+ type_name: ::protobuf::SingularField<::std::string::String>,
+ extendee: ::protobuf::SingularField<::std::string::String>,
+ default_value: ::protobuf::SingularField<::std::string::String>,
+ oneof_index: ::std::option::Option<i32>,
+ json_name: ::protobuf::SingularField<::std::string::String>,
+ options: ::protobuf::SingularPtrField<FieldOptions>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a FieldDescriptorProto {
+ fn default() -> &'a FieldDescriptorProto {
+ <FieldDescriptorProto as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl FieldDescriptorProto {
+ pub fn new() -> FieldDescriptorProto {
+ ::std::default::Default::default()
+ }
+
+ // optional string name = 1;
+
+
+ pub fn get_name(&self) -> &str {
+ match self.name.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_name(&mut self) {
+ self.name.clear();
+ }
+
+ pub fn has_name(&self) -> bool {
+ self.name.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_name(&mut self, v: ::std::string::String) {
+ self.name = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_name(&mut self) -> &mut ::std::string::String {
+ if self.name.is_none() {
+ self.name.set_default();
+ }
+ self.name.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_name(&mut self) -> ::std::string::String {
+ self.name.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional int32 number = 3;
+
+
+ pub fn get_number(&self) -> i32 {
+ self.number.unwrap_or(0)
+ }
+ pub fn clear_number(&mut self) {
+ self.number = ::std::option::Option::None;
+ }
+
+ pub fn has_number(&self) -> bool {
+ self.number.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_number(&mut self, v: i32) {
+ self.number = ::std::option::Option::Some(v);
+ }
+
+ // optional .google.protobuf.FieldDescriptorProto.Label label = 4;
+
+
+ pub fn get_label(&self) -> FieldDescriptorProto_Label {
+ self.label.unwrap_or(FieldDescriptorProto_Label::LABEL_OPTIONAL)
+ }
+ pub fn clear_label(&mut self) {
+ self.label = ::std::option::Option::None;
+ }
+
+ pub fn has_label(&self) -> bool {
+ self.label.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_label(&mut self, v: FieldDescriptorProto_Label) {
+ self.label = ::std::option::Option::Some(v);
+ }
+
+ // optional .google.protobuf.FieldDescriptorProto.Type type = 5;
+
+
+ pub fn get_field_type(&self) -> FieldDescriptorProto_Type {
+ self.field_type.unwrap_or(FieldDescriptorProto_Type::TYPE_DOUBLE)
+ }
+ pub fn clear_field_type(&mut self) {
+ self.field_type = ::std::option::Option::None;
+ }
+
+ pub fn has_field_type(&self) -> bool {
+ self.field_type.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_field_type(&mut self, v: FieldDescriptorProto_Type) {
+ self.field_type = ::std::option::Option::Some(v);
+ }
+
+ // optional string type_name = 6;
+
+
+ pub fn get_type_name(&self) -> &str {
+ match self.type_name.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_type_name(&mut self) {
+ self.type_name.clear();
+ }
+
+ pub fn has_type_name(&self) -> bool {
+ self.type_name.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_type_name(&mut self, v: ::std::string::String) {
+ self.type_name = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_type_name(&mut self) -> &mut ::std::string::String {
+ if self.type_name.is_none() {
+ self.type_name.set_default();
+ }
+ self.type_name.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_type_name(&mut self) -> ::std::string::String {
+ self.type_name.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional string extendee = 2;
+
+
+ pub fn get_extendee(&self) -> &str {
+ match self.extendee.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_extendee(&mut self) {
+ self.extendee.clear();
+ }
+
+ pub fn has_extendee(&self) -> bool {
+ self.extendee.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_extendee(&mut self, v: ::std::string::String) {
+ self.extendee = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_extendee(&mut self) -> &mut ::std::string::String {
+ if self.extendee.is_none() {
+ self.extendee.set_default();
+ }
+ self.extendee.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_extendee(&mut self) -> ::std::string::String {
+ self.extendee.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional string default_value = 7;
+
+
+ pub fn get_default_value(&self) -> &str {
+ match self.default_value.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_default_value(&mut self) {
+ self.default_value.clear();
+ }
+
+ pub fn has_default_value(&self) -> bool {
+ self.default_value.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_default_value(&mut self, v: ::std::string::String) {
+ self.default_value = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_default_value(&mut self) -> &mut ::std::string::String {
+ if self.default_value.is_none() {
+ self.default_value.set_default();
+ }
+ self.default_value.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_default_value(&mut self) -> ::std::string::String {
+ self.default_value.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional int32 oneof_index = 9;
+
+
+ pub fn get_oneof_index(&self) -> i32 {
+ self.oneof_index.unwrap_or(0)
+ }
+ pub fn clear_oneof_index(&mut self) {
+ self.oneof_index = ::std::option::Option::None;
+ }
+
+ pub fn has_oneof_index(&self) -> bool {
+ self.oneof_index.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_oneof_index(&mut self, v: i32) {
+ self.oneof_index = ::std::option::Option::Some(v);
+ }
+
+ // optional string json_name = 10;
+
+
+ pub fn get_json_name(&self) -> &str {
+ match self.json_name.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_json_name(&mut self) {
+ self.json_name.clear();
+ }
+
+ pub fn has_json_name(&self) -> bool {
+ self.json_name.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_json_name(&mut self, v: ::std::string::String) {
+ self.json_name = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_json_name(&mut self) -> &mut ::std::string::String {
+ if self.json_name.is_none() {
+ self.json_name.set_default();
+ }
+ self.json_name.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_json_name(&mut self) -> ::std::string::String {
+ self.json_name.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional .google.protobuf.FieldOptions options = 8;
+
+
+ pub fn get_options(&self) -> &FieldOptions {
+ self.options.as_ref().unwrap_or_else(|| FieldOptions::default_instance())
+ }
+ pub fn clear_options(&mut self) {
+ self.options.clear();
+ }
+
+ pub fn has_options(&self) -> bool {
+ self.options.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_options(&mut self, v: FieldOptions) {
+ self.options = ::protobuf::SingularPtrField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_options(&mut self) -> &mut FieldOptions {
+ if self.options.is_none() {
+ self.options.set_default();
+ }
+ self.options.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_options(&mut self) -> FieldOptions {
+ self.options.take().unwrap_or_else(|| FieldOptions::new())
+ }
+}
+
+impl ::protobuf::Message for FieldDescriptorProto {
+ fn is_initialized(&self) -> bool {
+ for v in &self.options {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.name)?;
+ },
+ 3 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_int32()?;
+ self.number = ::std::option::Option::Some(tmp);
+ },
+ 4 => {
+ ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.label, 4, &mut self.unknown_fields)?
+ },
+ 5 => {
+ ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.field_type, 5, &mut self.unknown_fields)?
+ },
+ 6 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.type_name)?;
+ },
+ 2 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.extendee)?;
+ },
+ 7 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.default_value)?;
+ },
+ 9 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_int32()?;
+ self.oneof_index = ::std::option::Option::Some(tmp);
+ },
+ 10 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.json_name)?;
+ },
+ 8 => {
+ ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.options)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(ref v) = self.name.as_ref() {
+ my_size += ::protobuf::rt::string_size(1, &v);
+ }
+ if let Some(v) = self.number {
+ my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint);
+ }
+ if let Some(v) = self.label {
+ my_size += ::protobuf::rt::enum_size(4, v);
+ }
+ if let Some(v) = self.field_type {
+ my_size += ::protobuf::rt::enum_size(5, v);
+ }
+ if let Some(ref v) = self.type_name.as_ref() {
+ my_size += ::protobuf::rt::string_size(6, &v);
+ }
+ if let Some(ref v) = self.extendee.as_ref() {
+ my_size += ::protobuf::rt::string_size(2, &v);
+ }
+ if let Some(ref v) = self.default_value.as_ref() {
+ my_size += ::protobuf::rt::string_size(7, &v);
+ }
+ if let Some(v) = self.oneof_index {
+ my_size += ::protobuf::rt::value_size(9, v, ::protobuf::wire_format::WireTypeVarint);
+ }
+ if let Some(ref v) = self.json_name.as_ref() {
+ my_size += ::protobuf::rt::string_size(10, &v);
+ }
+ if let Some(ref v) = self.options.as_ref() {
+ let len = v.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(ref v) = self.name.as_ref() {
+ os.write_string(1, &v)?;
+ }
+ if let Some(v) = self.number {
+ os.write_int32(3, v)?;
+ }
+ if let Some(v) = self.label {
+ os.write_enum(4, v.value())?;
+ }
+ if let Some(v) = self.field_type {
+ os.write_enum(5, v.value())?;
+ }
+ if let Some(ref v) = self.type_name.as_ref() {
+ os.write_string(6, &v)?;
+ }
+ if let Some(ref v) = self.extendee.as_ref() {
+ os.write_string(2, &v)?;
+ }
+ if let Some(ref v) = self.default_value.as_ref() {
+ os.write_string(7, &v)?;
+ }
+ if let Some(v) = self.oneof_index {
+ os.write_int32(9, v)?;
+ }
+ if let Some(ref v) = self.json_name.as_ref() {
+ os.write_string(10, &v)?;
+ }
+ if let Some(ref v) = self.options.as_ref() {
+ os.write_tag(8, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> FieldDescriptorProto {
+ FieldDescriptorProto::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "name",
+ |m: &FieldDescriptorProto| { &m.name },
+ |m: &mut FieldDescriptorProto| { &mut m.name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "number",
+ |m: &FieldDescriptorProto| { &m.number },
+ |m: &mut FieldDescriptorProto| { &mut m.number },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum<FieldDescriptorProto_Label>>(
+ "label",
+ |m: &FieldDescriptorProto| { &m.label },
+ |m: &mut FieldDescriptorProto| { &mut m.label },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum<FieldDescriptorProto_Type>>(
+ "type",
+ |m: &FieldDescriptorProto| { &m.field_type },
+ |m: &mut FieldDescriptorProto| { &mut m.field_type },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "type_name",
+ |m: &FieldDescriptorProto| { &m.type_name },
+ |m: &mut FieldDescriptorProto| { &mut m.type_name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "extendee",
+ |m: &FieldDescriptorProto| { &m.extendee },
+ |m: &mut FieldDescriptorProto| { &mut m.extendee },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "default_value",
+ |m: &FieldDescriptorProto| { &m.default_value },
+ |m: &mut FieldDescriptorProto| { &mut m.default_value },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "oneof_index",
+ |m: &FieldDescriptorProto| { &m.oneof_index },
+ |m: &mut FieldDescriptorProto| { &mut m.oneof_index },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "json_name",
+ |m: &FieldDescriptorProto| { &m.json_name },
+ |m: &mut FieldDescriptorProto| { &mut m.json_name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<FieldOptions>>(
+ "options",
+ |m: &FieldDescriptorProto| { &m.options },
+ |m: &mut FieldDescriptorProto| { &mut m.options },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<FieldDescriptorProto>(
+ "FieldDescriptorProto",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static FieldDescriptorProto {
+ static mut instance: ::protobuf::lazy::Lazy<FieldDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(FieldDescriptorProto::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for FieldDescriptorProto {
+ fn clear(&mut self) {
+ self.name.clear();
+ self.number = ::std::option::Option::None;
+ self.label = ::std::option::Option::None;
+ self.field_type = ::std::option::Option::None;
+ self.type_name.clear();
+ self.extendee.clear();
+ self.default_value.clear();
+ self.oneof_index = ::std::option::Option::None;
+ self.json_name.clear();
+ self.options.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for FieldDescriptorProto {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for FieldDescriptorProto {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(Clone,PartialEq,Eq,Debug,Hash)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub enum FieldDescriptorProto_Type {
+ TYPE_DOUBLE = 1,
+ TYPE_FLOAT = 2,
+ TYPE_INT64 = 3,
+ TYPE_UINT64 = 4,
+ TYPE_INT32 = 5,
+ TYPE_FIXED64 = 6,
+ TYPE_FIXED32 = 7,
+ TYPE_BOOL = 8,
+ TYPE_STRING = 9,
+ TYPE_GROUP = 10,
+ TYPE_MESSAGE = 11,
+ TYPE_BYTES = 12,
+ TYPE_UINT32 = 13,
+ TYPE_ENUM = 14,
+ TYPE_SFIXED32 = 15,
+ TYPE_SFIXED64 = 16,
+ TYPE_SINT32 = 17,
+ TYPE_SINT64 = 18,
+}
+
+impl ::protobuf::ProtobufEnum for FieldDescriptorProto_Type {
+ fn value(&self) -> i32 {
+ *self as i32
+ }
+
+ fn from_i32(value: i32) -> ::std::option::Option<FieldDescriptorProto_Type> {
+ match value {
+ 1 => ::std::option::Option::Some(FieldDescriptorProto_Type::TYPE_DOUBLE),
+ 2 => ::std::option::Option::Some(FieldDescriptorProto_Type::TYPE_FLOAT),
+ 3 => ::std::option::Option::Some(FieldDescriptorProto_Type::TYPE_INT64),
+ 4 => ::std::option::Option::Some(FieldDescriptorProto_Type::TYPE_UINT64),
+ 5 => ::std::option::Option::Some(FieldDescriptorProto_Type::TYPE_INT32),
+ 6 => ::std::option::Option::Some(FieldDescriptorProto_Type::TYPE_FIXED64),
+ 7 => ::std::option::Option::Some(FieldDescriptorProto_Type::TYPE_FIXED32),
+ 8 => ::std::option::Option::Some(FieldDescriptorProto_Type::TYPE_BOOL),
+ 9 => ::std::option::Option::Some(FieldDescriptorProto_Type::TYPE_STRING),
+ 10 => ::std::option::Option::Some(FieldDescriptorProto_Type::TYPE_GROUP),
+ 11 => ::std::option::Option::Some(FieldDescriptorProto_Type::TYPE_MESSAGE),
+ 12 => ::std::option::Option::Some(FieldDescriptorProto_Type::TYPE_BYTES),
+ 13 => ::std::option::Option::Some(FieldDescriptorProto_Type::TYPE_UINT32),
+ 14 => ::std::option::Option::Some(FieldDescriptorProto_Type::TYPE_ENUM),
+ 15 => ::std::option::Option::Some(FieldDescriptorProto_Type::TYPE_SFIXED32),
+ 16 => ::std::option::Option::Some(FieldDescriptorProto_Type::TYPE_SFIXED64),
+ 17 => ::std::option::Option::Some(FieldDescriptorProto_Type::TYPE_SINT32),
+ 18 => ::std::option::Option::Some(FieldDescriptorProto_Type::TYPE_SINT64),
+ _ => ::std::option::Option::None
+ }
+ }
+
+ fn values() -> &'static [Self] {
+ static values: &'static [FieldDescriptorProto_Type] = &[
+ FieldDescriptorProto_Type::TYPE_DOUBLE,
+ FieldDescriptorProto_Type::TYPE_FLOAT,
+ FieldDescriptorProto_Type::TYPE_INT64,
+ FieldDescriptorProto_Type::TYPE_UINT64,
+ FieldDescriptorProto_Type::TYPE_INT32,
+ FieldDescriptorProto_Type::TYPE_FIXED64,
+ FieldDescriptorProto_Type::TYPE_FIXED32,
+ FieldDescriptorProto_Type::TYPE_BOOL,
+ FieldDescriptorProto_Type::TYPE_STRING,
+ FieldDescriptorProto_Type::TYPE_GROUP,
+ FieldDescriptorProto_Type::TYPE_MESSAGE,
+ FieldDescriptorProto_Type::TYPE_BYTES,
+ FieldDescriptorProto_Type::TYPE_UINT32,
+ FieldDescriptorProto_Type::TYPE_ENUM,
+ FieldDescriptorProto_Type::TYPE_SFIXED32,
+ FieldDescriptorProto_Type::TYPE_SFIXED64,
+ FieldDescriptorProto_Type::TYPE_SINT32,
+ FieldDescriptorProto_Type::TYPE_SINT64,
+ ];
+ values
+ }
+
+ fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ ::protobuf::reflect::EnumDescriptor::new_pb_name::<FieldDescriptorProto_Type>("FieldDescriptorProto.Type", file_descriptor_proto())
+ })
+ }
+ }
+}
+
+impl ::std::marker::Copy for FieldDescriptorProto_Type {
+}
+
+// Note, `Default` is implemented although default value is not 0
+impl ::std::default::Default for FieldDescriptorProto_Type {
+ fn default() -> Self {
+ FieldDescriptorProto_Type::TYPE_DOUBLE
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for FieldDescriptorProto_Type {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Enum(self.descriptor())
+ }
+}
+
+#[derive(Clone,PartialEq,Eq,Debug,Hash)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub enum FieldDescriptorProto_Label {
+ LABEL_OPTIONAL = 1,
+ LABEL_REQUIRED = 2,
+ LABEL_REPEATED = 3,
+}
+
+impl ::protobuf::ProtobufEnum for FieldDescriptorProto_Label {
+ fn value(&self) -> i32 {
+ *self as i32
+ }
+
+ fn from_i32(value: i32) -> ::std::option::Option<FieldDescriptorProto_Label> {
+ match value {
+ 1 => ::std::option::Option::Some(FieldDescriptorProto_Label::LABEL_OPTIONAL),
+ 2 => ::std::option::Option::Some(FieldDescriptorProto_Label::LABEL_REQUIRED),
+ 3 => ::std::option::Option::Some(FieldDescriptorProto_Label::LABEL_REPEATED),
+ _ => ::std::option::Option::None
+ }
+ }
+
+ fn values() -> &'static [Self] {
+ static values: &'static [FieldDescriptorProto_Label] = &[
+ FieldDescriptorProto_Label::LABEL_OPTIONAL,
+ FieldDescriptorProto_Label::LABEL_REQUIRED,
+ FieldDescriptorProto_Label::LABEL_REPEATED,
+ ];
+ values
+ }
+
+ fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ ::protobuf::reflect::EnumDescriptor::new_pb_name::<FieldDescriptorProto_Label>("FieldDescriptorProto.Label", file_descriptor_proto())
+ })
+ }
+ }
+}
+
+impl ::std::marker::Copy for FieldDescriptorProto_Label {
+}
+
+// Note, `Default` is implemented although default value is not 0
+impl ::std::default::Default for FieldDescriptorProto_Label {
+ fn default() -> Self {
+ FieldDescriptorProto_Label::LABEL_OPTIONAL
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for FieldDescriptorProto_Label {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Enum(self.descriptor())
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct OneofDescriptorProto {
+ // message fields
+ name: ::protobuf::SingularField<::std::string::String>,
+ options: ::protobuf::SingularPtrField<OneofOptions>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a OneofDescriptorProto {
+ fn default() -> &'a OneofDescriptorProto {
+ <OneofDescriptorProto as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl OneofDescriptorProto {
+ pub fn new() -> OneofDescriptorProto {
+ ::std::default::Default::default()
+ }
+
+ // optional string name = 1;
+
+
+ pub fn get_name(&self) -> &str {
+ match self.name.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_name(&mut self) {
+ self.name.clear();
+ }
+
+ pub fn has_name(&self) -> bool {
+ self.name.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_name(&mut self, v: ::std::string::String) {
+ self.name = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_name(&mut self) -> &mut ::std::string::String {
+ if self.name.is_none() {
+ self.name.set_default();
+ }
+ self.name.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_name(&mut self) -> ::std::string::String {
+ self.name.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional .google.protobuf.OneofOptions options = 2;
+
+
+ pub fn get_options(&self) -> &OneofOptions {
+ self.options.as_ref().unwrap_or_else(|| OneofOptions::default_instance())
+ }
+ pub fn clear_options(&mut self) {
+ self.options.clear();
+ }
+
+ pub fn has_options(&self) -> bool {
+ self.options.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_options(&mut self, v: OneofOptions) {
+ self.options = ::protobuf::SingularPtrField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_options(&mut self) -> &mut OneofOptions {
+ if self.options.is_none() {
+ self.options.set_default();
+ }
+ self.options.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_options(&mut self) -> OneofOptions {
+ self.options.take().unwrap_or_else(|| OneofOptions::new())
+ }
+}
+
+impl ::protobuf::Message for OneofDescriptorProto {
+ fn is_initialized(&self) -> bool {
+ for v in &self.options {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.name)?;
+ },
+ 2 => {
+ ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.options)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(ref v) = self.name.as_ref() {
+ my_size += ::protobuf::rt::string_size(1, &v);
+ }
+ if let Some(ref v) = self.options.as_ref() {
+ let len = v.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(ref v) = self.name.as_ref() {
+ os.write_string(1, &v)?;
+ }
+ if let Some(ref v) = self.options.as_ref() {
+ os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> OneofDescriptorProto {
+ OneofDescriptorProto::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "name",
+ |m: &OneofDescriptorProto| { &m.name },
+ |m: &mut OneofDescriptorProto| { &mut m.name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<OneofOptions>>(
+ "options",
+ |m: &OneofDescriptorProto| { &m.options },
+ |m: &mut OneofDescriptorProto| { &mut m.options },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<OneofDescriptorProto>(
+ "OneofDescriptorProto",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static OneofDescriptorProto {
+ static mut instance: ::protobuf::lazy::Lazy<OneofDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(OneofDescriptorProto::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for OneofDescriptorProto {
+ fn clear(&mut self) {
+ self.name.clear();
+ self.options.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for OneofDescriptorProto {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for OneofDescriptorProto {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct EnumDescriptorProto {
+ // message fields
+ name: ::protobuf::SingularField<::std::string::String>,
+ value: ::protobuf::RepeatedField<EnumValueDescriptorProto>,
+ options: ::protobuf::SingularPtrField<EnumOptions>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a EnumDescriptorProto {
+ fn default() -> &'a EnumDescriptorProto {
+ <EnumDescriptorProto as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl EnumDescriptorProto {
+ pub fn new() -> EnumDescriptorProto {
+ ::std::default::Default::default()
+ }
+
+ // optional string name = 1;
+
+
+ pub fn get_name(&self) -> &str {
+ match self.name.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_name(&mut self) {
+ self.name.clear();
+ }
+
+ pub fn has_name(&self) -> bool {
+ self.name.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_name(&mut self, v: ::std::string::String) {
+ self.name = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_name(&mut self) -> &mut ::std::string::String {
+ if self.name.is_none() {
+ self.name.set_default();
+ }
+ self.name.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_name(&mut self) -> ::std::string::String {
+ self.name.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // repeated .google.protobuf.EnumValueDescriptorProto value = 2;
+
+
+ pub fn get_value(&self) -> &[EnumValueDescriptorProto] {
+ &self.value
+ }
+ pub fn clear_value(&mut self) {
+ self.value.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_value(&mut self, v: ::protobuf::RepeatedField<EnumValueDescriptorProto>) {
+ self.value = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_value(&mut self) -> &mut ::protobuf::RepeatedField<EnumValueDescriptorProto> {
+ &mut self.value
+ }
+
+ // Take field
+ pub fn take_value(&mut self) -> ::protobuf::RepeatedField<EnumValueDescriptorProto> {
+ ::std::mem::replace(&mut self.value, ::protobuf::RepeatedField::new())
+ }
+
+ // optional .google.protobuf.EnumOptions options = 3;
+
+
+ pub fn get_options(&self) -> &EnumOptions {
+ self.options.as_ref().unwrap_or_else(|| EnumOptions::default_instance())
+ }
+ pub fn clear_options(&mut self) {
+ self.options.clear();
+ }
+
+ pub fn has_options(&self) -> bool {
+ self.options.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_options(&mut self, v: EnumOptions) {
+ self.options = ::protobuf::SingularPtrField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_options(&mut self) -> &mut EnumOptions {
+ if self.options.is_none() {
+ self.options.set_default();
+ }
+ self.options.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_options(&mut self) -> EnumOptions {
+ self.options.take().unwrap_or_else(|| EnumOptions::new())
+ }
+}
+
+impl ::protobuf::Message for EnumDescriptorProto {
+ fn is_initialized(&self) -> bool {
+ for v in &self.value {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.options {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.name)?;
+ },
+ 2 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.value)?;
+ },
+ 3 => {
+ ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.options)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(ref v) = self.name.as_ref() {
+ my_size += ::protobuf::rt::string_size(1, &v);
+ }
+ for value in &self.value {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ if let Some(ref v) = self.options.as_ref() {
+ let len = v.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(ref v) = self.name.as_ref() {
+ os.write_string(1, &v)?;
+ }
+ for v in &self.value {
+ os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ if let Some(ref v) = self.options.as_ref() {
+ os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> EnumDescriptorProto {
+ EnumDescriptorProto::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "name",
+ |m: &EnumDescriptorProto| { &m.name },
+ |m: &mut EnumDescriptorProto| { &mut m.name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<EnumValueDescriptorProto>>(
+ "value",
+ |m: &EnumDescriptorProto| { &m.value },
+ |m: &mut EnumDescriptorProto| { &mut m.value },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<EnumOptions>>(
+ "options",
+ |m: &EnumDescriptorProto| { &m.options },
+ |m: &mut EnumDescriptorProto| { &mut m.options },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<EnumDescriptorProto>(
+ "EnumDescriptorProto",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static EnumDescriptorProto {
+ static mut instance: ::protobuf::lazy::Lazy<EnumDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(EnumDescriptorProto::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for EnumDescriptorProto {
+ fn clear(&mut self) {
+ self.name.clear();
+ self.value.clear();
+ self.options.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for EnumDescriptorProto {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for EnumDescriptorProto {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct EnumValueDescriptorProto {
+ // message fields
+ name: ::protobuf::SingularField<::std::string::String>,
+ number: ::std::option::Option<i32>,
+ options: ::protobuf::SingularPtrField<EnumValueOptions>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a EnumValueDescriptorProto {
+ fn default() -> &'a EnumValueDescriptorProto {
+ <EnumValueDescriptorProto as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl EnumValueDescriptorProto {
+ pub fn new() -> EnumValueDescriptorProto {
+ ::std::default::Default::default()
+ }
+
+ // optional string name = 1;
+
+
+ pub fn get_name(&self) -> &str {
+ match self.name.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_name(&mut self) {
+ self.name.clear();
+ }
+
+ pub fn has_name(&self) -> bool {
+ self.name.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_name(&mut self, v: ::std::string::String) {
+ self.name = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_name(&mut self) -> &mut ::std::string::String {
+ if self.name.is_none() {
+ self.name.set_default();
+ }
+ self.name.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_name(&mut self) -> ::std::string::String {
+ self.name.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional int32 number = 2;
+
+
+ pub fn get_number(&self) -> i32 {
+ self.number.unwrap_or(0)
+ }
+ pub fn clear_number(&mut self) {
+ self.number = ::std::option::Option::None;
+ }
+
+ pub fn has_number(&self) -> bool {
+ self.number.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_number(&mut self, v: i32) {
+ self.number = ::std::option::Option::Some(v);
+ }
+
+ // optional .google.protobuf.EnumValueOptions options = 3;
+
+
+ pub fn get_options(&self) -> &EnumValueOptions {
+ self.options.as_ref().unwrap_or_else(|| EnumValueOptions::default_instance())
+ }
+ pub fn clear_options(&mut self) {
+ self.options.clear();
+ }
+
+ pub fn has_options(&self) -> bool {
+ self.options.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_options(&mut self, v: EnumValueOptions) {
+ self.options = ::protobuf::SingularPtrField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_options(&mut self) -> &mut EnumValueOptions {
+ if self.options.is_none() {
+ self.options.set_default();
+ }
+ self.options.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_options(&mut self) -> EnumValueOptions {
+ self.options.take().unwrap_or_else(|| EnumValueOptions::new())
+ }
+}
+
+impl ::protobuf::Message for EnumValueDescriptorProto {
+ fn is_initialized(&self) -> bool {
+ for v in &self.options {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.name)?;
+ },
+ 2 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_int32()?;
+ self.number = ::std::option::Option::Some(tmp);
+ },
+ 3 => {
+ ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.options)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(ref v) = self.name.as_ref() {
+ my_size += ::protobuf::rt::string_size(1, &v);
+ }
+ if let Some(v) = self.number {
+ my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint);
+ }
+ if let Some(ref v) = self.options.as_ref() {
+ let len = v.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(ref v) = self.name.as_ref() {
+ os.write_string(1, &v)?;
+ }
+ if let Some(v) = self.number {
+ os.write_int32(2, v)?;
+ }
+ if let Some(ref v) = self.options.as_ref() {
+ os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> EnumValueDescriptorProto {
+ EnumValueDescriptorProto::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "name",
+ |m: &EnumValueDescriptorProto| { &m.name },
+ |m: &mut EnumValueDescriptorProto| { &mut m.name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "number",
+ |m: &EnumValueDescriptorProto| { &m.number },
+ |m: &mut EnumValueDescriptorProto| { &mut m.number },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<EnumValueOptions>>(
+ "options",
+ |m: &EnumValueDescriptorProto| { &m.options },
+ |m: &mut EnumValueDescriptorProto| { &mut m.options },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<EnumValueDescriptorProto>(
+ "EnumValueDescriptorProto",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static EnumValueDescriptorProto {
+ static mut instance: ::protobuf::lazy::Lazy<EnumValueDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(EnumValueDescriptorProto::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for EnumValueDescriptorProto {
+ fn clear(&mut self) {
+ self.name.clear();
+ self.number = ::std::option::Option::None;
+ self.options.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for EnumValueDescriptorProto {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for EnumValueDescriptorProto {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct ServiceDescriptorProto {
+ // message fields
+ name: ::protobuf::SingularField<::std::string::String>,
+ method: ::protobuf::RepeatedField<MethodDescriptorProto>,
+ options: ::protobuf::SingularPtrField<ServiceOptions>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a ServiceDescriptorProto {
+ fn default() -> &'a ServiceDescriptorProto {
+ <ServiceDescriptorProto as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl ServiceDescriptorProto {
+ pub fn new() -> ServiceDescriptorProto {
+ ::std::default::Default::default()
+ }
+
+ // optional string name = 1;
+
+
+ pub fn get_name(&self) -> &str {
+ match self.name.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_name(&mut self) {
+ self.name.clear();
+ }
+
+ pub fn has_name(&self) -> bool {
+ self.name.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_name(&mut self, v: ::std::string::String) {
+ self.name = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_name(&mut self) -> &mut ::std::string::String {
+ if self.name.is_none() {
+ self.name.set_default();
+ }
+ self.name.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_name(&mut self) -> ::std::string::String {
+ self.name.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // repeated .google.protobuf.MethodDescriptorProto method = 2;
+
+
+ pub fn get_method(&self) -> &[MethodDescriptorProto] {
+ &self.method
+ }
+ pub fn clear_method(&mut self) {
+ self.method.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_method(&mut self, v: ::protobuf::RepeatedField<MethodDescriptorProto>) {
+ self.method = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_method(&mut self) -> &mut ::protobuf::RepeatedField<MethodDescriptorProto> {
+ &mut self.method
+ }
+
+ // Take field
+ pub fn take_method(&mut self) -> ::protobuf::RepeatedField<MethodDescriptorProto> {
+ ::std::mem::replace(&mut self.method, ::protobuf::RepeatedField::new())
+ }
+
+ // optional .google.protobuf.ServiceOptions options = 3;
+
+
+ pub fn get_options(&self) -> &ServiceOptions {
+ self.options.as_ref().unwrap_or_else(|| ServiceOptions::default_instance())
+ }
+ pub fn clear_options(&mut self) {
+ self.options.clear();
+ }
+
+ pub fn has_options(&self) -> bool {
+ self.options.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_options(&mut self, v: ServiceOptions) {
+ self.options = ::protobuf::SingularPtrField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_options(&mut self) -> &mut ServiceOptions {
+ if self.options.is_none() {
+ self.options.set_default();
+ }
+ self.options.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_options(&mut self) -> ServiceOptions {
+ self.options.take().unwrap_or_else(|| ServiceOptions::new())
+ }
+}
+
+impl ::protobuf::Message for ServiceDescriptorProto {
+ fn is_initialized(&self) -> bool {
+ for v in &self.method {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.options {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.name)?;
+ },
+ 2 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.method)?;
+ },
+ 3 => {
+ ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.options)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(ref v) = self.name.as_ref() {
+ my_size += ::protobuf::rt::string_size(1, &v);
+ }
+ for value in &self.method {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ if let Some(ref v) = self.options.as_ref() {
+ let len = v.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(ref v) = self.name.as_ref() {
+ os.write_string(1, &v)?;
+ }
+ for v in &self.method {
+ os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ if let Some(ref v) = self.options.as_ref() {
+ os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> ServiceDescriptorProto {
+ ServiceDescriptorProto::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "name",
+ |m: &ServiceDescriptorProto| { &m.name },
+ |m: &mut ServiceDescriptorProto| { &mut m.name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<MethodDescriptorProto>>(
+ "method",
+ |m: &ServiceDescriptorProto| { &m.method },
+ |m: &mut ServiceDescriptorProto| { &mut m.method },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<ServiceOptions>>(
+ "options",
+ |m: &ServiceDescriptorProto| { &m.options },
+ |m: &mut ServiceDescriptorProto| { &mut m.options },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<ServiceDescriptorProto>(
+ "ServiceDescriptorProto",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static ServiceDescriptorProto {
+ static mut instance: ::protobuf::lazy::Lazy<ServiceDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(ServiceDescriptorProto::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for ServiceDescriptorProto {
+ fn clear(&mut self) {
+ self.name.clear();
+ self.method.clear();
+ self.options.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for ServiceDescriptorProto {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for ServiceDescriptorProto {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct MethodDescriptorProto {
+ // message fields
+ name: ::protobuf::SingularField<::std::string::String>,
+ input_type: ::protobuf::SingularField<::std::string::String>,
+ output_type: ::protobuf::SingularField<::std::string::String>,
+ options: ::protobuf::SingularPtrField<MethodOptions>,
+ client_streaming: ::std::option::Option<bool>,
+ server_streaming: ::std::option::Option<bool>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a MethodDescriptorProto {
+ fn default() -> &'a MethodDescriptorProto {
+ <MethodDescriptorProto as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl MethodDescriptorProto {
+ pub fn new() -> MethodDescriptorProto {
+ ::std::default::Default::default()
+ }
+
+ // optional string name = 1;
+
+
+ pub fn get_name(&self) -> &str {
+ match self.name.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_name(&mut self) {
+ self.name.clear();
+ }
+
+ pub fn has_name(&self) -> bool {
+ self.name.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_name(&mut self, v: ::std::string::String) {
+ self.name = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_name(&mut self) -> &mut ::std::string::String {
+ if self.name.is_none() {
+ self.name.set_default();
+ }
+ self.name.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_name(&mut self) -> ::std::string::String {
+ self.name.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional string input_type = 2;
+
+
+ pub fn get_input_type(&self) -> &str {
+ match self.input_type.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_input_type(&mut self) {
+ self.input_type.clear();
+ }
+
+ pub fn has_input_type(&self) -> bool {
+ self.input_type.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_input_type(&mut self, v: ::std::string::String) {
+ self.input_type = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_input_type(&mut self) -> &mut ::std::string::String {
+ if self.input_type.is_none() {
+ self.input_type.set_default();
+ }
+ self.input_type.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_input_type(&mut self) -> ::std::string::String {
+ self.input_type.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional string output_type = 3;
+
+
+ pub fn get_output_type(&self) -> &str {
+ match self.output_type.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_output_type(&mut self) {
+ self.output_type.clear();
+ }
+
+ pub fn has_output_type(&self) -> bool {
+ self.output_type.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_output_type(&mut self, v: ::std::string::String) {
+ self.output_type = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_output_type(&mut self) -> &mut ::std::string::String {
+ if self.output_type.is_none() {
+ self.output_type.set_default();
+ }
+ self.output_type.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_output_type(&mut self) -> ::std::string::String {
+ self.output_type.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional .google.protobuf.MethodOptions options = 4;
+
+
+ pub fn get_options(&self) -> &MethodOptions {
+ self.options.as_ref().unwrap_or_else(|| MethodOptions::default_instance())
+ }
+ pub fn clear_options(&mut self) {
+ self.options.clear();
+ }
+
+ pub fn has_options(&self) -> bool {
+ self.options.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_options(&mut self, v: MethodOptions) {
+ self.options = ::protobuf::SingularPtrField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_options(&mut self) -> &mut MethodOptions {
+ if self.options.is_none() {
+ self.options.set_default();
+ }
+ self.options.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_options(&mut self) -> MethodOptions {
+ self.options.take().unwrap_or_else(|| MethodOptions::new())
+ }
+
+ // optional bool client_streaming = 5;
+
+
+ pub fn get_client_streaming(&self) -> bool {
+ self.client_streaming.unwrap_or(false)
+ }
+ pub fn clear_client_streaming(&mut self) {
+ self.client_streaming = ::std::option::Option::None;
+ }
+
+ pub fn has_client_streaming(&self) -> bool {
+ self.client_streaming.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_client_streaming(&mut self, v: bool) {
+ self.client_streaming = ::std::option::Option::Some(v);
+ }
+
+ // optional bool server_streaming = 6;
+
+
+ pub fn get_server_streaming(&self) -> bool {
+ self.server_streaming.unwrap_or(false)
+ }
+ pub fn clear_server_streaming(&mut self) {
+ self.server_streaming = ::std::option::Option::None;
+ }
+
+ pub fn has_server_streaming(&self) -> bool {
+ self.server_streaming.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_server_streaming(&mut self, v: bool) {
+ self.server_streaming = ::std::option::Option::Some(v);
+ }
+}
+
+impl ::protobuf::Message for MethodDescriptorProto {
+ fn is_initialized(&self) -> bool {
+ for v in &self.options {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.name)?;
+ },
+ 2 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.input_type)?;
+ },
+ 3 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.output_type)?;
+ },
+ 4 => {
+ ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.options)?;
+ },
+ 5 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.client_streaming = ::std::option::Option::Some(tmp);
+ },
+ 6 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.server_streaming = ::std::option::Option::Some(tmp);
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(ref v) = self.name.as_ref() {
+ my_size += ::protobuf::rt::string_size(1, &v);
+ }
+ if let Some(ref v) = self.input_type.as_ref() {
+ my_size += ::protobuf::rt::string_size(2, &v);
+ }
+ if let Some(ref v) = self.output_type.as_ref() {
+ my_size += ::protobuf::rt::string_size(3, &v);
+ }
+ if let Some(ref v) = self.options.as_ref() {
+ let len = v.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ }
+ if let Some(v) = self.client_streaming {
+ my_size += 2;
+ }
+ if let Some(v) = self.server_streaming {
+ my_size += 2;
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(ref v) = self.name.as_ref() {
+ os.write_string(1, &v)?;
+ }
+ if let Some(ref v) = self.input_type.as_ref() {
+ os.write_string(2, &v)?;
+ }
+ if let Some(ref v) = self.output_type.as_ref() {
+ os.write_string(3, &v)?;
+ }
+ if let Some(ref v) = self.options.as_ref() {
+ os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ }
+ if let Some(v) = self.client_streaming {
+ os.write_bool(5, v)?;
+ }
+ if let Some(v) = self.server_streaming {
+ os.write_bool(6, v)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> MethodDescriptorProto {
+ MethodDescriptorProto::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "name",
+ |m: &MethodDescriptorProto| { &m.name },
+ |m: &mut MethodDescriptorProto| { &mut m.name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "input_type",
+ |m: &MethodDescriptorProto| { &m.input_type },
+ |m: &mut MethodDescriptorProto| { &mut m.input_type },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "output_type",
+ |m: &MethodDescriptorProto| { &m.output_type },
+ |m: &mut MethodDescriptorProto| { &mut m.output_type },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<MethodOptions>>(
+ "options",
+ |m: &MethodDescriptorProto| { &m.options },
+ |m: &mut MethodDescriptorProto| { &mut m.options },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "client_streaming",
+ |m: &MethodDescriptorProto| { &m.client_streaming },
+ |m: &mut MethodDescriptorProto| { &mut m.client_streaming },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "server_streaming",
+ |m: &MethodDescriptorProto| { &m.server_streaming },
+ |m: &mut MethodDescriptorProto| { &mut m.server_streaming },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<MethodDescriptorProto>(
+ "MethodDescriptorProto",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static MethodDescriptorProto {
+ static mut instance: ::protobuf::lazy::Lazy<MethodDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(MethodDescriptorProto::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for MethodDescriptorProto {
+ fn clear(&mut self) {
+ self.name.clear();
+ self.input_type.clear();
+ self.output_type.clear();
+ self.options.clear();
+ self.client_streaming = ::std::option::Option::None;
+ self.server_streaming = ::std::option::Option::None;
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for MethodDescriptorProto {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for MethodDescriptorProto {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct FileOptions {
+ // message fields
+ java_package: ::protobuf::SingularField<::std::string::String>,
+ java_outer_classname: ::protobuf::SingularField<::std::string::String>,
+ java_multiple_files: ::std::option::Option<bool>,
+ java_generate_equals_and_hash: ::std::option::Option<bool>,
+ java_string_check_utf8: ::std::option::Option<bool>,
+ optimize_for: ::std::option::Option<FileOptions_OptimizeMode>,
+ go_package: ::protobuf::SingularField<::std::string::String>,
+ cc_generic_services: ::std::option::Option<bool>,
+ java_generic_services: ::std::option::Option<bool>,
+ py_generic_services: ::std::option::Option<bool>,
+ deprecated: ::std::option::Option<bool>,
+ cc_enable_arenas: ::std::option::Option<bool>,
+ objc_class_prefix: ::protobuf::SingularField<::std::string::String>,
+ csharp_namespace: ::protobuf::SingularField<::std::string::String>,
+ uninterpreted_option: ::protobuf::RepeatedField<UninterpretedOption>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a FileOptions {
+ fn default() -> &'a FileOptions {
+ <FileOptions as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl FileOptions {
+ pub fn new() -> FileOptions {
+ ::std::default::Default::default()
+ }
+
+ // optional string java_package = 1;
+
+
+ pub fn get_java_package(&self) -> &str {
+ match self.java_package.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_java_package(&mut self) {
+ self.java_package.clear();
+ }
+
+ pub fn has_java_package(&self) -> bool {
+ self.java_package.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_java_package(&mut self, v: ::std::string::String) {
+ self.java_package = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_java_package(&mut self) -> &mut ::std::string::String {
+ if self.java_package.is_none() {
+ self.java_package.set_default();
+ }
+ self.java_package.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_java_package(&mut self) -> ::std::string::String {
+ self.java_package.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional string java_outer_classname = 8;
+
+
+ pub fn get_java_outer_classname(&self) -> &str {
+ match self.java_outer_classname.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_java_outer_classname(&mut self) {
+ self.java_outer_classname.clear();
+ }
+
+ pub fn has_java_outer_classname(&self) -> bool {
+ self.java_outer_classname.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_java_outer_classname(&mut self, v: ::std::string::String) {
+ self.java_outer_classname = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_java_outer_classname(&mut self) -> &mut ::std::string::String {
+ if self.java_outer_classname.is_none() {
+ self.java_outer_classname.set_default();
+ }
+ self.java_outer_classname.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_java_outer_classname(&mut self) -> ::std::string::String {
+ self.java_outer_classname.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional bool java_multiple_files = 10;
+
+
+ pub fn get_java_multiple_files(&self) -> bool {
+ self.java_multiple_files.unwrap_or(false)
+ }
+ pub fn clear_java_multiple_files(&mut self) {
+ self.java_multiple_files = ::std::option::Option::None;
+ }
+
+ pub fn has_java_multiple_files(&self) -> bool {
+ self.java_multiple_files.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_java_multiple_files(&mut self, v: bool) {
+ self.java_multiple_files = ::std::option::Option::Some(v);
+ }
+
+ // optional bool java_generate_equals_and_hash = 20;
+
+
+ pub fn get_java_generate_equals_and_hash(&self) -> bool {
+ self.java_generate_equals_and_hash.unwrap_or(false)
+ }
+ pub fn clear_java_generate_equals_and_hash(&mut self) {
+ self.java_generate_equals_and_hash = ::std::option::Option::None;
+ }
+
+ pub fn has_java_generate_equals_and_hash(&self) -> bool {
+ self.java_generate_equals_and_hash.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_java_generate_equals_and_hash(&mut self, v: bool) {
+ self.java_generate_equals_and_hash = ::std::option::Option::Some(v);
+ }
+
+ // optional bool java_string_check_utf8 = 27;
+
+
+ pub fn get_java_string_check_utf8(&self) -> bool {
+ self.java_string_check_utf8.unwrap_or(false)
+ }
+ pub fn clear_java_string_check_utf8(&mut self) {
+ self.java_string_check_utf8 = ::std::option::Option::None;
+ }
+
+ pub fn has_java_string_check_utf8(&self) -> bool {
+ self.java_string_check_utf8.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_java_string_check_utf8(&mut self, v: bool) {
+ self.java_string_check_utf8 = ::std::option::Option::Some(v);
+ }
+
+ // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9;
+
+
+ pub fn get_optimize_for(&self) -> FileOptions_OptimizeMode {
+ self.optimize_for.unwrap_or(FileOptions_OptimizeMode::SPEED)
+ }
+ pub fn clear_optimize_for(&mut self) {
+ self.optimize_for = ::std::option::Option::None;
+ }
+
+ pub fn has_optimize_for(&self) -> bool {
+ self.optimize_for.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_optimize_for(&mut self, v: FileOptions_OptimizeMode) {
+ self.optimize_for = ::std::option::Option::Some(v);
+ }
+
+ // optional string go_package = 11;
+
+
+ pub fn get_go_package(&self) -> &str {
+ match self.go_package.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_go_package(&mut self) {
+ self.go_package.clear();
+ }
+
+ pub fn has_go_package(&self) -> bool {
+ self.go_package.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_go_package(&mut self, v: ::std::string::String) {
+ self.go_package = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_go_package(&mut self) -> &mut ::std::string::String {
+ if self.go_package.is_none() {
+ self.go_package.set_default();
+ }
+ self.go_package.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_go_package(&mut self) -> ::std::string::String {
+ self.go_package.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional bool cc_generic_services = 16;
+
+
+ pub fn get_cc_generic_services(&self) -> bool {
+ self.cc_generic_services.unwrap_or(false)
+ }
+ pub fn clear_cc_generic_services(&mut self) {
+ self.cc_generic_services = ::std::option::Option::None;
+ }
+
+ pub fn has_cc_generic_services(&self) -> bool {
+ self.cc_generic_services.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_cc_generic_services(&mut self, v: bool) {
+ self.cc_generic_services = ::std::option::Option::Some(v);
+ }
+
+ // optional bool java_generic_services = 17;
+
+
+ pub fn get_java_generic_services(&self) -> bool {
+ self.java_generic_services.unwrap_or(false)
+ }
+ pub fn clear_java_generic_services(&mut self) {
+ self.java_generic_services = ::std::option::Option::None;
+ }
+
+ pub fn has_java_generic_services(&self) -> bool {
+ self.java_generic_services.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_java_generic_services(&mut self, v: bool) {
+ self.java_generic_services = ::std::option::Option::Some(v);
+ }
+
+ // optional bool py_generic_services = 18;
+
+
+ pub fn get_py_generic_services(&self) -> bool {
+ self.py_generic_services.unwrap_or(false)
+ }
+ pub fn clear_py_generic_services(&mut self) {
+ self.py_generic_services = ::std::option::Option::None;
+ }
+
+ pub fn has_py_generic_services(&self) -> bool {
+ self.py_generic_services.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_py_generic_services(&mut self, v: bool) {
+ self.py_generic_services = ::std::option::Option::Some(v);
+ }
+
+ // optional bool deprecated = 23;
+
+
+ pub fn get_deprecated(&self) -> bool {
+ self.deprecated.unwrap_or(false)
+ }
+ pub fn clear_deprecated(&mut self) {
+ self.deprecated = ::std::option::Option::None;
+ }
+
+ pub fn has_deprecated(&self) -> bool {
+ self.deprecated.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_deprecated(&mut self, v: bool) {
+ self.deprecated = ::std::option::Option::Some(v);
+ }
+
+ // optional bool cc_enable_arenas = 31;
+
+
+ pub fn get_cc_enable_arenas(&self) -> bool {
+ self.cc_enable_arenas.unwrap_or(false)
+ }
+ pub fn clear_cc_enable_arenas(&mut self) {
+ self.cc_enable_arenas = ::std::option::Option::None;
+ }
+
+ pub fn has_cc_enable_arenas(&self) -> bool {
+ self.cc_enable_arenas.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_cc_enable_arenas(&mut self, v: bool) {
+ self.cc_enable_arenas = ::std::option::Option::Some(v);
+ }
+
+ // optional string objc_class_prefix = 36;
+
+
+ pub fn get_objc_class_prefix(&self) -> &str {
+ match self.objc_class_prefix.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_objc_class_prefix(&mut self) {
+ self.objc_class_prefix.clear();
+ }
+
+ pub fn has_objc_class_prefix(&self) -> bool {
+ self.objc_class_prefix.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_objc_class_prefix(&mut self, v: ::std::string::String) {
+ self.objc_class_prefix = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_objc_class_prefix(&mut self) -> &mut ::std::string::String {
+ if self.objc_class_prefix.is_none() {
+ self.objc_class_prefix.set_default();
+ }
+ self.objc_class_prefix.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_objc_class_prefix(&mut self) -> ::std::string::String {
+ self.objc_class_prefix.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional string csharp_namespace = 37;
+
+
+ pub fn get_csharp_namespace(&self) -> &str {
+ match self.csharp_namespace.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_csharp_namespace(&mut self) {
+ self.csharp_namespace.clear();
+ }
+
+ pub fn has_csharp_namespace(&self) -> bool {
+ self.csharp_namespace.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_csharp_namespace(&mut self, v: ::std::string::String) {
+ self.csharp_namespace = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_csharp_namespace(&mut self) -> &mut ::std::string::String {
+ if self.csharp_namespace.is_none() {
+ self.csharp_namespace.set_default();
+ }
+ self.csharp_namespace.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_csharp_namespace(&mut self) -> ::std::string::String {
+ self.csharp_namespace.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
+
+
+ pub fn get_uninterpreted_option(&self) -> &[UninterpretedOption] {
+ &self.uninterpreted_option
+ }
+ pub fn clear_uninterpreted_option(&mut self) {
+ self.uninterpreted_option.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_uninterpreted_option(&mut self, v: ::protobuf::RepeatedField<UninterpretedOption>) {
+ self.uninterpreted_option = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_uninterpreted_option(&mut self) -> &mut ::protobuf::RepeatedField<UninterpretedOption> {
+ &mut self.uninterpreted_option
+ }
+
+ // Take field
+ pub fn take_uninterpreted_option(&mut self) -> ::protobuf::RepeatedField<UninterpretedOption> {
+ ::std::mem::replace(&mut self.uninterpreted_option, ::protobuf::RepeatedField::new())
+ }
+}
+
+impl ::protobuf::Message for FileOptions {
+ fn is_initialized(&self) -> bool {
+ for v in &self.uninterpreted_option {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.java_package)?;
+ },
+ 8 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.java_outer_classname)?;
+ },
+ 10 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.java_multiple_files = ::std::option::Option::Some(tmp);
+ },
+ 20 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.java_generate_equals_and_hash = ::std::option::Option::Some(tmp);
+ },
+ 27 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.java_string_check_utf8 = ::std::option::Option::Some(tmp);
+ },
+ 9 => {
+ ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.optimize_for, 9, &mut self.unknown_fields)?
+ },
+ 11 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.go_package)?;
+ },
+ 16 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.cc_generic_services = ::std::option::Option::Some(tmp);
+ },
+ 17 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.java_generic_services = ::std::option::Option::Some(tmp);
+ },
+ 18 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.py_generic_services = ::std::option::Option::Some(tmp);
+ },
+ 23 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.deprecated = ::std::option::Option::Some(tmp);
+ },
+ 31 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.cc_enable_arenas = ::std::option::Option::Some(tmp);
+ },
+ 36 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.objc_class_prefix)?;
+ },
+ 37 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.csharp_namespace)?;
+ },
+ 999 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.uninterpreted_option)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(ref v) = self.java_package.as_ref() {
+ my_size += ::protobuf::rt::string_size(1, &v);
+ }
+ if let Some(ref v) = self.java_outer_classname.as_ref() {
+ my_size += ::protobuf::rt::string_size(8, &v);
+ }
+ if let Some(v) = self.java_multiple_files {
+ my_size += 2;
+ }
+ if let Some(v) = self.java_generate_equals_and_hash {
+ my_size += 3;
+ }
+ if let Some(v) = self.java_string_check_utf8 {
+ my_size += 3;
+ }
+ if let Some(v) = self.optimize_for {
+ my_size += ::protobuf::rt::enum_size(9, v);
+ }
+ if let Some(ref v) = self.go_package.as_ref() {
+ my_size += ::protobuf::rt::string_size(11, &v);
+ }
+ if let Some(v) = self.cc_generic_services {
+ my_size += 3;
+ }
+ if let Some(v) = self.java_generic_services {
+ my_size += 3;
+ }
+ if let Some(v) = self.py_generic_services {
+ my_size += 3;
+ }
+ if let Some(v) = self.deprecated {
+ my_size += 3;
+ }
+ if let Some(v) = self.cc_enable_arenas {
+ my_size += 3;
+ }
+ if let Some(ref v) = self.objc_class_prefix.as_ref() {
+ my_size += ::protobuf::rt::string_size(36, &v);
+ }
+ if let Some(ref v) = self.csharp_namespace.as_ref() {
+ my_size += ::protobuf::rt::string_size(37, &v);
+ }
+ for value in &self.uninterpreted_option {
+ let len = value.compute_size();
+ my_size += 2 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(ref v) = self.java_package.as_ref() {
+ os.write_string(1, &v)?;
+ }
+ if let Some(ref v) = self.java_outer_classname.as_ref() {
+ os.write_string(8, &v)?;
+ }
+ if let Some(v) = self.java_multiple_files {
+ os.write_bool(10, v)?;
+ }
+ if let Some(v) = self.java_generate_equals_and_hash {
+ os.write_bool(20, v)?;
+ }
+ if let Some(v) = self.java_string_check_utf8 {
+ os.write_bool(27, v)?;
+ }
+ if let Some(v) = self.optimize_for {
+ os.write_enum(9, v.value())?;
+ }
+ if let Some(ref v) = self.go_package.as_ref() {
+ os.write_string(11, &v)?;
+ }
+ if let Some(v) = self.cc_generic_services {
+ os.write_bool(16, v)?;
+ }
+ if let Some(v) = self.java_generic_services {
+ os.write_bool(17, v)?;
+ }
+ if let Some(v) = self.py_generic_services {
+ os.write_bool(18, v)?;
+ }
+ if let Some(v) = self.deprecated {
+ os.write_bool(23, v)?;
+ }
+ if let Some(v) = self.cc_enable_arenas {
+ os.write_bool(31, v)?;
+ }
+ if let Some(ref v) = self.objc_class_prefix.as_ref() {
+ os.write_string(36, &v)?;
+ }
+ if let Some(ref v) = self.csharp_namespace.as_ref() {
+ os.write_string(37, &v)?;
+ }
+ for v in &self.uninterpreted_option {
+ os.write_tag(999, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> FileOptions {
+ FileOptions::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "java_package",
+ |m: &FileOptions| { &m.java_package },
+ |m: &mut FileOptions| { &mut m.java_package },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "java_outer_classname",
+ |m: &FileOptions| { &m.java_outer_classname },
+ |m: &mut FileOptions| { &mut m.java_outer_classname },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "java_multiple_files",
+ |m: &FileOptions| { &m.java_multiple_files },
+ |m: &mut FileOptions| { &mut m.java_multiple_files },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "java_generate_equals_and_hash",
+ |m: &FileOptions| { &m.java_generate_equals_and_hash },
+ |m: &mut FileOptions| { &mut m.java_generate_equals_and_hash },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "java_string_check_utf8",
+ |m: &FileOptions| { &m.java_string_check_utf8 },
+ |m: &mut FileOptions| { &mut m.java_string_check_utf8 },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum<FileOptions_OptimizeMode>>(
+ "optimize_for",
+ |m: &FileOptions| { &m.optimize_for },
+ |m: &mut FileOptions| { &mut m.optimize_for },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "go_package",
+ |m: &FileOptions| { &m.go_package },
+ |m: &mut FileOptions| { &mut m.go_package },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "cc_generic_services",
+ |m: &FileOptions| { &m.cc_generic_services },
+ |m: &mut FileOptions| { &mut m.cc_generic_services },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "java_generic_services",
+ |m: &FileOptions| { &m.java_generic_services },
+ |m: &mut FileOptions| { &mut m.java_generic_services },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "py_generic_services",
+ |m: &FileOptions| { &m.py_generic_services },
+ |m: &mut FileOptions| { &mut m.py_generic_services },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "deprecated",
+ |m: &FileOptions| { &m.deprecated },
+ |m: &mut FileOptions| { &mut m.deprecated },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "cc_enable_arenas",
+ |m: &FileOptions| { &m.cc_enable_arenas },
+ |m: &mut FileOptions| { &mut m.cc_enable_arenas },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "objc_class_prefix",
+ |m: &FileOptions| { &m.objc_class_prefix },
+ |m: &mut FileOptions| { &mut m.objc_class_prefix },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "csharp_namespace",
+ |m: &FileOptions| { &m.csharp_namespace },
+ |m: &mut FileOptions| { &mut m.csharp_namespace },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<UninterpretedOption>>(
+ "uninterpreted_option",
+ |m: &FileOptions| { &m.uninterpreted_option },
+ |m: &mut FileOptions| { &mut m.uninterpreted_option },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<FileOptions>(
+ "FileOptions",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static FileOptions {
+ static mut instance: ::protobuf::lazy::Lazy<FileOptions> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(FileOptions::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for FileOptions {
+ fn clear(&mut self) {
+ self.java_package.clear();
+ self.java_outer_classname.clear();
+ self.java_multiple_files = ::std::option::Option::None;
+ self.java_generate_equals_and_hash = ::std::option::Option::None;
+ self.java_string_check_utf8 = ::std::option::Option::None;
+ self.optimize_for = ::std::option::Option::None;
+ self.go_package.clear();
+ self.cc_generic_services = ::std::option::Option::None;
+ self.java_generic_services = ::std::option::Option::None;
+ self.py_generic_services = ::std::option::Option::None;
+ self.deprecated = ::std::option::Option::None;
+ self.cc_enable_arenas = ::std::option::Option::None;
+ self.objc_class_prefix.clear();
+ self.csharp_namespace.clear();
+ self.uninterpreted_option.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for FileOptions {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for FileOptions {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(Clone,PartialEq,Eq,Debug,Hash)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub enum FileOptions_OptimizeMode {
+ SPEED = 1,
+ CODE_SIZE = 2,
+ LITE_RUNTIME = 3,
+}
+
+impl ::protobuf::ProtobufEnum for FileOptions_OptimizeMode {
+ fn value(&self) -> i32 {
+ *self as i32
+ }
+
+ fn from_i32(value: i32) -> ::std::option::Option<FileOptions_OptimizeMode> {
+ match value {
+ 1 => ::std::option::Option::Some(FileOptions_OptimizeMode::SPEED),
+ 2 => ::std::option::Option::Some(FileOptions_OptimizeMode::CODE_SIZE),
+ 3 => ::std::option::Option::Some(FileOptions_OptimizeMode::LITE_RUNTIME),
+ _ => ::std::option::Option::None
+ }
+ }
+
+ fn values() -> &'static [Self] {
+ static values: &'static [FileOptions_OptimizeMode] = &[
+ FileOptions_OptimizeMode::SPEED,
+ FileOptions_OptimizeMode::CODE_SIZE,
+ FileOptions_OptimizeMode::LITE_RUNTIME,
+ ];
+ values
+ }
+
+ fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ ::protobuf::reflect::EnumDescriptor::new_pb_name::<FileOptions_OptimizeMode>("FileOptions.OptimizeMode", file_descriptor_proto())
+ })
+ }
+ }
+}
+
+impl ::std::marker::Copy for FileOptions_OptimizeMode {
+}
+
+// Note, `Default` is implemented although default value is not 0
+impl ::std::default::Default for FileOptions_OptimizeMode {
+ fn default() -> Self {
+ FileOptions_OptimizeMode::SPEED
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for FileOptions_OptimizeMode {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Enum(self.descriptor())
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct MessageOptions {
+ // message fields
+ message_set_wire_format: ::std::option::Option<bool>,
+ no_standard_descriptor_accessor: ::std::option::Option<bool>,
+ deprecated: ::std::option::Option<bool>,
+ map_entry: ::std::option::Option<bool>,
+ uninterpreted_option: ::protobuf::RepeatedField<UninterpretedOption>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a MessageOptions {
+ fn default() -> &'a MessageOptions {
+ <MessageOptions as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl MessageOptions {
+ pub fn new() -> MessageOptions {
+ ::std::default::Default::default()
+ }
+
+ // optional bool message_set_wire_format = 1;
+
+
+ pub fn get_message_set_wire_format(&self) -> bool {
+ self.message_set_wire_format.unwrap_or(false)
+ }
+ pub fn clear_message_set_wire_format(&mut self) {
+ self.message_set_wire_format = ::std::option::Option::None;
+ }
+
+ pub fn has_message_set_wire_format(&self) -> bool {
+ self.message_set_wire_format.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_message_set_wire_format(&mut self, v: bool) {
+ self.message_set_wire_format = ::std::option::Option::Some(v);
+ }
+
+ // optional bool no_standard_descriptor_accessor = 2;
+
+
+ pub fn get_no_standard_descriptor_accessor(&self) -> bool {
+ self.no_standard_descriptor_accessor.unwrap_or(false)
+ }
+ pub fn clear_no_standard_descriptor_accessor(&mut self) {
+ self.no_standard_descriptor_accessor = ::std::option::Option::None;
+ }
+
+ pub fn has_no_standard_descriptor_accessor(&self) -> bool {
+ self.no_standard_descriptor_accessor.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_no_standard_descriptor_accessor(&mut self, v: bool) {
+ self.no_standard_descriptor_accessor = ::std::option::Option::Some(v);
+ }
+
+ // optional bool deprecated = 3;
+
+
+ pub fn get_deprecated(&self) -> bool {
+ self.deprecated.unwrap_or(false)
+ }
+ pub fn clear_deprecated(&mut self) {
+ self.deprecated = ::std::option::Option::None;
+ }
+
+ pub fn has_deprecated(&self) -> bool {
+ self.deprecated.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_deprecated(&mut self, v: bool) {
+ self.deprecated = ::std::option::Option::Some(v);
+ }
+
+ // optional bool map_entry = 7;
+
+
+ pub fn get_map_entry(&self) -> bool {
+ self.map_entry.unwrap_or(false)
+ }
+ pub fn clear_map_entry(&mut self) {
+ self.map_entry = ::std::option::Option::None;
+ }
+
+ pub fn has_map_entry(&self) -> bool {
+ self.map_entry.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_map_entry(&mut self, v: bool) {
+ self.map_entry = ::std::option::Option::Some(v);
+ }
+
+ // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
+
+
+ pub fn get_uninterpreted_option(&self) -> &[UninterpretedOption] {
+ &self.uninterpreted_option
+ }
+ pub fn clear_uninterpreted_option(&mut self) {
+ self.uninterpreted_option.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_uninterpreted_option(&mut self, v: ::protobuf::RepeatedField<UninterpretedOption>) {
+ self.uninterpreted_option = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_uninterpreted_option(&mut self) -> &mut ::protobuf::RepeatedField<UninterpretedOption> {
+ &mut self.uninterpreted_option
+ }
+
+ // Take field
+ pub fn take_uninterpreted_option(&mut self) -> ::protobuf::RepeatedField<UninterpretedOption> {
+ ::std::mem::replace(&mut self.uninterpreted_option, ::protobuf::RepeatedField::new())
+ }
+}
+
+impl ::protobuf::Message for MessageOptions {
+ fn is_initialized(&self) -> bool {
+ for v in &self.uninterpreted_option {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.message_set_wire_format = ::std::option::Option::Some(tmp);
+ },
+ 2 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.no_standard_descriptor_accessor = ::std::option::Option::Some(tmp);
+ },
+ 3 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.deprecated = ::std::option::Option::Some(tmp);
+ },
+ 7 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.map_entry = ::std::option::Option::Some(tmp);
+ },
+ 999 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.uninterpreted_option)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(v) = self.message_set_wire_format {
+ my_size += 2;
+ }
+ if let Some(v) = self.no_standard_descriptor_accessor {
+ my_size += 2;
+ }
+ if let Some(v) = self.deprecated {
+ my_size += 2;
+ }
+ if let Some(v) = self.map_entry {
+ my_size += 2;
+ }
+ for value in &self.uninterpreted_option {
+ let len = value.compute_size();
+ my_size += 2 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(v) = self.message_set_wire_format {
+ os.write_bool(1, v)?;
+ }
+ if let Some(v) = self.no_standard_descriptor_accessor {
+ os.write_bool(2, v)?;
+ }
+ if let Some(v) = self.deprecated {
+ os.write_bool(3, v)?;
+ }
+ if let Some(v) = self.map_entry {
+ os.write_bool(7, v)?;
+ }
+ for v in &self.uninterpreted_option {
+ os.write_tag(999, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> MessageOptions {
+ MessageOptions::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "message_set_wire_format",
+ |m: &MessageOptions| { &m.message_set_wire_format },
+ |m: &mut MessageOptions| { &mut m.message_set_wire_format },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "no_standard_descriptor_accessor",
+ |m: &MessageOptions| { &m.no_standard_descriptor_accessor },
+ |m: &mut MessageOptions| { &mut m.no_standard_descriptor_accessor },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "deprecated",
+ |m: &MessageOptions| { &m.deprecated },
+ |m: &mut MessageOptions| { &mut m.deprecated },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "map_entry",
+ |m: &MessageOptions| { &m.map_entry },
+ |m: &mut MessageOptions| { &mut m.map_entry },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<UninterpretedOption>>(
+ "uninterpreted_option",
+ |m: &MessageOptions| { &m.uninterpreted_option },
+ |m: &mut MessageOptions| { &mut m.uninterpreted_option },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<MessageOptions>(
+ "MessageOptions",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static MessageOptions {
+ static mut instance: ::protobuf::lazy::Lazy<MessageOptions> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(MessageOptions::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for MessageOptions {
+ fn clear(&mut self) {
+ self.message_set_wire_format = ::std::option::Option::None;
+ self.no_standard_descriptor_accessor = ::std::option::Option::None;
+ self.deprecated = ::std::option::Option::None;
+ self.map_entry = ::std::option::Option::None;
+ self.uninterpreted_option.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for MessageOptions {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for MessageOptions {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct FieldOptions {
+ // message fields
+ ctype: ::std::option::Option<FieldOptions_CType>,
+ packed: ::std::option::Option<bool>,
+ jstype: ::std::option::Option<FieldOptions_JSType>,
+ lazy: ::std::option::Option<bool>,
+ deprecated: ::std::option::Option<bool>,
+ weak: ::std::option::Option<bool>,
+ uninterpreted_option: ::protobuf::RepeatedField<UninterpretedOption>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a FieldOptions {
+ fn default() -> &'a FieldOptions {
+ <FieldOptions as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl FieldOptions {
+ pub fn new() -> FieldOptions {
+ ::std::default::Default::default()
+ }
+
+ // optional .google.protobuf.FieldOptions.CType ctype = 1;
+
+
+ pub fn get_ctype(&self) -> FieldOptions_CType {
+ self.ctype.unwrap_or(FieldOptions_CType::STRING)
+ }
+ pub fn clear_ctype(&mut self) {
+ self.ctype = ::std::option::Option::None;
+ }
+
+ pub fn has_ctype(&self) -> bool {
+ self.ctype.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_ctype(&mut self, v: FieldOptions_CType) {
+ self.ctype = ::std::option::Option::Some(v);
+ }
+
+ // optional bool packed = 2;
+
+
+ pub fn get_packed(&self) -> bool {
+ self.packed.unwrap_or(false)
+ }
+ pub fn clear_packed(&mut self) {
+ self.packed = ::std::option::Option::None;
+ }
+
+ pub fn has_packed(&self) -> bool {
+ self.packed.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_packed(&mut self, v: bool) {
+ self.packed = ::std::option::Option::Some(v);
+ }
+
+ // optional .google.protobuf.FieldOptions.JSType jstype = 6;
+
+
+ pub fn get_jstype(&self) -> FieldOptions_JSType {
+ self.jstype.unwrap_or(FieldOptions_JSType::JS_NORMAL)
+ }
+ pub fn clear_jstype(&mut self) {
+ self.jstype = ::std::option::Option::None;
+ }
+
+ pub fn has_jstype(&self) -> bool {
+ self.jstype.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_jstype(&mut self, v: FieldOptions_JSType) {
+ self.jstype = ::std::option::Option::Some(v);
+ }
+
+ // optional bool lazy = 5;
+
+
+ pub fn get_lazy(&self) -> bool {
+ self.lazy.unwrap_or(false)
+ }
+ pub fn clear_lazy(&mut self) {
+ self.lazy = ::std::option::Option::None;
+ }
+
+ pub fn has_lazy(&self) -> bool {
+ self.lazy.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_lazy(&mut self, v: bool) {
+ self.lazy = ::std::option::Option::Some(v);
+ }
+
+ // optional bool deprecated = 3;
+
+
+ pub fn get_deprecated(&self) -> bool {
+ self.deprecated.unwrap_or(false)
+ }
+ pub fn clear_deprecated(&mut self) {
+ self.deprecated = ::std::option::Option::None;
+ }
+
+ pub fn has_deprecated(&self) -> bool {
+ self.deprecated.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_deprecated(&mut self, v: bool) {
+ self.deprecated = ::std::option::Option::Some(v);
+ }
+
+ // optional bool weak = 10;
+
+
+ pub fn get_weak(&self) -> bool {
+ self.weak.unwrap_or(false)
+ }
+ pub fn clear_weak(&mut self) {
+ self.weak = ::std::option::Option::None;
+ }
+
+ pub fn has_weak(&self) -> bool {
+ self.weak.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_weak(&mut self, v: bool) {
+ self.weak = ::std::option::Option::Some(v);
+ }
+
+ // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
+
+
+ pub fn get_uninterpreted_option(&self) -> &[UninterpretedOption] {
+ &self.uninterpreted_option
+ }
+ pub fn clear_uninterpreted_option(&mut self) {
+ self.uninterpreted_option.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_uninterpreted_option(&mut self, v: ::protobuf::RepeatedField<UninterpretedOption>) {
+ self.uninterpreted_option = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_uninterpreted_option(&mut self) -> &mut ::protobuf::RepeatedField<UninterpretedOption> {
+ &mut self.uninterpreted_option
+ }
+
+ // Take field
+ pub fn take_uninterpreted_option(&mut self) -> ::protobuf::RepeatedField<UninterpretedOption> {
+ ::std::mem::replace(&mut self.uninterpreted_option, ::protobuf::RepeatedField::new())
+ }
+}
+
+impl ::protobuf::Message for FieldOptions {
+ fn is_initialized(&self) -> bool {
+ for v in &self.uninterpreted_option {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.ctype, 1, &mut self.unknown_fields)?
+ },
+ 2 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.packed = ::std::option::Option::Some(tmp);
+ },
+ 6 => {
+ ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.jstype, 6, &mut self.unknown_fields)?
+ },
+ 5 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.lazy = ::std::option::Option::Some(tmp);
+ },
+ 3 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.deprecated = ::std::option::Option::Some(tmp);
+ },
+ 10 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.weak = ::std::option::Option::Some(tmp);
+ },
+ 999 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.uninterpreted_option)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(v) = self.ctype {
+ my_size += ::protobuf::rt::enum_size(1, v);
+ }
+ if let Some(v) = self.packed {
+ my_size += 2;
+ }
+ if let Some(v) = self.jstype {
+ my_size += ::protobuf::rt::enum_size(6, v);
+ }
+ if let Some(v) = self.lazy {
+ my_size += 2;
+ }
+ if let Some(v) = self.deprecated {
+ my_size += 2;
+ }
+ if let Some(v) = self.weak {
+ my_size += 2;
+ }
+ for value in &self.uninterpreted_option {
+ let len = value.compute_size();
+ my_size += 2 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(v) = self.ctype {
+ os.write_enum(1, v.value())?;
+ }
+ if let Some(v) = self.packed {
+ os.write_bool(2, v)?;
+ }
+ if let Some(v) = self.jstype {
+ os.write_enum(6, v.value())?;
+ }
+ if let Some(v) = self.lazy {
+ os.write_bool(5, v)?;
+ }
+ if let Some(v) = self.deprecated {
+ os.write_bool(3, v)?;
+ }
+ if let Some(v) = self.weak {
+ os.write_bool(10, v)?;
+ }
+ for v in &self.uninterpreted_option {
+ os.write_tag(999, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> FieldOptions {
+ FieldOptions::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum<FieldOptions_CType>>(
+ "ctype",
+ |m: &FieldOptions| { &m.ctype },
+ |m: &mut FieldOptions| { &mut m.ctype },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "packed",
+ |m: &FieldOptions| { &m.packed },
+ |m: &mut FieldOptions| { &mut m.packed },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum<FieldOptions_JSType>>(
+ "jstype",
+ |m: &FieldOptions| { &m.jstype },
+ |m: &mut FieldOptions| { &mut m.jstype },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "lazy",
+ |m: &FieldOptions| { &m.lazy },
+ |m: &mut FieldOptions| { &mut m.lazy },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "deprecated",
+ |m: &FieldOptions| { &m.deprecated },
+ |m: &mut FieldOptions| { &mut m.deprecated },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "weak",
+ |m: &FieldOptions| { &m.weak },
+ |m: &mut FieldOptions| { &mut m.weak },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<UninterpretedOption>>(
+ "uninterpreted_option",
+ |m: &FieldOptions| { &m.uninterpreted_option },
+ |m: &mut FieldOptions| { &mut m.uninterpreted_option },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<FieldOptions>(
+ "FieldOptions",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static FieldOptions {
+ static mut instance: ::protobuf::lazy::Lazy<FieldOptions> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(FieldOptions::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for FieldOptions {
+ fn clear(&mut self) {
+ self.ctype = ::std::option::Option::None;
+ self.packed = ::std::option::Option::None;
+ self.jstype = ::std::option::Option::None;
+ self.lazy = ::std::option::Option::None;
+ self.deprecated = ::std::option::Option::None;
+ self.weak = ::std::option::Option::None;
+ self.uninterpreted_option.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for FieldOptions {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for FieldOptions {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(Clone,PartialEq,Eq,Debug,Hash)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub enum FieldOptions_CType {
+ STRING = 0,
+ CORD = 1,
+ STRING_PIECE = 2,
+}
+
+impl ::protobuf::ProtobufEnum for FieldOptions_CType {
+ fn value(&self) -> i32 {
+ *self as i32
+ }
+
+ fn from_i32(value: i32) -> ::std::option::Option<FieldOptions_CType> {
+ match value {
+ 0 => ::std::option::Option::Some(FieldOptions_CType::STRING),
+ 1 => ::std::option::Option::Some(FieldOptions_CType::CORD),
+ 2 => ::std::option::Option::Some(FieldOptions_CType::STRING_PIECE),
+ _ => ::std::option::Option::None
+ }
+ }
+
+ fn values() -> &'static [Self] {
+ static values: &'static [FieldOptions_CType] = &[
+ FieldOptions_CType::STRING,
+ FieldOptions_CType::CORD,
+ FieldOptions_CType::STRING_PIECE,
+ ];
+ values
+ }
+
+ fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ ::protobuf::reflect::EnumDescriptor::new_pb_name::<FieldOptions_CType>("FieldOptions.CType", file_descriptor_proto())
+ })
+ }
+ }
+}
+
+impl ::std::marker::Copy for FieldOptions_CType {
+}
+
+impl ::std::default::Default for FieldOptions_CType {
+ fn default() -> Self {
+ FieldOptions_CType::STRING
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for FieldOptions_CType {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Enum(self.descriptor())
+ }
+}
+
+#[derive(Clone,PartialEq,Eq,Debug,Hash)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub enum FieldOptions_JSType {
+ JS_NORMAL = 0,
+ JS_STRING = 1,
+ JS_NUMBER = 2,
+}
+
+impl ::protobuf::ProtobufEnum for FieldOptions_JSType {
+ fn value(&self) -> i32 {
+ *self as i32
+ }
+
+ fn from_i32(value: i32) -> ::std::option::Option<FieldOptions_JSType> {
+ match value {
+ 0 => ::std::option::Option::Some(FieldOptions_JSType::JS_NORMAL),
+ 1 => ::std::option::Option::Some(FieldOptions_JSType::JS_STRING),
+ 2 => ::std::option::Option::Some(FieldOptions_JSType::JS_NUMBER),
+ _ => ::std::option::Option::None
+ }
+ }
+
+ fn values() -> &'static [Self] {
+ static values: &'static [FieldOptions_JSType] = &[
+ FieldOptions_JSType::JS_NORMAL,
+ FieldOptions_JSType::JS_STRING,
+ FieldOptions_JSType::JS_NUMBER,
+ ];
+ values
+ }
+
+ fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ ::protobuf::reflect::EnumDescriptor::new_pb_name::<FieldOptions_JSType>("FieldOptions.JSType", file_descriptor_proto())
+ })
+ }
+ }
+}
+
+impl ::std::marker::Copy for FieldOptions_JSType {
+}
+
+impl ::std::default::Default for FieldOptions_JSType {
+ fn default() -> Self {
+ FieldOptions_JSType::JS_NORMAL
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for FieldOptions_JSType {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Enum(self.descriptor())
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct OneofOptions {
+ // message fields
+ uninterpreted_option: ::protobuf::RepeatedField<UninterpretedOption>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a OneofOptions {
+ fn default() -> &'a OneofOptions {
+ <OneofOptions as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl OneofOptions {
+ pub fn new() -> OneofOptions {
+ ::std::default::Default::default()
+ }
+
+ // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
+
+
+ pub fn get_uninterpreted_option(&self) -> &[UninterpretedOption] {
+ &self.uninterpreted_option
+ }
+ pub fn clear_uninterpreted_option(&mut self) {
+ self.uninterpreted_option.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_uninterpreted_option(&mut self, v: ::protobuf::RepeatedField<UninterpretedOption>) {
+ self.uninterpreted_option = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_uninterpreted_option(&mut self) -> &mut ::protobuf::RepeatedField<UninterpretedOption> {
+ &mut self.uninterpreted_option
+ }
+
+ // Take field
+ pub fn take_uninterpreted_option(&mut self) -> ::protobuf::RepeatedField<UninterpretedOption> {
+ ::std::mem::replace(&mut self.uninterpreted_option, ::protobuf::RepeatedField::new())
+ }
+}
+
+impl ::protobuf::Message for OneofOptions {
+ fn is_initialized(&self) -> bool {
+ for v in &self.uninterpreted_option {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 999 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.uninterpreted_option)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ for value in &self.uninterpreted_option {
+ let len = value.compute_size();
+ my_size += 2 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ for v in &self.uninterpreted_option {
+ os.write_tag(999, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> OneofOptions {
+ OneofOptions::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<UninterpretedOption>>(
+ "uninterpreted_option",
+ |m: &OneofOptions| { &m.uninterpreted_option },
+ |m: &mut OneofOptions| { &mut m.uninterpreted_option },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<OneofOptions>(
+ "OneofOptions",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static OneofOptions {
+ static mut instance: ::protobuf::lazy::Lazy<OneofOptions> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(OneofOptions::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for OneofOptions {
+ fn clear(&mut self) {
+ self.uninterpreted_option.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for OneofOptions {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for OneofOptions {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct EnumOptions {
+ // message fields
+ allow_alias: ::std::option::Option<bool>,
+ deprecated: ::std::option::Option<bool>,
+ uninterpreted_option: ::protobuf::RepeatedField<UninterpretedOption>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a EnumOptions {
+ fn default() -> &'a EnumOptions {
+ <EnumOptions as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl EnumOptions {
+ pub fn new() -> EnumOptions {
+ ::std::default::Default::default()
+ }
+
+ // optional bool allow_alias = 2;
+
+
+ pub fn get_allow_alias(&self) -> bool {
+ self.allow_alias.unwrap_or(false)
+ }
+ pub fn clear_allow_alias(&mut self) {
+ self.allow_alias = ::std::option::Option::None;
+ }
+
+ pub fn has_allow_alias(&self) -> bool {
+ self.allow_alias.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_allow_alias(&mut self, v: bool) {
+ self.allow_alias = ::std::option::Option::Some(v);
+ }
+
+ // optional bool deprecated = 3;
+
+
+ pub fn get_deprecated(&self) -> bool {
+ self.deprecated.unwrap_or(false)
+ }
+ pub fn clear_deprecated(&mut self) {
+ self.deprecated = ::std::option::Option::None;
+ }
+
+ pub fn has_deprecated(&self) -> bool {
+ self.deprecated.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_deprecated(&mut self, v: bool) {
+ self.deprecated = ::std::option::Option::Some(v);
+ }
+
+ // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
+
+
+ pub fn get_uninterpreted_option(&self) -> &[UninterpretedOption] {
+ &self.uninterpreted_option
+ }
+ pub fn clear_uninterpreted_option(&mut self) {
+ self.uninterpreted_option.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_uninterpreted_option(&mut self, v: ::protobuf::RepeatedField<UninterpretedOption>) {
+ self.uninterpreted_option = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_uninterpreted_option(&mut self) -> &mut ::protobuf::RepeatedField<UninterpretedOption> {
+ &mut self.uninterpreted_option
+ }
+
+ // Take field
+ pub fn take_uninterpreted_option(&mut self) -> ::protobuf::RepeatedField<UninterpretedOption> {
+ ::std::mem::replace(&mut self.uninterpreted_option, ::protobuf::RepeatedField::new())
+ }
+}
+
+impl ::protobuf::Message for EnumOptions {
+ fn is_initialized(&self) -> bool {
+ for v in &self.uninterpreted_option {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 2 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.allow_alias = ::std::option::Option::Some(tmp);
+ },
+ 3 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.deprecated = ::std::option::Option::Some(tmp);
+ },
+ 999 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.uninterpreted_option)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(v) = self.allow_alias {
+ my_size += 2;
+ }
+ if let Some(v) = self.deprecated {
+ my_size += 2;
+ }
+ for value in &self.uninterpreted_option {
+ let len = value.compute_size();
+ my_size += 2 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(v) = self.allow_alias {
+ os.write_bool(2, v)?;
+ }
+ if let Some(v) = self.deprecated {
+ os.write_bool(3, v)?;
+ }
+ for v in &self.uninterpreted_option {
+ os.write_tag(999, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> EnumOptions {
+ EnumOptions::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "allow_alias",
+ |m: &EnumOptions| { &m.allow_alias },
+ |m: &mut EnumOptions| { &mut m.allow_alias },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "deprecated",
+ |m: &EnumOptions| { &m.deprecated },
+ |m: &mut EnumOptions| { &mut m.deprecated },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<UninterpretedOption>>(
+ "uninterpreted_option",
+ |m: &EnumOptions| { &m.uninterpreted_option },
+ |m: &mut EnumOptions| { &mut m.uninterpreted_option },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<EnumOptions>(
+ "EnumOptions",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static EnumOptions {
+ static mut instance: ::protobuf::lazy::Lazy<EnumOptions> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(EnumOptions::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for EnumOptions {
+ fn clear(&mut self) {
+ self.allow_alias = ::std::option::Option::None;
+ self.deprecated = ::std::option::Option::None;
+ self.uninterpreted_option.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for EnumOptions {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for EnumOptions {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct EnumValueOptions {
+ // message fields
+ deprecated: ::std::option::Option<bool>,
+ uninterpreted_option: ::protobuf::RepeatedField<UninterpretedOption>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a EnumValueOptions {
+ fn default() -> &'a EnumValueOptions {
+ <EnumValueOptions as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl EnumValueOptions {
+ pub fn new() -> EnumValueOptions {
+ ::std::default::Default::default()
+ }
+
+ // optional bool deprecated = 1;
+
+
+ pub fn get_deprecated(&self) -> bool {
+ self.deprecated.unwrap_or(false)
+ }
+ pub fn clear_deprecated(&mut self) {
+ self.deprecated = ::std::option::Option::None;
+ }
+
+ pub fn has_deprecated(&self) -> bool {
+ self.deprecated.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_deprecated(&mut self, v: bool) {
+ self.deprecated = ::std::option::Option::Some(v);
+ }
+
+ // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
+
+
+ pub fn get_uninterpreted_option(&self) -> &[UninterpretedOption] {
+ &self.uninterpreted_option
+ }
+ pub fn clear_uninterpreted_option(&mut self) {
+ self.uninterpreted_option.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_uninterpreted_option(&mut self, v: ::protobuf::RepeatedField<UninterpretedOption>) {
+ self.uninterpreted_option = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_uninterpreted_option(&mut self) -> &mut ::protobuf::RepeatedField<UninterpretedOption> {
+ &mut self.uninterpreted_option
+ }
+
+ // Take field
+ pub fn take_uninterpreted_option(&mut self) -> ::protobuf::RepeatedField<UninterpretedOption> {
+ ::std::mem::replace(&mut self.uninterpreted_option, ::protobuf::RepeatedField::new())
+ }
+}
+
+impl ::protobuf::Message for EnumValueOptions {
+ fn is_initialized(&self) -> bool {
+ for v in &self.uninterpreted_option {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.deprecated = ::std::option::Option::Some(tmp);
+ },
+ 999 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.uninterpreted_option)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(v) = self.deprecated {
+ my_size += 2;
+ }
+ for value in &self.uninterpreted_option {
+ let len = value.compute_size();
+ my_size += 2 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(v) = self.deprecated {
+ os.write_bool(1, v)?;
+ }
+ for v in &self.uninterpreted_option {
+ os.write_tag(999, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> EnumValueOptions {
+ EnumValueOptions::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "deprecated",
+ |m: &EnumValueOptions| { &m.deprecated },
+ |m: &mut EnumValueOptions| { &mut m.deprecated },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<UninterpretedOption>>(
+ "uninterpreted_option",
+ |m: &EnumValueOptions| { &m.uninterpreted_option },
+ |m: &mut EnumValueOptions| { &mut m.uninterpreted_option },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<EnumValueOptions>(
+ "EnumValueOptions",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static EnumValueOptions {
+ static mut instance: ::protobuf::lazy::Lazy<EnumValueOptions> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(EnumValueOptions::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for EnumValueOptions {
+ fn clear(&mut self) {
+ self.deprecated = ::std::option::Option::None;
+ self.uninterpreted_option.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for EnumValueOptions {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for EnumValueOptions {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct ServiceOptions {
+ // message fields
+ deprecated: ::std::option::Option<bool>,
+ uninterpreted_option: ::protobuf::RepeatedField<UninterpretedOption>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a ServiceOptions {
+ fn default() -> &'a ServiceOptions {
+ <ServiceOptions as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl ServiceOptions {
+ pub fn new() -> ServiceOptions {
+ ::std::default::Default::default()
+ }
+
+ // optional bool deprecated = 33;
+
+
+ pub fn get_deprecated(&self) -> bool {
+ self.deprecated.unwrap_or(false)
+ }
+ pub fn clear_deprecated(&mut self) {
+ self.deprecated = ::std::option::Option::None;
+ }
+
+ pub fn has_deprecated(&self) -> bool {
+ self.deprecated.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_deprecated(&mut self, v: bool) {
+ self.deprecated = ::std::option::Option::Some(v);
+ }
+
+ // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
+
+
+ pub fn get_uninterpreted_option(&self) -> &[UninterpretedOption] {
+ &self.uninterpreted_option
+ }
+ pub fn clear_uninterpreted_option(&mut self) {
+ self.uninterpreted_option.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_uninterpreted_option(&mut self, v: ::protobuf::RepeatedField<UninterpretedOption>) {
+ self.uninterpreted_option = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_uninterpreted_option(&mut self) -> &mut ::protobuf::RepeatedField<UninterpretedOption> {
+ &mut self.uninterpreted_option
+ }
+
+ // Take field
+ pub fn take_uninterpreted_option(&mut self) -> ::protobuf::RepeatedField<UninterpretedOption> {
+ ::std::mem::replace(&mut self.uninterpreted_option, ::protobuf::RepeatedField::new())
+ }
+}
+
+impl ::protobuf::Message for ServiceOptions {
+ fn is_initialized(&self) -> bool {
+ for v in &self.uninterpreted_option {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 33 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.deprecated = ::std::option::Option::Some(tmp);
+ },
+ 999 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.uninterpreted_option)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(v) = self.deprecated {
+ my_size += 3;
+ }
+ for value in &self.uninterpreted_option {
+ let len = value.compute_size();
+ my_size += 2 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(v) = self.deprecated {
+ os.write_bool(33, v)?;
+ }
+ for v in &self.uninterpreted_option {
+ os.write_tag(999, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> ServiceOptions {
+ ServiceOptions::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "deprecated",
+ |m: &ServiceOptions| { &m.deprecated },
+ |m: &mut ServiceOptions| { &mut m.deprecated },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<UninterpretedOption>>(
+ "uninterpreted_option",
+ |m: &ServiceOptions| { &m.uninterpreted_option },
+ |m: &mut ServiceOptions| { &mut m.uninterpreted_option },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<ServiceOptions>(
+ "ServiceOptions",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static ServiceOptions {
+ static mut instance: ::protobuf::lazy::Lazy<ServiceOptions> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(ServiceOptions::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for ServiceOptions {
+ fn clear(&mut self) {
+ self.deprecated = ::std::option::Option::None;
+ self.uninterpreted_option.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for ServiceOptions {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for ServiceOptions {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct MethodOptions {
+ // message fields
+ deprecated: ::std::option::Option<bool>,
+ uninterpreted_option: ::protobuf::RepeatedField<UninterpretedOption>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a MethodOptions {
+ fn default() -> &'a MethodOptions {
+ <MethodOptions as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl MethodOptions {
+ pub fn new() -> MethodOptions {
+ ::std::default::Default::default()
+ }
+
+ // optional bool deprecated = 33;
+
+
+ pub fn get_deprecated(&self) -> bool {
+ self.deprecated.unwrap_or(false)
+ }
+ pub fn clear_deprecated(&mut self) {
+ self.deprecated = ::std::option::Option::None;
+ }
+
+ pub fn has_deprecated(&self) -> bool {
+ self.deprecated.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_deprecated(&mut self, v: bool) {
+ self.deprecated = ::std::option::Option::Some(v);
+ }
+
+ // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
+
+
+ pub fn get_uninterpreted_option(&self) -> &[UninterpretedOption] {
+ &self.uninterpreted_option
+ }
+ pub fn clear_uninterpreted_option(&mut self) {
+ self.uninterpreted_option.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_uninterpreted_option(&mut self, v: ::protobuf::RepeatedField<UninterpretedOption>) {
+ self.uninterpreted_option = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_uninterpreted_option(&mut self) -> &mut ::protobuf::RepeatedField<UninterpretedOption> {
+ &mut self.uninterpreted_option
+ }
+
+ // Take field
+ pub fn take_uninterpreted_option(&mut self) -> ::protobuf::RepeatedField<UninterpretedOption> {
+ ::std::mem::replace(&mut self.uninterpreted_option, ::protobuf::RepeatedField::new())
+ }
+}
+
+impl ::protobuf::Message for MethodOptions {
+ fn is_initialized(&self) -> bool {
+ for v in &self.uninterpreted_option {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 33 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.deprecated = ::std::option::Option::Some(tmp);
+ },
+ 999 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.uninterpreted_option)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(v) = self.deprecated {
+ my_size += 3;
+ }
+ for value in &self.uninterpreted_option {
+ let len = value.compute_size();
+ my_size += 2 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(v) = self.deprecated {
+ os.write_bool(33, v)?;
+ }
+ for v in &self.uninterpreted_option {
+ os.write_tag(999, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> MethodOptions {
+ MethodOptions::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "deprecated",
+ |m: &MethodOptions| { &m.deprecated },
+ |m: &mut MethodOptions| { &mut m.deprecated },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<UninterpretedOption>>(
+ "uninterpreted_option",
+ |m: &MethodOptions| { &m.uninterpreted_option },
+ |m: &mut MethodOptions| { &mut m.uninterpreted_option },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<MethodOptions>(
+ "MethodOptions",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static MethodOptions {
+ static mut instance: ::protobuf::lazy::Lazy<MethodOptions> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(MethodOptions::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for MethodOptions {
+ fn clear(&mut self) {
+ self.deprecated = ::std::option::Option::None;
+ self.uninterpreted_option.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for MethodOptions {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for MethodOptions {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct UninterpretedOption {
+ // message fields
+ name: ::protobuf::RepeatedField<UninterpretedOption_NamePart>,
+ identifier_value: ::protobuf::SingularField<::std::string::String>,
+ positive_int_value: ::std::option::Option<u64>,
+ negative_int_value: ::std::option::Option<i64>,
+ double_value: ::std::option::Option<f64>,
+ string_value: ::protobuf::SingularField<::std::vec::Vec<u8>>,
+ aggregate_value: ::protobuf::SingularField<::std::string::String>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a UninterpretedOption {
+ fn default() -> &'a UninterpretedOption {
+ <UninterpretedOption as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl UninterpretedOption {
+ pub fn new() -> UninterpretedOption {
+ ::std::default::Default::default()
+ }
+
+ // repeated .google.protobuf.UninterpretedOption.NamePart name = 2;
+
+
+ pub fn get_name(&self) -> &[UninterpretedOption_NamePart] {
+ &self.name
+ }
+ pub fn clear_name(&mut self) {
+ self.name.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_name(&mut self, v: ::protobuf::RepeatedField<UninterpretedOption_NamePart>) {
+ self.name = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_name(&mut self) -> &mut ::protobuf::RepeatedField<UninterpretedOption_NamePart> {
+ &mut self.name
+ }
+
+ // Take field
+ pub fn take_name(&mut self) -> ::protobuf::RepeatedField<UninterpretedOption_NamePart> {
+ ::std::mem::replace(&mut self.name, ::protobuf::RepeatedField::new())
+ }
+
+ // optional string identifier_value = 3;
+
+
+ pub fn get_identifier_value(&self) -> &str {
+ match self.identifier_value.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_identifier_value(&mut self) {
+ self.identifier_value.clear();
+ }
+
+ pub fn has_identifier_value(&self) -> bool {
+ self.identifier_value.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_identifier_value(&mut self, v: ::std::string::String) {
+ self.identifier_value = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_identifier_value(&mut self) -> &mut ::std::string::String {
+ if self.identifier_value.is_none() {
+ self.identifier_value.set_default();
+ }
+ self.identifier_value.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_identifier_value(&mut self) -> ::std::string::String {
+ self.identifier_value.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional uint64 positive_int_value = 4;
+
+
+ pub fn get_positive_int_value(&self) -> u64 {
+ self.positive_int_value.unwrap_or(0)
+ }
+ pub fn clear_positive_int_value(&mut self) {
+ self.positive_int_value = ::std::option::Option::None;
+ }
+
+ pub fn has_positive_int_value(&self) -> bool {
+ self.positive_int_value.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_positive_int_value(&mut self, v: u64) {
+ self.positive_int_value = ::std::option::Option::Some(v);
+ }
+
+ // optional int64 negative_int_value = 5;
+
+
+ pub fn get_negative_int_value(&self) -> i64 {
+ self.negative_int_value.unwrap_or(0)
+ }
+ pub fn clear_negative_int_value(&mut self) {
+ self.negative_int_value = ::std::option::Option::None;
+ }
+
+ pub fn has_negative_int_value(&self) -> bool {
+ self.negative_int_value.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_negative_int_value(&mut self, v: i64) {
+ self.negative_int_value = ::std::option::Option::Some(v);
+ }
+
+ // optional double double_value = 6;
+
+
+ pub fn get_double_value(&self) -> f64 {
+ self.double_value.unwrap_or(0.)
+ }
+ pub fn clear_double_value(&mut self) {
+ self.double_value = ::std::option::Option::None;
+ }
+
+ pub fn has_double_value(&self) -> bool {
+ self.double_value.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_double_value(&mut self, v: f64) {
+ self.double_value = ::std::option::Option::Some(v);
+ }
+
+ // optional bytes string_value = 7;
+
+
+ pub fn get_string_value(&self) -> &[u8] {
+ match self.string_value.as_ref() {
+ Some(v) => &v,
+ None => &[],
+ }
+ }
+ pub fn clear_string_value(&mut self) {
+ self.string_value.clear();
+ }
+
+ pub fn has_string_value(&self) -> bool {
+ self.string_value.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_string_value(&mut self, v: ::std::vec::Vec<u8>) {
+ self.string_value = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_string_value(&mut self) -> &mut ::std::vec::Vec<u8> {
+ if self.string_value.is_none() {
+ self.string_value.set_default();
+ }
+ self.string_value.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_string_value(&mut self) -> ::std::vec::Vec<u8> {
+ self.string_value.take().unwrap_or_else(|| ::std::vec::Vec::new())
+ }
+
+ // optional string aggregate_value = 8;
+
+
+ pub fn get_aggregate_value(&self) -> &str {
+ match self.aggregate_value.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_aggregate_value(&mut self) {
+ self.aggregate_value.clear();
+ }
+
+ pub fn has_aggregate_value(&self) -> bool {
+ self.aggregate_value.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_aggregate_value(&mut self, v: ::std::string::String) {
+ self.aggregate_value = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_aggregate_value(&mut self) -> &mut ::std::string::String {
+ if self.aggregate_value.is_none() {
+ self.aggregate_value.set_default();
+ }
+ self.aggregate_value.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_aggregate_value(&mut self) -> ::std::string::String {
+ self.aggregate_value.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+}
+
+impl ::protobuf::Message for UninterpretedOption {
+ fn is_initialized(&self) -> bool {
+ for v in &self.name {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 2 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.name)?;
+ },
+ 3 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.identifier_value)?;
+ },
+ 4 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_uint64()?;
+ self.positive_int_value = ::std::option::Option::Some(tmp);
+ },
+ 5 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_int64()?;
+ self.negative_int_value = ::std::option::Option::Some(tmp);
+ },
+ 6 => {
+ if wire_type != ::protobuf::wire_format::WireTypeFixed64 {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_double()?;
+ self.double_value = ::std::option::Option::Some(tmp);
+ },
+ 7 => {
+ ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.string_value)?;
+ },
+ 8 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.aggregate_value)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ for value in &self.name {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ if let Some(ref v) = self.identifier_value.as_ref() {
+ my_size += ::protobuf::rt::string_size(3, &v);
+ }
+ if let Some(v) = self.positive_int_value {
+ my_size += ::protobuf::rt::value_size(4, v, ::protobuf::wire_format::WireTypeVarint);
+ }
+ if let Some(v) = self.negative_int_value {
+ my_size += ::protobuf::rt::value_size(5, v, ::protobuf::wire_format::WireTypeVarint);
+ }
+ if let Some(v) = self.double_value {
+ my_size += 9;
+ }
+ if let Some(ref v) = self.string_value.as_ref() {
+ my_size += ::protobuf::rt::bytes_size(7, &v);
+ }
+ if let Some(ref v) = self.aggregate_value.as_ref() {
+ my_size += ::protobuf::rt::string_size(8, &v);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ for v in &self.name {
+ os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ if let Some(ref v) = self.identifier_value.as_ref() {
+ os.write_string(3, &v)?;
+ }
+ if let Some(v) = self.positive_int_value {
+ os.write_uint64(4, v)?;
+ }
+ if let Some(v) = self.negative_int_value {
+ os.write_int64(5, v)?;
+ }
+ if let Some(v) = self.double_value {
+ os.write_double(6, v)?;
+ }
+ if let Some(ref v) = self.string_value.as_ref() {
+ os.write_bytes(7, &v)?;
+ }
+ if let Some(ref v) = self.aggregate_value.as_ref() {
+ os.write_string(8, &v)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> UninterpretedOption {
+ UninterpretedOption::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<UninterpretedOption_NamePart>>(
+ "name",
+ |m: &UninterpretedOption| { &m.name },
+ |m: &mut UninterpretedOption| { &mut m.name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "identifier_value",
+ |m: &UninterpretedOption| { &m.identifier_value },
+ |m: &mut UninterpretedOption| { &mut m.identifier_value },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>(
+ "positive_int_value",
+ |m: &UninterpretedOption| { &m.positive_int_value },
+ |m: &mut UninterpretedOption| { &mut m.positive_int_value },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt64>(
+ "negative_int_value",
+ |m: &UninterpretedOption| { &m.negative_int_value },
+ |m: &mut UninterpretedOption| { &mut m.negative_int_value },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>(
+ "double_value",
+ |m: &UninterpretedOption| { &m.double_value },
+ |m: &mut UninterpretedOption| { &mut m.double_value },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
+ "string_value",
+ |m: &UninterpretedOption| { &m.string_value },
+ |m: &mut UninterpretedOption| { &mut m.string_value },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "aggregate_value",
+ |m: &UninterpretedOption| { &m.aggregate_value },
+ |m: &mut UninterpretedOption| { &mut m.aggregate_value },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<UninterpretedOption>(
+ "UninterpretedOption",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static UninterpretedOption {
+ static mut instance: ::protobuf::lazy::Lazy<UninterpretedOption> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(UninterpretedOption::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for UninterpretedOption {
+ fn clear(&mut self) {
+ self.name.clear();
+ self.identifier_value.clear();
+ self.positive_int_value = ::std::option::Option::None;
+ self.negative_int_value = ::std::option::Option::None;
+ self.double_value = ::std::option::Option::None;
+ self.string_value.clear();
+ self.aggregate_value.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for UninterpretedOption {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for UninterpretedOption {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct UninterpretedOption_NamePart {
+ // message fields
+ name_part: ::protobuf::SingularField<::std::string::String>,
+ is_extension: ::std::option::Option<bool>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a UninterpretedOption_NamePart {
+ fn default() -> &'a UninterpretedOption_NamePart {
+ <UninterpretedOption_NamePart as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl UninterpretedOption_NamePart {
+ pub fn new() -> UninterpretedOption_NamePart {
+ ::std::default::Default::default()
+ }
+
+ // required string name_part = 1;
+
+
+ pub fn get_name_part(&self) -> &str {
+ match self.name_part.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_name_part(&mut self) {
+ self.name_part.clear();
+ }
+
+ pub fn has_name_part(&self) -> bool {
+ self.name_part.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_name_part(&mut self, v: ::std::string::String) {
+ self.name_part = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_name_part(&mut self) -> &mut ::std::string::String {
+ if self.name_part.is_none() {
+ self.name_part.set_default();
+ }
+ self.name_part.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_name_part(&mut self) -> ::std::string::String {
+ self.name_part.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // required bool is_extension = 2;
+
+
+ pub fn get_is_extension(&self) -> bool {
+ self.is_extension.unwrap_or(false)
+ }
+ pub fn clear_is_extension(&mut self) {
+ self.is_extension = ::std::option::Option::None;
+ }
+
+ pub fn has_is_extension(&self) -> bool {
+ self.is_extension.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_is_extension(&mut self, v: bool) {
+ self.is_extension = ::std::option::Option::Some(v);
+ }
+}
+
+impl ::protobuf::Message for UninterpretedOption_NamePart {
+ fn is_initialized(&self) -> bool {
+ if self.name_part.is_none() {
+ return false;
+ }
+ if self.is_extension.is_none() {
+ return false;
+ }
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.name_part)?;
+ },
+ 2 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.is_extension = ::std::option::Option::Some(tmp);
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(ref v) = self.name_part.as_ref() {
+ my_size += ::protobuf::rt::string_size(1, &v);
+ }
+ if let Some(v) = self.is_extension {
+ my_size += 2;
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(ref v) = self.name_part.as_ref() {
+ os.write_string(1, &v)?;
+ }
+ if let Some(v) = self.is_extension {
+ os.write_bool(2, v)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> UninterpretedOption_NamePart {
+ UninterpretedOption_NamePart::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "name_part",
+ |m: &UninterpretedOption_NamePart| { &m.name_part },
+ |m: &mut UninterpretedOption_NamePart| { &mut m.name_part },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "is_extension",
+ |m: &UninterpretedOption_NamePart| { &m.is_extension },
+ |m: &mut UninterpretedOption_NamePart| { &mut m.is_extension },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<UninterpretedOption_NamePart>(
+ "UninterpretedOption.NamePart",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static UninterpretedOption_NamePart {
+ static mut instance: ::protobuf::lazy::Lazy<UninterpretedOption_NamePart> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(UninterpretedOption_NamePart::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for UninterpretedOption_NamePart {
+ fn clear(&mut self) {
+ self.name_part.clear();
+ self.is_extension = ::std::option::Option::None;
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for UninterpretedOption_NamePart {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for UninterpretedOption_NamePart {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct SourceCodeInfo {
+ // message fields
+ location: ::protobuf::RepeatedField<SourceCodeInfo_Location>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a SourceCodeInfo {
+ fn default() -> &'a SourceCodeInfo {
+ <SourceCodeInfo as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl SourceCodeInfo {
+ pub fn new() -> SourceCodeInfo {
+ ::std::default::Default::default()
+ }
+
+ // repeated .google.protobuf.SourceCodeInfo.Location location = 1;
+
+
+ pub fn get_location(&self) -> &[SourceCodeInfo_Location] {
+ &self.location
+ }
+ pub fn clear_location(&mut self) {
+ self.location.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_location(&mut self, v: ::protobuf::RepeatedField<SourceCodeInfo_Location>) {
+ self.location = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_location(&mut self) -> &mut ::protobuf::RepeatedField<SourceCodeInfo_Location> {
+ &mut self.location
+ }
+
+ // Take field
+ pub fn take_location(&mut self) -> ::protobuf::RepeatedField<SourceCodeInfo_Location> {
+ ::std::mem::replace(&mut self.location, ::protobuf::RepeatedField::new())
+ }
+}
+
+impl ::protobuf::Message for SourceCodeInfo {
+ fn is_initialized(&self) -> bool {
+ for v in &self.location {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.location)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ for value in &self.location {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ for v in &self.location {
+ os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> SourceCodeInfo {
+ SourceCodeInfo::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<SourceCodeInfo_Location>>(
+ "location",
+ |m: &SourceCodeInfo| { &m.location },
+ |m: &mut SourceCodeInfo| { &mut m.location },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<SourceCodeInfo>(
+ "SourceCodeInfo",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static SourceCodeInfo {
+ static mut instance: ::protobuf::lazy::Lazy<SourceCodeInfo> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(SourceCodeInfo::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for SourceCodeInfo {
+ fn clear(&mut self) {
+ self.location.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for SourceCodeInfo {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for SourceCodeInfo {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct SourceCodeInfo_Location {
+ // message fields
+ path: ::std::vec::Vec<i32>,
+ span: ::std::vec::Vec<i32>,
+ leading_comments: ::protobuf::SingularField<::std::string::String>,
+ trailing_comments: ::protobuf::SingularField<::std::string::String>,
+ leading_detached_comments: ::protobuf::RepeatedField<::std::string::String>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a SourceCodeInfo_Location {
+ fn default() -> &'a SourceCodeInfo_Location {
+ <SourceCodeInfo_Location as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl SourceCodeInfo_Location {
+ pub fn new() -> SourceCodeInfo_Location {
+ ::std::default::Default::default()
+ }
+
+ // repeated int32 path = 1;
+
+
+ pub fn get_path(&self) -> &[i32] {
+ &self.path
+ }
+ pub fn clear_path(&mut self) {
+ self.path.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_path(&mut self, v: ::std::vec::Vec<i32>) {
+ self.path = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_path(&mut self) -> &mut ::std::vec::Vec<i32> {
+ &mut self.path
+ }
+
+ // Take field
+ pub fn take_path(&mut self) -> ::std::vec::Vec<i32> {
+ ::std::mem::replace(&mut self.path, ::std::vec::Vec::new())
+ }
+
+ // repeated int32 span = 2;
+
+
+ pub fn get_span(&self) -> &[i32] {
+ &self.span
+ }
+ pub fn clear_span(&mut self) {
+ self.span.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_span(&mut self, v: ::std::vec::Vec<i32>) {
+ self.span = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_span(&mut self) -> &mut ::std::vec::Vec<i32> {
+ &mut self.span
+ }
+
+ // Take field
+ pub fn take_span(&mut self) -> ::std::vec::Vec<i32> {
+ ::std::mem::replace(&mut self.span, ::std::vec::Vec::new())
+ }
+
+ // optional string leading_comments = 3;
+
+
+ pub fn get_leading_comments(&self) -> &str {
+ match self.leading_comments.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_leading_comments(&mut self) {
+ self.leading_comments.clear();
+ }
+
+ pub fn has_leading_comments(&self) -> bool {
+ self.leading_comments.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_leading_comments(&mut self, v: ::std::string::String) {
+ self.leading_comments = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_leading_comments(&mut self) -> &mut ::std::string::String {
+ if self.leading_comments.is_none() {
+ self.leading_comments.set_default();
+ }
+ self.leading_comments.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_leading_comments(&mut self) -> ::std::string::String {
+ self.leading_comments.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional string trailing_comments = 4;
+
+
+ pub fn get_trailing_comments(&self) -> &str {
+ match self.trailing_comments.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_trailing_comments(&mut self) {
+ self.trailing_comments.clear();
+ }
+
+ pub fn has_trailing_comments(&self) -> bool {
+ self.trailing_comments.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_trailing_comments(&mut self, v: ::std::string::String) {
+ self.trailing_comments = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_trailing_comments(&mut self) -> &mut ::std::string::String {
+ if self.trailing_comments.is_none() {
+ self.trailing_comments.set_default();
+ }
+ self.trailing_comments.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_trailing_comments(&mut self) -> ::std::string::String {
+ self.trailing_comments.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // repeated string leading_detached_comments = 6;
+
+
+ pub fn get_leading_detached_comments(&self) -> &[::std::string::String] {
+ &self.leading_detached_comments
+ }
+ pub fn clear_leading_detached_comments(&mut self) {
+ self.leading_detached_comments.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_leading_detached_comments(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) {
+ self.leading_detached_comments = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_leading_detached_comments(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> {
+ &mut self.leading_detached_comments
+ }
+
+ // Take field
+ pub fn take_leading_detached_comments(&mut self) -> ::protobuf::RepeatedField<::std::string::String> {
+ ::std::mem::replace(&mut self.leading_detached_comments, ::protobuf::RepeatedField::new())
+ }
+}
+
+impl ::protobuf::Message for SourceCodeInfo_Location {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_repeated_int32_into(wire_type, is, &mut self.path)?;
+ },
+ 2 => {
+ ::protobuf::rt::read_repeated_int32_into(wire_type, is, &mut self.span)?;
+ },
+ 3 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.leading_comments)?;
+ },
+ 4 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.trailing_comments)?;
+ },
+ 6 => {
+ ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.leading_detached_comments)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if !self.path.is_empty() {
+ my_size += ::protobuf::rt::vec_packed_varint_size(1, &self.path);
+ }
+ if !self.span.is_empty() {
+ my_size += ::protobuf::rt::vec_packed_varint_size(2, &self.span);
+ }
+ if let Some(ref v) = self.leading_comments.as_ref() {
+ my_size += ::protobuf::rt::string_size(3, &v);
+ }
+ if let Some(ref v) = self.trailing_comments.as_ref() {
+ my_size += ::protobuf::rt::string_size(4, &v);
+ }
+ for value in &self.leading_detached_comments {
+ my_size += ::protobuf::rt::string_size(6, &value);
+ };
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if !self.path.is_empty() {
+ os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ // TODO: Data size is computed again, it should be cached
+ os.write_raw_varint32(::protobuf::rt::vec_packed_varint_data_size(&self.path))?;
+ for v in &self.path {
+ os.write_int32_no_tag(*v)?;
+ };
+ }
+ if !self.span.is_empty() {
+ os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ // TODO: Data size is computed again, it should be cached
+ os.write_raw_varint32(::protobuf::rt::vec_packed_varint_data_size(&self.span))?;
+ for v in &self.span {
+ os.write_int32_no_tag(*v)?;
+ };
+ }
+ if let Some(ref v) = self.leading_comments.as_ref() {
+ os.write_string(3, &v)?;
+ }
+ if let Some(ref v) = self.trailing_comments.as_ref() {
+ os.write_string(4, &v)?;
+ }
+ for v in &self.leading_detached_comments {
+ os.write_string(6, &v)?;
+ };
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> SourceCodeInfo_Location {
+ SourceCodeInfo_Location::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "path",
+ |m: &SourceCodeInfo_Location| { &m.path },
+ |m: &mut SourceCodeInfo_Location| { &mut m.path },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "span",
+ |m: &SourceCodeInfo_Location| { &m.span },
+ |m: &mut SourceCodeInfo_Location| { &mut m.span },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "leading_comments",
+ |m: &SourceCodeInfo_Location| { &m.leading_comments },
+ |m: &mut SourceCodeInfo_Location| { &mut m.leading_comments },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "trailing_comments",
+ |m: &SourceCodeInfo_Location| { &m.trailing_comments },
+ |m: &mut SourceCodeInfo_Location| { &mut m.trailing_comments },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "leading_detached_comments",
+ |m: &SourceCodeInfo_Location| { &m.leading_detached_comments },
+ |m: &mut SourceCodeInfo_Location| { &mut m.leading_detached_comments },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<SourceCodeInfo_Location>(
+ "SourceCodeInfo.Location",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static SourceCodeInfo_Location {
+ static mut instance: ::protobuf::lazy::Lazy<SourceCodeInfo_Location> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(SourceCodeInfo_Location::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for SourceCodeInfo_Location {
+ fn clear(&mut self) {
+ self.path.clear();
+ self.span.clear();
+ self.leading_comments.clear();
+ self.trailing_comments.clear();
+ self.leading_detached_comments.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for SourceCodeInfo_Location {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for SourceCodeInfo_Location {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct GeneratedCodeInfo {
+ // message fields
+ annotation: ::protobuf::RepeatedField<GeneratedCodeInfo_Annotation>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a GeneratedCodeInfo {
+ fn default() -> &'a GeneratedCodeInfo {
+ <GeneratedCodeInfo as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl GeneratedCodeInfo {
+ pub fn new() -> GeneratedCodeInfo {
+ ::std::default::Default::default()
+ }
+
+ // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;
+
+
+ pub fn get_annotation(&self) -> &[GeneratedCodeInfo_Annotation] {
+ &self.annotation
+ }
+ pub fn clear_annotation(&mut self) {
+ self.annotation.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_annotation(&mut self, v: ::protobuf::RepeatedField<GeneratedCodeInfo_Annotation>) {
+ self.annotation = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_annotation(&mut self) -> &mut ::protobuf::RepeatedField<GeneratedCodeInfo_Annotation> {
+ &mut self.annotation
+ }
+
+ // Take field
+ pub fn take_annotation(&mut self) -> ::protobuf::RepeatedField<GeneratedCodeInfo_Annotation> {
+ ::std::mem::replace(&mut self.annotation, ::protobuf::RepeatedField::new())
+ }
+}
+
+impl ::protobuf::Message for GeneratedCodeInfo {
+ fn is_initialized(&self) -> bool {
+ for v in &self.annotation {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.annotation)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ for value in &self.annotation {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ for v in &self.annotation {
+ os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> GeneratedCodeInfo {
+ GeneratedCodeInfo::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<GeneratedCodeInfo_Annotation>>(
+ "annotation",
+ |m: &GeneratedCodeInfo| { &m.annotation },
+ |m: &mut GeneratedCodeInfo| { &mut m.annotation },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<GeneratedCodeInfo>(
+ "GeneratedCodeInfo",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static GeneratedCodeInfo {
+ static mut instance: ::protobuf::lazy::Lazy<GeneratedCodeInfo> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(GeneratedCodeInfo::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for GeneratedCodeInfo {
+ fn clear(&mut self) {
+ self.annotation.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for GeneratedCodeInfo {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for GeneratedCodeInfo {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct GeneratedCodeInfo_Annotation {
+ // message fields
+ path: ::std::vec::Vec<i32>,
+ source_file: ::protobuf::SingularField<::std::string::String>,
+ begin: ::std::option::Option<i32>,
+ end: ::std::option::Option<i32>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a GeneratedCodeInfo_Annotation {
+ fn default() -> &'a GeneratedCodeInfo_Annotation {
+ <GeneratedCodeInfo_Annotation as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl GeneratedCodeInfo_Annotation {
+ pub fn new() -> GeneratedCodeInfo_Annotation {
+ ::std::default::Default::default()
+ }
+
+ // repeated int32 path = 1;
+
+
+ pub fn get_path(&self) -> &[i32] {
+ &self.path
+ }
+ pub fn clear_path(&mut self) {
+ self.path.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_path(&mut self, v: ::std::vec::Vec<i32>) {
+ self.path = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_path(&mut self) -> &mut ::std::vec::Vec<i32> {
+ &mut self.path
+ }
+
+ // Take field
+ pub fn take_path(&mut self) -> ::std::vec::Vec<i32> {
+ ::std::mem::replace(&mut self.path, ::std::vec::Vec::new())
+ }
+
+ // optional string source_file = 2;
+
+
+ pub fn get_source_file(&self) -> &str {
+ match self.source_file.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_source_file(&mut self) {
+ self.source_file.clear();
+ }
+
+ pub fn has_source_file(&self) -> bool {
+ self.source_file.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_source_file(&mut self, v: ::std::string::String) {
+ self.source_file = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_source_file(&mut self) -> &mut ::std::string::String {
+ if self.source_file.is_none() {
+ self.source_file.set_default();
+ }
+ self.source_file.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_source_file(&mut self) -> ::std::string::String {
+ self.source_file.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional int32 begin = 3;
+
+
+ pub fn get_begin(&self) -> i32 {
+ self.begin.unwrap_or(0)
+ }
+ pub fn clear_begin(&mut self) {
+ self.begin = ::std::option::Option::None;
+ }
+
+ pub fn has_begin(&self) -> bool {
+ self.begin.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_begin(&mut self, v: i32) {
+ self.begin = ::std::option::Option::Some(v);
+ }
+
+ // optional int32 end = 4;
+
+
+ pub fn get_end(&self) -> i32 {
+ self.end.unwrap_or(0)
+ }
+ pub fn clear_end(&mut self) {
+ self.end = ::std::option::Option::None;
+ }
+
+ pub fn has_end(&self) -> bool {
+ self.end.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_end(&mut self, v: i32) {
+ self.end = ::std::option::Option::Some(v);
+ }
+}
+
+impl ::protobuf::Message for GeneratedCodeInfo_Annotation {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_repeated_int32_into(wire_type, is, &mut self.path)?;
+ },
+ 2 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.source_file)?;
+ },
+ 3 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_int32()?;
+ self.begin = ::std::option::Option::Some(tmp);
+ },
+ 4 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_int32()?;
+ self.end = ::std::option::Option::Some(tmp);
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if !self.path.is_empty() {
+ my_size += ::protobuf::rt::vec_packed_varint_size(1, &self.path);
+ }
+ if let Some(ref v) = self.source_file.as_ref() {
+ my_size += ::protobuf::rt::string_size(2, &v);
+ }
+ if let Some(v) = self.begin {
+ my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint);
+ }
+ if let Some(v) = self.end {
+ my_size += ::protobuf::rt::value_size(4, v, ::protobuf::wire_format::WireTypeVarint);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if !self.path.is_empty() {
+ os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ // TODO: Data size is computed again, it should be cached
+ os.write_raw_varint32(::protobuf::rt::vec_packed_varint_data_size(&self.path))?;
+ for v in &self.path {
+ os.write_int32_no_tag(*v)?;
+ };
+ }
+ if let Some(ref v) = self.source_file.as_ref() {
+ os.write_string(2, &v)?;
+ }
+ if let Some(v) = self.begin {
+ os.write_int32(3, v)?;
+ }
+ if let Some(v) = self.end {
+ os.write_int32(4, v)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> GeneratedCodeInfo_Annotation {
+ GeneratedCodeInfo_Annotation::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "path",
+ |m: &GeneratedCodeInfo_Annotation| { &m.path },
+ |m: &mut GeneratedCodeInfo_Annotation| { &mut m.path },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "source_file",
+ |m: &GeneratedCodeInfo_Annotation| { &m.source_file },
+ |m: &mut GeneratedCodeInfo_Annotation| { &mut m.source_file },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "begin",
+ |m: &GeneratedCodeInfo_Annotation| { &m.begin },
+ |m: &mut GeneratedCodeInfo_Annotation| { &mut m.begin },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "end",
+ |m: &GeneratedCodeInfo_Annotation| { &m.end },
+ |m: &mut GeneratedCodeInfo_Annotation| { &mut m.end },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<GeneratedCodeInfo_Annotation>(
+ "GeneratedCodeInfo.Annotation",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static GeneratedCodeInfo_Annotation {
+ static mut instance: ::protobuf::lazy::Lazy<GeneratedCodeInfo_Annotation> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(GeneratedCodeInfo_Annotation::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for GeneratedCodeInfo_Annotation {
+ fn clear(&mut self) {
+ self.path.clear();
+ self.source_file.clear();
+ self.begin = ::std::option::Option::None;
+ self.end = ::std::option::Option::None;
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for GeneratedCodeInfo_Annotation {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for GeneratedCodeInfo_Annotation {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+static file_descriptor_proto_data: &'static [u8] = b"\
+ \n\x20google/protobuf/descriptor.proto\x12\x0fgoogle.protobuf\"M\n\x11Fi\
+ leDescriptorSet\x128\n\x04file\x18\x01\x20\x03(\x0b2$.google.protobuf.Fi\
+ leDescriptorProtoR\x04file\"\xe4\x04\n\x13FileDescriptorProto\x12\x12\n\
+ \x04name\x18\x01\x20\x01(\tR\x04name\x12\x18\n\x07package\x18\x02\x20\
+ \x01(\tR\x07package\x12\x1e\n\ndependency\x18\x03\x20\x03(\tR\ndependenc\
+ y\x12+\n\x11public_dependency\x18\n\x20\x03(\x05R\x10publicDependency\
+ \x12'\n\x0fweak_dependency\x18\x0b\x20\x03(\x05R\x0eweakDependency\x12C\
+ \n\x0cmessage_type\x18\x04\x20\x03(\x0b2\x20.google.protobuf.DescriptorP\
+ rotoR\x0bmessageType\x12A\n\tenum_type\x18\x05\x20\x03(\x0b2$.google.pro\
+ tobuf.EnumDescriptorProtoR\x08enumType\x12A\n\x07service\x18\x06\x20\x03\
+ (\x0b2'.google.protobuf.ServiceDescriptorProtoR\x07service\x12C\n\texten\
+ sion\x18\x07\x20\x03(\x0b2%.google.protobuf.FieldDescriptorProtoR\texten\
+ sion\x126\n\x07options\x18\x08\x20\x01(\x0b2\x1c.google.protobuf.FileOpt\
+ ionsR\x07options\x12I\n\x10source_code_info\x18\t\x20\x01(\x0b2\x1f.goog\
+ le.protobuf.SourceCodeInfoR\x0esourceCodeInfo\x12\x16\n\x06syntax\x18\
+ \x0c\x20\x01(\tR\x06syntax\"\xf7\x05\n\x0fDescriptorProto\x12\x12\n\x04n\
+ ame\x18\x01\x20\x01(\tR\x04name\x12;\n\x05field\x18\x02\x20\x03(\x0b2%.g\
+ oogle.protobuf.FieldDescriptorProtoR\x05field\x12C\n\textension\x18\x06\
+ \x20\x03(\x0b2%.google.protobuf.FieldDescriptorProtoR\textension\x12A\n\
+ \x0bnested_type\x18\x03\x20\x03(\x0b2\x20.google.protobuf.DescriptorProt\
+ oR\nnestedType\x12A\n\tenum_type\x18\x04\x20\x03(\x0b2$.google.protobuf.\
+ EnumDescriptorProtoR\x08enumType\x12X\n\x0fextension_range\x18\x05\x20\
+ \x03(\x0b2/.google.protobuf.DescriptorProto.ExtensionRangeR\x0eextension\
+ Range\x12D\n\noneof_decl\x18\x08\x20\x03(\x0b2%.google.protobuf.OneofDes\
+ criptorProtoR\toneofDecl\x129\n\x07options\x18\x07\x20\x01(\x0b2\x1f.goo\
+ gle.protobuf.MessageOptionsR\x07options\x12U\n\x0ereserved_range\x18\t\
+ \x20\x03(\x0b2..google.protobuf.DescriptorProto.ReservedRangeR\rreserved\
+ Range\x12#\n\rreserved_name\x18\n\x20\x03(\tR\x0creservedName\x1a8\n\x0e\
+ ExtensionRange\x12\x14\n\x05start\x18\x01\x20\x01(\x05R\x05start\x12\x10\
+ \n\x03end\x18\x02\x20\x01(\x05R\x03end\x1a7\n\rReservedRange\x12\x14\n\
+ \x05start\x18\x01\x20\x01(\x05R\x05start\x12\x10\n\x03end\x18\x02\x20\
+ \x01(\x05R\x03end\"\x98\x06\n\x14FieldDescriptorProto\x12\x12\n\x04name\
+ \x18\x01\x20\x01(\tR\x04name\x12\x16\n\x06number\x18\x03\x20\x01(\x05R\
+ \x06number\x12A\n\x05label\x18\x04\x20\x01(\x0e2+.google.protobuf.FieldD\
+ escriptorProto.LabelR\x05label\x12>\n\x04type\x18\x05\x20\x01(\x0e2*.goo\
+ gle.protobuf.FieldDescriptorProto.TypeR\x04type\x12\x1b\n\ttype_name\x18\
+ \x06\x20\x01(\tR\x08typeName\x12\x1a\n\x08extendee\x18\x02\x20\x01(\tR\
+ \x08extendee\x12#\n\rdefault_value\x18\x07\x20\x01(\tR\x0cdefaultValue\
+ \x12\x1f\n\x0boneof_index\x18\t\x20\x01(\x05R\noneofIndex\x12\x1b\n\tjso\
+ n_name\x18\n\x20\x01(\tR\x08jsonName\x127\n\x07options\x18\x08\x20\x01(\
+ \x0b2\x1d.google.protobuf.FieldOptionsR\x07options\"\xb6\x02\n\x04Type\
+ \x12\x0f\n\x0bTYPE_DOUBLE\x10\x01\x12\x0e\n\nTYPE_FLOAT\x10\x02\x12\x0e\
+ \n\nTYPE_INT64\x10\x03\x12\x0f\n\x0bTYPE_UINT64\x10\x04\x12\x0e\n\nTYPE_\
+ INT32\x10\x05\x12\x10\n\x0cTYPE_FIXED64\x10\x06\x12\x10\n\x0cTYPE_FIXED3\
+ 2\x10\x07\x12\r\n\tTYPE_BOOL\x10\x08\x12\x0f\n\x0bTYPE_STRING\x10\t\x12\
+ \x0e\n\nTYPE_GROUP\x10\n\x12\x10\n\x0cTYPE_MESSAGE\x10\x0b\x12\x0e\n\nTY\
+ PE_BYTES\x10\x0c\x12\x0f\n\x0bTYPE_UINT32\x10\r\x12\r\n\tTYPE_ENUM\x10\
+ \x0e\x12\x11\n\rTYPE_SFIXED32\x10\x0f\x12\x11\n\rTYPE_SFIXED64\x10\x10\
+ \x12\x0f\n\x0bTYPE_SINT32\x10\x11\x12\x0f\n\x0bTYPE_SINT64\x10\x12\"C\n\
+ \x05Label\x12\x12\n\x0eLABEL_OPTIONAL\x10\x01\x12\x12\n\x0eLABEL_REQUIRE\
+ D\x10\x02\x12\x12\n\x0eLABEL_REPEATED\x10\x03\"c\n\x14OneofDescriptorPro\
+ to\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x127\n\x07options\x18\
+ \x02\x20\x01(\x0b2\x1d.google.protobuf.OneofOptionsR\x07options\"\xa2\
+ \x01\n\x13EnumDescriptorProto\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04n\
+ ame\x12?\n\x05value\x18\x02\x20\x03(\x0b2).google.protobuf.EnumValueDesc\
+ riptorProtoR\x05value\x126\n\x07options\x18\x03\x20\x01(\x0b2\x1c.google\
+ .protobuf.EnumOptionsR\x07options\"\x83\x01\n\x18EnumValueDescriptorProt\
+ o\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x12\x16\n\x06number\x18\
+ \x02\x20\x01(\x05R\x06number\x12;\n\x07options\x18\x03\x20\x01(\x0b2!.go\
+ ogle.protobuf.EnumValueOptionsR\x07options\"\xa7\x01\n\x16ServiceDescrip\
+ torProto\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x12>\n\x06method\
+ \x18\x02\x20\x03(\x0b2&.google.protobuf.MethodDescriptorProtoR\x06method\
+ \x129\n\x07options\x18\x03\x20\x01(\x0b2\x1f.google.protobuf.ServiceOpti\
+ onsR\x07options\"\x89\x02\n\x15MethodDescriptorProto\x12\x12\n\x04name\
+ \x18\x01\x20\x01(\tR\x04name\x12\x1d\n\ninput_type\x18\x02\x20\x01(\tR\t\
+ inputType\x12\x1f\n\x0boutput_type\x18\x03\x20\x01(\tR\noutputType\x128\
+ \n\x07options\x18\x04\x20\x01(\x0b2\x1e.google.protobuf.MethodOptionsR\
+ \x07options\x120\n\x10client_streaming\x18\x05\x20\x01(\x08:\x05falseR\
+ \x0fclientStreaming\x120\n\x10server_streaming\x18\x06\x20\x01(\x08:\x05\
+ falseR\x0fserverStreaming\"\x88\x07\n\x0bFileOptions\x12!\n\x0cjava_pack\
+ age\x18\x01\x20\x01(\tR\x0bjavaPackage\x120\n\x14java_outer_classname\
+ \x18\x08\x20\x01(\tR\x12javaOuterClassname\x125\n\x13java_multiple_files\
+ \x18\n\x20\x01(\x08:\x05falseR\x11javaMultipleFiles\x12D\n\x1djava_gener\
+ ate_equals_and_hash\x18\x14\x20\x01(\x08R\x19javaGenerateEqualsAndHashB\
+ \x02\x18\x01\x12:\n\x16java_string_check_utf8\x18\x1b\x20\x01(\x08:\x05f\
+ alseR\x13javaStringCheckUtf8\x12S\n\x0coptimize_for\x18\t\x20\x01(\x0e2)\
+ .google.protobuf.FileOptions.OptimizeMode:\x05SPEEDR\x0boptimizeFor\x12\
+ \x1d\n\ngo_package\x18\x0b\x20\x01(\tR\tgoPackage\x125\n\x13cc_generic_s\
+ ervices\x18\x10\x20\x01(\x08:\x05falseR\x11ccGenericServices\x129\n\x15j\
+ ava_generic_services\x18\x11\x20\x01(\x08:\x05falseR\x13javaGenericServi\
+ ces\x125\n\x13py_generic_services\x18\x12\x20\x01(\x08:\x05falseR\x11pyG\
+ enericServices\x12%\n\ndeprecated\x18\x17\x20\x01(\x08:\x05falseR\ndepre\
+ cated\x12/\n\x10cc_enable_arenas\x18\x1f\x20\x01(\x08:\x05falseR\x0eccEn\
+ ableArenas\x12*\n\x11objc_class_prefix\x18$\x20\x01(\tR\x0fobjcClassPref\
+ ix\x12)\n\x10csharp_namespace\x18%\x20\x01(\tR\x0fcsharpNamespace\x12X\n\
+ \x14uninterpreted_option\x18\xe7\x07\x20\x03(\x0b2$.google.protobuf.Unin\
+ terpretedOptionR\x13uninterpretedOption\":\n\x0cOptimizeMode\x12\t\n\x05\
+ SPEED\x10\x01\x12\r\n\tCODE_SIZE\x10\x02\x12\x10\n\x0cLITE_RUNTIME\x10\
+ \x03*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xc5\x02\n\x0eMessageOption\
+ s\x12<\n\x17message_set_wire_format\x18\x01\x20\x01(\x08:\x05falseR\x14m\
+ essageSetWireFormat\x12L\n\x1fno_standard_descriptor_accessor\x18\x02\
+ \x20\x01(\x08:\x05falseR\x1cnoStandardDescriptorAccessor\x12%\n\ndepreca\
+ ted\x18\x03\x20\x01(\x08:\x05falseR\ndeprecated\x12\x1b\n\tmap_entry\x18\
+ \x07\x20\x01(\x08R\x08mapEntry\x12X\n\x14uninterpreted_option\x18\xe7\
+ \x07\x20\x03(\x0b2$.google.protobuf.UninterpretedOptionR\x13uninterprete\
+ dOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\xdc\x03\n\x0cFieldOptio\
+ ns\x12A\n\x05ctype\x18\x01\x20\x01(\x0e2#.google.protobuf.FieldOptions.C\
+ Type:\x06STRINGR\x05ctype\x12\x16\n\x06packed\x18\x02\x20\x01(\x08R\x06p\
+ acked\x12G\n\x06jstype\x18\x06\x20\x01(\x0e2$.google.protobuf.FieldOptio\
+ ns.JSType:\tJS_NORMALR\x06jstype\x12\x19\n\x04lazy\x18\x05\x20\x01(\x08:\
+ \x05falseR\x04lazy\x12%\n\ndeprecated\x18\x03\x20\x01(\x08:\x05falseR\nd\
+ eprecated\x12\x19\n\x04weak\x18\n\x20\x01(\x08:\x05falseR\x04weak\x12X\n\
+ \x14uninterpreted_option\x18\xe7\x07\x20\x03(\x0b2$.google.protobuf.Unin\
+ terpretedOptionR\x13uninterpretedOption\"/\n\x05CType\x12\n\n\x06STRING\
+ \x10\0\x12\x08\n\x04CORD\x10\x01\x12\x10\n\x0cSTRING_PIECE\x10\x02\"5\n\
+ \x06JSType\x12\r\n\tJS_NORMAL\x10\0\x12\r\n\tJS_STRING\x10\x01\x12\r\n\t\
+ JS_NUMBER\x10\x02*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"s\n\x0cOneofOp\
+ tions\x12X\n\x14uninterpreted_option\x18\xe7\x07\x20\x03(\x0b2$.google.p\
+ rotobuf.UninterpretedOptionR\x13uninterpretedOption*\t\x08\xe8\x07\x10\
+ \x80\x80\x80\x80\x02\"\xba\x01\n\x0bEnumOptions\x12\x1f\n\x0ballow_alias\
+ \x18\x02\x20\x01(\x08R\nallowAlias\x12%\n\ndeprecated\x18\x03\x20\x01(\
+ \x08:\x05falseR\ndeprecated\x12X\n\x14uninterpreted_option\x18\xe7\x07\
+ \x20\x03(\x0b2$.google.protobuf.UninterpretedOptionR\x13uninterpretedOpt\
+ ion*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\x9e\x01\n\x10EnumValueOptio\
+ ns\x12%\n\ndeprecated\x18\x01\x20\x01(\x08:\x05falseR\ndeprecated\x12X\n\
+ \x14uninterpreted_option\x18\xe7\x07\x20\x03(\x0b2$.google.protobuf.Unin\
+ terpretedOptionR\x13uninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\
+ \x80\x02\"\x9c\x01\n\x0eServiceOptions\x12%\n\ndeprecated\x18!\x20\x01(\
+ \x08:\x05falseR\ndeprecated\x12X\n\x14uninterpreted_option\x18\xe7\x07\
+ \x20\x03(\x0b2$.google.protobuf.UninterpretedOptionR\x13uninterpretedOpt\
+ ion*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\x9b\x01\n\rMethodOptions\
+ \x12%\n\ndeprecated\x18!\x20\x01(\x08:\x05falseR\ndeprecated\x12X\n\x14u\
+ ninterpreted_option\x18\xe7\x07\x20\x03(\x0b2$.google.protobuf.Uninterpr\
+ etedOptionR\x13uninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\
+ \x02\"\x9a\x03\n\x13UninterpretedOption\x12A\n\x04name\x18\x02\x20\x03(\
+ \x0b2-.google.protobuf.UninterpretedOption.NamePartR\x04name\x12)\n\x10i\
+ dentifier_value\x18\x03\x20\x01(\tR\x0fidentifierValue\x12,\n\x12positiv\
+ e_int_value\x18\x04\x20\x01(\x04R\x10positiveIntValue\x12,\n\x12negative\
+ _int_value\x18\x05\x20\x01(\x03R\x10negativeIntValue\x12!\n\x0cdouble_va\
+ lue\x18\x06\x20\x01(\x01R\x0bdoubleValue\x12!\n\x0cstring_value\x18\x07\
+ \x20\x01(\x0cR\x0bstringValue\x12'\n\x0faggregate_value\x18\x08\x20\x01(\
+ \tR\x0eaggregateValue\x1aJ\n\x08NamePart\x12\x1b\n\tname_part\x18\x01\
+ \x20\x02(\tR\x08namePart\x12!\n\x0cis_extension\x18\x02\x20\x02(\x08R\
+ \x0bisExtension\"\xa7\x02\n\x0eSourceCodeInfo\x12D\n\x08location\x18\x01\
+ \x20\x03(\x0b2(.google.protobuf.SourceCodeInfo.LocationR\x08location\x1a\
+ \xce\x01\n\x08Location\x12\x16\n\x04path\x18\x01\x20\x03(\x05R\x04pathB\
+ \x02\x10\x01\x12\x16\n\x04span\x18\x02\x20\x03(\x05R\x04spanB\x02\x10\
+ \x01\x12)\n\x10leading_comments\x18\x03\x20\x01(\tR\x0fleadingComments\
+ \x12+\n\x11trailing_comments\x18\x04\x20\x01(\tR\x10trailingComments\x12\
+ :\n\x19leading_detached_comments\x18\x06\x20\x03(\tR\x17leadingDetachedC\
+ omments\"\xd1\x01\n\x11GeneratedCodeInfo\x12M\n\nannotation\x18\x01\x20\
+ \x03(\x0b2-.google.protobuf.GeneratedCodeInfo.AnnotationR\nannotation\
+ \x1am\n\nAnnotation\x12\x16\n\x04path\x18\x01\x20\x03(\x05R\x04pathB\x02\
+ \x10\x01\x12\x1f\n\x0bsource_file\x18\x02\x20\x01(\tR\nsourceFile\x12\
+ \x14\n\x05begin\x18\x03\x20\x01(\x05R\x05begin\x12\x10\n\x03end\x18\x04\
+ \x20\x01(\x05R\x03endBX\n\x13com.google.protobufB\x10DescriptorProtosH\
+ \x01Z\ndescriptor\xa2\x02\x03GPB\xaa\x02\x1aGoogle.Protobuf.ReflectionJ\
+ \xb3\x9f\x02\n\x07\x12\x05'\0\xa3\x06\x01\n\xaa\x0f\n\x01\x0c\x12\x03'\0\
+ \x122\xc1\x0c\x20Protocol\x20Buffers\x20-\x20Google's\x20data\x20interch\
+ ange\x20format\n\x20Copyright\x202008\x20Google\x20Inc.\x20\x20All\x20ri\
+ ghts\x20reserved.\n\x20https://developers.google.com/protocol-buffers/\n\
+ \n\x20Redistribution\x20and\x20use\x20in\x20source\x20and\x20binary\x20f\
+ orms,\x20with\x20or\x20without\n\x20modification,\x20are\x20permitted\
+ \x20provided\x20that\x20the\x20following\x20conditions\x20are\n\x20met:\
+ \n\n\x20\x20\x20\x20\x20*\x20Redistributions\x20of\x20source\x20code\x20\
+ must\x20retain\x20the\x20above\x20copyright\n\x20notice,\x20this\x20list\
+ \x20of\x20conditions\x20and\x20the\x20following\x20disclaimer.\n\x20\x20\
+ \x20\x20\x20*\x20Redistributions\x20in\x20binary\x20form\x20must\x20repr\
+ oduce\x20the\x20above\n\x20copyright\x20notice,\x20this\x20list\x20of\
+ \x20conditions\x20and\x20the\x20following\x20disclaimer\n\x20in\x20the\
+ \x20documentation\x20and/or\x20other\x20materials\x20provided\x20with\
+ \x20the\n\x20distribution.\n\x20\x20\x20\x20\x20*\x20Neither\x20the\x20n\
+ ame\x20of\x20Google\x20Inc.\x20nor\x20the\x20names\x20of\x20its\n\x20con\
+ tributors\x20may\x20be\x20used\x20to\x20endorse\x20or\x20promote\x20prod\
+ ucts\x20derived\x20from\n\x20this\x20software\x20without\x20specific\x20\
+ prior\x20written\x20permission.\n\n\x20THIS\x20SOFTWARE\x20IS\x20PROVIDE\
+ D\x20BY\x20THE\x20COPYRIGHT\x20HOLDERS\x20AND\x20CONTRIBUTORS\n\x20\"AS\
+ \x20IS\"\x20AND\x20ANY\x20EXPRESS\x20OR\x20IMPLIED\x20WARRANTIES,\x20INC\
+ LUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\x20THE\x20IMPLIED\x20WARRANTIE\
+ S\x20OF\x20MERCHANTABILITY\x20AND\x20FITNESS\x20FOR\n\x20A\x20PARTICULAR\
+ \x20PURPOSE\x20ARE\x20DISCLAIMED.\x20IN\x20NO\x20EVENT\x20SHALL\x20THE\
+ \x20COPYRIGHT\n\x20OWNER\x20OR\x20CONTRIBUTORS\x20BE\x20LIABLE\x20FOR\
+ \x20ANY\x20DIRECT,\x20INDIRECT,\x20INCIDENTAL,\n\x20SPECIAL,\x20EXEMPLAR\
+ Y,\x20OR\x20CONSEQUENTIAL\x20DAMAGES\x20(INCLUDING,\x20BUT\x20NOT\n\x20L\
+ IMITED\x20TO,\x20PROCUREMENT\x20OF\x20SUBSTITUTE\x20GOODS\x20OR\x20SERVI\
+ CES;\x20LOSS\x20OF\x20USE,\n\x20DATA,\x20OR\x20PROFITS;\x20OR\x20BUSINES\
+ S\x20INTERRUPTION)\x20HOWEVER\x20CAUSED\x20AND\x20ON\x20ANY\n\x20THEORY\
+ \x20OF\x20LIABILITY,\x20WHETHER\x20IN\x20CONTRACT,\x20STRICT\x20LIABILIT\
+ Y,\x20OR\x20TORT\n\x20(INCLUDING\x20NEGLIGENCE\x20OR\x20OTHERWISE)\x20AR\
+ ISING\x20IN\x20ANY\x20WAY\x20OUT\x20OF\x20THE\x20USE\n\x20OF\x20THIS\x20\
+ SOFTWARE,\x20EVEN\x20IF\x20ADVISED\x20OF\x20THE\x20POSSIBILITY\x20OF\x20\
+ SUCH\x20DAMAGE.\n2\xdb\x02\x20Author:\x20kenton@google.com\x20(Kenton\
+ \x20Varda)\n\x20\x20Based\x20on\x20original\x20Protocol\x20Buffers\x20de\
+ sign\x20by\n\x20\x20Sanjay\x20Ghemawat,\x20Jeff\x20Dean,\x20and\x20other\
+ s.\n\n\x20The\x20messages\x20in\x20this\x20file\x20describe\x20the\x20de\
+ finitions\x20found\x20in\x20.proto\x20files.\n\x20A\x20valid\x20.proto\
+ \x20file\x20can\x20be\x20translated\x20directly\x20to\x20a\x20FileDescri\
+ ptorProto\n\x20without\x20any\x20other\x20information\x20(e.g.\x20withou\
+ t\x20reading\x20its\x20imports).\n\n\x08\n\x01\x02\x12\x03)\0\x18\n\x08\
+ \n\x01\x08\x12\x03*\0!\n\t\n\x02\x08\x0b\x12\x03*\0!\n\x08\n\x01\x08\x12\
+ \x03+\0,\n\t\n\x02\x08\x01\x12\x03+\0,\n\x08\n\x01\x08\x12\x03,\01\n\t\n\
+ \x02\x08\x08\x12\x03,\01\n\x08\n\x01\x08\x12\x03-\07\n\t\n\x02\x08%\x12\
+ \x03-\07\n\x08\n\x01\x08\x12\x03.\0!\n\t\n\x02\x08$\x12\x03.\0!\n\x08\n\
+ \x01\x08\x12\x032\0\x1c\n\x7f\n\x02\x08\t\x12\x032\0\x1c\x1at\x20descrip\
+ tor.proto\x20must\x20be\x20optimized\x20for\x20speed\x20because\x20refle\
+ ction-based\n\x20algorithms\x20don't\x20work\x20during\x20bootstrapping.\
+ \n\nj\n\x02\x04\0\x12\x046\08\x01\x1a^\x20The\x20protocol\x20compiler\
+ \x20can\x20output\x20a\x20FileDescriptorSet\x20containing\x20the\x20.pro\
+ to\n\x20files\x20it\x20parses.\n\n\n\n\x03\x04\0\x01\x12\x036\x08\x19\n\
+ \x0b\n\x04\x04\0\x02\0\x12\x037\x02(\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03\
+ 7\x02\n\n\x0c\n\x05\x04\0\x02\0\x06\x12\x037\x0b\x1e\n\x0c\n\x05\x04\0\
+ \x02\0\x01\x12\x037\x1f#\n\x0c\n\x05\x04\0\x02\0\x03\x12\x037&'\n/\n\x02\
+ \x04\x01\x12\x04;\0X\x01\x1a#\x20Describes\x20a\x20complete\x20.proto\
+ \x20file.\n\n\n\n\x03\x04\x01\x01\x12\x03;\x08\x1b\n9\n\x04\x04\x01\x02\
+ \0\x12\x03<\x02\x1b\",\x20file\x20name,\x20relative\x20to\x20root\x20of\
+ \x20source\x20tree\n\n\x0c\n\x05\x04\x01\x02\0\x04\x12\x03<\x02\n\n\x0c\
+ \n\x05\x04\x01\x02\0\x05\x12\x03<\x0b\x11\n\x0c\n\x05\x04\x01\x02\0\x01\
+ \x12\x03<\x12\x16\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03<\x19\x1a\n*\n\
+ \x04\x04\x01\x02\x01\x12\x03=\x02\x1e\"\x1d\x20e.g.\x20\"foo\",\x20\"foo\
+ .bar\",\x20etc.\n\n\x0c\n\x05\x04\x01\x02\x01\x04\x12\x03=\x02\n\n\x0c\n\
+ \x05\x04\x01\x02\x01\x05\x12\x03=\x0b\x11\n\x0c\n\x05\x04\x01\x02\x01\
+ \x01\x12\x03=\x12\x19\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03=\x1c\x1d\n\
+ 4\n\x04\x04\x01\x02\x02\x12\x03@\x02!\x1a'\x20Names\x20of\x20files\x20im\
+ ported\x20by\x20this\x20file.\n\n\x0c\n\x05\x04\x01\x02\x02\x04\x12\x03@\
+ \x02\n\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03@\x0b\x11\n\x0c\n\x05\x04\
+ \x01\x02\x02\x01\x12\x03@\x12\x1c\n\x0c\n\x05\x04\x01\x02\x02\x03\x12\
+ \x03@\x1f\x20\nQ\n\x04\x04\x01\x02\x03\x12\x03B\x02(\x1aD\x20Indexes\x20\
+ of\x20the\x20public\x20imported\x20files\x20in\x20the\x20dependency\x20l\
+ ist\x20above.\n\n\x0c\n\x05\x04\x01\x02\x03\x04\x12\x03B\x02\n\n\x0c\n\
+ \x05\x04\x01\x02\x03\x05\x12\x03B\x0b\x10\n\x0c\n\x05\x04\x01\x02\x03\
+ \x01\x12\x03B\x11\"\n\x0c\n\x05\x04\x01\x02\x03\x03\x12\x03B%'\nz\n\x04\
+ \x04\x01\x02\x04\x12\x03E\x02&\x1am\x20Indexes\x20of\x20the\x20weak\x20i\
+ mported\x20files\x20in\x20the\x20dependency\x20list.\n\x20For\x20Google-\
+ internal\x20migration\x20only.\x20Do\x20not\x20use.\n\n\x0c\n\x05\x04\
+ \x01\x02\x04\x04\x12\x03E\x02\n\n\x0c\n\x05\x04\x01\x02\x04\x05\x12\x03E\
+ \x0b\x10\n\x0c\n\x05\x04\x01\x02\x04\x01\x12\x03E\x11\x20\n\x0c\n\x05\
+ \x04\x01\x02\x04\x03\x12\x03E#%\n6\n\x04\x04\x01\x02\x05\x12\x03H\x02,\
+ \x1a)\x20All\x20top-level\x20definitions\x20in\x20this\x20file.\n\n\x0c\
+ \n\x05\x04\x01\x02\x05\x04\x12\x03H\x02\n\n\x0c\n\x05\x04\x01\x02\x05\
+ \x06\x12\x03H\x0b\x1a\n\x0c\n\x05\x04\x01\x02\x05\x01\x12\x03H\x1b'\n\
+ \x0c\n\x05\x04\x01\x02\x05\x03\x12\x03H*+\n\x0b\n\x04\x04\x01\x02\x06\
+ \x12\x03I\x02-\n\x0c\n\x05\x04\x01\x02\x06\x04\x12\x03I\x02\n\n\x0c\n\
+ \x05\x04\x01\x02\x06\x06\x12\x03I\x0b\x1e\n\x0c\n\x05\x04\x01\x02\x06\
+ \x01\x12\x03I\x1f(\n\x0c\n\x05\x04\x01\x02\x06\x03\x12\x03I+,\n\x0b\n\
+ \x04\x04\x01\x02\x07\x12\x03J\x02.\n\x0c\n\x05\x04\x01\x02\x07\x04\x12\
+ \x03J\x02\n\n\x0c\n\x05\x04\x01\x02\x07\x06\x12\x03J\x0b!\n\x0c\n\x05\
+ \x04\x01\x02\x07\x01\x12\x03J\")\n\x0c\n\x05\x04\x01\x02\x07\x03\x12\x03\
+ J,-\n\x0b\n\x04\x04\x01\x02\x08\x12\x03K\x02.\n\x0c\n\x05\x04\x01\x02\
+ \x08\x04\x12\x03K\x02\n\n\x0c\n\x05\x04\x01\x02\x08\x06\x12\x03K\x0b\x1f\
+ \n\x0c\n\x05\x04\x01\x02\x08\x01\x12\x03K\x20)\n\x0c\n\x05\x04\x01\x02\
+ \x08\x03\x12\x03K,-\n\x0b\n\x04\x04\x01\x02\t\x12\x03M\x02#\n\x0c\n\x05\
+ \x04\x01\x02\t\x04\x12\x03M\x02\n\n\x0c\n\x05\x04\x01\x02\t\x06\x12\x03M\
+ \x0b\x16\n\x0c\n\x05\x04\x01\x02\t\x01\x12\x03M\x17\x1e\n\x0c\n\x05\x04\
+ \x01\x02\t\x03\x12\x03M!\"\n\xf4\x01\n\x04\x04\x01\x02\n\x12\x03S\x02/\
+ \x1a\xe6\x01\x20This\x20field\x20contains\x20optional\x20information\x20\
+ about\x20the\x20original\x20source\x20code.\n\x20You\x20may\x20safely\
+ \x20remove\x20this\x20entire\x20field\x20without\x20harming\x20runtime\n\
+ \x20functionality\x20of\x20the\x20descriptors\x20--\x20the\x20informatio\
+ n\x20is\x20needed\x20only\x20by\n\x20development\x20tools.\n\n\x0c\n\x05\
+ \x04\x01\x02\n\x04\x12\x03S\x02\n\n\x0c\n\x05\x04\x01\x02\n\x06\x12\x03S\
+ \x0b\x19\n\x0c\n\x05\x04\x01\x02\n\x01\x12\x03S\x1a*\n\x0c\n\x05\x04\x01\
+ \x02\n\x03\x12\x03S-.\n]\n\x04\x04\x01\x02\x0b\x12\x03W\x02\x1e\x1aP\x20\
+ The\x20syntax\x20of\x20the\x20proto\x20file.\n\x20The\x20supported\x20va\
+ lues\x20are\x20\"proto2\"\x20and\x20\"proto3\".\n\n\x0c\n\x05\x04\x01\
+ \x02\x0b\x04\x12\x03W\x02\n\n\x0c\n\x05\x04\x01\x02\x0b\x05\x12\x03W\x0b\
+ \x11\n\x0c\n\x05\x04\x01\x02\x0b\x01\x12\x03W\x12\x18\n\x0c\n\x05\x04\
+ \x01\x02\x0b\x03\x12\x03W\x1b\x1d\n'\n\x02\x04\x02\x12\x04[\0y\x01\x1a\
+ \x1b\x20Describes\x20a\x20message\x20type.\n\n\n\n\x03\x04\x02\x01\x12\
+ \x03[\x08\x17\n\x0b\n\x04\x04\x02\x02\0\x12\x03\\\x02\x1b\n\x0c\n\x05\
+ \x04\x02\x02\0\x04\x12\x03\\\x02\n\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\
+ \\\x0b\x11\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\\\x12\x16\n\x0c\n\x05\
+ \x04\x02\x02\0\x03\x12\x03\\\x19\x1a\n\x0b\n\x04\x04\x02\x02\x01\x12\x03\
+ ^\x02*\n\x0c\n\x05\x04\x02\x02\x01\x04\x12\x03^\x02\n\n\x0c\n\x05\x04\
+ \x02\x02\x01\x06\x12\x03^\x0b\x1f\n\x0c\n\x05\x04\x02\x02\x01\x01\x12\
+ \x03^\x20%\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\x03^()\n\x0b\n\x04\x04\
+ \x02\x02\x02\x12\x03_\x02.\n\x0c\n\x05\x04\x02\x02\x02\x04\x12\x03_\x02\
+ \n\n\x0c\n\x05\x04\x02\x02\x02\x06\x12\x03_\x0b\x1f\n\x0c\n\x05\x04\x02\
+ \x02\x02\x01\x12\x03_\x20)\n\x0c\n\x05\x04\x02\x02\x02\x03\x12\x03_,-\n\
+ \x0b\n\x04\x04\x02\x02\x03\x12\x03a\x02+\n\x0c\n\x05\x04\x02\x02\x03\x04\
+ \x12\x03a\x02\n\n\x0c\n\x05\x04\x02\x02\x03\x06\x12\x03a\x0b\x1a\n\x0c\n\
+ \x05\x04\x02\x02\x03\x01\x12\x03a\x1b&\n\x0c\n\x05\x04\x02\x02\x03\x03\
+ \x12\x03a)*\n\x0b\n\x04\x04\x02\x02\x04\x12\x03b\x02-\n\x0c\n\x05\x04\
+ \x02\x02\x04\x04\x12\x03b\x02\n\n\x0c\n\x05\x04\x02\x02\x04\x06\x12\x03b\
+ \x0b\x1e\n\x0c\n\x05\x04\x02\x02\x04\x01\x12\x03b\x1f(\n\x0c\n\x05\x04\
+ \x02\x02\x04\x03\x12\x03b+,\n\x0c\n\x04\x04\x02\x03\0\x12\x04d\x02g\x03\
+ \n\x0c\n\x05\x04\x02\x03\0\x01\x12\x03d\n\x18\n\r\n\x06\x04\x02\x03\0\
+ \x02\0\x12\x03e\x04\x1d\n\x0e\n\x07\x04\x02\x03\0\x02\0\x04\x12\x03e\x04\
+ \x0c\n\x0e\n\x07\x04\x02\x03\0\x02\0\x05\x12\x03e\r\x12\n\x0e\n\x07\x04\
+ \x02\x03\0\x02\0\x01\x12\x03e\x13\x18\n\x0e\n\x07\x04\x02\x03\0\x02\0\
+ \x03\x12\x03e\x1b\x1c\n\r\n\x06\x04\x02\x03\0\x02\x01\x12\x03f\x04\x1b\n\
+ \x0e\n\x07\x04\x02\x03\0\x02\x01\x04\x12\x03f\x04\x0c\n\x0e\n\x07\x04\
+ \x02\x03\0\x02\x01\x05\x12\x03f\r\x12\n\x0e\n\x07\x04\x02\x03\0\x02\x01\
+ \x01\x12\x03f\x13\x16\n\x0e\n\x07\x04\x02\x03\0\x02\x01\x03\x12\x03f\x19\
+ \x1a\n\x0b\n\x04\x04\x02\x02\x05\x12\x03h\x02.\n\x0c\n\x05\x04\x02\x02\
+ \x05\x04\x12\x03h\x02\n\n\x0c\n\x05\x04\x02\x02\x05\x06\x12\x03h\x0b\x19\
+ \n\x0c\n\x05\x04\x02\x02\x05\x01\x12\x03h\x1a)\n\x0c\n\x05\x04\x02\x02\
+ \x05\x03\x12\x03h,-\n\x0b\n\x04\x04\x02\x02\x06\x12\x03j\x02/\n\x0c\n\
+ \x05\x04\x02\x02\x06\x04\x12\x03j\x02\n\n\x0c\n\x05\x04\x02\x02\x06\x06\
+ \x12\x03j\x0b\x1f\n\x0c\n\x05\x04\x02\x02\x06\x01\x12\x03j\x20*\n\x0c\n\
+ \x05\x04\x02\x02\x06\x03\x12\x03j-.\n\x0b\n\x04\x04\x02\x02\x07\x12\x03l\
+ \x02&\n\x0c\n\x05\x04\x02\x02\x07\x04\x12\x03l\x02\n\n\x0c\n\x05\x04\x02\
+ \x02\x07\x06\x12\x03l\x0b\x19\n\x0c\n\x05\x04\x02\x02\x07\x01\x12\x03l\
+ \x1a!\n\x0c\n\x05\x04\x02\x02\x07\x03\x12\x03l$%\n\xaa\x01\n\x04\x04\x02\
+ \x03\x01\x12\x04q\x02t\x03\x1a\x9b\x01\x20Range\x20of\x20reserved\x20tag\
+ \x20numbers.\x20Reserved\x20tag\x20numbers\x20may\x20not\x20be\x20used\
+ \x20by\n\x20fields\x20or\x20extension\x20ranges\x20in\x20the\x20same\x20\
+ message.\x20Reserved\x20ranges\x20may\n\x20not\x20overlap.\n\n\x0c\n\x05\
+ \x04\x02\x03\x01\x01\x12\x03q\n\x17\n\x1b\n\x06\x04\x02\x03\x01\x02\0\
+ \x12\x03r\x04\x1d\"\x0c\x20Inclusive.\n\n\x0e\n\x07\x04\x02\x03\x01\x02\
+ \0\x04\x12\x03r\x04\x0c\n\x0e\n\x07\x04\x02\x03\x01\x02\0\x05\x12\x03r\r\
+ \x12\n\x0e\n\x07\x04\x02\x03\x01\x02\0\x01\x12\x03r\x13\x18\n\x0e\n\x07\
+ \x04\x02\x03\x01\x02\0\x03\x12\x03r\x1b\x1c\n\x1b\n\x06\x04\x02\x03\x01\
+ \x02\x01\x12\x03s\x04\x1b\"\x0c\x20Exclusive.\n\n\x0e\n\x07\x04\x02\x03\
+ \x01\x02\x01\x04\x12\x03s\x04\x0c\n\x0e\n\x07\x04\x02\x03\x01\x02\x01\
+ \x05\x12\x03s\r\x12\n\x0e\n\x07\x04\x02\x03\x01\x02\x01\x01\x12\x03s\x13\
+ \x16\n\x0e\n\x07\x04\x02\x03\x01\x02\x01\x03\x12\x03s\x19\x1a\n\x0b\n\
+ \x04\x04\x02\x02\x08\x12\x03u\x02,\n\x0c\n\x05\x04\x02\x02\x08\x04\x12\
+ \x03u\x02\n\n\x0c\n\x05\x04\x02\x02\x08\x06\x12\x03u\x0b\x18\n\x0c\n\x05\
+ \x04\x02\x02\x08\x01\x12\x03u\x19'\n\x0c\n\x05\x04\x02\x02\x08\x03\x12\
+ \x03u*+\n\x82\x01\n\x04\x04\x02\x02\t\x12\x03x\x02%\x1au\x20Reserved\x20\
+ field\x20names,\x20which\x20may\x20not\x20be\x20used\x20by\x20fields\x20\
+ in\x20the\x20same\x20message.\n\x20A\x20given\x20name\x20may\x20only\x20\
+ be\x20reserved\x20once.\n\n\x0c\n\x05\x04\x02\x02\t\x04\x12\x03x\x02\n\n\
+ \x0c\n\x05\x04\x02\x02\t\x05\x12\x03x\x0b\x11\n\x0c\n\x05\x04\x02\x02\t\
+ \x01\x12\x03x\x12\x1f\n\x0c\n\x05\x04\x02\x02\t\x03\x12\x03x\"$\n2\n\x02\
+ \x04\x03\x12\x05|\0\xc7\x01\x01\x1a%\x20Describes\x20a\x20field\x20withi\
+ n\x20a\x20message.\n\n\n\n\x03\x04\x03\x01\x12\x03|\x08\x1c\n\r\n\x04\
+ \x04\x03\x04\0\x12\x05}\x02\x98\x01\x03\n\x0c\n\x05\x04\x03\x04\0\x01\
+ \x12\x03}\x07\x0b\nS\n\x06\x04\x03\x04\0\x02\0\x12\x04\x80\x01\x04\x1c\
+ \x1aC\x200\x20is\x20reserved\x20for\x20errors.\n\x20Order\x20is\x20weird\
+ \x20for\x20historical\x20reasons.\n\n\x0f\n\x07\x04\x03\x04\0\x02\0\x01\
+ \x12\x04\x80\x01\x04\x0f\n\x0f\n\x07\x04\x03\x04\0\x02\0\x02\x12\x04\x80\
+ \x01\x1a\x1b\n\x0e\n\x06\x04\x03\x04\0\x02\x01\x12\x04\x81\x01\x04\x1c\n\
+ \x0f\n\x07\x04\x03\x04\0\x02\x01\x01\x12\x04\x81\x01\x04\x0e\n\x0f\n\x07\
+ \x04\x03\x04\0\x02\x01\x02\x12\x04\x81\x01\x1a\x1b\nw\n\x06\x04\x03\x04\
+ \0\x02\x02\x12\x04\x84\x01\x04\x1c\x1ag\x20Not\x20ZigZag\x20encoded.\x20\
+ \x20Negative\x20numbers\x20take\x2010\x20bytes.\x20\x20Use\x20TYPE_SINT6\
+ 4\x20if\n\x20negative\x20values\x20are\x20likely.\n\n\x0f\n\x07\x04\x03\
+ \x04\0\x02\x02\x01\x12\x04\x84\x01\x04\x0e\n\x0f\n\x07\x04\x03\x04\0\x02\
+ \x02\x02\x12\x04\x84\x01\x1a\x1b\n\x0e\n\x06\x04\x03\x04\0\x02\x03\x12\
+ \x04\x85\x01\x04\x1c\n\x0f\n\x07\x04\x03\x04\0\x02\x03\x01\x12\x04\x85\
+ \x01\x04\x0f\n\x0f\n\x07\x04\x03\x04\0\x02\x03\x02\x12\x04\x85\x01\x1a\
+ \x1b\nw\n\x06\x04\x03\x04\0\x02\x04\x12\x04\x88\x01\x04\x1c\x1ag\x20Not\
+ \x20ZigZag\x20encoded.\x20\x20Negative\x20numbers\x20take\x2010\x20bytes\
+ .\x20\x20Use\x20TYPE_SINT32\x20if\n\x20negative\x20values\x20are\x20like\
+ ly.\n\n\x0f\n\x07\x04\x03\x04\0\x02\x04\x01\x12\x04\x88\x01\x04\x0e\n\
+ \x0f\n\x07\x04\x03\x04\0\x02\x04\x02\x12\x04\x88\x01\x1a\x1b\n\x0e\n\x06\
+ \x04\x03\x04\0\x02\x05\x12\x04\x89\x01\x04\x1c\n\x0f\n\x07\x04\x03\x04\0\
+ \x02\x05\x01\x12\x04\x89\x01\x04\x10\n\x0f\n\x07\x04\x03\x04\0\x02\x05\
+ \x02\x12\x04\x89\x01\x1a\x1b\n\x0e\n\x06\x04\x03\x04\0\x02\x06\x12\x04\
+ \x8a\x01\x04\x1c\n\x0f\n\x07\x04\x03\x04\0\x02\x06\x01\x12\x04\x8a\x01\
+ \x04\x10\n\x0f\n\x07\x04\x03\x04\0\x02\x06\x02\x12\x04\x8a\x01\x1a\x1b\n\
+ \x0e\n\x06\x04\x03\x04\0\x02\x07\x12\x04\x8b\x01\x04\x1c\n\x0f\n\x07\x04\
+ \x03\x04\0\x02\x07\x01\x12\x04\x8b\x01\x04\r\n\x0f\n\x07\x04\x03\x04\0\
+ \x02\x07\x02\x12\x04\x8b\x01\x1a\x1b\n\x0e\n\x06\x04\x03\x04\0\x02\x08\
+ \x12\x04\x8c\x01\x04\x1c\n\x0f\n\x07\x04\x03\x04\0\x02\x08\x01\x12\x04\
+ \x8c\x01\x04\x0f\n\x0f\n\x07\x04\x03\x04\0\x02\x08\x02\x12\x04\x8c\x01\
+ \x1a\x1b\n*\n\x06\x04\x03\x04\0\x02\t\x12\x04\x8d\x01\x04\x1d\"\x1a\x20T\
+ ag-delimited\x20aggregate.\n\n\x0f\n\x07\x04\x03\x04\0\x02\t\x01\x12\x04\
+ \x8d\x01\x04\x0e\n\x0f\n\x07\x04\x03\x04\0\x02\t\x02\x12\x04\x8d\x01\x1a\
+ \x1c\n-\n\x06\x04\x03\x04\0\x02\n\x12\x04\x8e\x01\x04\x1d\"\x1d\x20Lengt\
+ h-delimited\x20aggregate.\n\n\x0f\n\x07\x04\x03\x04\0\x02\n\x01\x12\x04\
+ \x8e\x01\x04\x10\n\x0f\n\x07\x04\x03\x04\0\x02\n\x02\x12\x04\x8e\x01\x1a\
+ \x1c\n#\n\x06\x04\x03\x04\0\x02\x0b\x12\x04\x91\x01\x04\x1d\x1a\x13\x20N\
+ ew\x20in\x20version\x202.\n\n\x0f\n\x07\x04\x03\x04\0\x02\x0b\x01\x12\
+ \x04\x91\x01\x04\x0e\n\x0f\n\x07\x04\x03\x04\0\x02\x0b\x02\x12\x04\x91\
+ \x01\x1a\x1c\n\x0e\n\x06\x04\x03\x04\0\x02\x0c\x12\x04\x92\x01\x04\x1d\n\
+ \x0f\n\x07\x04\x03\x04\0\x02\x0c\x01\x12\x04\x92\x01\x04\x0f\n\x0f\n\x07\
+ \x04\x03\x04\0\x02\x0c\x02\x12\x04\x92\x01\x1a\x1c\n\x0e\n\x06\x04\x03\
+ \x04\0\x02\r\x12\x04\x93\x01\x04\x1d\n\x0f\n\x07\x04\x03\x04\0\x02\r\x01\
+ \x12\x04\x93\x01\x04\r\n\x0f\n\x07\x04\x03\x04\0\x02\r\x02\x12\x04\x93\
+ \x01\x1a\x1c\n\x0e\n\x06\x04\x03\x04\0\x02\x0e\x12\x04\x94\x01\x04\x1d\n\
+ \x0f\n\x07\x04\x03\x04\0\x02\x0e\x01\x12\x04\x94\x01\x04\x11\n\x0f\n\x07\
+ \x04\x03\x04\0\x02\x0e\x02\x12\x04\x94\x01\x1a\x1c\n\x0e\n\x06\x04\x03\
+ \x04\0\x02\x0f\x12\x04\x95\x01\x04\x1d\n\x0f\n\x07\x04\x03\x04\0\x02\x0f\
+ \x01\x12\x04\x95\x01\x04\x11\n\x0f\n\x07\x04\x03\x04\0\x02\x0f\x02\x12\
+ \x04\x95\x01\x1a\x1c\n'\n\x06\x04\x03\x04\0\x02\x10\x12\x04\x96\x01\x04\
+ \x1d\"\x17\x20Uses\x20ZigZag\x20encoding.\n\n\x0f\n\x07\x04\x03\x04\0\
+ \x02\x10\x01\x12\x04\x96\x01\x04\x0f\n\x0f\n\x07\x04\x03\x04\0\x02\x10\
+ \x02\x12\x04\x96\x01\x1a\x1c\n'\n\x06\x04\x03\x04\0\x02\x11\x12\x04\x97\
+ \x01\x04\x1d\"\x17\x20Uses\x20ZigZag\x20encoding.\n\n\x0f\n\x07\x04\x03\
+ \x04\0\x02\x11\x01\x12\x04\x97\x01\x04\x0f\n\x0f\n\x07\x04\x03\x04\0\x02\
+ \x11\x02\x12\x04\x97\x01\x1a\x1c\n\x0e\n\x04\x04\x03\x04\x01\x12\x06\x9a\
+ \x01\x02\xa0\x01\x03\n\r\n\x05\x04\x03\x04\x01\x01\x12\x04\x9a\x01\x07\
+ \x0c\n*\n\x06\x04\x03\x04\x01\x02\0\x12\x04\x9c\x01\x04\x1c\x1a\x1a\x200\
+ \x20is\x20reserved\x20for\x20errors\n\n\x0f\n\x07\x04\x03\x04\x01\x02\0\
+ \x01\x12\x04\x9c\x01\x04\x12\n\x0f\n\x07\x04\x03\x04\x01\x02\0\x02\x12\
+ \x04\x9c\x01\x1a\x1b\n\x0e\n\x06\x04\x03\x04\x01\x02\x01\x12\x04\x9d\x01\
+ \x04\x1c\n\x0f\n\x07\x04\x03\x04\x01\x02\x01\x01\x12\x04\x9d\x01\x04\x12\
+ \n\x0f\n\x07\x04\x03\x04\x01\x02\x01\x02\x12\x04\x9d\x01\x1a\x1b\n8\n\
+ \x06\x04\x03\x04\x01\x02\x02\x12\x04\x9e\x01\x04\x1c\"(\x20TODO(sanjay):\
+ \x20Should\x20we\x20add\x20LABEL_MAP?\n\n\x0f\n\x07\x04\x03\x04\x01\x02\
+ \x02\x01\x12\x04\x9e\x01\x04\x12\n\x0f\n\x07\x04\x03\x04\x01\x02\x02\x02\
+ \x12\x04\x9e\x01\x1a\x1b\n\x0c\n\x04\x04\x03\x02\0\x12\x04\xa2\x01\x02\
+ \x1b\n\r\n\x05\x04\x03\x02\0\x04\x12\x04\xa2\x01\x02\n\n\r\n\x05\x04\x03\
+ \x02\0\x05\x12\x04\xa2\x01\x0b\x11\n\r\n\x05\x04\x03\x02\0\x01\x12\x04\
+ \xa2\x01\x12\x16\n\r\n\x05\x04\x03\x02\0\x03\x12\x04\xa2\x01\x19\x1a\n\
+ \x0c\n\x04\x04\x03\x02\x01\x12\x04\xa3\x01\x02\x1c\n\r\n\x05\x04\x03\x02\
+ \x01\x04\x12\x04\xa3\x01\x02\n\n\r\n\x05\x04\x03\x02\x01\x05\x12\x04\xa3\
+ \x01\x0b\x10\n\r\n\x05\x04\x03\x02\x01\x01\x12\x04\xa3\x01\x11\x17\n\r\n\
+ \x05\x04\x03\x02\x01\x03\x12\x04\xa3\x01\x1a\x1b\n\x0c\n\x04\x04\x03\x02\
+ \x02\x12\x04\xa4\x01\x02\x1b\n\r\n\x05\x04\x03\x02\x02\x04\x12\x04\xa4\
+ \x01\x02\n\n\r\n\x05\x04\x03\x02\x02\x06\x12\x04\xa4\x01\x0b\x10\n\r\n\
+ \x05\x04\x03\x02\x02\x01\x12\x04\xa4\x01\x11\x16\n\r\n\x05\x04\x03\x02\
+ \x02\x03\x12\x04\xa4\x01\x19\x1a\n\x9c\x01\n\x04\x04\x03\x02\x03\x12\x04\
+ \xa8\x01\x02\x19\x1a\x8d\x01\x20If\x20type_name\x20is\x20set,\x20this\
+ \x20need\x20not\x20be\x20set.\x20\x20If\x20both\x20this\x20and\x20type_n\
+ ame\n\x20are\x20set,\x20this\x20must\x20be\x20one\x20of\x20TYPE_ENUM,\
+ \x20TYPE_MESSAGE\x20or\x20TYPE_GROUP.\n\n\r\n\x05\x04\x03\x02\x03\x04\
+ \x12\x04\xa8\x01\x02\n\n\r\n\x05\x04\x03\x02\x03\x06\x12\x04\xa8\x01\x0b\
+ \x0f\n\r\n\x05\x04\x03\x02\x03\x01\x12\x04\xa8\x01\x10\x14\n\r\n\x05\x04\
+ \x03\x02\x03\x03\x12\x04\xa8\x01\x17\x18\n\xb7\x02\n\x04\x04\x03\x02\x04\
+ \x12\x04\xaf\x01\x02\x20\x1a\xa8\x02\x20For\x20message\x20and\x20enum\
+ \x20types,\x20this\x20is\x20the\x20name\x20of\x20the\x20type.\x20\x20If\
+ \x20the\x20name\n\x20starts\x20with\x20a\x20'.',\x20it\x20is\x20fully-qu\
+ alified.\x20\x20Otherwise,\x20C++-like\x20scoping\n\x20rules\x20are\x20u\
+ sed\x20to\x20find\x20the\x20type\x20(i.e.\x20first\x20the\x20nested\x20t\
+ ypes\x20within\x20this\n\x20message\x20are\x20searched,\x20then\x20withi\
+ n\x20the\x20parent,\x20on\x20up\x20to\x20the\x20root\n\x20namespace).\n\
+ \n\r\n\x05\x04\x03\x02\x04\x04\x12\x04\xaf\x01\x02\n\n\r\n\x05\x04\x03\
+ \x02\x04\x05\x12\x04\xaf\x01\x0b\x11\n\r\n\x05\x04\x03\x02\x04\x01\x12\
+ \x04\xaf\x01\x12\x1b\n\r\n\x05\x04\x03\x02\x04\x03\x12\x04\xaf\x01\x1e\
+ \x1f\n~\n\x04\x04\x03\x02\x05\x12\x04\xb3\x01\x02\x1f\x1ap\x20For\x20ext\
+ ensions,\x20this\x20is\x20the\x20name\x20of\x20the\x20type\x20being\x20e\
+ xtended.\x20\x20It\x20is\n\x20resolved\x20in\x20the\x20same\x20manner\
+ \x20as\x20type_name.\n\n\r\n\x05\x04\x03\x02\x05\x04\x12\x04\xb3\x01\x02\
+ \n\n\r\n\x05\x04\x03\x02\x05\x05\x12\x04\xb3\x01\x0b\x11\n\r\n\x05\x04\
+ \x03\x02\x05\x01\x12\x04\xb3\x01\x12\x1a\n\r\n\x05\x04\x03\x02\x05\x03\
+ \x12\x04\xb3\x01\x1d\x1e\n\xb1\x02\n\x04\x04\x03\x02\x06\x12\x04\xba\x01\
+ \x02$\x1a\xa2\x02\x20For\x20numeric\x20types,\x20contains\x20the\x20orig\
+ inal\x20text\x20representation\x20of\x20the\x20value.\n\x20For\x20boolea\
+ ns,\x20\"true\"\x20or\x20\"false\".\n\x20For\x20strings,\x20contains\x20\
+ the\x20default\x20text\x20contents\x20(not\x20escaped\x20in\x20any\x20wa\
+ y).\n\x20For\x20bytes,\x20contains\x20the\x20C\x20escaped\x20value.\x20\
+ \x20All\x20bytes\x20>=\x20128\x20are\x20escaped.\n\x20TODO(kenton):\x20\
+ \x20Base-64\x20encode?\n\n\r\n\x05\x04\x03\x02\x06\x04\x12\x04\xba\x01\
+ \x02\n\n\r\n\x05\x04\x03\x02\x06\x05\x12\x04\xba\x01\x0b\x11\n\r\n\x05\
+ \x04\x03\x02\x06\x01\x12\x04\xba\x01\x12\x1f\n\r\n\x05\x04\x03\x02\x06\
+ \x03\x12\x04\xba\x01\"#\n\x84\x01\n\x04\x04\x03\x02\x07\x12\x04\xbe\x01\
+ \x02!\x1av\x20If\x20set,\x20gives\x20the\x20index\x20of\x20a\x20oneof\
+ \x20in\x20the\x20containing\x20type's\x20oneof_decl\n\x20list.\x20\x20Th\
+ is\x20field\x20is\x20a\x20member\x20of\x20that\x20oneof.\n\n\r\n\x05\x04\
+ \x03\x02\x07\x04\x12\x04\xbe\x01\x02\n\n\r\n\x05\x04\x03\x02\x07\x05\x12\
+ \x04\xbe\x01\x0b\x10\n\r\n\x05\x04\x03\x02\x07\x01\x12\x04\xbe\x01\x11\
+ \x1c\n\r\n\x05\x04\x03\x02\x07\x03\x12\x04\xbe\x01\x1f\x20\n\xfa\x01\n\
+ \x04\x04\x03\x02\x08\x12\x04\xc4\x01\x02!\x1a\xeb\x01\x20JSON\x20name\
+ \x20of\x20this\x20field.\x20The\x20value\x20is\x20set\x20by\x20protocol\
+ \x20compiler.\x20If\x20the\n\x20user\x20has\x20set\x20a\x20\"json_name\"\
+ \x20option\x20on\x20this\x20field,\x20that\x20option's\x20value\n\x20wil\
+ l\x20be\x20used.\x20Otherwise,\x20it's\x20deduced\x20from\x20the\x20fiel\
+ d's\x20name\x20by\x20converting\n\x20it\x20to\x20camelCase.\n\n\r\n\x05\
+ \x04\x03\x02\x08\x04\x12\x04\xc4\x01\x02\n\n\r\n\x05\x04\x03\x02\x08\x05\
+ \x12\x04\xc4\x01\x0b\x11\n\r\n\x05\x04\x03\x02\x08\x01\x12\x04\xc4\x01\
+ \x12\x1b\n\r\n\x05\x04\x03\x02\x08\x03\x12\x04\xc4\x01\x1e\x20\n\x0c\n\
+ \x04\x04\x03\x02\t\x12\x04\xc6\x01\x02$\n\r\n\x05\x04\x03\x02\t\x04\x12\
+ \x04\xc6\x01\x02\n\n\r\n\x05\x04\x03\x02\t\x06\x12\x04\xc6\x01\x0b\x17\n\
+ \r\n\x05\x04\x03\x02\t\x01\x12\x04\xc6\x01\x18\x1f\n\r\n\x05\x04\x03\x02\
+ \t\x03\x12\x04\xc6\x01\"#\n\"\n\x02\x04\x04\x12\x06\xca\x01\0\xcd\x01\
+ \x01\x1a\x14\x20Describes\x20a\x20oneof.\n\n\x0b\n\x03\x04\x04\x01\x12\
+ \x04\xca\x01\x08\x1c\n\x0c\n\x04\x04\x04\x02\0\x12\x04\xcb\x01\x02\x1b\n\
+ \r\n\x05\x04\x04\x02\0\x04\x12\x04\xcb\x01\x02\n\n\r\n\x05\x04\x04\x02\0\
+ \x05\x12\x04\xcb\x01\x0b\x11\n\r\n\x05\x04\x04\x02\0\x01\x12\x04\xcb\x01\
+ \x12\x16\n\r\n\x05\x04\x04\x02\0\x03\x12\x04\xcb\x01\x19\x1a\n\x0c\n\x04\
+ \x04\x04\x02\x01\x12\x04\xcc\x01\x02$\n\r\n\x05\x04\x04\x02\x01\x04\x12\
+ \x04\xcc\x01\x02\n\n\r\n\x05\x04\x04\x02\x01\x06\x12\x04\xcc\x01\x0b\x17\
+ \n\r\n\x05\x04\x04\x02\x01\x01\x12\x04\xcc\x01\x18\x1f\n\r\n\x05\x04\x04\
+ \x02\x01\x03\x12\x04\xcc\x01\"#\n'\n\x02\x04\x05\x12\x06\xd0\x01\0\xd6\
+ \x01\x01\x1a\x19\x20Describes\x20an\x20enum\x20type.\n\n\x0b\n\x03\x04\
+ \x05\x01\x12\x04\xd0\x01\x08\x1b\n\x0c\n\x04\x04\x05\x02\0\x12\x04\xd1\
+ \x01\x02\x1b\n\r\n\x05\x04\x05\x02\0\x04\x12\x04\xd1\x01\x02\n\n\r\n\x05\
+ \x04\x05\x02\0\x05\x12\x04\xd1\x01\x0b\x11\n\r\n\x05\x04\x05\x02\0\x01\
+ \x12\x04\xd1\x01\x12\x16\n\r\n\x05\x04\x05\x02\0\x03\x12\x04\xd1\x01\x19\
+ \x1a\n\x0c\n\x04\x04\x05\x02\x01\x12\x04\xd3\x01\x02.\n\r\n\x05\x04\x05\
+ \x02\x01\x04\x12\x04\xd3\x01\x02\n\n\r\n\x05\x04\x05\x02\x01\x06\x12\x04\
+ \xd3\x01\x0b#\n\r\n\x05\x04\x05\x02\x01\x01\x12\x04\xd3\x01$)\n\r\n\x05\
+ \x04\x05\x02\x01\x03\x12\x04\xd3\x01,-\n\x0c\n\x04\x04\x05\x02\x02\x12\
+ \x04\xd5\x01\x02#\n\r\n\x05\x04\x05\x02\x02\x04\x12\x04\xd5\x01\x02\n\n\
+ \r\n\x05\x04\x05\x02\x02\x06\x12\x04\xd5\x01\x0b\x16\n\r\n\x05\x04\x05\
+ \x02\x02\x01\x12\x04\xd5\x01\x17\x1e\n\r\n\x05\x04\x05\x02\x02\x03\x12\
+ \x04\xd5\x01!\"\n1\n\x02\x04\x06\x12\x06\xd9\x01\0\xde\x01\x01\x1a#\x20D\
+ escribes\x20a\x20value\x20within\x20an\x20enum.\n\n\x0b\n\x03\x04\x06\
+ \x01\x12\x04\xd9\x01\x08\x20\n\x0c\n\x04\x04\x06\x02\0\x12\x04\xda\x01\
+ \x02\x1b\n\r\n\x05\x04\x06\x02\0\x04\x12\x04\xda\x01\x02\n\n\r\n\x05\x04\
+ \x06\x02\0\x05\x12\x04\xda\x01\x0b\x11\n\r\n\x05\x04\x06\x02\0\x01\x12\
+ \x04\xda\x01\x12\x16\n\r\n\x05\x04\x06\x02\0\x03\x12\x04\xda\x01\x19\x1a\
+ \n\x0c\n\x04\x04\x06\x02\x01\x12\x04\xdb\x01\x02\x1c\n\r\n\x05\x04\x06\
+ \x02\x01\x04\x12\x04\xdb\x01\x02\n\n\r\n\x05\x04\x06\x02\x01\x05\x12\x04\
+ \xdb\x01\x0b\x10\n\r\n\x05\x04\x06\x02\x01\x01\x12\x04\xdb\x01\x11\x17\n\
+ \r\n\x05\x04\x06\x02\x01\x03\x12\x04\xdb\x01\x1a\x1b\n\x0c\n\x04\x04\x06\
+ \x02\x02\x12\x04\xdd\x01\x02(\n\r\n\x05\x04\x06\x02\x02\x04\x12\x04\xdd\
+ \x01\x02\n\n\r\n\x05\x04\x06\x02\x02\x06\x12\x04\xdd\x01\x0b\x1b\n\r\n\
+ \x05\x04\x06\x02\x02\x01\x12\x04\xdd\x01\x1c#\n\r\n\x05\x04\x06\x02\x02\
+ \x03\x12\x04\xdd\x01&'\n$\n\x02\x04\x07\x12\x06\xe1\x01\0\xe6\x01\x01\
+ \x1a\x16\x20Describes\x20a\x20service.\n\n\x0b\n\x03\x04\x07\x01\x12\x04\
+ \xe1\x01\x08\x1e\n\x0c\n\x04\x04\x07\x02\0\x12\x04\xe2\x01\x02\x1b\n\r\n\
+ \x05\x04\x07\x02\0\x04\x12\x04\xe2\x01\x02\n\n\r\n\x05\x04\x07\x02\0\x05\
+ \x12\x04\xe2\x01\x0b\x11\n\r\n\x05\x04\x07\x02\0\x01\x12\x04\xe2\x01\x12\
+ \x16\n\r\n\x05\x04\x07\x02\0\x03\x12\x04\xe2\x01\x19\x1a\n\x0c\n\x04\x04\
+ \x07\x02\x01\x12\x04\xe3\x01\x02,\n\r\n\x05\x04\x07\x02\x01\x04\x12\x04\
+ \xe3\x01\x02\n\n\r\n\x05\x04\x07\x02\x01\x06\x12\x04\xe3\x01\x0b\x20\n\r\
+ \n\x05\x04\x07\x02\x01\x01\x12\x04\xe3\x01!'\n\r\n\x05\x04\x07\x02\x01\
+ \x03\x12\x04\xe3\x01*+\n\x0c\n\x04\x04\x07\x02\x02\x12\x04\xe5\x01\x02&\
+ \n\r\n\x05\x04\x07\x02\x02\x04\x12\x04\xe5\x01\x02\n\n\r\n\x05\x04\x07\
+ \x02\x02\x06\x12\x04\xe5\x01\x0b\x19\n\r\n\x05\x04\x07\x02\x02\x01\x12\
+ \x04\xe5\x01\x1a!\n\r\n\x05\x04\x07\x02\x02\x03\x12\x04\xe5\x01$%\n0\n\
+ \x02\x04\x08\x12\x06\xe9\x01\0\xf7\x01\x01\x1a\"\x20Describes\x20a\x20me\
+ thod\x20of\x20a\x20service.\n\n\x0b\n\x03\x04\x08\x01\x12\x04\xe9\x01\
+ \x08\x1d\n\x0c\n\x04\x04\x08\x02\0\x12\x04\xea\x01\x02\x1b\n\r\n\x05\x04\
+ \x08\x02\0\x04\x12\x04\xea\x01\x02\n\n\r\n\x05\x04\x08\x02\0\x05\x12\x04\
+ \xea\x01\x0b\x11\n\r\n\x05\x04\x08\x02\0\x01\x12\x04\xea\x01\x12\x16\n\r\
+ \n\x05\x04\x08\x02\0\x03\x12\x04\xea\x01\x19\x1a\n\x97\x01\n\x04\x04\x08\
+ \x02\x01\x12\x04\xee\x01\x02!\x1a\x88\x01\x20Input\x20and\x20output\x20t\
+ ype\x20names.\x20\x20These\x20are\x20resolved\x20in\x20the\x20same\x20wa\
+ y\x20as\n\x20FieldDescriptorProto.type_name,\x20but\x20must\x20refer\x20\
+ to\x20a\x20message\x20type.\n\n\r\n\x05\x04\x08\x02\x01\x04\x12\x04\xee\
+ \x01\x02\n\n\r\n\x05\x04\x08\x02\x01\x05\x12\x04\xee\x01\x0b\x11\n\r\n\
+ \x05\x04\x08\x02\x01\x01\x12\x04\xee\x01\x12\x1c\n\r\n\x05\x04\x08\x02\
+ \x01\x03\x12\x04\xee\x01\x1f\x20\n\x0c\n\x04\x04\x08\x02\x02\x12\x04\xef\
+ \x01\x02\"\n\r\n\x05\x04\x08\x02\x02\x04\x12\x04\xef\x01\x02\n\n\r\n\x05\
+ \x04\x08\x02\x02\x05\x12\x04\xef\x01\x0b\x11\n\r\n\x05\x04\x08\x02\x02\
+ \x01\x12\x04\xef\x01\x12\x1d\n\r\n\x05\x04\x08\x02\x02\x03\x12\x04\xef\
+ \x01\x20!\n\x0c\n\x04\x04\x08\x02\x03\x12\x04\xf1\x01\x02%\n\r\n\x05\x04\
+ \x08\x02\x03\x04\x12\x04\xf1\x01\x02\n\n\r\n\x05\x04\x08\x02\x03\x06\x12\
+ \x04\xf1\x01\x0b\x18\n\r\n\x05\x04\x08\x02\x03\x01\x12\x04\xf1\x01\x19\
+ \x20\n\r\n\x05\x04\x08\x02\x03\x03\x12\x04\xf1\x01#$\nE\n\x04\x04\x08\
+ \x02\x04\x12\x04\xf4\x01\x025\x1a7\x20Identifies\x20if\x20client\x20stre\
+ ams\x20multiple\x20client\x20messages\n\n\r\n\x05\x04\x08\x02\x04\x04\
+ \x12\x04\xf4\x01\x02\n\n\r\n\x05\x04\x08\x02\x04\x05\x12\x04\xf4\x01\x0b\
+ \x0f\n\r\n\x05\x04\x08\x02\x04\x01\x12\x04\xf4\x01\x10\x20\n\r\n\x05\x04\
+ \x08\x02\x04\x03\x12\x04\xf4\x01#$\n\r\n\x05\x04\x08\x02\x04\x08\x12\x04\
+ \xf4\x01%4\n\r\n\x05\x04\x08\x02\x04\x07\x12\x04\xf4\x01.3\nE\n\x04\x04\
+ \x08\x02\x05\x12\x04\xf6\x01\x025\x1a7\x20Identifies\x20if\x20server\x20\
+ streams\x20multiple\x20server\x20messages\n\n\r\n\x05\x04\x08\x02\x05\
+ \x04\x12\x04\xf6\x01\x02\n\n\r\n\x05\x04\x08\x02\x05\x05\x12\x04\xf6\x01\
+ \x0b\x0f\n\r\n\x05\x04\x08\x02\x05\x01\x12\x04\xf6\x01\x10\x20\n\r\n\x05\
+ \x04\x08\x02\x05\x03\x12\x04\xf6\x01#$\n\r\n\x05\x04\x08\x02\x05\x08\x12\
+ \x04\xf6\x01%4\n\r\n\x05\x04\x08\x02\x05\x07\x12\x04\xf6\x01.3\n\xaf\x0e\
+ \n\x02\x04\t\x12\x06\x9b\x02\0\xf8\x02\x012N\x20========================\
+ ===========================================\n\x20Options\n2\xd0\r\x20Eac\
+ h\x20of\x20the\x20definitions\x20above\x20may\x20have\x20\"options\"\x20\
+ attached.\x20\x20These\x20are\n\x20just\x20annotations\x20which\x20may\
+ \x20cause\x20code\x20to\x20be\x20generated\x20slightly\x20differently\n\
+ \x20or\x20may\x20contain\x20hints\x20for\x20code\x20that\x20manipulates\
+ \x20protocol\x20messages.\n\n\x20Clients\x20may\x20define\x20custom\x20o\
+ ptions\x20as\x20extensions\x20of\x20the\x20*Options\x20messages.\n\x20Th\
+ ese\x20extensions\x20may\x20not\x20yet\x20be\x20known\x20at\x20parsing\
+ \x20time,\x20so\x20the\x20parser\x20cannot\n\x20store\x20the\x20values\
+ \x20in\x20them.\x20\x20Instead\x20it\x20stores\x20them\x20in\x20a\x20fie\
+ ld\x20in\x20the\x20*Options\n\x20message\x20called\x20uninterpreted_opti\
+ on.\x20This\x20field\x20must\x20have\x20the\x20same\x20name\n\x20across\
+ \x20all\x20*Options\x20messages.\x20We\x20then\x20use\x20this\x20field\
+ \x20to\x20populate\x20the\n\x20extensions\x20when\x20we\x20build\x20a\
+ \x20descriptor,\x20at\x20which\x20point\x20all\x20protos\x20have\x20been\
+ \n\x20parsed\x20and\x20so\x20all\x20extensions\x20are\x20known.\n\n\x20E\
+ xtension\x20numbers\x20for\x20custom\x20options\x20may\x20be\x20chosen\
+ \x20as\x20follows:\n\x20*\x20For\x20options\x20which\x20will\x20only\x20\
+ be\x20used\x20within\x20a\x20single\x20application\x20or\n\x20\x20\x20or\
+ ganization,\x20or\x20for\x20experimental\x20options,\x20use\x20field\x20\
+ numbers\x2050000\n\x20\x20\x20through\x2099999.\x20\x20It\x20is\x20up\
+ \x20to\x20you\x20to\x20ensure\x20that\x20you\x20do\x20not\x20use\x20the\
+ \n\x20\x20\x20same\x20number\x20for\x20multiple\x20options.\n\x20*\x20Fo\
+ r\x20options\x20which\x20will\x20be\x20published\x20and\x20used\x20publi\
+ cly\x20by\x20multiple\n\x20\x20\x20independent\x20entities,\x20e-mail\
+ \x20protobuf-global-extension-registry@google.com\n\x20\x20\x20to\x20res\
+ erve\x20extension\x20numbers.\x20Simply\x20provide\x20your\x20project\
+ \x20name\x20(e.g.\n\x20\x20\x20Objective-C\x20plugin)\x20and\x20your\x20\
+ project\x20website\x20(if\x20available)\x20--\x20there's\x20no\n\x20\x20\
+ \x20need\x20to\x20explain\x20how\x20you\x20intend\x20to\x20use\x20them.\
+ \x20Usually\x20you\x20only\x20need\x20one\n\x20\x20\x20extension\x20numb\
+ er.\x20You\x20can\x20declare\x20multiple\x20options\x20with\x20only\x20o\
+ ne\x20extension\n\x20\x20\x20number\x20by\x20putting\x20them\x20in\x20a\
+ \x20sub-message.\x20See\x20the\x20Custom\x20Options\x20section\x20of\n\
+ \x20\x20\x20the\x20docs\x20for\x20examples:\n\x20\x20\x20https://develop\
+ ers.google.com/protocol-buffers/docs/proto#options\n\x20\x20\x20If\x20th\
+ is\x20turns\x20out\x20to\x20be\x20popular,\x20a\x20web\x20service\x20wil\
+ l\x20be\x20set\x20up\n\x20\x20\x20to\x20automatically\x20assign\x20optio\
+ n\x20numbers.\n\n\x0b\n\x03\x04\t\x01\x12\x04\x9b\x02\x08\x13\n\xf4\x01\
+ \n\x04\x04\t\x02\0\x12\x04\xa1\x02\x02#\x1a\xe5\x01\x20Sets\x20the\x20Ja\
+ va\x20package\x20where\x20classes\x20generated\x20from\x20this\x20.proto\
+ \x20will\x20be\n\x20placed.\x20\x20By\x20default,\x20the\x20proto\x20pac\
+ kage\x20is\x20used,\x20but\x20this\x20is\x20often\n\x20inappropriate\x20\
+ because\x20proto\x20packages\x20do\x20not\x20normally\x20start\x20with\
+ \x20backwards\n\x20domain\x20names.\n\n\r\n\x05\x04\t\x02\0\x04\x12\x04\
+ \xa1\x02\x02\n\n\r\n\x05\x04\t\x02\0\x05\x12\x04\xa1\x02\x0b\x11\n\r\n\
+ \x05\x04\t\x02\0\x01\x12\x04\xa1\x02\x12\x1e\n\r\n\x05\x04\t\x02\0\x03\
+ \x12\x04\xa1\x02!\"\n\xbf\x02\n\x04\x04\t\x02\x01\x12\x04\xa9\x02\x02+\
+ \x1a\xb0\x02\x20If\x20set,\x20all\x20the\x20classes\x20from\x20the\x20.p\
+ roto\x20file\x20are\x20wrapped\x20in\x20a\x20single\n\x20outer\x20class\
+ \x20with\x20the\x20given\x20name.\x20\x20This\x20applies\x20to\x20both\
+ \x20Proto1\n\x20(equivalent\x20to\x20the\x20old\x20\"--one_java_file\"\
+ \x20option)\x20and\x20Proto2\x20(where\n\x20a\x20.proto\x20always\x20tra\
+ nslates\x20to\x20a\x20single\x20class,\x20but\x20you\x20may\x20want\x20t\
+ o\n\x20explicitly\x20choose\x20the\x20class\x20name).\n\n\r\n\x05\x04\t\
+ \x02\x01\x04\x12\x04\xa9\x02\x02\n\n\r\n\x05\x04\t\x02\x01\x05\x12\x04\
+ \xa9\x02\x0b\x11\n\r\n\x05\x04\t\x02\x01\x01\x12\x04\xa9\x02\x12&\n\r\n\
+ \x05\x04\t\x02\x01\x03\x12\x04\xa9\x02)*\n\xa3\x03\n\x04\x04\t\x02\x02\
+ \x12\x04\xb1\x02\x029\x1a\x94\x03\x20If\x20set\x20true,\x20then\x20the\
+ \x20Java\x20code\x20generator\x20will\x20generate\x20a\x20separate\x20.j\
+ ava\n\x20file\x20for\x20each\x20top-level\x20message,\x20enum,\x20and\
+ \x20service\x20defined\x20in\x20the\x20.proto\n\x20file.\x20\x20Thus,\
+ \x20these\x20types\x20will\x20*not*\x20be\x20nested\x20inside\x20the\x20\
+ outer\x20class\n\x20named\x20by\x20java_outer_classname.\x20\x20However,\
+ \x20the\x20outer\x20class\x20will\x20still\x20be\n\x20generated\x20to\
+ \x20contain\x20the\x20file's\x20getDescriptor()\x20method\x20as\x20well\
+ \x20as\x20any\n\x20top-level\x20extensions\x20defined\x20in\x20the\x20fi\
+ le.\n\n\r\n\x05\x04\t\x02\x02\x04\x12\x04\xb1\x02\x02\n\n\r\n\x05\x04\t\
+ \x02\x02\x05\x12\x04\xb1\x02\x0b\x0f\n\r\n\x05\x04\t\x02\x02\x01\x12\x04\
+ \xb1\x02\x10#\n\r\n\x05\x04\t\x02\x02\x03\x12\x04\xb1\x02&(\n\r\n\x05\
+ \x04\t\x02\x02\x08\x12\x04\xb1\x02)8\n\r\n\x05\x04\t\x02\x02\x07\x12\x04\
+ \xb1\x0227\n)\n\x04\x04\t\x02\x03\x12\x04\xb4\x02\x02E\x1a\x1b\x20This\
+ \x20option\x20does\x20nothing.\n\n\r\n\x05\x04\t\x02\x03\x04\x12\x04\xb4\
+ \x02\x02\n\n\r\n\x05\x04\t\x02\x03\x05\x12\x04\xb4\x02\x0b\x0f\n\r\n\x05\
+ \x04\t\x02\x03\x01\x12\x04\xb4\x02\x10-\n\r\n\x05\x04\t\x02\x03\x03\x12\
+ \x04\xb4\x0202\n\r\n\x05\x04\t\x02\x03\x08\x12\x04\xb4\x023D\n\x0e\n\x06\
+ \x04\t\x02\x03\x08\x03\x12\x04\xb4\x024C\n\xe6\x02\n\x04\x04\t\x02\x04\
+ \x12\x04\xbc\x02\x02<\x1a\xd7\x02\x20If\x20set\x20true,\x20then\x20the\
+ \x20Java2\x20code\x20generator\x20will\x20generate\x20code\x20that\n\x20\
+ throws\x20an\x20exception\x20whenever\x20an\x20attempt\x20is\x20made\x20\
+ to\x20assign\x20a\x20non-UTF-8\n\x20byte\x20sequence\x20to\x20a\x20strin\
+ g\x20field.\n\x20Message\x20reflection\x20will\x20do\x20the\x20same.\n\
+ \x20However,\x20an\x20extension\x20field\x20still\x20accepts\x20non-UTF-\
+ 8\x20byte\x20sequences.\n\x20This\x20option\x20has\x20no\x20effect\x20on\
+ \x20when\x20used\x20with\x20the\x20lite\x20runtime.\n\n\r\n\x05\x04\t\
+ \x02\x04\x04\x12\x04\xbc\x02\x02\n\n\r\n\x05\x04\t\x02\x04\x05\x12\x04\
+ \xbc\x02\x0b\x0f\n\r\n\x05\x04\t\x02\x04\x01\x12\x04\xbc\x02\x10&\n\r\n\
+ \x05\x04\t\x02\x04\x03\x12\x04\xbc\x02)+\n\r\n\x05\x04\t\x02\x04\x08\x12\
+ \x04\xbc\x02,;\n\r\n\x05\x04\t\x02\x04\x07\x12\x04\xbc\x025:\nL\n\x04\
+ \x04\t\x04\0\x12\x06\xc0\x02\x02\xc5\x02\x03\x1a<\x20Generated\x20classe\
+ s\x20can\x20be\x20optimized\x20for\x20speed\x20or\x20code\x20size.\n\n\r\
+ \n\x05\x04\t\x04\0\x01\x12\x04\xc0\x02\x07\x13\nD\n\x06\x04\t\x04\0\x02\
+ \0\x12\x04\xc1\x02\x04\x0e\"4\x20Generate\x20complete\x20code\x20for\x20\
+ parsing,\x20serialization,\n\n\x0f\n\x07\x04\t\x04\0\x02\0\x01\x12\x04\
+ \xc1\x02\x04\t\n\x0f\n\x07\x04\t\x04\0\x02\0\x02\x12\x04\xc1\x02\x0c\r\n\
+ G\n\x06\x04\t\x04\0\x02\x01\x12\x04\xc3\x02\x04\x12\x1a\x06\x20etc.\n\"/\
+ \x20Use\x20ReflectionOps\x20to\x20implement\x20these\x20methods.\n\n\x0f\
+ \n\x07\x04\t\x04\0\x02\x01\x01\x12\x04\xc3\x02\x04\r\n\x0f\n\x07\x04\t\
+ \x04\0\x02\x01\x02\x12\x04\xc3\x02\x10\x11\nG\n\x06\x04\t\x04\0\x02\x02\
+ \x12\x04\xc4\x02\x04\x15\"7\x20Generate\x20code\x20using\x20MessageLite\
+ \x20and\x20the\x20lite\x20runtime.\n\n\x0f\n\x07\x04\t\x04\0\x02\x02\x01\
+ \x12\x04\xc4\x02\x04\x10\n\x0f\n\x07\x04\t\x04\0\x02\x02\x02\x12\x04\xc4\
+ \x02\x13\x14\n\x0c\n\x04\x04\t\x02\x05\x12\x04\xc6\x02\x029\n\r\n\x05\
+ \x04\t\x02\x05\x04\x12\x04\xc6\x02\x02\n\n\r\n\x05\x04\t\x02\x05\x06\x12\
+ \x04\xc6\x02\x0b\x17\n\r\n\x05\x04\t\x02\x05\x01\x12\x04\xc6\x02\x18$\n\
+ \r\n\x05\x04\t\x02\x05\x03\x12\x04\xc6\x02'(\n\r\n\x05\x04\t\x02\x05\x08\
+ \x12\x04\xc6\x02)8\n\r\n\x05\x04\t\x02\x05\x07\x12\x04\xc6\x0227\n\xe2\
+ \x02\n\x04\x04\t\x02\x06\x12\x04\xcd\x02\x02\"\x1a\xd3\x02\x20Sets\x20th\
+ e\x20Go\x20package\x20where\x20structs\x20generated\x20from\x20this\x20.\
+ proto\x20will\x20be\n\x20placed.\x20If\x20omitted,\x20the\x20Go\x20packa\
+ ge\x20will\x20be\x20derived\x20from\x20the\x20following:\n\x20\x20\x20-\
+ \x20The\x20basename\x20of\x20the\x20package\x20import\x20path,\x20if\x20\
+ provided.\n\x20\x20\x20-\x20Otherwise,\x20the\x20package\x20statement\
+ \x20in\x20the\x20.proto\x20file,\x20if\x20present.\n\x20\x20\x20-\x20Oth\
+ erwise,\x20the\x20basename\x20of\x20the\x20.proto\x20file,\x20without\
+ \x20extension.\n\n\r\n\x05\x04\t\x02\x06\x04\x12\x04\xcd\x02\x02\n\n\r\n\
+ \x05\x04\t\x02\x06\x05\x12\x04\xcd\x02\x0b\x11\n\r\n\x05\x04\t\x02\x06\
+ \x01\x12\x04\xcd\x02\x12\x1c\n\r\n\x05\x04\t\x02\x06\x03\x12\x04\xcd\x02\
+ \x1f!\n\xd4\x04\n\x04\x04\t\x02\x07\x12\x04\xdb\x02\x029\x1a\xc5\x04\x20\
+ Should\x20generic\x20services\x20be\x20generated\x20in\x20each\x20langua\
+ ge?\x20\x20\"Generic\"\x20services\n\x20are\x20not\x20specific\x20to\x20\
+ any\x20particular\x20RPC\x20system.\x20\x20They\x20are\x20generated\x20b\
+ y\x20the\n\x20main\x20code\x20generators\x20in\x20each\x20language\x20(w\
+ ithout\x20additional\x20plugins).\n\x20Generic\x20services\x20were\x20th\
+ e\x20only\x20kind\x20of\x20service\x20generation\x20supported\x20by\n\
+ \x20early\x20versions\x20of\x20google.protobuf.\n\n\x20Generic\x20servic\
+ es\x20are\x20now\x20considered\x20deprecated\x20in\x20favor\x20of\x20usi\
+ ng\x20plugins\n\x20that\x20generate\x20code\x20specific\x20to\x20your\
+ \x20particular\x20RPC\x20system.\x20\x20Therefore,\n\x20these\x20default\
+ \x20to\x20false.\x20\x20Old\x20code\x20which\x20depends\x20on\x20generic\
+ \x20services\x20should\n\x20explicitly\x20set\x20them\x20to\x20true.\n\n\
+ \r\n\x05\x04\t\x02\x07\x04\x12\x04\xdb\x02\x02\n\n\r\n\x05\x04\t\x02\x07\
+ \x05\x12\x04\xdb\x02\x0b\x0f\n\r\n\x05\x04\t\x02\x07\x01\x12\x04\xdb\x02\
+ \x10#\n\r\n\x05\x04\t\x02\x07\x03\x12\x04\xdb\x02&(\n\r\n\x05\x04\t\x02\
+ \x07\x08\x12\x04\xdb\x02)8\n\r\n\x05\x04\t\x02\x07\x07\x12\x04\xdb\x0227\
+ \n\x0c\n\x04\x04\t\x02\x08\x12\x04\xdc\x02\x02;\n\r\n\x05\x04\t\x02\x08\
+ \x04\x12\x04\xdc\x02\x02\n\n\r\n\x05\x04\t\x02\x08\x05\x12\x04\xdc\x02\
+ \x0b\x0f\n\r\n\x05\x04\t\x02\x08\x01\x12\x04\xdc\x02\x10%\n\r\n\x05\x04\
+ \t\x02\x08\x03\x12\x04\xdc\x02(*\n\r\n\x05\x04\t\x02\x08\x08\x12\x04\xdc\
+ \x02+:\n\r\n\x05\x04\t\x02\x08\x07\x12\x04\xdc\x0249\n\x0c\n\x04\x04\t\
+ \x02\t\x12\x04\xdd\x02\x029\n\r\n\x05\x04\t\x02\t\x04\x12\x04\xdd\x02\
+ \x02\n\n\r\n\x05\x04\t\x02\t\x05\x12\x04\xdd\x02\x0b\x0f\n\r\n\x05\x04\t\
+ \x02\t\x01\x12\x04\xdd\x02\x10#\n\r\n\x05\x04\t\x02\t\x03\x12\x04\xdd\
+ \x02&(\n\r\n\x05\x04\t\x02\t\x08\x12\x04\xdd\x02)8\n\r\n\x05\x04\t\x02\t\
+ \x07\x12\x04\xdd\x0227\n\xf3\x01\n\x04\x04\t\x02\n\x12\x04\xe3\x02\x020\
+ \x1a\xe4\x01\x20Is\x20this\x20file\x20deprecated?\n\x20Depending\x20on\
+ \x20the\x20target\x20platform,\x20this\x20can\x20emit\x20Deprecated\x20a\
+ nnotations\n\x20for\x20everything\x20in\x20the\x20file,\x20or\x20it\x20w\
+ ill\x20be\x20completely\x20ignored;\x20in\x20the\x20very\n\x20least,\x20\
+ this\x20is\x20a\x20formalization\x20for\x20deprecating\x20files.\n\n\r\n\
+ \x05\x04\t\x02\n\x04\x12\x04\xe3\x02\x02\n\n\r\n\x05\x04\t\x02\n\x05\x12\
+ \x04\xe3\x02\x0b\x0f\n\r\n\x05\x04\t\x02\n\x01\x12\x04\xe3\x02\x10\x1a\n\
+ \r\n\x05\x04\t\x02\n\x03\x12\x04\xe3\x02\x1d\x1f\n\r\n\x05\x04\t\x02\n\
+ \x08\x12\x04\xe3\x02\x20/\n\r\n\x05\x04\t\x02\n\x07\x12\x04\xe3\x02).\n\
+ \x7f\n\x04\x04\t\x02\x0b\x12\x04\xe7\x02\x026\x1aq\x20Enables\x20the\x20\
+ use\x20of\x20arenas\x20for\x20the\x20proto\x20messages\x20in\x20this\x20\
+ file.\x20This\x20applies\n\x20only\x20to\x20generated\x20classes\x20for\
+ \x20C++.\n\n\r\n\x05\x04\t\x02\x0b\x04\x12\x04\xe7\x02\x02\n\n\r\n\x05\
+ \x04\t\x02\x0b\x05\x12\x04\xe7\x02\x0b\x0f\n\r\n\x05\x04\t\x02\x0b\x01\
+ \x12\x04\xe7\x02\x10\x20\n\r\n\x05\x04\t\x02\x0b\x03\x12\x04\xe7\x02#%\n\
+ \r\n\x05\x04\t\x02\x0b\x08\x12\x04\xe7\x02&5\n\r\n\x05\x04\t\x02\x0b\x07\
+ \x12\x04\xe7\x02/4\n\x92\x01\n\x04\x04\t\x02\x0c\x12\x04\xec\x02\x02)\
+ \x1a\x83\x01\x20Sets\x20the\x20objective\x20c\x20class\x20prefix\x20whic\
+ h\x20is\x20prepended\x20to\x20all\x20objective\x20c\n\x20generated\x20cl\
+ asses\x20from\x20this\x20.proto.\x20There\x20is\x20no\x20default.\n\n\r\
+ \n\x05\x04\t\x02\x0c\x04\x12\x04\xec\x02\x02\n\n\r\n\x05\x04\t\x02\x0c\
+ \x05\x12\x04\xec\x02\x0b\x11\n\r\n\x05\x04\t\x02\x0c\x01\x12\x04\xec\x02\
+ \x12#\n\r\n\x05\x04\t\x02\x0c\x03\x12\x04\xec\x02&(\nI\n\x04\x04\t\x02\r\
+ \x12\x04\xef\x02\x02(\x1a;\x20Namespace\x20for\x20generated\x20classes;\
+ \x20defaults\x20to\x20the\x20package.\n\n\r\n\x05\x04\t\x02\r\x04\x12\
+ \x04\xef\x02\x02\n\n\r\n\x05\x04\t\x02\r\x05\x12\x04\xef\x02\x0b\x11\n\r\
+ \n\x05\x04\t\x02\r\x01\x12\x04\xef\x02\x12\"\n\r\n\x05\x04\t\x02\r\x03\
+ \x12\x04\xef\x02%'\nO\n\x04\x04\t\x02\x0e\x12\x04\xf2\x02\x02:\x1aA\x20T\
+ he\x20parser\x20stores\x20options\x20it\x20doesn't\x20recognize\x20here.\
+ \x20See\x20above.\n\n\r\n\x05\x04\t\x02\x0e\x04\x12\x04\xf2\x02\x02\n\n\
+ \r\n\x05\x04\t\x02\x0e\x06\x12\x04\xf2\x02\x0b\x1e\n\r\n\x05\x04\t\x02\
+ \x0e\x01\x12\x04\xf2\x02\x1f3\n\r\n\x05\x04\t\x02\x0e\x03\x12\x04\xf2\
+ \x0269\nZ\n\x03\x04\t\x05\x12\x04\xf5\x02\x02\x19\x1aM\x20Clients\x20can\
+ \x20define\x20custom\x20options\x20in\x20extensions\x20of\x20this\x20mes\
+ sage.\x20See\x20above.\n\n\x0c\n\x04\x04\t\x05\0\x12\x04\xf5\x02\r\x18\n\
+ \r\n\x05\x04\t\x05\0\x01\x12\x04\xf5\x02\r\x11\n\r\n\x05\x04\t\x05\0\x02\
+ \x12\x04\xf5\x02\x15\x18\n\x0c\n\x02\x04\n\x12\x06\xfa\x02\0\xb8\x03\x01\
+ \n\x0b\n\x03\x04\n\x01\x12\x04\xfa\x02\x08\x16\n\xd8\x05\n\x04\x04\n\x02\
+ \0\x12\x04\x8d\x03\x02<\x1a\xc9\x05\x20Set\x20true\x20to\x20use\x20the\
+ \x20old\x20proto1\x20MessageSet\x20wire\x20format\x20for\x20extensions.\
+ \n\x20This\x20is\x20provided\x20for\x20backwards-compatibility\x20with\
+ \x20the\x20MessageSet\x20wire\n\x20format.\x20\x20You\x20should\x20not\
+ \x20use\x20this\x20for\x20any\x20other\x20reason:\x20\x20It's\x20less\n\
+ \x20efficient,\x20has\x20fewer\x20features,\x20and\x20is\x20more\x20comp\
+ licated.\n\n\x20The\x20message\x20must\x20be\x20defined\x20exactly\x20as\
+ \x20follows:\n\x20\x20\x20message\x20Foo\x20{\n\x20\x20\x20\x20\x20optio\
+ n\x20message_set_wire_format\x20=\x20true;\n\x20\x20\x20\x20\x20extensio\
+ ns\x204\x20to\x20max;\n\x20\x20\x20}\n\x20Note\x20that\x20the\x20message\
+ \x20cannot\x20have\x20any\x20defined\x20fields;\x20MessageSets\x20only\n\
+ \x20have\x20extensions.\n\n\x20All\x20extensions\x20of\x20your\x20type\
+ \x20must\x20be\x20singular\x20messages;\x20e.g.\x20they\x20cannot\n\x20b\
+ e\x20int32s,\x20enums,\x20or\x20repeated\x20messages.\n\n\x20Because\x20\
+ this\x20is\x20an\x20option,\x20the\x20above\x20two\x20restrictions\x20ar\
+ e\x20not\x20enforced\x20by\n\x20the\x20protocol\x20compiler.\n\n\r\n\x05\
+ \x04\n\x02\0\x04\x12\x04\x8d\x03\x02\n\n\r\n\x05\x04\n\x02\0\x05\x12\x04\
+ \x8d\x03\x0b\x0f\n\r\n\x05\x04\n\x02\0\x01\x12\x04\x8d\x03\x10'\n\r\n\
+ \x05\x04\n\x02\0\x03\x12\x04\x8d\x03*+\n\r\n\x05\x04\n\x02\0\x08\x12\x04\
+ \x8d\x03,;\n\r\n\x05\x04\n\x02\0\x07\x12\x04\x8d\x035:\n\xeb\x01\n\x04\
+ \x04\n\x02\x01\x12\x04\x92\x03\x02D\x1a\xdc\x01\x20Disables\x20the\x20ge\
+ neration\x20of\x20the\x20standard\x20\"descriptor()\"\x20accessor,\x20wh\
+ ich\x20can\n\x20conflict\x20with\x20a\x20field\x20of\x20the\x20same\x20n\
+ ame.\x20\x20This\x20is\x20meant\x20to\x20make\x20migration\n\x20from\x20\
+ proto1\x20easier;\x20new\x20code\x20should\x20avoid\x20fields\x20named\
+ \x20\"descriptor\".\n\n\r\n\x05\x04\n\x02\x01\x04\x12\x04\x92\x03\x02\n\
+ \n\r\n\x05\x04\n\x02\x01\x05\x12\x04\x92\x03\x0b\x0f\n\r\n\x05\x04\n\x02\
+ \x01\x01\x12\x04\x92\x03\x10/\n\r\n\x05\x04\n\x02\x01\x03\x12\x04\x92\
+ \x0323\n\r\n\x05\x04\n\x02\x01\x08\x12\x04\x92\x034C\n\r\n\x05\x04\n\x02\
+ \x01\x07\x12\x04\x92\x03=B\n\xee\x01\n\x04\x04\n\x02\x02\x12\x04\x98\x03\
+ \x02/\x1a\xdf\x01\x20Is\x20this\x20message\x20deprecated?\n\x20Depending\
+ \x20on\x20the\x20target\x20platform,\x20this\x20can\x20emit\x20Deprecate\
+ d\x20annotations\n\x20for\x20the\x20message,\x20or\x20it\x20will\x20be\
+ \x20completely\x20ignored;\x20in\x20the\x20very\x20least,\n\x20this\x20i\
+ s\x20a\x20formalization\x20for\x20deprecating\x20messages.\n\n\r\n\x05\
+ \x04\n\x02\x02\x04\x12\x04\x98\x03\x02\n\n\r\n\x05\x04\n\x02\x02\x05\x12\
+ \x04\x98\x03\x0b\x0f\n\r\n\x05\x04\n\x02\x02\x01\x12\x04\x98\x03\x10\x1a\
+ \n\r\n\x05\x04\n\x02\x02\x03\x12\x04\x98\x03\x1d\x1e\n\r\n\x05\x04\n\x02\
+ \x02\x08\x12\x04\x98\x03\x1f.\n\r\n\x05\x04\n\x02\x02\x07\x12\x04\x98\
+ \x03(-\n\x9e\x06\n\x04\x04\n\x02\x03\x12\x04\xaf\x03\x02\x1e\x1a\x8f\x06\
+ \x20Whether\x20the\x20message\x20is\x20an\x20automatically\x20generated\
+ \x20map\x20entry\x20type\x20for\x20the\n\x20maps\x20field.\n\n\x20For\
+ \x20maps\x20fields:\n\x20\x20\x20\x20\x20map<KeyType,\x20ValueType>\x20m\
+ ap_field\x20=\x201;\n\x20The\x20parsed\x20descriptor\x20looks\x20like:\n\
+ \x20\x20\x20\x20\x20message\x20MapFieldEntry\x20{\n\x20\x20\x20\x20\x20\
+ \x20\x20\x20\x20option\x20map_entry\x20=\x20true;\n\x20\x20\x20\x20\x20\
+ \x20\x20\x20\x20optional\x20KeyType\x20key\x20=\x201;\n\x20\x20\x20\x20\
+ \x20\x20\x20\x20\x20optional\x20ValueType\x20value\x20=\x202;\n\x20\x20\
+ \x20\x20\x20}\n\x20\x20\x20\x20\x20repeated\x20MapFieldEntry\x20map_fiel\
+ d\x20=\x201;\n\n\x20Implementations\x20may\x20choose\x20not\x20to\x20gen\
+ erate\x20the\x20map_entry=true\x20message,\x20but\n\x20use\x20a\x20nativ\
+ e\x20map\x20in\x20the\x20target\x20language\x20to\x20hold\x20the\x20keys\
+ \x20and\x20values.\n\x20The\x20reflection\x20APIs\x20in\x20such\x20imple\
+ mentions\x20still\x20need\x20to\x20work\x20as\n\x20if\x20the\x20field\
+ \x20is\x20a\x20repeated\x20message\x20field.\n\n\x20NOTE:\x20Do\x20not\
+ \x20set\x20the\x20option\x20in\x20.proto\x20files.\x20Always\x20use\x20t\
+ he\x20maps\x20syntax\n\x20instead.\x20The\x20option\x20should\x20only\
+ \x20be\x20implicitly\x20set\x20by\x20the\x20proto\x20compiler\n\x20parse\
+ r.\n\n\r\n\x05\x04\n\x02\x03\x04\x12\x04\xaf\x03\x02\n\n\r\n\x05\x04\n\
+ \x02\x03\x05\x12\x04\xaf\x03\x0b\x0f\n\r\n\x05\x04\n\x02\x03\x01\x12\x04\
+ \xaf\x03\x10\x19\n\r\n\x05\x04\n\x02\x03\x03\x12\x04\xaf\x03\x1c\x1d\nO\
+ \n\x04\x04\n\x02\x04\x12\x04\xb2\x03\x02:\x1aA\x20The\x20parser\x20store\
+ s\x20options\x20it\x20doesn't\x20recognize\x20here.\x20See\x20above.\n\n\
+ \r\n\x05\x04\n\x02\x04\x04\x12\x04\xb2\x03\x02\n\n\r\n\x05\x04\n\x02\x04\
+ \x06\x12\x04\xb2\x03\x0b\x1e\n\r\n\x05\x04\n\x02\x04\x01\x12\x04\xb2\x03\
+ \x1f3\n\r\n\x05\x04\n\x02\x04\x03\x12\x04\xb2\x0369\nZ\n\x03\x04\n\x05\
+ \x12\x04\xb5\x03\x02\x19\x1aM\x20Clients\x20can\x20define\x20custom\x20o\
+ ptions\x20in\x20extensions\x20of\x20this\x20message.\x20See\x20above.\n\
+ \n\x0c\n\x04\x04\n\x05\0\x12\x04\xb5\x03\r\x18\n\r\n\x05\x04\n\x05\0\x01\
+ \x12\x04\xb5\x03\r\x11\n\r\n\x05\x04\n\x05\0\x02\x12\x04\xb5\x03\x15\x18\
+ \n\x0c\n\x02\x04\x0b\x12\x06\xba\x03\0\x93\x04\x01\n\x0b\n\x03\x04\x0b\
+ \x01\x12\x04\xba\x03\x08\x14\n\xa3\x02\n\x04\x04\x0b\x02\0\x12\x04\xbf\
+ \x03\x02.\x1a\x94\x02\x20The\x20ctype\x20option\x20instructs\x20the\x20C\
+ ++\x20code\x20generator\x20to\x20use\x20a\x20different\n\x20representati\
+ on\x20of\x20the\x20field\x20than\x20it\x20normally\x20would.\x20\x20See\
+ \x20the\x20specific\n\x20options\x20below.\x20\x20This\x20option\x20is\
+ \x20not\x20yet\x20implemented\x20in\x20the\x20open\x20source\n\x20releas\
+ e\x20--\x20sorry,\x20we'll\x20try\x20to\x20include\x20it\x20in\x20a\x20f\
+ uture\x20version!\n\n\r\n\x05\x04\x0b\x02\0\x04\x12\x04\xbf\x03\x02\n\n\
+ \r\n\x05\x04\x0b\x02\0\x06\x12\x04\xbf\x03\x0b\x10\n\r\n\x05\x04\x0b\x02\
+ \0\x01\x12\x04\xbf\x03\x11\x16\n\r\n\x05\x04\x0b\x02\0\x03\x12\x04\xbf\
+ \x03\x19\x1a\n\r\n\x05\x04\x0b\x02\0\x08\x12\x04\xbf\x03\x1b-\n\r\n\x05\
+ \x04\x0b\x02\0\x07\x12\x04\xbf\x03&,\n\x0e\n\x04\x04\x0b\x04\0\x12\x06\
+ \xc0\x03\x02\xc7\x03\x03\n\r\n\x05\x04\x0b\x04\0\x01\x12\x04\xc0\x03\x07\
+ \x0c\n\x1f\n\x06\x04\x0b\x04\0\x02\0\x12\x04\xc2\x03\x04\x0f\x1a\x0f\x20\
+ Default\x20mode.\n\n\x0f\n\x07\x04\x0b\x04\0\x02\0\x01\x12\x04\xc2\x03\
+ \x04\n\n\x0f\n\x07\x04\x0b\x04\0\x02\0\x02\x12\x04\xc2\x03\r\x0e\n\x0e\n\
+ \x06\x04\x0b\x04\0\x02\x01\x12\x04\xc4\x03\x04\r\n\x0f\n\x07\x04\x0b\x04\
+ \0\x02\x01\x01\x12\x04\xc4\x03\x04\x08\n\x0f\n\x07\x04\x0b\x04\0\x02\x01\
+ \x02\x12\x04\xc4\x03\x0b\x0c\n\x0e\n\x06\x04\x0b\x04\0\x02\x02\x12\x04\
+ \xc6\x03\x04\x15\n\x0f\n\x07\x04\x0b\x04\0\x02\x02\x01\x12\x04\xc6\x03\
+ \x04\x10\n\x0f\n\x07\x04\x0b\x04\0\x02\x02\x02\x12\x04\xc6\x03\x13\x14\n\
+ \xda\x02\n\x04\x04\x0b\x02\x01\x12\x04\xcd\x03\x02\x1b\x1a\xcb\x02\x20Th\
+ e\x20packed\x20option\x20can\x20be\x20enabled\x20for\x20repeated\x20prim\
+ itive\x20fields\x20to\x20enable\n\x20a\x20more\x20efficient\x20represent\
+ ation\x20on\x20the\x20wire.\x20Rather\x20than\x20repeatedly\n\x20writing\
+ \x20the\x20tag\x20and\x20type\x20for\x20each\x20element,\x20the\x20entir\
+ e\x20array\x20is\x20encoded\x20as\n\x20a\x20single\x20length-delimited\
+ \x20blob.\x20In\x20proto3,\x20only\x20explicit\x20setting\x20it\x20to\n\
+ \x20false\x20will\x20avoid\x20using\x20packed\x20encoding.\n\n\r\n\x05\
+ \x04\x0b\x02\x01\x04\x12\x04\xcd\x03\x02\n\n\r\n\x05\x04\x0b\x02\x01\x05\
+ \x12\x04\xcd\x03\x0b\x0f\n\r\n\x05\x04\x0b\x02\x01\x01\x12\x04\xcd\x03\
+ \x10\x16\n\r\n\x05\x04\x0b\x02\x01\x03\x12\x04\xcd\x03\x19\x1a\n\xe4\x04\
+ \n\x04\x04\x0b\x02\x02\x12\x04\xd8\x03\x023\x1a\xd5\x04\x20The\x20jstype\
+ \x20option\x20determines\x20the\x20JavaScript\x20type\x20used\x20for\x20\
+ values\x20of\x20the\n\x20field.\x20\x20The\x20option\x20is\x20permitted\
+ \x20only\x20for\x2064\x20bit\x20integral\x20and\x20fixed\x20types\n\x20(\
+ int64,\x20uint64,\x20sint64,\x20fixed64,\x20sfixed64).\x20\x20By\x20defa\
+ ult\x20these\x20types\x20are\n\x20represented\x20as\x20JavaScript\x20str\
+ ings.\x20\x20This\x20avoids\x20loss\x20of\x20precision\x20that\x20can\n\
+ \x20happen\x20when\x20a\x20large\x20value\x20is\x20converted\x20to\x20a\
+ \x20floating\x20point\x20JavaScript\n\x20numbers.\x20\x20Specifying\x20J\
+ S_NUMBER\x20for\x20the\x20jstype\x20causes\x20the\x20generated\n\x20Java\
+ Script\x20code\x20to\x20use\x20the\x20JavaScript\x20\"number\"\x20type\
+ \x20instead\x20of\x20strings.\n\x20This\x20option\x20is\x20an\x20enum\
+ \x20to\x20permit\x20additional\x20types\x20to\x20be\x20added,\n\x20e.g.\
+ \x20goog.math.Integer.\n\n\r\n\x05\x04\x0b\x02\x02\x04\x12\x04\xd8\x03\
+ \x02\n\n\r\n\x05\x04\x0b\x02\x02\x06\x12\x04\xd8\x03\x0b\x11\n\r\n\x05\
+ \x04\x0b\x02\x02\x01\x12\x04\xd8\x03\x12\x18\n\r\n\x05\x04\x0b\x02\x02\
+ \x03\x12\x04\xd8\x03\x1b\x1c\n\r\n\x05\x04\x0b\x02\x02\x08\x12\x04\xd8\
+ \x03\x1d2\n\r\n\x05\x04\x0b\x02\x02\x07\x12\x04\xd8\x03(1\n\x0e\n\x04\
+ \x04\x0b\x04\x01\x12\x06\xd9\x03\x02\xe2\x03\x03\n\r\n\x05\x04\x0b\x04\
+ \x01\x01\x12\x04\xd9\x03\x07\r\n'\n\x06\x04\x0b\x04\x01\x02\0\x12\x04\
+ \xdb\x03\x04\x12\x1a\x17\x20Use\x20the\x20default\x20type.\n\n\x0f\n\x07\
+ \x04\x0b\x04\x01\x02\0\x01\x12\x04\xdb\x03\x04\r\n\x0f\n\x07\x04\x0b\x04\
+ \x01\x02\0\x02\x12\x04\xdb\x03\x10\x11\n)\n\x06\x04\x0b\x04\x01\x02\x01\
+ \x12\x04\xde\x03\x04\x12\x1a\x19\x20Use\x20JavaScript\x20strings.\n\n\
+ \x0f\n\x07\x04\x0b\x04\x01\x02\x01\x01\x12\x04\xde\x03\x04\r\n\x0f\n\x07\
+ \x04\x0b\x04\x01\x02\x01\x02\x12\x04\xde\x03\x10\x11\n)\n\x06\x04\x0b\
+ \x04\x01\x02\x02\x12\x04\xe1\x03\x04\x12\x1a\x19\x20Use\x20JavaScript\
+ \x20numbers.\n\n\x0f\n\x07\x04\x0b\x04\x01\x02\x02\x01\x12\x04\xe1\x03\
+ \x04\r\n\x0f\n\x07\x04\x0b\x04\x01\x02\x02\x02\x12\x04\xe1\x03\x10\x11\n\
+ \xef\x0c\n\x04\x04\x0b\x02\x03\x12\x04\x80\x04\x02)\x1a\xe0\x0c\x20Shoul\
+ d\x20this\x20field\x20be\x20parsed\x20lazily?\x20\x20Lazy\x20applies\x20\
+ only\x20to\x20message-type\n\x20fields.\x20\x20It\x20means\x20that\x20wh\
+ en\x20the\x20outer\x20message\x20is\x20initially\x20parsed,\x20the\n\x20\
+ inner\x20message's\x20contents\x20will\x20not\x20be\x20parsed\x20but\x20\
+ instead\x20stored\x20in\x20encoded\n\x20form.\x20\x20The\x20inner\x20mes\
+ sage\x20will\x20actually\x20be\x20parsed\x20when\x20it\x20is\x20first\
+ \x20accessed.\n\n\x20This\x20is\x20only\x20a\x20hint.\x20\x20Implementat\
+ ions\x20are\x20free\x20to\x20choose\x20whether\x20to\x20use\n\x20eager\
+ \x20or\x20lazy\x20parsing\x20regardless\x20of\x20the\x20value\x20of\x20t\
+ his\x20option.\x20\x20However,\n\x20setting\x20this\x20option\x20true\
+ \x20suggests\x20that\x20the\x20protocol\x20author\x20believes\x20that\n\
+ \x20using\x20lazy\x20parsing\x20on\x20this\x20field\x20is\x20worth\x20th\
+ e\x20additional\x20bookkeeping\n\x20overhead\x20typically\x20needed\x20t\
+ o\x20implement\x20it.\n\n\x20This\x20option\x20does\x20not\x20affect\x20\
+ the\x20public\x20interface\x20of\x20any\x20generated\x20code;\n\x20all\
+ \x20method\x20signatures\x20remain\x20the\x20same.\x20\x20Furthermore,\
+ \x20thread-safety\x20of\x20the\n\x20interface\x20is\x20not\x20affected\
+ \x20by\x20this\x20option;\x20const\x20methods\x20remain\x20safe\x20to\n\
+ \x20call\x20from\x20multiple\x20threads\x20concurrently,\x20while\x20non\
+ -const\x20methods\x20continue\n\x20to\x20require\x20exclusive\x20access.\
+ \n\n\n\x20Note\x20that\x20implementations\x20may\x20choose\x20not\x20to\
+ \x20check\x20required\x20fields\x20within\n\x20a\x20lazy\x20sub-message.\
+ \x20\x20That\x20is,\x20calling\x20IsInitialized()\x20on\x20the\x20outer\
+ \x20message\n\x20may\x20return\x20true\x20even\x20if\x20the\x20inner\x20\
+ message\x20has\x20missing\x20required\x20fields.\n\x20This\x20is\x20nece\
+ ssary\x20because\x20otherwise\x20the\x20inner\x20message\x20would\x20hav\
+ e\x20to\x20be\n\x20parsed\x20in\x20order\x20to\x20perform\x20the\x20chec\
+ k,\x20defeating\x20the\x20purpose\x20of\x20lazy\n\x20parsing.\x20\x20An\
+ \x20implementation\x20which\x20chooses\x20not\x20to\x20check\x20required\
+ \x20fields\n\x20must\x20be\x20consistent\x20about\x20it.\x20\x20That\x20\
+ is,\x20for\x20any\x20particular\x20sub-message,\x20the\n\x20implementati\
+ on\x20must\x20either\x20*always*\x20check\x20its\x20required\x20fields,\
+ \x20or\x20*never*\n\x20check\x20its\x20required\x20fields,\x20regardless\
+ \x20of\x20whether\x20or\x20not\x20the\x20message\x20has\n\x20been\x20par\
+ sed.\n\n\r\n\x05\x04\x0b\x02\x03\x04\x12\x04\x80\x04\x02\n\n\r\n\x05\x04\
+ \x0b\x02\x03\x05\x12\x04\x80\x04\x0b\x0f\n\r\n\x05\x04\x0b\x02\x03\x01\
+ \x12\x04\x80\x04\x10\x14\n\r\n\x05\x04\x0b\x02\x03\x03\x12\x04\x80\x04\
+ \x17\x18\n\r\n\x05\x04\x0b\x02\x03\x08\x12\x04\x80\x04\x19(\n\r\n\x05\
+ \x04\x0b\x02\x03\x07\x12\x04\x80\x04\"'\n\xe8\x01\n\x04\x04\x0b\x02\x04\
+ \x12\x04\x86\x04\x02/\x1a\xd9\x01\x20Is\x20this\x20field\x20deprecated?\
+ \n\x20Depending\x20on\x20the\x20target\x20platform,\x20this\x20can\x20em\
+ it\x20Deprecated\x20annotations\n\x20for\x20accessors,\x20or\x20it\x20wi\
+ ll\x20be\x20completely\x20ignored;\x20in\x20the\x20very\x20least,\x20thi\
+ s\n\x20is\x20a\x20formalization\x20for\x20deprecating\x20fields.\n\n\r\n\
+ \x05\x04\x0b\x02\x04\x04\x12\x04\x86\x04\x02\n\n\r\n\x05\x04\x0b\x02\x04\
+ \x05\x12\x04\x86\x04\x0b\x0f\n\r\n\x05\x04\x0b\x02\x04\x01\x12\x04\x86\
+ \x04\x10\x1a\n\r\n\x05\x04\x0b\x02\x04\x03\x12\x04\x86\x04\x1d\x1e\n\r\n\
+ \x05\x04\x0b\x02\x04\x08\x12\x04\x86\x04\x1f.\n\r\n\x05\x04\x0b\x02\x04\
+ \x07\x12\x04\x86\x04(-\n?\n\x04\x04\x0b\x02\x05\x12\x04\x89\x04\x02*\x1a\
+ 1\x20For\x20Google-internal\x20migration\x20only.\x20Do\x20not\x20use.\n\
+ \n\r\n\x05\x04\x0b\x02\x05\x04\x12\x04\x89\x04\x02\n\n\r\n\x05\x04\x0b\
+ \x02\x05\x05\x12\x04\x89\x04\x0b\x0f\n\r\n\x05\x04\x0b\x02\x05\x01\x12\
+ \x04\x89\x04\x10\x14\n\r\n\x05\x04\x0b\x02\x05\x03\x12\x04\x89\x04\x17\
+ \x19\n\r\n\x05\x04\x0b\x02\x05\x08\x12\x04\x89\x04\x1a)\n\r\n\x05\x04\
+ \x0b\x02\x05\x07\x12\x04\x89\x04#(\nO\n\x04\x04\x0b\x02\x06\x12\x04\x8d\
+ \x04\x02:\x1aA\x20The\x20parser\x20stores\x20options\x20it\x20doesn't\
+ \x20recognize\x20here.\x20See\x20above.\n\n\r\n\x05\x04\x0b\x02\x06\x04\
+ \x12\x04\x8d\x04\x02\n\n\r\n\x05\x04\x0b\x02\x06\x06\x12\x04\x8d\x04\x0b\
+ \x1e\n\r\n\x05\x04\x0b\x02\x06\x01\x12\x04\x8d\x04\x1f3\n\r\n\x05\x04\
+ \x0b\x02\x06\x03\x12\x04\x8d\x0469\nZ\n\x03\x04\x0b\x05\x12\x04\x90\x04\
+ \x02\x19\x1aM\x20Clients\x20can\x20define\x20custom\x20options\x20in\x20\
+ extensions\x20of\x20this\x20message.\x20See\x20above.\n\n\x0c\n\x04\x04\
+ \x0b\x05\0\x12\x04\x90\x04\r\x18\n\r\n\x05\x04\x0b\x05\0\x01\x12\x04\x90\
+ \x04\r\x11\n\r\n\x05\x04\x0b\x05\0\x02\x12\x04\x90\x04\x15\x18\n\x0c\n\
+ \x02\x04\x0c\x12\x06\x95\x04\0\x9b\x04\x01\n\x0b\n\x03\x04\x0c\x01\x12\
+ \x04\x95\x04\x08\x14\nO\n\x04\x04\x0c\x02\0\x12\x04\x97\x04\x02:\x1aA\
+ \x20The\x20parser\x20stores\x20options\x20it\x20doesn't\x20recognize\x20\
+ here.\x20See\x20above.\n\n\r\n\x05\x04\x0c\x02\0\x04\x12\x04\x97\x04\x02\
+ \n\n\r\n\x05\x04\x0c\x02\0\x06\x12\x04\x97\x04\x0b\x1e\n\r\n\x05\x04\x0c\
+ \x02\0\x01\x12\x04\x97\x04\x1f3\n\r\n\x05\x04\x0c\x02\0\x03\x12\x04\x97\
+ \x0469\nZ\n\x03\x04\x0c\x05\x12\x04\x9a\x04\x02\x19\x1aM\x20Clients\x20c\
+ an\x20define\x20custom\x20options\x20in\x20extensions\x20of\x20this\x20m\
+ essage.\x20See\x20above.\n\n\x0c\n\x04\x04\x0c\x05\0\x12\x04\x9a\x04\r\
+ \x18\n\r\n\x05\x04\x0c\x05\0\x01\x12\x04\x9a\x04\r\x11\n\r\n\x05\x04\x0c\
+ \x05\0\x02\x12\x04\x9a\x04\x15\x18\n\x0c\n\x02\x04\r\x12\x06\x9d\x04\0\
+ \xae\x04\x01\n\x0b\n\x03\x04\r\x01\x12\x04\x9d\x04\x08\x13\n`\n\x04\x04\
+ \r\x02\0\x12\x04\xa1\x04\x02\x20\x1aR\x20Set\x20this\x20option\x20to\x20\
+ true\x20to\x20allow\x20mapping\x20different\x20tag\x20names\x20to\x20the\
+ \x20same\n\x20value.\n\n\r\n\x05\x04\r\x02\0\x04\x12\x04\xa1\x04\x02\n\n\
+ \r\n\x05\x04\r\x02\0\x05\x12\x04\xa1\x04\x0b\x0f\n\r\n\x05\x04\r\x02\0\
+ \x01\x12\x04\xa1\x04\x10\x1b\n\r\n\x05\x04\r\x02\0\x03\x12\x04\xa1\x04\
+ \x1e\x1f\n\xe5\x01\n\x04\x04\r\x02\x01\x12\x04\xa7\x04\x02/\x1a\xd6\x01\
+ \x20Is\x20this\x20enum\x20deprecated?\n\x20Depending\x20on\x20the\x20tar\
+ get\x20platform,\x20this\x20can\x20emit\x20Deprecated\x20annotations\n\
+ \x20for\x20the\x20enum,\x20or\x20it\x20will\x20be\x20completely\x20ignor\
+ ed;\x20in\x20the\x20very\x20least,\x20this\n\x20is\x20a\x20formalization\
+ \x20for\x20deprecating\x20enums.\n\n\r\n\x05\x04\r\x02\x01\x04\x12\x04\
+ \xa7\x04\x02\n\n\r\n\x05\x04\r\x02\x01\x05\x12\x04\xa7\x04\x0b\x0f\n\r\n\
+ \x05\x04\r\x02\x01\x01\x12\x04\xa7\x04\x10\x1a\n\r\n\x05\x04\r\x02\x01\
+ \x03\x12\x04\xa7\x04\x1d\x1e\n\r\n\x05\x04\r\x02\x01\x08\x12\x04\xa7\x04\
+ \x1f.\n\r\n\x05\x04\r\x02\x01\x07\x12\x04\xa7\x04(-\nO\n\x04\x04\r\x02\
+ \x02\x12\x04\xaa\x04\x02:\x1aA\x20The\x20parser\x20stores\x20options\x20\
+ it\x20doesn't\x20recognize\x20here.\x20See\x20above.\n\n\r\n\x05\x04\r\
+ \x02\x02\x04\x12\x04\xaa\x04\x02\n\n\r\n\x05\x04\r\x02\x02\x06\x12\x04\
+ \xaa\x04\x0b\x1e\n\r\n\x05\x04\r\x02\x02\x01\x12\x04\xaa\x04\x1f3\n\r\n\
+ \x05\x04\r\x02\x02\x03\x12\x04\xaa\x0469\nZ\n\x03\x04\r\x05\x12\x04\xad\
+ \x04\x02\x19\x1aM\x20Clients\x20can\x20define\x20custom\x20options\x20in\
+ \x20extensions\x20of\x20this\x20message.\x20See\x20above.\n\n\x0c\n\x04\
+ \x04\r\x05\0\x12\x04\xad\x04\r\x18\n\r\n\x05\x04\r\x05\0\x01\x12\x04\xad\
+ \x04\r\x11\n\r\n\x05\x04\r\x05\0\x02\x12\x04\xad\x04\x15\x18\n\x0c\n\x02\
+ \x04\x0e\x12\x06\xb0\x04\0\xbc\x04\x01\n\x0b\n\x03\x04\x0e\x01\x12\x04\
+ \xb0\x04\x08\x18\n\xf7\x01\n\x04\x04\x0e\x02\0\x12\x04\xb5\x04\x02/\x1a\
+ \xe8\x01\x20Is\x20this\x20enum\x20value\x20deprecated?\n\x20Depending\
+ \x20on\x20the\x20target\x20platform,\x20this\x20can\x20emit\x20Deprecate\
+ d\x20annotations\n\x20for\x20the\x20enum\x20value,\x20or\x20it\x20will\
+ \x20be\x20completely\x20ignored;\x20in\x20the\x20very\x20least,\n\x20thi\
+ s\x20is\x20a\x20formalization\x20for\x20deprecating\x20enum\x20values.\n\
+ \n\r\n\x05\x04\x0e\x02\0\x04\x12\x04\xb5\x04\x02\n\n\r\n\x05\x04\x0e\x02\
+ \0\x05\x12\x04\xb5\x04\x0b\x0f\n\r\n\x05\x04\x0e\x02\0\x01\x12\x04\xb5\
+ \x04\x10\x1a\n\r\n\x05\x04\x0e\x02\0\x03\x12\x04\xb5\x04\x1d\x1e\n\r\n\
+ \x05\x04\x0e\x02\0\x08\x12\x04\xb5\x04\x1f.\n\r\n\x05\x04\x0e\x02\0\x07\
+ \x12\x04\xb5\x04(-\nO\n\x04\x04\x0e\x02\x01\x12\x04\xb8\x04\x02:\x1aA\
+ \x20The\x20parser\x20stores\x20options\x20it\x20doesn't\x20recognize\x20\
+ here.\x20See\x20above.\n\n\r\n\x05\x04\x0e\x02\x01\x04\x12\x04\xb8\x04\
+ \x02\n\n\r\n\x05\x04\x0e\x02\x01\x06\x12\x04\xb8\x04\x0b\x1e\n\r\n\x05\
+ \x04\x0e\x02\x01\x01\x12\x04\xb8\x04\x1f3\n\r\n\x05\x04\x0e\x02\x01\x03\
+ \x12\x04\xb8\x0469\nZ\n\x03\x04\x0e\x05\x12\x04\xbb\x04\x02\x19\x1aM\x20\
+ Clients\x20can\x20define\x20custom\x20options\x20in\x20extensions\x20of\
+ \x20this\x20message.\x20See\x20above.\n\n\x0c\n\x04\x04\x0e\x05\0\x12\
+ \x04\xbb\x04\r\x18\n\r\n\x05\x04\x0e\x05\0\x01\x12\x04\xbb\x04\r\x11\n\r\
+ \n\x05\x04\x0e\x05\0\x02\x12\x04\xbb\x04\x15\x18\n\x0c\n\x02\x04\x0f\x12\
+ \x06\xbe\x04\0\xd0\x04\x01\n\x0b\n\x03\x04\x0f\x01\x12\x04\xbe\x04\x08\
+ \x16\n\xd9\x03\n\x04\x04\x0f\x02\0\x12\x04\xc9\x04\x020\x1a\xdf\x01\x20I\
+ s\x20this\x20service\x20deprecated?\n\x20Depending\x20on\x20the\x20targe\
+ t\x20platform,\x20this\x20can\x20emit\x20Deprecated\x20annotations\n\x20\
+ for\x20the\x20service,\x20or\x20it\x20will\x20be\x20completely\x20ignore\
+ d;\x20in\x20the\x20very\x20least,\n\x20this\x20is\x20a\x20formalization\
+ \x20for\x20deprecating\x20services.\n2\xe8\x01\x20Note:\x20\x20Field\x20\
+ numbers\x201\x20through\x2032\x20are\x20reserved\x20for\x20Google's\x20i\
+ nternal\x20RPC\n\x20\x20\x20framework.\x20\x20We\x20apologize\x20for\x20\
+ hoarding\x20these\x20numbers\x20to\x20ourselves,\x20but\n\x20\x20\x20we\
+ \x20were\x20already\x20using\x20them\x20long\x20before\x20we\x20decided\
+ \x20to\x20release\x20Protocol\n\x20\x20\x20Buffers.\n\n\r\n\x05\x04\x0f\
+ \x02\0\x04\x12\x04\xc9\x04\x02\n\n\r\n\x05\x04\x0f\x02\0\x05\x12\x04\xc9\
+ \x04\x0b\x0f\n\r\n\x05\x04\x0f\x02\0\x01\x12\x04\xc9\x04\x10\x1a\n\r\n\
+ \x05\x04\x0f\x02\0\x03\x12\x04\xc9\x04\x1d\x1f\n\r\n\x05\x04\x0f\x02\0\
+ \x08\x12\x04\xc9\x04\x20/\n\r\n\x05\x04\x0f\x02\0\x07\x12\x04\xc9\x04).\
+ \nO\n\x04\x04\x0f\x02\x01\x12\x04\xcc\x04\x02:\x1aA\x20The\x20parser\x20\
+ stores\x20options\x20it\x20doesn't\x20recognize\x20here.\x20See\x20above\
+ .\n\n\r\n\x05\x04\x0f\x02\x01\x04\x12\x04\xcc\x04\x02\n\n\r\n\x05\x04\
+ \x0f\x02\x01\x06\x12\x04\xcc\x04\x0b\x1e\n\r\n\x05\x04\x0f\x02\x01\x01\
+ \x12\x04\xcc\x04\x1f3\n\r\n\x05\x04\x0f\x02\x01\x03\x12\x04\xcc\x0469\nZ\
+ \n\x03\x04\x0f\x05\x12\x04\xcf\x04\x02\x19\x1aM\x20Clients\x20can\x20def\
+ ine\x20custom\x20options\x20in\x20extensions\x20of\x20this\x20message.\
+ \x20See\x20above.\n\n\x0c\n\x04\x04\x0f\x05\0\x12\x04\xcf\x04\r\x18\n\r\
+ \n\x05\x04\x0f\x05\0\x01\x12\x04\xcf\x04\r\x11\n\r\n\x05\x04\x0f\x05\0\
+ \x02\x12\x04\xcf\x04\x15\x18\n\x0c\n\x02\x04\x10\x12\x06\xd2\x04\0\xe4\
+ \x04\x01\n\x0b\n\x03\x04\x10\x01\x12\x04\xd2\x04\x08\x15\n\xd6\x03\n\x04\
+ \x04\x10\x02\0\x12\x04\xdd\x04\x020\x1a\xdc\x01\x20Is\x20this\x20method\
+ \x20deprecated?\n\x20Depending\x20on\x20the\x20target\x20platform,\x20th\
+ is\x20can\x20emit\x20Deprecated\x20annotations\n\x20for\x20the\x20method\
+ ,\x20or\x20it\x20will\x20be\x20completely\x20ignored;\x20in\x20the\x20ve\
+ ry\x20least,\n\x20this\x20is\x20a\x20formalization\x20for\x20deprecating\
+ \x20methods.\n2\xe8\x01\x20Note:\x20\x20Field\x20numbers\x201\x20through\
+ \x2032\x20are\x20reserved\x20for\x20Google's\x20internal\x20RPC\n\x20\
+ \x20\x20framework.\x20\x20We\x20apologize\x20for\x20hoarding\x20these\
+ \x20numbers\x20to\x20ourselves,\x20but\n\x20\x20\x20we\x20were\x20alread\
+ y\x20using\x20them\x20long\x20before\x20we\x20decided\x20to\x20release\
+ \x20Protocol\n\x20\x20\x20Buffers.\n\n\r\n\x05\x04\x10\x02\0\x04\x12\x04\
+ \xdd\x04\x02\n\n\r\n\x05\x04\x10\x02\0\x05\x12\x04\xdd\x04\x0b\x0f\n\r\n\
+ \x05\x04\x10\x02\0\x01\x12\x04\xdd\x04\x10\x1a\n\r\n\x05\x04\x10\x02\0\
+ \x03\x12\x04\xdd\x04\x1d\x1f\n\r\n\x05\x04\x10\x02\0\x08\x12\x04\xdd\x04\
+ \x20/\n\r\n\x05\x04\x10\x02\0\x07\x12\x04\xdd\x04).\nO\n\x04\x04\x10\x02\
+ \x01\x12\x04\xe0\x04\x02:\x1aA\x20The\x20parser\x20stores\x20options\x20\
+ it\x20doesn't\x20recognize\x20here.\x20See\x20above.\n\n\r\n\x05\x04\x10\
+ \x02\x01\x04\x12\x04\xe0\x04\x02\n\n\r\n\x05\x04\x10\x02\x01\x06\x12\x04\
+ \xe0\x04\x0b\x1e\n\r\n\x05\x04\x10\x02\x01\x01\x12\x04\xe0\x04\x1f3\n\r\
+ \n\x05\x04\x10\x02\x01\x03\x12\x04\xe0\x0469\nZ\n\x03\x04\x10\x05\x12\
+ \x04\xe3\x04\x02\x19\x1aM\x20Clients\x20can\x20define\x20custom\x20optio\
+ ns\x20in\x20extensions\x20of\x20this\x20message.\x20See\x20above.\n\n\
+ \x0c\n\x04\x04\x10\x05\0\x12\x04\xe3\x04\r\x18\n\r\n\x05\x04\x10\x05\0\
+ \x01\x12\x04\xe3\x04\r\x11\n\r\n\x05\x04\x10\x05\0\x02\x12\x04\xe3\x04\
+ \x15\x18\n\x8b\x03\n\x02\x04\x11\x12\x06\xed\x04\0\x81\x05\x01\x1a\xfc\
+ \x02\x20A\x20message\x20representing\x20a\x20option\x20the\x20parser\x20\
+ does\x20not\x20recognize.\x20This\x20only\n\x20appears\x20in\x20options\
+ \x20protos\x20created\x20by\x20the\x20compiler::Parser\x20class.\n\x20De\
+ scriptorPool\x20resolves\x20these\x20when\x20building\x20Descriptor\x20o\
+ bjects.\x20Therefore,\n\x20options\x20protos\x20in\x20descriptor\x20obje\
+ cts\x20(e.g.\x20returned\x20by\x20Descriptor::options(),\n\x20or\x20prod\
+ uced\x20by\x20Descriptor::CopyTo())\x20will\x20never\x20have\x20Uninterp\
+ retedOptions\n\x20in\x20them.\n\n\x0b\n\x03\x04\x11\x01\x12\x04\xed\x04\
+ \x08\x1b\n\xcb\x02\n\x04\x04\x11\x03\0\x12\x06\xf3\x04\x02\xf6\x04\x03\
+ \x1a\xba\x02\x20The\x20name\x20of\x20the\x20uninterpreted\x20option.\x20\
+ \x20Each\x20string\x20represents\x20a\x20segment\x20in\n\x20a\x20dot-sep\
+ arated\x20name.\x20\x20is_extension\x20is\x20true\x20iff\x20a\x20segment\
+ \x20represents\x20an\n\x20extension\x20(denoted\x20with\x20parentheses\
+ \x20in\x20options\x20specs\x20in\x20.proto\x20files).\n\x20E.g.,{\x20[\"\
+ foo\",\x20false],\x20[\"bar.baz\",\x20true],\x20[\"qux\",\x20false]\x20}\
+ \x20represents\n\x20\"foo.(bar.baz).qux\".\n\n\r\n\x05\x04\x11\x03\0\x01\
+ \x12\x04\xf3\x04\n\x12\n\x0e\n\x06\x04\x11\x03\0\x02\0\x12\x04\xf4\x04\
+ \x04\"\n\x0f\n\x07\x04\x11\x03\0\x02\0\x04\x12\x04\xf4\x04\x04\x0c\n\x0f\
+ \n\x07\x04\x11\x03\0\x02\0\x05\x12\x04\xf4\x04\r\x13\n\x0f\n\x07\x04\x11\
+ \x03\0\x02\0\x01\x12\x04\xf4\x04\x14\x1d\n\x0f\n\x07\x04\x11\x03\0\x02\0\
+ \x03\x12\x04\xf4\x04\x20!\n\x0e\n\x06\x04\x11\x03\0\x02\x01\x12\x04\xf5\
+ \x04\x04#\n\x0f\n\x07\x04\x11\x03\0\x02\x01\x04\x12\x04\xf5\x04\x04\x0c\
+ \n\x0f\n\x07\x04\x11\x03\0\x02\x01\x05\x12\x04\xf5\x04\r\x11\n\x0f\n\x07\
+ \x04\x11\x03\0\x02\x01\x01\x12\x04\xf5\x04\x12\x1e\n\x0f\n\x07\x04\x11\
+ \x03\0\x02\x01\x03\x12\x04\xf5\x04!\"\n\x0c\n\x04\x04\x11\x02\0\x12\x04\
+ \xf7\x04\x02\x1d\n\r\n\x05\x04\x11\x02\0\x04\x12\x04\xf7\x04\x02\n\n\r\n\
+ \x05\x04\x11\x02\0\x06\x12\x04\xf7\x04\x0b\x13\n\r\n\x05\x04\x11\x02\0\
+ \x01\x12\x04\xf7\x04\x14\x18\n\r\n\x05\x04\x11\x02\0\x03\x12\x04\xf7\x04\
+ \x1b\x1c\n\x9c\x01\n\x04\x04\x11\x02\x01\x12\x04\xfb\x04\x02'\x1a\x8d\
+ \x01\x20The\x20value\x20of\x20the\x20uninterpreted\x20option,\x20in\x20w\
+ hatever\x20type\x20the\x20tokenizer\n\x20identified\x20it\x20as\x20durin\
+ g\x20parsing.\x20Exactly\x20one\x20of\x20these\x20should\x20be\x20set.\n\
+ \n\r\n\x05\x04\x11\x02\x01\x04\x12\x04\xfb\x04\x02\n\n\r\n\x05\x04\x11\
+ \x02\x01\x05\x12\x04\xfb\x04\x0b\x11\n\r\n\x05\x04\x11\x02\x01\x01\x12\
+ \x04\xfb\x04\x12\"\n\r\n\x05\x04\x11\x02\x01\x03\x12\x04\xfb\x04%&\n\x0c\
+ \n\x04\x04\x11\x02\x02\x12\x04\xfc\x04\x02)\n\r\n\x05\x04\x11\x02\x02\
+ \x04\x12\x04\xfc\x04\x02\n\n\r\n\x05\x04\x11\x02\x02\x05\x12\x04\xfc\x04\
+ \x0b\x11\n\r\n\x05\x04\x11\x02\x02\x01\x12\x04\xfc\x04\x12$\n\r\n\x05\
+ \x04\x11\x02\x02\x03\x12\x04\xfc\x04'(\n\x0c\n\x04\x04\x11\x02\x03\x12\
+ \x04\xfd\x04\x02(\n\r\n\x05\x04\x11\x02\x03\x04\x12\x04\xfd\x04\x02\n\n\
+ \r\n\x05\x04\x11\x02\x03\x05\x12\x04\xfd\x04\x0b\x10\n\r\n\x05\x04\x11\
+ \x02\x03\x01\x12\x04\xfd\x04\x11#\n\r\n\x05\x04\x11\x02\x03\x03\x12\x04\
+ \xfd\x04&'\n\x0c\n\x04\x04\x11\x02\x04\x12\x04\xfe\x04\x02#\n\r\n\x05\
+ \x04\x11\x02\x04\x04\x12\x04\xfe\x04\x02\n\n\r\n\x05\x04\x11\x02\x04\x05\
+ \x12\x04\xfe\x04\x0b\x11\n\r\n\x05\x04\x11\x02\x04\x01\x12\x04\xfe\x04\
+ \x12\x1e\n\r\n\x05\x04\x11\x02\x04\x03\x12\x04\xfe\x04!\"\n\x0c\n\x04\
+ \x04\x11\x02\x05\x12\x04\xff\x04\x02\"\n\r\n\x05\x04\x11\x02\x05\x04\x12\
+ \x04\xff\x04\x02\n\n\r\n\x05\x04\x11\x02\x05\x05\x12\x04\xff\x04\x0b\x10\
+ \n\r\n\x05\x04\x11\x02\x05\x01\x12\x04\xff\x04\x11\x1d\n\r\n\x05\x04\x11\
+ \x02\x05\x03\x12\x04\xff\x04\x20!\n\x0c\n\x04\x04\x11\x02\x06\x12\x04\
+ \x80\x05\x02&\n\r\n\x05\x04\x11\x02\x06\x04\x12\x04\x80\x05\x02\n\n\r\n\
+ \x05\x04\x11\x02\x06\x05\x12\x04\x80\x05\x0b\x11\n\r\n\x05\x04\x11\x02\
+ \x06\x01\x12\x04\x80\x05\x12!\n\r\n\x05\x04\x11\x02\x06\x03\x12\x04\x80\
+ \x05$%\n\xda\x01\n\x02\x04\x12\x12\x06\x88\x05\0\x89\x06\x01\x1aj\x20Enc\
+ apsulates\x20information\x20about\x20the\x20original\x20source\x20file\
+ \x20from\x20which\x20a\n\x20FileDescriptorProto\x20was\x20generated.\n2`\
+ \x20===================================================================\
+ \n\x20Optional\x20source\x20code\x20info\n\n\x0b\n\x03\x04\x12\x01\x12\
+ \x04\x88\x05\x08\x16\n\x82\x11\n\x04\x04\x12\x02\0\x12\x04\xb4\x05\x02!\
+ \x1a\xf3\x10\x20A\x20Location\x20identifies\x20a\x20piece\x20of\x20sourc\
+ e\x20code\x20in\x20a\x20.proto\x20file\x20which\n\x20corresponds\x20to\
+ \x20a\x20particular\x20definition.\x20\x20This\x20information\x20is\x20i\
+ ntended\n\x20to\x20be\x20useful\x20to\x20IDEs,\x20code\x20indexers,\x20d\
+ ocumentation\x20generators,\x20and\x20similar\n\x20tools.\n\n\x20For\x20\
+ example,\x20say\x20we\x20have\x20a\x20file\x20like:\n\x20\x20\x20message\
+ \x20Foo\x20{\n\x20\x20\x20\x20\x20optional\x20string\x20foo\x20=\x201;\n\
+ \x20\x20\x20}\n\x20Let's\x20look\x20at\x20just\x20the\x20field\x20defini\
+ tion:\n\x20\x20\x20optional\x20string\x20foo\x20=\x201;\n\x20\x20\x20^\
+ \x20\x20\x20\x20\x20\x20\x20^^\x20\x20\x20\x20\x20^^\x20\x20^\x20\x20^^^\
+ \n\x20\x20\x20a\x20\x20\x20\x20\x20\x20\x20bc\x20\x20\x20\x20\x20de\x20\
+ \x20f\x20\x20ghi\n\x20We\x20have\x20the\x20following\x20locations:\n\x20\
+ \x20\x20span\x20\x20\x20path\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\
+ \x20\x20\x20\x20represents\n\x20\x20\x20[a,i)\x20\x20[\x204,\x200,\x202,\
+ \x200\x20]\x20\x20\x20\x20\x20The\x20whole\x20field\x20definition.\n\x20\
+ \x20\x20[a,b)\x20\x20[\x204,\x200,\x202,\x200,\x204\x20]\x20\x20The\x20l\
+ abel\x20(optional).\n\x20\x20\x20[c,d)\x20\x20[\x204,\x200,\x202,\x200,\
+ \x205\x20]\x20\x20The\x20type\x20(string).\n\x20\x20\x20[e,f)\x20\x20[\
+ \x204,\x200,\x202,\x200,\x201\x20]\x20\x20The\x20name\x20(foo).\n\x20\
+ \x20\x20[g,h)\x20\x20[\x204,\x200,\x202,\x200,\x203\x20]\x20\x20The\x20n\
+ umber\x20(1).\n\n\x20Notes:\n\x20-\x20A\x20location\x20may\x20refer\x20t\
+ o\x20a\x20repeated\x20field\x20itself\x20(i.e.\x20not\x20to\x20any\n\x20\
+ \x20\x20particular\x20index\x20within\x20it).\x20\x20This\x20is\x20used\
+ \x20whenever\x20a\x20set\x20of\x20elements\x20are\n\x20\x20\x20logically\
+ \x20enclosed\x20in\x20a\x20single\x20code\x20segment.\x20\x20For\x20exam\
+ ple,\x20an\x20entire\n\x20\x20\x20extend\x20block\x20(possibly\x20contai\
+ ning\x20multiple\x20extension\x20definitions)\x20will\n\x20\x20\x20have\
+ \x20an\x20outer\x20location\x20whose\x20path\x20refers\x20to\x20the\x20\
+ \"extensions\"\x20repeated\n\x20\x20\x20field\x20without\x20an\x20index.\
+ \n\x20-\x20Multiple\x20locations\x20may\x20have\x20the\x20same\x20path.\
+ \x20\x20This\x20happens\x20when\x20a\x20single\n\x20\x20\x20logical\x20d\
+ eclaration\x20is\x20spread\x20out\x20across\x20multiple\x20places.\x20\
+ \x20The\x20most\n\x20\x20\x20obvious\x20example\x20is\x20the\x20\"extend\
+ \"\x20block\x20again\x20--\x20there\x20may\x20be\x20multiple\n\x20\x20\
+ \x20extend\x20blocks\x20in\x20the\x20same\x20scope,\x20each\x20of\x20whi\
+ ch\x20will\x20have\x20the\x20same\x20path.\n\x20-\x20A\x20location's\x20\
+ span\x20is\x20not\x20always\x20a\x20subset\x20of\x20its\x20parent's\x20s\
+ pan.\x20\x20For\n\x20\x20\x20example,\x20the\x20\"extendee\"\x20of\x20an\
+ \x20extension\x20declaration\x20appears\x20at\x20the\n\x20\x20\x20beginn\
+ ing\x20of\x20the\x20\"extend\"\x20block\x20and\x20is\x20shared\x20by\x20\
+ all\x20extensions\x20within\n\x20\x20\x20the\x20block.\n\x20-\x20Just\
+ \x20because\x20a\x20location's\x20span\x20is\x20a\x20subset\x20of\x20som\
+ e\x20other\x20location's\x20span\n\x20\x20\x20does\x20not\x20mean\x20tha\
+ t\x20it\x20is\x20a\x20descendent.\x20\x20For\x20example,\x20a\x20\"group\
+ \"\x20defines\n\x20\x20\x20both\x20a\x20type\x20and\x20a\x20field\x20in\
+ \x20a\x20single\x20declaration.\x20\x20Thus,\x20the\x20locations\n\x20\
+ \x20\x20corresponding\x20to\x20the\x20type\x20and\x20field\x20and\x20the\
+ ir\x20components\x20will\x20overlap.\n\x20-\x20Code\x20which\x20tries\
+ \x20to\x20interpret\x20locations\x20should\x20probably\x20be\x20designed\
+ \x20to\n\x20\x20\x20ignore\x20those\x20that\x20it\x20doesn't\x20understa\
+ nd,\x20as\x20more\x20types\x20of\x20locations\x20could\n\x20\x20\x20be\
+ \x20recorded\x20in\x20the\x20future.\n\n\r\n\x05\x04\x12\x02\0\x04\x12\
+ \x04\xb4\x05\x02\n\n\r\n\x05\x04\x12\x02\0\x06\x12\x04\xb4\x05\x0b\x13\n\
+ \r\n\x05\x04\x12\x02\0\x01\x12\x04\xb4\x05\x14\x1c\n\r\n\x05\x04\x12\x02\
+ \0\x03\x12\x04\xb4\x05\x1f\x20\n\x0e\n\x04\x04\x12\x03\0\x12\x06\xb5\x05\
+ \x02\x88\x06\x03\n\r\n\x05\x04\x12\x03\0\x01\x12\x04\xb5\x05\n\x12\n\x83\
+ \x07\n\x06\x04\x12\x03\0\x02\0\x12\x04\xcd\x05\x04*\x1a\xf2\x06\x20Ident\
+ ifies\x20which\x20part\x20of\x20the\x20FileDescriptorProto\x20was\x20def\
+ ined\x20at\x20this\n\x20location.\n\n\x20Each\x20element\x20is\x20a\x20f\
+ ield\x20number\x20or\x20an\x20index.\x20\x20They\x20form\x20a\x20path\
+ \x20from\n\x20the\x20root\x20FileDescriptorProto\x20to\x20the\x20place\
+ \x20where\x20the\x20definition.\x20\x20For\n\x20example,\x20this\x20path\
+ :\n\x20\x20\x20[\x204,\x203,\x202,\x207,\x201\x20]\n\x20refers\x20to:\n\
+ \x20\x20\x20file.message_type(3)\x20\x20//\x204,\x203\n\x20\x20\x20\x20\
+ \x20\x20\x20.field(7)\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x202,\x207\n\
+ \x20\x20\x20\x20\x20\x20\x20.name()\x20\x20\x20\x20\x20\x20\x20\x20\x20\
+ \x20\x20//\x201\n\x20This\x20is\x20because\x20FileDescriptorProto.messag\
+ e_type\x20has\x20field\x20number\x204:\n\x20\x20\x20repeated\x20Descript\
+ orProto\x20message_type\x20=\x204;\n\x20and\x20DescriptorProto.field\x20\
+ has\x20field\x20number\x202:\n\x20\x20\x20repeated\x20FieldDescriptorPro\
+ to\x20field\x20=\x202;\n\x20and\x20FieldDescriptorProto.name\x20has\x20f\
+ ield\x20number\x201:\n\x20\x20\x20optional\x20string\x20name\x20=\x201;\
+ \n\n\x20Thus,\x20the\x20above\x20path\x20gives\x20the\x20location\x20of\
+ \x20a\x20field\x20name.\x20\x20If\x20we\x20removed\n\x20the\x20last\x20e\
+ lement:\n\x20\x20\x20[\x204,\x203,\x202,\x207\x20]\n\x20this\x20path\x20\
+ refers\x20to\x20the\x20whole\x20field\x20declaration\x20(from\x20the\x20\
+ beginning\n\x20of\x20the\x20label\x20to\x20the\x20terminating\x20semicol\
+ on).\n\n\x0f\n\x07\x04\x12\x03\0\x02\0\x04\x12\x04\xcd\x05\x04\x0c\n\x0f\
+ \n\x07\x04\x12\x03\0\x02\0\x05\x12\x04\xcd\x05\r\x12\n\x0f\n\x07\x04\x12\
+ \x03\0\x02\0\x01\x12\x04\xcd\x05\x13\x17\n\x0f\n\x07\x04\x12\x03\0\x02\0\
+ \x03\x12\x04\xcd\x05\x1a\x1b\n\x0f\n\x07\x04\x12\x03\0\x02\0\x08\x12\x04\
+ \xcd\x05\x1c)\n\x10\n\x08\x04\x12\x03\0\x02\0\x08\x02\x12\x04\xcd\x05\
+ \x1d(\n\xd2\x02\n\x06\x04\x12\x03\0\x02\x01\x12\x04\xd4\x05\x04*\x1a\xc1\
+ \x02\x20Always\x20has\x20exactly\x20three\x20or\x20four\x20elements:\x20\
+ start\x20line,\x20start\x20column,\n\x20end\x20line\x20(optional,\x20oth\
+ erwise\x20assumed\x20same\x20as\x20start\x20line),\x20end\x20column.\n\
+ \x20These\x20are\x20packed\x20into\x20a\x20single\x20field\x20for\x20eff\
+ iciency.\x20\x20Note\x20that\x20line\n\x20and\x20column\x20numbers\x20ar\
+ e\x20zero-based\x20--\x20typically\x20you\x20will\x20want\x20to\x20add\n\
+ \x201\x20to\x20each\x20before\x20displaying\x20to\x20a\x20user.\n\n\x0f\
+ \n\x07\x04\x12\x03\0\x02\x01\x04\x12\x04\xd4\x05\x04\x0c\n\x0f\n\x07\x04\
+ \x12\x03\0\x02\x01\x05\x12\x04\xd4\x05\r\x12\n\x0f\n\x07\x04\x12\x03\0\
+ \x02\x01\x01\x12\x04\xd4\x05\x13\x17\n\x0f\n\x07\x04\x12\x03\0\x02\x01\
+ \x03\x12\x04\xd4\x05\x1a\x1b\n\x0f\n\x07\x04\x12\x03\0\x02\x01\x08\x12\
+ \x04\xd4\x05\x1c)\n\x10\n\x08\x04\x12\x03\0\x02\x01\x08\x02\x12\x04\xd4\
+ \x05\x1d(\n\xa5\x0c\n\x06\x04\x12\x03\0\x02\x02\x12\x04\x85\x06\x04)\x1a\
+ \x94\x0c\x20If\x20this\x20SourceCodeInfo\x20represents\x20a\x20complete\
+ \x20declaration,\x20these\x20are\x20any\n\x20comments\x20appearing\x20be\
+ fore\x20and\x20after\x20the\x20declaration\x20which\x20appear\x20to\x20b\
+ e\n\x20attached\x20to\x20the\x20declaration.\n\n\x20A\x20series\x20of\
+ \x20line\x20comments\x20appearing\x20on\x20consecutive\x20lines,\x20with\
+ \x20no\x20other\n\x20tokens\x20appearing\x20on\x20those\x20lines,\x20wil\
+ l\x20be\x20treated\x20as\x20a\x20single\x20comment.\n\n\x20leading_detac\
+ hed_comments\x20will\x20keep\x20paragraphs\x20of\x20comments\x20that\x20\
+ appear\n\x20before\x20(but\x20not\x20connected\x20to)\x20the\x20current\
+ \x20element.\x20Each\x20paragraph,\n\x20separated\x20by\x20empty\x20line\
+ s,\x20will\x20be\x20one\x20comment\x20element\x20in\x20the\x20repeated\n\
+ \x20field.\n\n\x20Only\x20the\x20comment\x20content\x20is\x20provided;\
+ \x20comment\x20markers\x20(e.g.\x20//)\x20are\n\x20stripped\x20out.\x20\
+ \x20For\x20block\x20comments,\x20leading\x20whitespace\x20and\x20an\x20a\
+ sterisk\n\x20will\x20be\x20stripped\x20from\x20the\x20beginning\x20of\
+ \x20each\x20line\x20other\x20than\x20the\x20first.\n\x20Newlines\x20are\
+ \x20included\x20in\x20the\x20output.\n\n\x20Examples:\n\n\x20\x20\x20opt\
+ ional\x20int32\x20foo\x20=\x201;\x20\x20//\x20Comment\x20attached\x20to\
+ \x20foo.\n\x20\x20\x20//\x20Comment\x20attached\x20to\x20bar.\n\x20\x20\
+ \x20optional\x20int32\x20bar\x20=\x202;\n\n\x20\x20\x20optional\x20strin\
+ g\x20baz\x20=\x203;\n\x20\x20\x20//\x20Comment\x20attached\x20to\x20baz.\
+ \n\x20\x20\x20//\x20Another\x20line\x20attached\x20to\x20baz.\n\n\x20\
+ \x20\x20//\x20Comment\x20attached\x20to\x20qux.\n\x20\x20\x20//\n\x20\
+ \x20\x20//\x20Another\x20line\x20attached\x20to\x20qux.\n\x20\x20\x20opt\
+ ional\x20double\x20qux\x20=\x204;\n\n\x20\x20\x20//\x20Detached\x20comme\
+ nt\x20for\x20corge.\x20This\x20is\x20not\x20leading\x20or\x20trailing\
+ \x20comments\n\x20\x20\x20//\x20to\x20qux\x20or\x20corge\x20because\x20t\
+ here\x20are\x20blank\x20lines\x20separating\x20it\x20from\n\x20\x20\x20/\
+ /\x20both.\n\n\x20\x20\x20//\x20Detached\x20comment\x20for\x20corge\x20p\
+ aragraph\x202.\n\n\x20\x20\x20optional\x20string\x20corge\x20=\x205;\n\
+ \x20\x20\x20/*\x20Block\x20comment\x20attached\n\x20\x20\x20\x20*\x20to\
+ \x20corge.\x20\x20Leading\x20asterisks\n\x20\x20\x20\x20*\x20will\x20be\
+ \x20removed.\x20*/\n\x20\x20\x20/*\x20Block\x20comment\x20attached\x20to\
+ \n\x20\x20\x20\x20*\x20grault.\x20*/\n\x20\x20\x20optional\x20int32\x20g\
+ rault\x20=\x206;\n\n\x20\x20\x20//\x20ignored\x20detached\x20comments.\n\
+ \n\x0f\n\x07\x04\x12\x03\0\x02\x02\x04\x12\x04\x85\x06\x04\x0c\n\x0f\n\
+ \x07\x04\x12\x03\0\x02\x02\x05\x12\x04\x85\x06\r\x13\n\x0f\n\x07\x04\x12\
+ \x03\0\x02\x02\x01\x12\x04\x85\x06\x14$\n\x0f\n\x07\x04\x12\x03\0\x02\
+ \x02\x03\x12\x04\x85\x06'(\n\x0e\n\x06\x04\x12\x03\0\x02\x03\x12\x04\x86\
+ \x06\x04*\n\x0f\n\x07\x04\x12\x03\0\x02\x03\x04\x12\x04\x86\x06\x04\x0c\
+ \n\x0f\n\x07\x04\x12\x03\0\x02\x03\x05\x12\x04\x86\x06\r\x13\n\x0f\n\x07\
+ \x04\x12\x03\0\x02\x03\x01\x12\x04\x86\x06\x14%\n\x0f\n\x07\x04\x12\x03\
+ \0\x02\x03\x03\x12\x04\x86\x06()\n\x0e\n\x06\x04\x12\x03\0\x02\x04\x12\
+ \x04\x87\x06\x042\n\x0f\n\x07\x04\x12\x03\0\x02\x04\x04\x12\x04\x87\x06\
+ \x04\x0c\n\x0f\n\x07\x04\x12\x03\0\x02\x04\x05\x12\x04\x87\x06\r\x13\n\
+ \x0f\n\x07\x04\x12\x03\0\x02\x04\x01\x12\x04\x87\x06\x14-\n\x0f\n\x07\
+ \x04\x12\x03\0\x02\x04\x03\x12\x04\x87\x0601\n\xee\x01\n\x02\x04\x13\x12\
+ \x06\x8e\x06\0\xa3\x06\x01\x1a\xdf\x01\x20Describes\x20the\x20relationsh\
+ ip\x20between\x20generated\x20code\x20and\x20its\x20original\x20source\n\
+ \x20file.\x20A\x20GeneratedCodeInfo\x20message\x20is\x20associated\x20wi\
+ th\x20only\x20one\x20generated\n\x20source\x20file,\x20but\x20may\x20con\
+ tain\x20references\x20to\x20different\x20source\x20.proto\x20files.\n\n\
+ \x0b\n\x03\x04\x13\x01\x12\x04\x8e\x06\x08\x19\nx\n\x04\x04\x13\x02\0\
+ \x12\x04\x91\x06\x02%\x1aj\x20An\x20Annotation\x20connects\x20some\x20sp\
+ an\x20of\x20text\x20in\x20generated\x20code\x20to\x20an\x20element\n\x20\
+ of\x20its\x20generating\x20.proto\x20file.\n\n\r\n\x05\x04\x13\x02\0\x04\
+ \x12\x04\x91\x06\x02\n\n\r\n\x05\x04\x13\x02\0\x06\x12\x04\x91\x06\x0b\
+ \x15\n\r\n\x05\x04\x13\x02\0\x01\x12\x04\x91\x06\x16\x20\n\r\n\x05\x04\
+ \x13\x02\0\x03\x12\x04\x91\x06#$\n\x0e\n\x04\x04\x13\x03\0\x12\x06\x92\
+ \x06\x02\xa2\x06\x03\n\r\n\x05\x04\x13\x03\0\x01\x12\x04\x92\x06\n\x14\n\
+ \x8f\x01\n\x06\x04\x13\x03\0\x02\0\x12\x04\x95\x06\x04*\x1a\x7f\x20Ident\
+ ifies\x20the\x20element\x20in\x20the\x20original\x20source\x20.proto\x20\
+ file.\x20This\x20field\n\x20is\x20formatted\x20the\x20same\x20as\x20Sour\
+ ceCodeInfo.Location.path.\n\n\x0f\n\x07\x04\x13\x03\0\x02\0\x04\x12\x04\
+ \x95\x06\x04\x0c\n\x0f\n\x07\x04\x13\x03\0\x02\0\x05\x12\x04\x95\x06\r\
+ \x12\n\x0f\n\x07\x04\x13\x03\0\x02\0\x01\x12\x04\x95\x06\x13\x17\n\x0f\n\
+ \x07\x04\x13\x03\0\x02\0\x03\x12\x04\x95\x06\x1a\x1b\n\x0f\n\x07\x04\x13\
+ \x03\0\x02\0\x08\x12\x04\x95\x06\x1c)\n\x10\n\x08\x04\x13\x03\0\x02\0\
+ \x08\x02\x12\x04\x95\x06\x1d(\nO\n\x06\x04\x13\x03\0\x02\x01\x12\x04\x98\
+ \x06\x04$\x1a?\x20Identifies\x20the\x20filesystem\x20path\x20to\x20the\
+ \x20original\x20source\x20.proto.\n\n\x0f\n\x07\x04\x13\x03\0\x02\x01\
+ \x04\x12\x04\x98\x06\x04\x0c\n\x0f\n\x07\x04\x13\x03\0\x02\x01\x05\x12\
+ \x04\x98\x06\r\x13\n\x0f\n\x07\x04\x13\x03\0\x02\x01\x01\x12\x04\x98\x06\
+ \x14\x1f\n\x0f\n\x07\x04\x13\x03\0\x02\x01\x03\x12\x04\x98\x06\"#\nw\n\
+ \x06\x04\x13\x03\0\x02\x02\x12\x04\x9c\x06\x04\x1d\x1ag\x20Identifies\
+ \x20the\x20starting\x20offset\x20in\x20bytes\x20in\x20the\x20generated\
+ \x20code\n\x20that\x20relates\x20to\x20the\x20identified\x20object.\n\n\
+ \x0f\n\x07\x04\x13\x03\0\x02\x02\x04\x12\x04\x9c\x06\x04\x0c\n\x0f\n\x07\
+ \x04\x13\x03\0\x02\x02\x05\x12\x04\x9c\x06\r\x12\n\x0f\n\x07\x04\x13\x03\
+ \0\x02\x02\x01\x12\x04\x9c\x06\x13\x18\n\x0f\n\x07\x04\x13\x03\0\x02\x02\
+ \x03\x12\x04\x9c\x06\x1b\x1c\n\xdb\x01\n\x06\x04\x13\x03\0\x02\x03\x12\
+ \x04\xa1\x06\x04\x1b\x1a\xca\x01\x20Identifies\x20the\x20ending\x20offse\
+ t\x20in\x20bytes\x20in\x20the\x20generated\x20code\x20that\n\x20relates\
+ \x20to\x20the\x20identified\x20offset.\x20The\x20end\x20offset\x20should\
+ \x20be\x20one\x20past\n\x20the\x20last\x20relevant\x20byte\x20(so\x20the\
+ \x20length\x20of\x20the\x20text\x20=\x20end\x20-\x20begin).\n\n\x0f\n\
+ \x07\x04\x13\x03\0\x02\x03\x04\x12\x04\xa1\x06\x04\x0c\n\x0f\n\x07\x04\
+ \x13\x03\0\x02\x03\x05\x12\x04\xa1\x06\r\x12\n\x0f\n\x07\x04\x13\x03\0\
+ \x02\x03\x01\x12\x04\xa1\x06\x13\x16\n\x0f\n\x07\x04\x13\x03\0\x02\x03\
+ \x03\x12\x04\xa1\x06\x19\x1a\
+";
+
+static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+
+fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
+ ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
+}
+
+pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
+ unsafe {
+ file_descriptor_proto_lazy.get(|| {
+ parse_descriptor_proto()
+ })
+ }
+}
diff --git a/src/descriptorx.rs b/src/descriptorx.rs
new file mode 100644
index 0000000..033aa2a
--- /dev/null
+++ b/src/descriptorx.rs
@@ -0,0 +1,657 @@
+// Should not be a part of public API
+#![doc(hidden)]
+
+use descriptor::DescriptorProto;
+use descriptor::EnumDescriptorProto;
+use descriptor::EnumValueDescriptorProto;
+use descriptor::FieldDescriptorProto;
+/// utilities to work with descriptor
+use descriptor::FileDescriptorProto;
+use descriptor::OneofDescriptorProto;
+
+use rust;
+use strx;
+
+// Copy-pasted from libsyntax.
+fn ident_start(c: char) -> bool {
+ (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_'
+}
+
+// Copy-pasted from libsyntax.
+fn ident_continue(c: char) -> bool {
+ (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_'
+}
+
+pub fn proto_path_to_rust_mod(path: &str) -> String {
+ let without_dir = strx::remove_to(path, '/');
+ let without_suffix = strx::remove_suffix(without_dir, ".proto");
+
+ let name = without_suffix
+ .chars()
+ .enumerate()
+ .map(|(i, c)| {
+ let valid = if i == 0 {
+ ident_start(c)
+ } else {
+ ident_continue(c)
+ };
+ if valid {
+ c
+ } else {
+ '_'
+ }
+ })
+ .collect::<String>();
+
+ let name = if rust::is_rust_keyword(&name) {
+ format!("{}_pb", name)
+ } else {
+ name
+ };
+ name
+}
+
+pub struct RootScope<'a> {
+ pub file_descriptors: &'a [FileDescriptorProto],
+}
+
+impl<'a> RootScope<'a> {
+ fn packages(&'a self) -> Vec<FileScope<'a>> {
+ self.file_descriptors
+ .iter()
+ .map(|fd| FileScope {
+ file_descriptor: fd,
+ })
+ .collect()
+ }
+
+ // find enum by fully qualified name
+ pub fn find_enum(&'a self, fqn: &str) -> EnumWithScope<'a> {
+ match self.find_message_or_enum(fqn) {
+ MessageOrEnumWithScope::Enum(e) => e,
+ _ => panic!("not an enum: {}", fqn),
+ }
+ }
+
+ // find message by fully qualified name
+ pub fn find_message(&'a self, fqn: &str) -> MessageWithScope<'a> {
+ match self.find_message_or_enum(fqn) {
+ MessageOrEnumWithScope::Message(m) => m,
+ _ => panic!("not a message: {}", fqn),
+ }
+ }
+
+ // find message or enum by fully qualified name
+ pub fn find_message_or_enum(&'a self, fqn: &str) -> MessageOrEnumWithScope<'a> {
+ assert!(fqn.starts_with("."), "name must start with dot: {}", fqn);
+ let fqn1 = &fqn[1..];
+ self.packages()
+ .into_iter()
+ .flat_map(|p| {
+ (if p.get_package().is_empty() {
+ p.find_message_or_enum(fqn1)
+ } else if fqn1.starts_with(&(p.get_package().to_string() + ".")) {
+ let remaining = &fqn1[(p.get_package().len() + 1)..];
+ p.find_message_or_enum(remaining)
+ } else {
+ None
+ })
+ .into_iter()
+ })
+ .next()
+ .expect(&format!("enum not found by name: {}", fqn))
+ }
+}
+
+#[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),
+ }
+ }
+}
+
+#[derive(Clone)]
+pub struct FileScope<'a> {
+ pub file_descriptor: &'a FileDescriptorProto,
+}
+
+impl<'a> FileScope<'a> {
+ fn get_package(&self) -> &'a str {
+ self.file_descriptor.get_package()
+ }
+
+ pub fn syntax(&self) -> Syntax {
+ Syntax::parse(self.file_descriptor.get_syntax())
+ }
+
+ pub fn to_scope(&self) -> Scope<'a> {
+ Scope {
+ file_scope: self.clone(),
+ path: Vec::new(),
+ }
+ }
+
+ fn find_message_or_enum(&self, name: &str) -> Option<MessageOrEnumWithScope<'a>> {
+ assert!(!name.starts_with("."));
+ self.find_messages_and_enums()
+ .into_iter()
+ .filter(|e| e.name_to_package() == name)
+ .next()
+ }
+
+ // find all enums in given file descriptor
+ pub fn find_enums(&self) -> Vec<EnumWithScope<'a>> {
+ let mut r = Vec::new();
+
+ self.to_scope().walk_scopes(|scope| {
+ r.extend(scope.get_enums());
+ });
+
+ r
+ }
+
+ // find all messages in given file descriptor
+ pub fn find_messages(&self) -> Vec<MessageWithScope<'a>> {
+ let mut r = Vec::new();
+
+ self.to_scope().walk_scopes(|scope| {
+ r.extend(scope.get_messages());
+ });
+
+ r
+ }
+
+ // find all messages and enums in given file descriptor
+ pub fn find_messages_and_enums(&self) -> Vec<MessageOrEnumWithScope<'a>> {
+ let mut r = Vec::new();
+
+ self.to_scope().walk_scopes(|scope| {
+ r.extend(scope.get_messages_and_enums());
+ });
+
+ r
+ }
+}
+
+#[derive(Clone)]
+pub struct Scope<'a> {
+ pub file_scope: FileScope<'a>,
+ pub path: Vec<&'a DescriptorProto>,
+}
+
+impl<'a> Scope<'a> {
+ pub fn get_file_descriptor(&self) -> &'a FileDescriptorProto {
+ self.file_scope.file_descriptor
+ }
+
+ // get message descriptors in this scope
+ fn get_message_descriptors(&self) -> &'a [DescriptorProto] {
+ if self.path.is_empty() {
+ self.file_scope.file_descriptor.get_message_type()
+ } else {
+ self.path.last().unwrap().get_nested_type()
+ }
+ }
+
+ // get enum descriptors in this scope
+ fn get_enum_descriptors(&self) -> &'a [EnumDescriptorProto] {
+ if self.path.is_empty() {
+ self.file_scope.file_descriptor.get_enum_type()
+ } else {
+ self.path.last().unwrap().get_enum_type()
+ }
+ }
+
+ // get messages with attached scopes in this scope
+ pub fn get_messages(&self) -> Vec<MessageWithScope<'a>> {
+ self.get_message_descriptors()
+ .iter()
+ .map(|m| MessageWithScope {
+ scope: self.clone(),
+ message: m,
+ })
+ .collect()
+ }
+
+ // get enums with attached scopes in this scope
+ pub fn get_enums(&self) -> Vec<EnumWithScope<'a>> {
+ self.get_enum_descriptors()
+ .iter()
+ .map(|e| EnumWithScope {
+ scope: self.clone(),
+ en: e,
+ })
+ .collect()
+ }
+
+ // get messages and enums with attached scopes in this scope
+ pub fn get_messages_and_enums(&self) -> Vec<MessageOrEnumWithScope<'a>> {
+ self.get_messages()
+ .into_iter()
+ .map(|m| MessageOrEnumWithScope::Message(m))
+ .chain(
+ self.get_enums()
+ .into_iter()
+ .map(|m| MessageOrEnumWithScope::Enum(m)),
+ )
+ .collect()
+ }
+
+ // nested scopes, i. e. scopes of nested messages
+ fn nested_scopes(&self) -> Vec<Scope<'a>> {
+ self.get_message_descriptors()
+ .iter()
+ .map(|m| {
+ let mut nested = self.clone();
+ nested.path.push(m);
+ nested
+ })
+ .collect()
+ }
+
+ fn walk_scopes_impl<F: FnMut(&Scope<'a>)>(&self, callback: &mut F) {
+ (*callback)(self);
+
+ for nested in self.nested_scopes() {
+ nested.walk_scopes_impl(callback);
+ }
+ }
+
+ // apply callback for this scope and all nested scopes
+ fn walk_scopes<F>(&self, mut callback: F)
+ where
+ F: FnMut(&Scope<'a>),
+ {
+ self.walk_scopes_impl(&mut callback);
+ }
+
+ pub fn prefix(&self) -> String {
+ if self.path.is_empty() {
+ "".to_string()
+ } else {
+ let v: Vec<&'a str> = self.path.iter().map(|m| m.get_name()).collect();
+ let mut r = v.join(".");
+ r.push_str(".");
+ r
+ }
+ }
+
+ // rust type name prefix for this scope
+ pub fn rust_prefix(&self) -> String {
+ self.prefix().replace(".", "_")
+ }
+}
+
+pub trait WithScope<'a> {
+ fn get_scope(&self) -> &Scope<'a>;
+
+ fn get_file_descriptor(&self) -> &'a FileDescriptorProto {
+ self.get_scope().get_file_descriptor()
+ }
+
+ // message or enum name
+ fn get_name(&self) -> &'a str;
+
+ fn escape_prefix(&self) -> &'static str;
+
+ fn name_to_package(&self) -> String {
+ let mut r = self.get_scope().prefix();
+ r.push_str(self.get_name());
+ r
+ }
+
+ /// Return absolute name starting with dot
+ fn name_absolute(&self) -> String {
+ let mut r = String::new();
+ r.push_str(".");
+ let package = self.get_file_descriptor().get_package();
+ if !package.is_empty() {
+ r.push_str(package);
+ r.push_str(".");
+ }
+ r.push_str(&self.name_to_package());
+ r
+ }
+
+ // rust type name of this descriptor
+ fn rust_name(&self) -> String {
+ let mut r = self.get_scope().rust_prefix();
+ // Only escape if prefix is not empty
+ if r.is_empty() && rust::is_rust_keyword(self.get_name()) {
+ r.push_str(self.escape_prefix());
+ }
+ r.push_str(self.get_name());
+ r
+ }
+
+ // fully-qualified name of this type
+ fn rust_fq_name(&self) -> String {
+ format!(
+ "{}::{}",
+ proto_path_to_rust_mod(self.get_scope().get_file_descriptor().get_name()),
+ self.rust_name()
+ )
+ }
+}
+
+#[derive(Clone)]
+pub struct MessageWithScope<'a> {
+ pub scope: Scope<'a>,
+ pub message: &'a DescriptorProto,
+}
+
+impl<'a> WithScope<'a> for MessageWithScope<'a> {
+ fn get_scope(&self) -> &Scope<'a> {
+ &self.scope
+ }
+
+ fn escape_prefix(&self) -> &'static str {
+ "message_"
+ }
+
+ fn get_name(&self) -> &'a str {
+ self.message.get_name()
+ }
+}
+
+impl<'a> MessageWithScope<'a> {
+ pub fn into_scope(mut self) -> Scope<'a> {
+ self.scope.path.push(self.message);
+ self.scope
+ }
+
+ pub fn to_scope(&self) -> Scope<'a> {
+ self.clone().into_scope()
+ }
+
+ pub fn fields(&self) -> Vec<FieldWithContext<'a>> {
+ self.message
+ .get_field()
+ .iter()
+ .map(|f| FieldWithContext {
+ field: f,
+ message: self.clone(),
+ })
+ .collect()
+ }
+
+ pub fn oneofs(&self) -> Vec<OneofWithContext<'a>> {
+ self.message
+ .get_oneof_decl()
+ .iter()
+ .enumerate()
+ .map(|(index, oneof)| OneofWithContext {
+ message: self.clone(),
+ oneof: &oneof,
+ index: index as u32,
+ })
+ .collect()
+ }
+
+ pub fn oneof_by_index(&self, index: u32) -> OneofWithContext<'a> {
+ self.oneofs().swap_remove(index as usize)
+ }
+
+ /// Pair of (key, value) if this message is map entry
+ pub fn map_entry(&'a self) -> Option<(FieldWithContext<'a>, FieldWithContext<'a>)> {
+ if self.message.get_options().get_map_entry() {
+ let key = self
+ .fields()
+ .into_iter()
+ .find(|f| f.field.get_number() == 1)
+ .unwrap();
+ let value = self
+ .fields()
+ .into_iter()
+ .find(|f| f.field.get_number() == 2)
+ .unwrap();
+ Some((key, value))
+ } else {
+ None
+ }
+ }
+}
+
+#[derive(Clone)]
+pub struct EnumWithScope<'a> {
+ pub scope: Scope<'a>,
+ pub en: &'a EnumDescriptorProto,
+}
+
+impl<'a> EnumWithScope<'a> {
+ // enum values
+ pub fn values(&'a self) -> &'a [EnumValueDescriptorProto] {
+ self.en.get_value()
+ }
+
+ // find enum value by name
+ pub fn value_by_name(&'a self, name: &str) -> &'a EnumValueDescriptorProto {
+ self.en
+ .get_value()
+ .into_iter()
+ .find(|v| v.get_name() == name)
+ .unwrap()
+ }
+}
+
+pub trait EnumValueDescriptorEx {
+ fn rust_name(&self) -> String;
+}
+
+impl EnumValueDescriptorEx for EnumValueDescriptorProto {
+ fn rust_name(&self) -> String {
+ let mut r = String::new();
+ if rust::is_rust_keyword(self.get_name()) {
+ r.push_str("value_");
+ }
+ r.push_str(self.get_name());
+ r
+ }
+}
+
+impl<'a> WithScope<'a> for EnumWithScope<'a> {
+ fn get_scope(&self) -> &Scope<'a> {
+ &self.scope
+ }
+
+ fn escape_prefix(&self) -> &'static str {
+ "enum_"
+ }
+
+ fn get_name(&self) -> &'a str {
+ self.en.get_name()
+ }
+}
+
+pub enum MessageOrEnumWithScope<'a> {
+ Message(MessageWithScope<'a>),
+ Enum(EnumWithScope<'a>),
+}
+
+impl<'a> WithScope<'a> for MessageOrEnumWithScope<'a> {
+ fn get_scope(&self) -> &Scope<'a> {
+ match self {
+ &MessageOrEnumWithScope::Message(ref m) => m.get_scope(),
+ &MessageOrEnumWithScope::Enum(ref e) => e.get_scope(),
+ }
+ }
+
+ fn escape_prefix(&self) -> &'static str {
+ match self {
+ &MessageOrEnumWithScope::Message(ref m) => m.escape_prefix(),
+ &MessageOrEnumWithScope::Enum(ref e) => e.escape_prefix(),
+ }
+ }
+
+ fn get_name(&self) -> &'a str {
+ match self {
+ &MessageOrEnumWithScope::Message(ref m) => m.get_name(),
+ &MessageOrEnumWithScope::Enum(ref e) => e.get_name(),
+ }
+ }
+}
+
+pub trait FieldDescriptorProtoExt {
+ fn rust_name(&self) -> String;
+}
+
+impl FieldDescriptorProtoExt for FieldDescriptorProto {
+ fn rust_name(&self) -> String {
+ if rust::is_rust_keyword(self.get_name()) {
+ format!("field_{}", self.get_name())
+ } else {
+ self.get_name().to_string()
+ }
+ }
+}
+
+#[derive(Clone)]
+pub struct FieldWithContext<'a> {
+ pub field: &'a FieldDescriptorProto,
+ pub message: MessageWithScope<'a>,
+}
+
+impl<'a> FieldWithContext<'a> {
+ #[doc(hidden)]
+ pub fn is_oneof(&self) -> bool {
+ self.field.has_oneof_index()
+ }
+
+ pub fn oneof(&self) -> Option<OneofWithContext<'a>> {
+ if self.is_oneof() {
+ Some(
+ self.message
+ .oneof_by_index(self.field.get_oneof_index() as u32),
+ )
+ } else {
+ None
+ }
+ }
+
+ pub fn number(&self) -> u32 {
+ self.field.get_number() as u32
+ }
+
+ /// Shortcut
+ pub fn name(&self) -> &str {
+ self.field.get_name()
+ }
+
+ // field name in generated code
+ #[deprecated]
+ pub fn rust_name(&self) -> String {
+ self.field.rust_name()
+ }
+
+ // From field to file root
+ pub fn containing_messages(&self) -> Vec<&'a DescriptorProto> {
+ let mut r = Vec::new();
+ r.push(self.message.message);
+ r.extend(self.message.scope.path.iter().rev());
+ r
+ }
+}
+
+#[derive(Clone)]
+pub struct OneofVariantWithContext<'a> {
+ pub oneof: &'a OneofWithContext<'a>,
+ pub field: &'a FieldDescriptorProto,
+}
+
+#[derive(Clone)]
+pub struct OneofWithContext<'a> {
+ pub oneof: &'a OneofDescriptorProto,
+ pub index: u32,
+ pub message: MessageWithScope<'a>,
+}
+
+impl<'a> OneofWithContext<'a> {
+ /// Oneof rust name
+ pub fn name(&'a self) -> &'a str {
+ match self.oneof.get_name() {
+ "type" => "field_type",
+ "box" => "field_box",
+ x => x,
+ }
+ }
+
+ /// rust type name of enum
+ pub fn rust_name(&self) -> String {
+ format!(
+ "{}_oneof_{}",
+ self.message.rust_name(),
+ self.oneof.get_name()
+ )
+ }
+
+ /// Oneof variants
+ pub fn variants(&'a self) -> Vec<OneofVariantWithContext<'a>> {
+ self.message
+ .fields()
+ .iter()
+ .filter(|f| f.field.has_oneof_index() && f.field.get_oneof_index() == self.index as i32)
+ .map(|f| OneofVariantWithContext {
+ oneof: self,
+ field: &f.field,
+ })
+ .collect()
+ }
+}
+
+/// Find message by rust type name
+pub fn find_message_by_rust_name<'a>(
+ fd: &'a FileDescriptorProto,
+ rust_name: &str,
+) -> MessageWithScope<'a> {
+ FileScope {
+ file_descriptor: fd,
+ }
+ .find_messages()
+ .into_iter()
+ .find(|m| m.rust_name() == rust_name)
+ .unwrap()
+}
+
+/// Find enum by rust type name
+pub fn find_enum_by_rust_name<'a>(
+ fd: &'a FileDescriptorProto,
+ rust_name: &str,
+) -> EnumWithScope<'a> {
+ FileScope {
+ file_descriptor: fd,
+ }
+ .find_enums()
+ .into_iter()
+ .find(|e| e.rust_name() == rust_name)
+ .unwrap()
+}
+
+#[cfg(test)]
+mod test {
+
+ use super::proto_path_to_rust_mod;
+
+ #[test]
+ fn test_mod_path_proto_ext() {
+ assert_eq!("proto", proto_path_to_rust_mod("proto.proto"));
+ }
+
+ #[test]
+ fn test_mod_path_unknown_ext() {
+ assert_eq!("proto_proto3", proto_path_to_rust_mod("proto.proto3"));
+ }
+
+ #[test]
+ fn test_mod_path_empty_ext() {
+ assert_eq!("proto", proto_path_to_rust_mod("proto"));
+ }
+}
diff --git a/src/enums.rs b/src/enums.rs
new file mode 100644
index 0000000..1c2a62e
--- /dev/null
+++ b/src/enums.rs
@@ -0,0 +1,32 @@
+use reflect::EnumDescriptor;
+use reflect::EnumValueDescriptor;
+
+/// Trait implemented by all protobuf enum types.
+pub trait ProtobufEnum: Eq + Sized + Copy + 'static {
+ /// Get enum `i32` value.
+ fn value(&self) -> i32;
+
+ /// Try to create an enum from `i32` value.
+ /// Return `None` if value is unknown.
+ fn from_i32(v: i32) -> Option<Self>;
+
+ /// Get all enum values for enum type.
+ fn values() -> &'static [Self] {
+ panic!();
+ }
+
+ /// Get enum value descriptor.
+ fn descriptor(&self) -> &'static EnumValueDescriptor {
+ self.enum_descriptor().value_by_number(self.value())
+ }
+
+ /// Get enum descriptor.
+ fn enum_descriptor(&self) -> &'static EnumDescriptor {
+ Self::enum_descriptor_static()
+ }
+
+ /// Get enum descriptor by type.
+ fn enum_descriptor_static() -> &'static EnumDescriptor {
+ panic!();
+ }
+}
diff --git a/src/error.rs b/src/error.rs
new file mode 100644
index 0000000..8039baf
--- /dev/null
+++ b/src/error.rs
@@ -0,0 +1,151 @@
+//! Protobuf error type
+
+use std::error::Error;
+use std::fmt;
+use std::io;
+use std::str;
+
+use wire_format::WireType;
+
+/// `Result` alias for `ProtobufError`
+pub type ProtobufResult<T> = Result<T, ProtobufError>;
+
+/// Enum values added here for diagnostic purposes.
+/// Users should not depend on specific values.
+#[derive(Debug)]
+pub enum WireError {
+ /// Could not read complete message because stream is EOF
+ UnexpectedEof,
+ /// Wrong wire type for given field
+ UnexpectedWireType(WireType),
+ /// Incorrect tag value
+ IncorrectTag(u32),
+ /// Malformed map field
+ IncompleteMap,
+ /// Malformed varint
+ IncorrectVarint,
+ /// String is not valid UTD-8
+ Utf8Error,
+ /// Enum value is unknown
+ InvalidEnumValue(i32),
+ /// Message is too nested
+ OverRecursionLimit,
+ /// Could not read complete message because stream is EOF
+ TruncatedMessage,
+ /// Other error
+ Other,
+}
+
+impl fmt::Display for WireError {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ match self {
+ WireError::Utf8Error => write!(f, "invalid UTF-8 sequence"),
+ WireError::UnexpectedWireType(..) => write!(f, "unexpected wire type"),
+ WireError::InvalidEnumValue(..) => write!(f, "invalid enum value"),
+ WireError::IncorrectTag(..) => write!(f, "incorrect tag"),
+ WireError::IncorrectVarint => write!(f, "incorrect varint"),
+ WireError::IncompleteMap => write!(f, "incomplete map"),
+ WireError::UnexpectedEof => write!(f, "unexpected EOF"),
+ WireError::OverRecursionLimit => write!(f, "over recursion limit"),
+ WireError::TruncatedMessage => write!(f, "truncated message"),
+ WireError::Other => write!(f, "other error"),
+ }
+ }
+}
+
+/// Generic protobuf error
+#[derive(Debug)]
+pub enum ProtobufError {
+ /// I/O error when reading or writing
+ IoError(io::Error),
+ /// Malformed input
+ WireError(WireError),
+ /// Protocol contains a string which is not valid UTF-8 string
+ Utf8(str::Utf8Error),
+ /// Not all required fields set
+ MessageNotInitialized {
+ /// Message name
+ message: &'static str,
+ },
+}
+
+impl ProtobufError {
+ /// Create message not initialized error.
+ #[doc(hidden)]
+ pub fn message_not_initialized(message: &'static str) -> ProtobufError {
+ ProtobufError::MessageNotInitialized { message: message }
+ }
+}
+
+impl fmt::Display for ProtobufError {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ match self {
+ // not sure that cause should be included in message
+ &ProtobufError::IoError(ref e) => write!(f, "IO error: {}", e),
+ &ProtobufError::WireError(ref e) => fmt::Display::fmt(e, f),
+ &ProtobufError::Utf8(ref e) => write!(f, "{}", e),
+ &ProtobufError::MessageNotInitialized { .. } => write!(f, "not all message fields set"),
+ }
+ }
+}
+
+impl Error for ProtobufError {
+ #[allow(deprecated)] // call to `description`
+ fn description(&self) -> &str {
+ match self {
+ // not sure that cause should be included in message
+ &ProtobufError::IoError(ref e) => e.description(),
+ &ProtobufError::WireError(ref e) => match *e {
+ WireError::Utf8Error => "invalid UTF-8 sequence",
+ WireError::UnexpectedWireType(..) => "unexpected wire type",
+ WireError::InvalidEnumValue(..) => "invalid enum value",
+ WireError::IncorrectTag(..) => "incorrect tag",
+ WireError::IncorrectVarint => "incorrect varint",
+ WireError::IncompleteMap => "incomplete map",
+ WireError::UnexpectedEof => "unexpected EOF",
+ WireError::OverRecursionLimit => "over recursion limit",
+ WireError::TruncatedMessage => "truncated message",
+ WireError::Other => "other error",
+ },
+ &ProtobufError::Utf8(ref e) => &e.description(),
+ &ProtobufError::MessageNotInitialized { .. } => "not all message fields set",
+ }
+ }
+
+ fn cause(&self) -> Option<&Error> {
+ match self {
+ &ProtobufError::IoError(ref e) => Some(e),
+ &ProtobufError::Utf8(ref e) => Some(e),
+ &ProtobufError::WireError(..) => None,
+ &ProtobufError::MessageNotInitialized { .. } => None,
+ }
+ }
+}
+
+impl From<io::Error> for ProtobufError {
+ fn from(err: io::Error) -> Self {
+ ProtobufError::IoError(err)
+ }
+}
+
+impl From<str::Utf8Error> for ProtobufError {
+ fn from(err: str::Utf8Error) -> Self {
+ ProtobufError::Utf8(err)
+ }
+}
+
+impl From<ProtobufError> for io::Error {
+ fn from(err: ProtobufError) -> Self {
+ match err {
+ ProtobufError::IoError(e) => e,
+ ProtobufError::WireError(e) => {
+ io::Error::new(io::ErrorKind::InvalidData, ProtobufError::WireError(e))
+ }
+ ProtobufError::MessageNotInitialized { message: msg } => io::Error::new(
+ io::ErrorKind::InvalidInput,
+ ProtobufError::MessageNotInitialized { message: msg },
+ ),
+ e => io::Error::new(io::ErrorKind::Other, Box::new(e)),
+ }
+ }
+}
diff --git a/src/ext.rs b/src/ext.rs
new file mode 100644
index 0000000..70b7439
--- /dev/null
+++ b/src/ext.rs
@@ -0,0 +1,47 @@
+//! Utilities to support "extension" fields.
+//!
+//! Extensions are [described in the official protobuf documentation][exts].
+//!
+//! [exts]: https://developers.google.com/protocol-buffers/docs/proto#extensions
+
+use std::marker::PhantomData;
+
+use core::Message;
+use types::ProtobufType;
+
+/// Optional ext field
+pub struct ExtFieldOptional<M: Message, T: ProtobufType> {
+ /// Extension field number
+ pub field_number: u32,
+ /// Marker
+ // TODO: hide
+ pub phantom: PhantomData<(M, T)>,
+}
+
+/// Repeated ext field
+pub struct ExtFieldRepeated<M: Message, T: ProtobufType> {
+ /// Extension field number
+ pub field_number: u32,
+ /// Extension field number
+ // TODO: hide
+ pub phantom: PhantomData<(M, T)>,
+}
+
+impl<M: Message, T: ProtobufType> ExtFieldOptional<M, T> {
+ /// Get a copy of value from a message.
+ ///
+ /// Extension data is stored in [`UnknownFields`](crate::UnknownFields).
+ pub fn get(&self, m: &M) -> Option<T::Value> {
+ m.get_unknown_fields()
+ .get(self.field_number)
+ .and_then(T::get_from_unknown)
+ }
+}
+
+impl<M: Message, T: ProtobufType> ExtFieldRepeated<M, T> {
+ /// Get a copy of value from a message (**not implemented**).
+ pub fn get(&self, _m: &M) -> Vec<T::Value> {
+ // TODO
+ unimplemented!()
+ }
+}
diff --git a/src/lazy.rs b/src/lazy.rs
new file mode 100644
index 0000000..b57d9f9
--- /dev/null
+++ b/src/lazy.rs
@@ -0,0 +1,105 @@
+//! Lazily initialized data.
+//! Used in generated code.
+
+use std::mem;
+use std::sync;
+
+/// Lasily initialized data.
+pub struct Lazy<T> {
+ #[doc(hidden)]
+ pub lock: sync::Once,
+ #[doc(hidden)]
+ pub ptr: *const T,
+}
+
+impl<T> Lazy<T> {
+ /// Uninitialized `Lazy` object.
+ ///
+ /// The initializer is added in rust-protobuf 2.11, for compatibility with
+ /// previously generated code, existing fields are kept public.
+ pub const INIT: Lazy<T> = Lazy {
+ lock: sync::Once::new(),
+ ptr: 0 as *const T,
+ };
+
+ /// Get lazy field value, initialize it with given function if not yet.
+ pub fn get<F>(&'static mut self, init: F) -> &'static T
+ where
+ F: FnOnce() -> T,
+ {
+ // ~ decouple the lifetimes of 'self' and 'self.lock' such we
+ // can initialize self.ptr in the call_once closure (note: we
+ // do have to initialize self.ptr in the closure to guarantee
+ // the ptr is valid for all calling threads at any point in
+ // time)
+ let lock: &sync::Once = unsafe { mem::transmute(&self.lock) };
+ lock.call_once(|| unsafe {
+ self.ptr = mem::transmute(Box::new(init()));
+ });
+ unsafe { &*self.ptr }
+ }
+}
+
+/// Used to initialize `lock` field in `Lazy` struct.
+#[deprecated(
+ since = "2.11",
+ note = "Regenerate .proto files to use safer initializer"
+)]
+pub const ONCE_INIT: sync::Once = sync::Once::new();
+
+#[cfg(test)]
+mod test {
+ use super::Lazy;
+ use std::sync::atomic::AtomicIsize;
+ use std::sync::atomic::Ordering;
+ use std::sync::Arc;
+ use std::sync::Barrier;
+ use std::thread;
+
+ #[test]
+ fn many_threads_calling_get() {
+ const N_THREADS: usize = 32;
+ const N_ITERS_IN_THREAD: usize = 32;
+ const N_ITERS: usize = 16;
+
+ static mut LAZY: Lazy<String> = Lazy::INIT;
+ static CALL_COUNT: AtomicIsize = AtomicIsize::new(0);
+
+ let value = "Hello, world!".to_owned();
+
+ for _ in 0..N_ITERS {
+ // Reset mutable state.
+ unsafe {
+ LAZY = Lazy::INIT;
+ }
+ CALL_COUNT.store(0, Ordering::SeqCst);
+
+ // Create a bunch of threads, all calling .get() at the same time.
+ let mut threads = vec![];
+ let barrier = Arc::new(Barrier::new(N_THREADS));
+
+ for _ in 0..N_THREADS {
+ let cloned_value_thread = value.clone();
+ let cloned_barrier = barrier.clone();
+ threads.push(thread::spawn(move || {
+ // Ensure all threads start at once to maximise contention.
+ cloned_barrier.wait();
+ for _ in 0..N_ITERS_IN_THREAD {
+ assert_eq!(&cloned_value_thread, unsafe {
+ LAZY.get(|| {
+ CALL_COUNT.fetch_add(1, Ordering::SeqCst);
+ cloned_value_thread.clone()
+ })
+ });
+ }
+ }));
+ }
+
+ for thread in threads {
+ thread.join().unwrap();
+ }
+
+ assert_eq!(CALL_COUNT.load(Ordering::SeqCst), 1);
+ }
+ }
+}
diff --git a/src/lib.rs b/src/lib.rs
new file mode 100644
index 0000000..515bba8
--- /dev/null
+++ b/src/lib.rs
@@ -0,0 +1,126 @@
+//! Library to read and write protocol buffers data.
+
+#![deny(missing_docs)]
+#![deny(intra_doc_link_resolution_failure)]
+// Because we need compat with Rust 1.26
+#![allow(bare_trait_objects)]
+
+#[cfg(feature = "bytes")]
+extern crate bytes;
+#[cfg(feature = "with-serde")]
+extern crate serde;
+#[macro_use]
+#[cfg(feature = "with-serde")]
+extern crate serde_derive;
+pub use cached_size::CachedSize;
+#[cfg(feature = "bytes")]
+pub use chars::Chars;
+pub use clear::Clear;
+pub use core::parse_from_bytes;
+#[cfg(feature = "bytes")]
+pub use core::parse_from_carllerche_bytes;
+pub use core::parse_from_reader;
+#[allow(deprecated)]
+pub use core::parse_length_delimited_from;
+#[allow(deprecated)]
+pub use core::parse_length_delimited_from_bytes;
+#[allow(deprecated)]
+pub use core::parse_length_delimited_from_reader;
+pub use core::Message;
+pub use enums::ProtobufEnum;
+pub use error::ProtobufError;
+pub use error::ProtobufResult;
+pub use repeated::RepeatedField;
+pub use singular::SingularField;
+pub use singular::SingularPtrField;
+pub use stream::wire_format;
+pub use stream::CodedInputStream;
+pub use stream::CodedOutputStream;
+pub use unknown::UnknownFields;
+pub use unknown::UnknownFieldsIter;
+pub use unknown::UnknownValue;
+pub use unknown::UnknownValueRef;
+pub use unknown::UnknownValues;
+pub use unknown::UnknownValuesIter;
+
+// generated
+pub mod descriptor;
+pub mod plugin;
+pub mod rustproto;
+
+mod any;
+
+mod clear;
+pub mod compiler_plugin;
+mod core;
+mod enums;
+pub mod error;
+pub mod ext;
+pub mod lazy;
+pub mod reflect;
+mod repeated;
+pub mod rt;
+mod singular;
+pub mod stream;
+pub mod text_format;
+pub mod types;
+pub mod well_known_types;
+
+// used by test
+#[cfg(test)]
+#[path = "../../protobuf-test-common/src/hex.rs"]
+mod hex;
+
+// used by rust-grpc
+pub mod descriptorx;
+
+mod cached_size;
+#[cfg(feature = "bytes")]
+mod chars;
+#[doc(hidden)] // used by codegen
+pub mod rust;
+mod strx;
+mod unknown;
+mod varint;
+mod zigzag;
+
+mod misc;
+
+mod buf_read_iter;
+
+// so `use protobuf::*` could work in mod descriptor and well_known_types
+mod protobuf {
+ pub use cached_size::CachedSize;
+ pub use clear::Clear;
+ pub use core::*;
+ pub use descriptor;
+ pub use descriptorx;
+ pub use enums::ProtobufEnum;
+ pub use error::*;
+ pub use ext;
+ pub use lazy;
+ pub use reflect;
+ pub use repeated::RepeatedField;
+ pub use rt;
+ pub use singular::SingularField;
+ pub use singular::SingularPtrField;
+ pub use stream::*;
+ pub use text_format;
+ pub use types;
+ pub use unknown::UnknownFields;
+ pub use unknown::UnknownFieldsIter;
+ pub use unknown::UnknownValue;
+ pub use unknown::UnknownValueRef;
+ pub use unknown::UnknownValues;
+ pub use unknown::UnknownValuesIter;
+ pub use well_known_types;
+}
+
+/// This symbol is in generated `version.rs`, include here for IDE
+#[cfg(never)]
+pub const VERSION: &str = "";
+/// This symbol is in generated `version.rs`, include here for IDE
+#[cfg(never)]
+#[doc(hidden)]
+pub const VERSION_IDENT: &str = "";
+include!("../out/version.rs");
diff --git a/src/misc.rs b/src/misc.rs
new file mode 100644
index 0000000..d923d58
--- /dev/null
+++ b/src/misc.rs
@@ -0,0 +1,37 @@
+use std::mem;
+use std::slice;
+
+/// Slice from `vec[vec.len()..vec.capacity()]`
+pub unsafe fn remaining_capacity_as_slice_mut<A>(vec: &mut Vec<A>) -> &mut [A] {
+ slice::from_raw_parts_mut(
+ vec.as_mut_slice().as_mut_ptr().offset(vec.len() as isize),
+ vec.capacity() - vec.len(),
+ )
+}
+
+pub unsafe fn remove_lifetime_mut<A: ?Sized>(a: &mut A) -> &'static mut A {
+ mem::transmute(a)
+}
+
+#[cfg(test)]
+mod test {
+ use super::*;
+
+ #[test]
+ fn test_remaining_capacity_as_slice_mut() {
+ let mut v = Vec::with_capacity(5);
+ v.push(10);
+ v.push(11);
+ v.push(12);
+ unsafe {
+ {
+ let s = remaining_capacity_as_slice_mut(&mut v);
+ assert_eq!(2, s.len());
+ s[0] = 13;
+ s[1] = 14;
+ }
+ v.set_len(5);
+ }
+ assert_eq!(vec![10, 11, 12, 13, 14], v);
+ }
+}
diff --git a/src/plugin.rs b/src/plugin.rs
new file mode 100644
index 0000000..ec24a8f
--- /dev/null
+++ b/src/plugin.rs
@@ -0,0 +1,998 @@
+// This file is generated by rust-protobuf 2.14.0-pre. Do not edit
+// @generated
+
+// https://github.com/rust-lang/rust-clippy/issues/702
+#![allow(unknown_lints)]
+#![allow(clippy::all)]
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
+#![allow(box_pointers)]
+#![allow(dead_code)]
+#![allow(missing_docs)]
+#![allow(non_camel_case_types)]
+#![allow(non_snake_case)]
+#![allow(non_upper_case_globals)]
+#![allow(trivial_casts)]
+#![allow(unsafe_code)]
+#![allow(unused_imports)]
+#![allow(unused_results)]
+//! Generated file from `google/protobuf/compiler/plugin.proto`
+
+use protobuf::Message as Message_imported_for_functions;
+use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct CodeGeneratorRequest {
+ // message fields
+ file_to_generate: ::protobuf::RepeatedField<::std::string::String>,
+ parameter: ::protobuf::SingularField<::std::string::String>,
+ proto_file: ::protobuf::RepeatedField<::protobuf::descriptor::FileDescriptorProto>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a CodeGeneratorRequest {
+ fn default() -> &'a CodeGeneratorRequest {
+ <CodeGeneratorRequest as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl CodeGeneratorRequest {
+ pub fn new() -> CodeGeneratorRequest {
+ ::std::default::Default::default()
+ }
+
+ // repeated string file_to_generate = 1;
+
+
+ pub fn get_file_to_generate(&self) -> &[::std::string::String] {
+ &self.file_to_generate
+ }
+ pub fn clear_file_to_generate(&mut self) {
+ self.file_to_generate.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_file_to_generate(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) {
+ self.file_to_generate = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_file_to_generate(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> {
+ &mut self.file_to_generate
+ }
+
+ // Take field
+ pub fn take_file_to_generate(&mut self) -> ::protobuf::RepeatedField<::std::string::String> {
+ ::std::mem::replace(&mut self.file_to_generate, ::protobuf::RepeatedField::new())
+ }
+
+ // optional string parameter = 2;
+
+
+ pub fn get_parameter(&self) -> &str {
+ match self.parameter.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_parameter(&mut self) {
+ self.parameter.clear();
+ }
+
+ pub fn has_parameter(&self) -> bool {
+ self.parameter.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_parameter(&mut self, v: ::std::string::String) {
+ self.parameter = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_parameter(&mut self) -> &mut ::std::string::String {
+ if self.parameter.is_none() {
+ self.parameter.set_default();
+ }
+ self.parameter.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_parameter(&mut self) -> ::std::string::String {
+ self.parameter.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // repeated .google.protobuf.FileDescriptorProto proto_file = 15;
+
+
+ pub fn get_proto_file(&self) -> &[::protobuf::descriptor::FileDescriptorProto] {
+ &self.proto_file
+ }
+ pub fn clear_proto_file(&mut self) {
+ self.proto_file.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_proto_file(&mut self, v: ::protobuf::RepeatedField<::protobuf::descriptor::FileDescriptorProto>) {
+ self.proto_file = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_proto_file(&mut self) -> &mut ::protobuf::RepeatedField<::protobuf::descriptor::FileDescriptorProto> {
+ &mut self.proto_file
+ }
+
+ // Take field
+ pub fn take_proto_file(&mut self) -> ::protobuf::RepeatedField<::protobuf::descriptor::FileDescriptorProto> {
+ ::std::mem::replace(&mut self.proto_file, ::protobuf::RepeatedField::new())
+ }
+}
+
+impl ::protobuf::Message for CodeGeneratorRequest {
+ fn is_initialized(&self) -> bool {
+ for v in &self.proto_file {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.file_to_generate)?;
+ },
+ 2 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.parameter)?;
+ },
+ 15 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.proto_file)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ for value in &self.file_to_generate {
+ my_size += ::protobuf::rt::string_size(1, &value);
+ };
+ if let Some(ref v) = self.parameter.as_ref() {
+ my_size += ::protobuf::rt::string_size(2, &v);
+ }
+ for value in &self.proto_file {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ for v in &self.file_to_generate {
+ os.write_string(1, &v)?;
+ };
+ if let Some(ref v) = self.parameter.as_ref() {
+ os.write_string(2, &v)?;
+ }
+ for v in &self.proto_file {
+ os.write_tag(15, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> CodeGeneratorRequest {
+ CodeGeneratorRequest::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "file_to_generate",
+ |m: &CodeGeneratorRequest| { &m.file_to_generate },
+ |m: &mut CodeGeneratorRequest| { &mut m.file_to_generate },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "parameter",
+ |m: &CodeGeneratorRequest| { &m.parameter },
+ |m: &mut CodeGeneratorRequest| { &mut m.parameter },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<::protobuf::descriptor::FileDescriptorProto>>(
+ "proto_file",
+ |m: &CodeGeneratorRequest| { &m.proto_file },
+ |m: &mut CodeGeneratorRequest| { &mut m.proto_file },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<CodeGeneratorRequest>(
+ "CodeGeneratorRequest",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static CodeGeneratorRequest {
+ static mut instance: ::protobuf::lazy::Lazy<CodeGeneratorRequest> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(CodeGeneratorRequest::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for CodeGeneratorRequest {
+ fn clear(&mut self) {
+ self.file_to_generate.clear();
+ self.parameter.clear();
+ self.proto_file.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for CodeGeneratorRequest {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for CodeGeneratorRequest {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct CodeGeneratorResponse {
+ // message fields
+ error: ::protobuf::SingularField<::std::string::String>,
+ file: ::protobuf::RepeatedField<CodeGeneratorResponse_File>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a CodeGeneratorResponse {
+ fn default() -> &'a CodeGeneratorResponse {
+ <CodeGeneratorResponse as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl CodeGeneratorResponse {
+ pub fn new() -> CodeGeneratorResponse {
+ ::std::default::Default::default()
+ }
+
+ // optional string error = 1;
+
+
+ pub fn get_error(&self) -> &str {
+ match self.error.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_error(&mut self) {
+ self.error.clear();
+ }
+
+ pub fn has_error(&self) -> bool {
+ self.error.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_error(&mut self, v: ::std::string::String) {
+ self.error = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_error(&mut self) -> &mut ::std::string::String {
+ if self.error.is_none() {
+ self.error.set_default();
+ }
+ self.error.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_error(&mut self) -> ::std::string::String {
+ self.error.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;
+
+
+ pub fn get_file(&self) -> &[CodeGeneratorResponse_File] {
+ &self.file
+ }
+ pub fn clear_file(&mut self) {
+ self.file.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_file(&mut self, v: ::protobuf::RepeatedField<CodeGeneratorResponse_File>) {
+ self.file = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_file(&mut self) -> &mut ::protobuf::RepeatedField<CodeGeneratorResponse_File> {
+ &mut self.file
+ }
+
+ // Take field
+ pub fn take_file(&mut self) -> ::protobuf::RepeatedField<CodeGeneratorResponse_File> {
+ ::std::mem::replace(&mut self.file, ::protobuf::RepeatedField::new())
+ }
+}
+
+impl ::protobuf::Message for CodeGeneratorResponse {
+ fn is_initialized(&self) -> bool {
+ for v in &self.file {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.error)?;
+ },
+ 15 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.file)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(ref v) = self.error.as_ref() {
+ my_size += ::protobuf::rt::string_size(1, &v);
+ }
+ for value in &self.file {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(ref v) = self.error.as_ref() {
+ os.write_string(1, &v)?;
+ }
+ for v in &self.file {
+ os.write_tag(15, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> CodeGeneratorResponse {
+ CodeGeneratorResponse::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "error",
+ |m: &CodeGeneratorResponse| { &m.error },
+ |m: &mut CodeGeneratorResponse| { &mut m.error },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<CodeGeneratorResponse_File>>(
+ "file",
+ |m: &CodeGeneratorResponse| { &m.file },
+ |m: &mut CodeGeneratorResponse| { &mut m.file },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<CodeGeneratorResponse>(
+ "CodeGeneratorResponse",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static CodeGeneratorResponse {
+ static mut instance: ::protobuf::lazy::Lazy<CodeGeneratorResponse> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(CodeGeneratorResponse::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for CodeGeneratorResponse {
+ fn clear(&mut self) {
+ self.error.clear();
+ self.file.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for CodeGeneratorResponse {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for CodeGeneratorResponse {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct CodeGeneratorResponse_File {
+ // message fields
+ name: ::protobuf::SingularField<::std::string::String>,
+ insertion_point: ::protobuf::SingularField<::std::string::String>,
+ content: ::protobuf::SingularField<::std::string::String>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a CodeGeneratorResponse_File {
+ fn default() -> &'a CodeGeneratorResponse_File {
+ <CodeGeneratorResponse_File as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl CodeGeneratorResponse_File {
+ pub fn new() -> CodeGeneratorResponse_File {
+ ::std::default::Default::default()
+ }
+
+ // optional string name = 1;
+
+
+ pub fn get_name(&self) -> &str {
+ match self.name.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_name(&mut self) {
+ self.name.clear();
+ }
+
+ pub fn has_name(&self) -> bool {
+ self.name.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_name(&mut self, v: ::std::string::String) {
+ self.name = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_name(&mut self) -> &mut ::std::string::String {
+ if self.name.is_none() {
+ self.name.set_default();
+ }
+ self.name.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_name(&mut self) -> ::std::string::String {
+ self.name.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional string insertion_point = 2;
+
+
+ pub fn get_insertion_point(&self) -> &str {
+ match self.insertion_point.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_insertion_point(&mut self) {
+ self.insertion_point.clear();
+ }
+
+ pub fn has_insertion_point(&self) -> bool {
+ self.insertion_point.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_insertion_point(&mut self, v: ::std::string::String) {
+ self.insertion_point = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_insertion_point(&mut self) -> &mut ::std::string::String {
+ if self.insertion_point.is_none() {
+ self.insertion_point.set_default();
+ }
+ self.insertion_point.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_insertion_point(&mut self) -> ::std::string::String {
+ self.insertion_point.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+
+ // optional string content = 15;
+
+
+ pub fn get_content(&self) -> &str {
+ match self.content.as_ref() {
+ Some(v) => &v,
+ None => "",
+ }
+ }
+ pub fn clear_content(&mut self) {
+ self.content.clear();
+ }
+
+ pub fn has_content(&self) -> bool {
+ self.content.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_content(&mut self, v: ::std::string::String) {
+ self.content = ::protobuf::SingularField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_content(&mut self) -> &mut ::std::string::String {
+ if self.content.is_none() {
+ self.content.set_default();
+ }
+ self.content.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_content(&mut self) -> ::std::string::String {
+ self.content.take().unwrap_or_else(|| ::std::string::String::new())
+ }
+}
+
+impl ::protobuf::Message for CodeGeneratorResponse_File {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.name)?;
+ },
+ 2 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.insertion_point)?;
+ },
+ 15 => {
+ ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.content)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let Some(ref v) = self.name.as_ref() {
+ my_size += ::protobuf::rt::string_size(1, &v);
+ }
+ if let Some(ref v) = self.insertion_point.as_ref() {
+ my_size += ::protobuf::rt::string_size(2, &v);
+ }
+ if let Some(ref v) = self.content.as_ref() {
+ my_size += ::protobuf::rt::string_size(15, &v);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let Some(ref v) = self.name.as_ref() {
+ os.write_string(1, &v)?;
+ }
+ if let Some(ref v) = self.insertion_point.as_ref() {
+ os.write_string(2, &v)?;
+ }
+ if let Some(ref v) = self.content.as_ref() {
+ os.write_string(15, &v)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> CodeGeneratorResponse_File {
+ CodeGeneratorResponse_File::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "name",
+ |m: &CodeGeneratorResponse_File| { &m.name },
+ |m: &mut CodeGeneratorResponse_File| { &mut m.name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "insertion_point",
+ |m: &CodeGeneratorResponse_File| { &m.insertion_point },
+ |m: &mut CodeGeneratorResponse_File| { &mut m.insertion_point },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "content",
+ |m: &CodeGeneratorResponse_File| { &m.content },
+ |m: &mut CodeGeneratorResponse_File| { &mut m.content },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<CodeGeneratorResponse_File>(
+ "CodeGeneratorResponse.File",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static CodeGeneratorResponse_File {
+ static mut instance: ::protobuf::lazy::Lazy<CodeGeneratorResponse_File> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(CodeGeneratorResponse_File::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for CodeGeneratorResponse_File {
+ fn clear(&mut self) {
+ self.name.clear();
+ self.insertion_point.clear();
+ self.content.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for CodeGeneratorResponse_File {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for CodeGeneratorResponse_File {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+static file_descriptor_proto_data: &'static [u8] = b"\
+ \n%google/protobuf/compiler/plugin.proto\x12\x18google.protobuf.compiler\
+ \x1a\x20google/protobuf/descriptor.proto\"\xa3\x01\n\x14CodeGeneratorReq\
+ uest\x12(\n\x10file_to_generate\x18\x01\x20\x03(\tR\x0efileToGenerate\
+ \x12\x1c\n\tparameter\x18\x02\x20\x01(\tR\tparameter\x12C\n\nproto_file\
+ \x18\x0f\x20\x03(\x0b2$.google.protobuf.FileDescriptorProtoR\tprotoFile\
+ \"\xd6\x01\n\x15CodeGeneratorResponse\x12\x14\n\x05error\x18\x01\x20\x01\
+ (\tR\x05error\x12H\n\x04file\x18\x0f\x20\x03(\x0b24.google.protobuf.comp\
+ iler.CodeGeneratorResponse.FileR\x04file\x1a]\n\x04File\x12\x12\n\x04nam\
+ e\x18\x01\x20\x01(\tR\x04name\x12'\n\x0finsertion_point\x18\x02\x20\x01(\
+ \tR\x0einsertionPoint\x12\x18\n\x07content\x18\x0f\x20\x01(\tR\x07conten\
+ tB7\n\x1ccom.google.protobuf.compilerB\x0cPluginProtosZ\tplugin_goJ\xd29\
+ \n\x07\x12\x05.\0\x95\x01\x01\n\xca\x11\n\x01\x0c\x12\x03.\0\x122\xc1\
+ \x0c\x20Protocol\x20Buffers\x20-\x20Google's\x20data\x20interchange\x20f\
+ ormat\n\x20Copyright\x202008\x20Google\x20Inc.\x20\x20All\x20rights\x20r\
+ eserved.\n\x20https://developers.google.com/protocol-buffers/\n\n\x20Red\
+ istribution\x20and\x20use\x20in\x20source\x20and\x20binary\x20forms,\x20\
+ with\x20or\x20without\n\x20modification,\x20are\x20permitted\x20provided\
+ \x20that\x20the\x20following\x20conditions\x20are\n\x20met:\n\n\x20\x20\
+ \x20\x20\x20*\x20Redistributions\x20of\x20source\x20code\x20must\x20reta\
+ in\x20the\x20above\x20copyright\n\x20notice,\x20this\x20list\x20of\x20co\
+ nditions\x20and\x20the\x20following\x20disclaimer.\n\x20\x20\x20\x20\x20\
+ *\x20Redistributions\x20in\x20binary\x20form\x20must\x20reproduce\x20the\
+ \x20above\n\x20copyright\x20notice,\x20this\x20list\x20of\x20conditions\
+ \x20and\x20the\x20following\x20disclaimer\n\x20in\x20the\x20documentatio\
+ n\x20and/or\x20other\x20materials\x20provided\x20with\x20the\n\x20distri\
+ bution.\n\x20\x20\x20\x20\x20*\x20Neither\x20the\x20name\x20of\x20Google\
+ \x20Inc.\x20nor\x20the\x20names\x20of\x20its\n\x20contributors\x20may\
+ \x20be\x20used\x20to\x20endorse\x20or\x20promote\x20products\x20derived\
+ \x20from\n\x20this\x20software\x20without\x20specific\x20prior\x20writte\
+ n\x20permission.\n\n\x20THIS\x20SOFTWARE\x20IS\x20PROVIDED\x20BY\x20THE\
+ \x20COPYRIGHT\x20HOLDERS\x20AND\x20CONTRIBUTORS\n\x20\"AS\x20IS\"\x20AND\
+ \x20ANY\x20EXPRESS\x20OR\x20IMPLIED\x20WARRANTIES,\x20INCLUDING,\x20BUT\
+ \x20NOT\n\x20LIMITED\x20TO,\x20THE\x20IMPLIED\x20WARRANTIES\x20OF\x20MER\
+ CHANTABILITY\x20AND\x20FITNESS\x20FOR\n\x20A\x20PARTICULAR\x20PURPOSE\
+ \x20ARE\x20DISCLAIMED.\x20IN\x20NO\x20EVENT\x20SHALL\x20THE\x20COPYRIGHT\
+ \n\x20OWNER\x20OR\x20CONTRIBUTORS\x20BE\x20LIABLE\x20FOR\x20ANY\x20DIREC\
+ T,\x20INDIRECT,\x20INCIDENTAL,\n\x20SPECIAL,\x20EXEMPLARY,\x20OR\x20CONS\
+ EQUENTIAL\x20DAMAGES\x20(INCLUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\
+ \x20PROCUREMENT\x20OF\x20SUBSTITUTE\x20GOODS\x20OR\x20SERVICES;\x20LOSS\
+ \x20OF\x20USE,\n\x20DATA,\x20OR\x20PROFITS;\x20OR\x20BUSINESS\x20INTERRU\
+ PTION)\x20HOWEVER\x20CAUSED\x20AND\x20ON\x20ANY\n\x20THEORY\x20OF\x20LIA\
+ BILITY,\x20WHETHER\x20IN\x20CONTRACT,\x20STRICT\x20LIABILITY,\x20OR\x20T\
+ ORT\n\x20(INCLUDING\x20NEGLIGENCE\x20OR\x20OTHERWISE)\x20ARISING\x20IN\
+ \x20ANY\x20WAY\x20OUT\x20OF\x20THE\x20USE\n\x20OF\x20THIS\x20SOFTWARE,\
+ \x20EVEN\x20IF\x20ADVISED\x20OF\x20THE\x20POSSIBILITY\x20OF\x20SUCH\x20D\
+ AMAGE.\n2\xfb\x04\x20Author:\x20kenton@google.com\x20(Kenton\x20Varda)\n\
+ \n\x20WARNING:\x20\x20The\x20plugin\x20interface\x20is\x20currently\x20E\
+ XPERIMENTAL\x20and\x20is\x20subject\x20to\n\x20\x20\x20change.\n\n\x20pr\
+ otoc\x20(aka\x20the\x20Protocol\x20Compiler)\x20can\x20be\x20extended\
+ \x20via\x20plugins.\x20\x20A\x20plugin\x20is\n\x20just\x20a\x20program\
+ \x20that\x20reads\x20a\x20CodeGeneratorRequest\x20from\x20stdin\x20and\
+ \x20writes\x20a\n\x20CodeGeneratorResponse\x20to\x20stdout.\n\n\x20Plugi\
+ ns\x20written\x20using\x20C++\x20can\x20use\x20google/protobuf/compiler/\
+ plugin.h\x20instead\n\x20of\x20dealing\x20with\x20the\x20raw\x20protocol\
+ \x20defined\x20here.\n\n\x20A\x20plugin\x20executable\x20needs\x20only\
+ \x20to\x20be\x20placed\x20somewhere\x20in\x20the\x20path.\x20\x20The\n\
+ \x20plugin\x20should\x20be\x20named\x20\"protoc-gen-$NAME\",\x20and\x20w\
+ ill\x20then\x20be\x20used\x20when\x20the\n\x20flag\x20\"--${NAME}_out\"\
+ \x20is\x20passed\x20to\x20protoc.\n\n\x08\n\x01\x02\x12\x03/\0!\n\x08\n\
+ \x01\x08\x12\x030\05\n\t\n\x02\x08\x01\x12\x030\05\n\x08\n\x01\x08\x12\
+ \x031\0-\n\t\n\x02\x08\x08\x12\x031\0-\n\x08\n\x01\x08\x12\x033\0\x20\n\
+ \t\n\x02\x08\x0b\x12\x033\0\x20\n\t\n\x02\x03\0\x12\x035\0*\nO\n\x02\x04\
+ \0\x12\x048\0M\x01\x1aC\x20An\x20encoded\x20CodeGeneratorRequest\x20is\
+ \x20written\x20to\x20the\x20plugin's\x20stdin.\n\n\n\n\x03\x04\0\x01\x12\
+ \x038\x08\x1c\n\xd1\x01\n\x04\x04\0\x02\0\x12\x03<\x02'\x1a\xc3\x01\x20T\
+ he\x20.proto\x20files\x20that\x20were\x20explicitly\x20listed\x20on\x20t\
+ he\x20command-line.\x20\x20The\n\x20code\x20generator\x20should\x20gener\
+ ate\x20code\x20only\x20for\x20these\x20files.\x20\x20Each\x20file's\n\
+ \x20descriptor\x20will\x20be\x20included\x20in\x20proto_file,\x20below.\
+ \n\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03<\x02\n\n\x0c\n\x05\x04\0\x02\0\
+ \x05\x12\x03<\x0b\x11\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03<\x12\"\n\x0c\n\
+ \x05\x04\0\x02\0\x03\x12\x03<%&\nB\n\x04\x04\0\x02\x01\x12\x03?\x02\x20\
+ \x1a5\x20The\x20generator\x20parameter\x20passed\x20on\x20the\x20command\
+ -line.\n\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03?\x02\n\n\x0c\n\x05\x04\0\
+ \x02\x01\x05\x12\x03?\x0b\x11\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03?\x12\
+ \x1b\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03?\x1e\x1f\n\xa9\x05\n\x04\x04\
+ \0\x02\x02\x12\x03L\x02/\x1a\x9b\x05\x20FileDescriptorProtos\x20for\x20a\
+ ll\x20files\x20in\x20files_to_generate\x20and\x20everything\n\x20they\
+ \x20import.\x20\x20The\x20files\x20will\x20appear\x20in\x20topological\
+ \x20order,\x20so\x20each\x20file\n\x20appears\x20before\x20any\x20file\
+ \x20that\x20imports\x20it.\n\n\x20protoc\x20guarantees\x20that\x20all\
+ \x20proto_files\x20will\x20be\x20written\x20after\n\x20the\x20fields\x20\
+ above,\x20even\x20though\x20this\x20is\x20not\x20technically\x20guarante\
+ ed\x20by\x20the\n\x20protobuf\x20wire\x20format.\x20\x20This\x20theoreti\
+ cally\x20could\x20allow\x20a\x20plugin\x20to\x20stream\n\x20in\x20the\
+ \x20FileDescriptorProtos\x20and\x20handle\x20them\x20one\x20by\x20one\
+ \x20rather\x20than\x20read\n\x20the\x20entire\x20set\x20into\x20memory\
+ \x20at\x20once.\x20\x20However,\x20as\x20of\x20this\x20writing,\x20this\
+ \n\x20is\x20not\x20similarly\x20optimized\x20on\x20protoc's\x20end\x20--\
+ \x20it\x20will\x20store\x20all\x20fields\x20in\n\x20memory\x20at\x20once\
+ \x20before\x20sending\x20them\x20to\x20the\x20plugin.\n\n\x0c\n\x05\x04\
+ \0\x02\x02\x04\x12\x03L\x02\n\n\x0c\n\x05\x04\0\x02\x02\x06\x12\x03L\x0b\
+ \x1e\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03L\x1f)\n\x0c\n\x05\x04\0\x02\
+ \x02\x03\x12\x03L,.\nL\n\x02\x04\x01\x12\x05P\0\x95\x01\x01\x1a?\x20The\
+ \x20plugin\x20writes\x20an\x20encoded\x20CodeGeneratorResponse\x20to\x20\
+ stdout.\n\n\n\n\x03\x04\x01\x01\x12\x03P\x08\x1d\n\xed\x03\n\x04\x04\x01\
+ \x02\0\x12\x03Y\x02\x1c\x1a\xdf\x03\x20Error\x20message.\x20\x20If\x20no\
+ n-empty,\x20code\x20generation\x20failed.\x20\x20The\x20plugin\x20proces\
+ s\n\x20should\x20exit\x20with\x20status\x20code\x20zero\x20even\x20if\
+ \x20it\x20reports\x20an\x20error\x20in\x20this\x20way.\n\n\x20This\x20sh\
+ ould\x20be\x20used\x20to\x20indicate\x20errors\x20in\x20.proto\x20files\
+ \x20which\x20prevent\x20the\n\x20code\x20generator\x20from\x20generating\
+ \x20correct\x20code.\x20\x20Errors\x20which\x20indicate\x20a\n\x20proble\
+ m\x20in\x20protoc\x20itself\x20--\x20such\x20as\x20the\x20input\x20CodeG\
+ eneratorRequest\x20being\n\x20unparseable\x20--\x20should\x20be\x20repor\
+ ted\x20by\x20writing\x20a\x20message\x20to\x20stderr\x20and\n\x20exiting\
+ \x20with\x20a\x20non-zero\x20status\x20code.\n\n\x0c\n\x05\x04\x01\x02\0\
+ \x04\x12\x03Y\x02\n\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03Y\x0b\x11\n\x0c\
+ \n\x05\x04\x01\x02\0\x01\x12\x03Y\x12\x17\n\x0c\n\x05\x04\x01\x02\0\x03\
+ \x12\x03Y\x1a\x1b\n4\n\x04\x04\x01\x03\0\x12\x05\\\x02\x93\x01\x03\x1a%\
+ \x20Represents\x20a\x20single\x20generated\x20file.\n\n\x0c\n\x05\x04\
+ \x01\x03\0\x01\x12\x03\\\n\x0e\n\xad\x05\n\x06\x04\x01\x03\0\x02\0\x12\
+ \x03h\x04\x1d\x1a\x9d\x05\x20The\x20file\x20name,\x20relative\x20to\x20t\
+ he\x20output\x20directory.\x20\x20The\x20name\x20must\x20not\n\x20contai\
+ n\x20\".\"\x20or\x20\"..\"\x20components\x20and\x20must\x20be\x20relativ\
+ e,\x20not\x20be\x20absolute\x20(so,\n\x20the\x20file\x20cannot\x20lie\
+ \x20outside\x20the\x20output\x20directory).\x20\x20\"/\"\x20must\x20be\
+ \x20used\x20as\n\x20the\x20path\x20separator,\x20not\x20\"\\\".\n\n\x20I\
+ f\x20the\x20name\x20is\x20omitted,\x20the\x20content\x20will\x20be\x20ap\
+ pended\x20to\x20the\x20previous\n\x20file.\x20\x20This\x20allows\x20the\
+ \x20generator\x20to\x20break\x20large\x20files\x20into\x20small\x20chunk\
+ s,\n\x20and\x20allows\x20the\x20generated\x20text\x20to\x20be\x20streame\
+ d\x20back\x20to\x20protoc\x20so\x20that\x20large\n\x20files\x20need\x20n\
+ ot\x20reside\x20completely\x20in\x20memory\x20at\x20one\x20time.\x20\x20\
+ Note\x20that\x20as\x20of\n\x20this\x20writing\x20protoc\x20does\x20not\
+ \x20optimize\x20for\x20this\x20--\x20it\x20will\x20read\x20the\x20entire\
+ \n\x20CodeGeneratorResponse\x20before\x20writing\x20files\x20to\x20disk.\
+ \n\n\x0e\n\x07\x04\x01\x03\0\x02\0\x04\x12\x03h\x04\x0c\n\x0e\n\x07\x04\
+ \x01\x03\0\x02\0\x05\x12\x03h\r\x13\n\x0e\n\x07\x04\x01\x03\0\x02\0\x01\
+ \x12\x03h\x14\x18\n\x0e\n\x07\x04\x01\x03\0\x02\0\x03\x12\x03h\x1b\x1c\n\
+ \xae\x10\n\x06\x04\x01\x03\0\x02\x01\x12\x04\x8f\x01\x04(\x1a\x9d\x10\
+ \x20If\x20non-empty,\x20indicates\x20that\x20the\x20named\x20file\x20sho\
+ uld\x20already\x20exist,\x20and\x20the\n\x20content\x20here\x20is\x20to\
+ \x20be\x20inserted\x20into\x20that\x20file\x20at\x20a\x20defined\x20inse\
+ rtion\n\x20point.\x20\x20This\x20feature\x20allows\x20a\x20code\x20gener\
+ ator\x20to\x20extend\x20the\x20output\n\x20produced\x20by\x20another\x20\
+ code\x20generator.\x20\x20The\x20original\x20generator\x20may\x20provide\
+ \n\x20insertion\x20points\x20by\x20placing\x20special\x20annotations\x20\
+ in\x20the\x20file\x20that\x20look\n\x20like:\n\x20\x20\x20@@protoc_inser\
+ tion_point(NAME)\n\x20The\x20annotation\x20can\x20have\x20arbitrary\x20t\
+ ext\x20before\x20and\x20after\x20it\x20on\x20the\x20line,\n\x20which\x20\
+ allows\x20it\x20to\x20be\x20placed\x20in\x20a\x20comment.\x20\x20NAME\
+ \x20should\x20be\x20replaced\x20with\n\x20an\x20identifier\x20naming\x20\
+ the\x20point\x20--\x20this\x20is\x20what\x20other\x20generators\x20will\
+ \x20use\n\x20as\x20the\x20insertion_point.\x20\x20Code\x20inserted\x20at\
+ \x20this\x20point\x20will\x20be\x20placed\n\x20immediately\x20above\x20t\
+ he\x20line\x20containing\x20the\x20insertion\x20point\x20(thus\x20multip\
+ le\n\x20insertions\x20to\x20the\x20same\x20point\x20will\x20come\x20out\
+ \x20in\x20the\x20order\x20they\x20were\x20added).\n\x20The\x20double-@\
+ \x20is\x20intended\x20to\x20make\x20it\x20unlikely\x20that\x20the\x20gen\
+ erated\x20code\n\x20could\x20contain\x20things\x20that\x20look\x20like\
+ \x20insertion\x20points\x20by\x20accident.\n\n\x20For\x20example,\x20the\
+ \x20C++\x20code\x20generator\x20places\x20the\x20following\x20line\x20in\
+ \x20the\n\x20.pb.h\x20files\x20that\x20it\x20generates:\n\x20\x20\x20//\
+ \x20@@protoc_insertion_point(namespace_scope)\n\x20This\x20line\x20appea\
+ rs\x20within\x20the\x20scope\x20of\x20the\x20file's\x20package\x20namesp\
+ ace,\x20but\n\x20outside\x20of\x20any\x20particular\x20class.\x20\x20Ano\
+ ther\x20plugin\x20can\x20then\x20specify\x20the\n\x20insertion_point\x20\
+ \"namespace_scope\"\x20to\x20generate\x20additional\x20classes\x20or\n\
+ \x20other\x20declarations\x20that\x20should\x20be\x20placed\x20in\x20thi\
+ s\x20scope.\n\n\x20Note\x20that\x20if\x20the\x20line\x20containing\x20th\
+ e\x20insertion\x20point\x20begins\x20with\n\x20whitespace,\x20the\x20sam\
+ e\x20whitespace\x20will\x20be\x20added\x20to\x20every\x20line\x20of\x20t\
+ he\n\x20inserted\x20text.\x20\x20This\x20is\x20useful\x20for\x20language\
+ s\x20like\x20Python,\x20where\n\x20indentation\x20matters.\x20\x20In\x20\
+ these\x20languages,\x20the\x20insertion\x20point\x20comment\n\x20should\
+ \x20be\x20indented\x20the\x20same\x20amount\x20as\x20any\x20inserted\x20\
+ code\x20will\x20need\x20to\x20be\n\x20in\x20order\x20to\x20work\x20corre\
+ ctly\x20in\x20that\x20context.\n\n\x20The\x20code\x20generator\x20that\
+ \x20generates\x20the\x20initial\x20file\x20and\x20the\x20one\x20which\n\
+ \x20inserts\x20into\x20it\x20must\x20both\x20run\x20as\x20part\x20of\x20\
+ a\x20single\x20invocation\x20of\x20protoc.\n\x20Code\x20generators\x20ar\
+ e\x20executed\x20in\x20the\x20order\x20in\x20which\x20they\x20appear\x20\
+ on\x20the\n\x20command\x20line.\n\n\x20If\x20|insertion_point|\x20is\x20\
+ present,\x20|name|\x20must\x20also\x20be\x20present.\n\n\x0f\n\x07\x04\
+ \x01\x03\0\x02\x01\x04\x12\x04\x8f\x01\x04\x0c\n\x0f\n\x07\x04\x01\x03\0\
+ \x02\x01\x05\x12\x04\x8f\x01\r\x13\n\x0f\n\x07\x04\x01\x03\0\x02\x01\x01\
+ \x12\x04\x8f\x01\x14#\n\x0f\n\x07\x04\x01\x03\0\x02\x01\x03\x12\x04\x8f\
+ \x01&'\n$\n\x06\x04\x01\x03\0\x02\x02\x12\x04\x92\x01\x04!\x1a\x14\x20Th\
+ e\x20file\x20contents.\n\n\x0f\n\x07\x04\x01\x03\0\x02\x02\x04\x12\x04\
+ \x92\x01\x04\x0c\n\x0f\n\x07\x04\x01\x03\0\x02\x02\x05\x12\x04\x92\x01\r\
+ \x13\n\x0f\n\x07\x04\x01\x03\0\x02\x02\x01\x12\x04\x92\x01\x14\x1b\n\x0f\
+ \n\x07\x04\x01\x03\0\x02\x02\x03\x12\x04\x92\x01\x1e\x20\n\x0c\n\x04\x04\
+ \x01\x02\x01\x12\x04\x94\x01\x02\x1a\n\r\n\x05\x04\x01\x02\x01\x04\x12\
+ \x04\x94\x01\x02\n\n\r\n\x05\x04\x01\x02\x01\x06\x12\x04\x94\x01\x0b\x0f\
+ \n\r\n\x05\x04\x01\x02\x01\x01\x12\x04\x94\x01\x10\x14\n\r\n\x05\x04\x01\
+ \x02\x01\x03\x12\x04\x94\x01\x17\x19\
+";
+
+static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+
+fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
+ ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
+}
+
+pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
+ unsafe {
+ file_descriptor_proto_lazy.get(|| {
+ parse_descriptor_proto()
+ })
+ }
+}
diff --git a/src/reflect/accessor.rs b/src/reflect/accessor.rs
new file mode 100644
index 0000000..8a586b2
--- /dev/null
+++ b/src/reflect/accessor.rs
@@ -0,0 +1,789 @@
+#![doc(hidden)]
+
+use std::collections::HashMap;
+use std::fmt;
+use std::hash::Hash;
+
+use core::message_down_cast;
+use core::Message;
+use enums::ProtobufEnum;
+use reflect::EnumValueDescriptor;
+use types::*;
+
+use repeated::RepeatedField;
+use singular::SingularField;
+use singular::SingularPtrField;
+
+use super::map::ReflectMap;
+use super::optional::ReflectOptional;
+use super::repeated::ReflectRepeated;
+use super::repeated::ReflectRepeatedEnum;
+use super::repeated::ReflectRepeatedMessage;
+use super::value::ProtobufValue;
+use super::value::ReflectValueRef;
+use super::ReflectFieldRef;
+
+/// this trait should not be used directly, use `FieldDescriptor` instead
+pub trait FieldAccessor {
+ fn name_generic(&self) -> &'static str;
+ fn has_field_generic(&self, m: &Message) -> bool;
+ fn len_field_generic(&self, m: &Message) -> usize;
+ // TODO: should it return default value or panic on unset field?
+ fn get_message_generic<'a>(&self, m: &'a Message) -> &'a Message;
+ fn get_enum_generic(&self, m: &Message) -> &'static EnumValueDescriptor;
+ fn get_str_generic<'a>(&self, m: &'a Message) -> &'a str;
+ fn get_bytes_generic<'a>(&self, m: &'a Message) -> &'a [u8];
+ fn get_u32_generic(&self, m: &Message) -> u32;
+ fn get_u64_generic(&self, m: &Message) -> u64;
+ fn get_i32_generic(&self, m: &Message) -> i32;
+ fn get_i64_generic(&self, m: &Message) -> i64;
+ fn get_bool_generic(&self, m: &Message) -> bool;
+ fn get_f32_generic(&self, m: &Message) -> f32;
+ fn get_f64_generic(&self, m: &Message) -> f64;
+
+ fn get_reflect<'a>(&self, m: &'a Message) -> ReflectFieldRef<'a>;
+}
+
+trait GetSingularMessage<M> {
+ fn get_message<'a>(&self, m: &'a M) -> &'a Message;
+}
+
+struct GetSingularMessageImpl<M, N> {
+ get: for<'a> fn(&'a M) -> &'a N,
+}
+
+impl<M: Message, N: Message + 'static> GetSingularMessage<M> for GetSingularMessageImpl<M, N> {
+ fn get_message<'a>(&self, m: &'a M) -> &'a Message {
+ (self.get)(m)
+ }
+}
+
+trait GetSingularEnum<M> {
+ fn get_enum(&self, m: &M) -> &'static EnumValueDescriptor;
+}
+
+struct GetSingularEnumImpl<M, E> {
+ get: fn(&M) -> E,
+}
+
+impl<M: Message, E: ProtobufEnum> GetSingularEnum<M> for GetSingularEnumImpl<M, E> {
+ fn get_enum(&self, m: &M) -> &'static EnumValueDescriptor {
+ (self.get)(m).descriptor()
+ }
+}
+
+trait GetRepeatedMessage<M> {
+ fn len_field(&self, m: &M) -> usize;
+ fn get_message_item<'a>(&self, m: &'a M, index: usize) -> &'a Message;
+ fn reflect_repeated_message<'a>(&self, m: &'a M) -> Box<ReflectRepeatedMessage<'a> + 'a>;
+}
+
+trait GetRepeatedEnum<M: Message + 'static> {
+ fn len_field(&self, m: &M) -> usize;
+ fn get_enum_item(&self, m: &M, index: usize) -> &'static EnumValueDescriptor;
+ fn reflect_repeated_enum<'a>(&self, m: &'a M) -> Box<ReflectRepeatedEnum<'a> + 'a>;
+}
+
+trait GetSetCopyFns<M> {
+ fn get_field<'a>(&self, m: &'a M) -> ReflectValueRef<'a>;
+}
+
+struct GetSetCopyFnsImpl<M, V: ProtobufValue + Copy> {
+ get: fn(&M) -> V,
+ _set: fn(&mut M, V),
+}
+
+impl<M, V: ProtobufValue + Copy> GetSetCopyFns<M> for GetSetCopyFnsImpl<M, V> {
+ fn get_field<'a>(&self, m: &'a M) -> ReflectValueRef<'a> {
+ (&(self.get)(m) as &ProtobufValue).as_ref_copy()
+ }
+}
+
+enum SingularGetSet<M> {
+ Copy(Box<GetSetCopyFns<M>>),
+ String(for<'a> fn(&'a M) -> &'a str, fn(&mut M, String)),
+ Bytes(for<'a> fn(&'a M) -> &'a [u8], fn(&mut M, Vec<u8>)),
+ Enum(Box<GetSingularEnum<M> + 'static>),
+ Message(Box<GetSingularMessage<M> + 'static>),
+}
+
+impl<M: Message + 'static> SingularGetSet<M> {
+ fn get_ref<'a>(&self, m: &'a M) -> ReflectValueRef<'a> {
+ match self {
+ &SingularGetSet::Copy(ref copy) => copy.get_field(m),
+ &SingularGetSet::String(get, _) => ReflectValueRef::String(get(m)),
+ &SingularGetSet::Bytes(get, _) => ReflectValueRef::Bytes(get(m)),
+ &SingularGetSet::Enum(ref get) => ReflectValueRef::Enum(get.get_enum(m)),
+ &SingularGetSet::Message(ref get) => ReflectValueRef::Message(get.get_message(m)),
+ }
+ }
+}
+
+trait FieldAccessor2<M, R: ?Sized>
+where
+ M: Message + 'static,
+{
+ fn get_field<'a>(&self, &'a M) -> &'a R;
+ fn mut_field<'a>(&self, &'a mut M) -> &'a mut R;
+}
+
+struct MessageGetMut<M, L>
+where
+ M: Message + 'static,
+{
+ get_field: for<'a> fn(&'a M) -> &'a L,
+ mut_field: for<'a> fn(&'a mut M) -> &'a mut L,
+}
+
+enum FieldAccessorFunctions<M> {
+ // up to 1.0.24 optional or required
+ SingularHasGetSet {
+ has: fn(&M) -> bool,
+ get_set: SingularGetSet<M>,
+ },
+ // protobuf 3 simple field
+ Simple(Box<FieldAccessor2<M, ProtobufValue>>),
+ // optional, required or message
+ Optional(Box<FieldAccessor2<M, ReflectOptional>>),
+ // repeated
+ Repeated(Box<FieldAccessor2<M, ReflectRepeated>>),
+ // protobuf 3 map
+ Map(Box<FieldAccessor2<M, ReflectMap>>),
+}
+
+impl<M> fmt::Debug for FieldAccessorFunctions<M> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ match self {
+ &FieldAccessorFunctions::SingularHasGetSet { .. } => {
+ write!(f, "SingularHasGetSet {{ .. }}")
+ }
+ &FieldAccessorFunctions::Simple(..) => write!(f, "Simple(..)"),
+ &FieldAccessorFunctions::Optional(..) => write!(f, "Optional(..)"),
+ &FieldAccessorFunctions::Repeated(..) => write!(f, "Repeated(..)"),
+ &FieldAccessorFunctions::Map(..) => write!(f, "Map(..)"),
+ }
+ }
+}
+
+struct FieldAccessorImpl<M> {
+ name: &'static str,
+ fns: FieldAccessorFunctions<M>,
+}
+
+impl<M: Message> FieldAccessorImpl<M> {
+ fn get_value_option<'a>(&self, m: &'a M) -> Option<ReflectValueRef<'a>> {
+ match self.fns {
+ FieldAccessorFunctions::Repeated(..) | FieldAccessorFunctions::Map(..) => {
+ panic!("repeated")
+ }
+ FieldAccessorFunctions::Simple(ref a) => Some(a.get_field(m).as_ref()),
+ FieldAccessorFunctions::Optional(ref a) => {
+ a.get_field(m).to_option().map(|v| v.as_ref())
+ }
+ FieldAccessorFunctions::SingularHasGetSet {
+ ref has,
+ ref get_set,
+ } => {
+ if !has(m) {
+ None
+ } else {
+ Some(get_set.get_ref(m))
+ }
+ }
+ }
+ }
+}
+
+impl<M: Message + 'static> FieldAccessor for FieldAccessorImpl<M> {
+ fn name_generic(&self) -> &'static str {
+ self.name
+ }
+
+ fn has_field_generic(&self, m: &Message) -> bool {
+ match self.fns {
+ FieldAccessorFunctions::SingularHasGetSet { has, .. } => has(message_down_cast(m)),
+ FieldAccessorFunctions::Optional(ref a) => {
+ a.get_field(message_down_cast(m)).to_option().is_some()
+ }
+ FieldAccessorFunctions::Simple(ref a) => {
+ a.get_field(message_down_cast(m)).is_non_zero()
+ }
+ FieldAccessorFunctions::Map(..) | FieldAccessorFunctions::Repeated(..) => {
+ panic!("has_xxx is not implemented for repeated");
+ }
+ }
+ }
+
+ fn len_field_generic(&self, m: &Message) -> usize {
+ match self.fns {
+ FieldAccessorFunctions::Repeated(ref a) => a.get_field(message_down_cast(m)).len(),
+ FieldAccessorFunctions::Map(ref a) => a.get_field(message_down_cast(m)).len(),
+ FieldAccessorFunctions::Simple(..)
+ | FieldAccessorFunctions::SingularHasGetSet { .. }
+ | FieldAccessorFunctions::Optional(..) => {
+ panic!("not a repeated field");
+ }
+ }
+ }
+
+ fn get_message_generic<'a>(&self, m: &'a Message) -> &'a Message {
+ match self.fns {
+ FieldAccessorFunctions::SingularHasGetSet {
+ get_set: SingularGetSet::Message(ref get),
+ ..
+ } => get.get_message(message_down_cast(m)),
+ FieldAccessorFunctions::Optional(ref t) => {
+ match t
+ .get_field(message_down_cast(m))
+ .to_option()
+ .expect("field unset")
+ .as_ref()
+ {
+ ReflectValueRef::Message(m) => m,
+ _ => panic!("not a message"),
+ }
+ }
+ ref fns => panic!("unknown accessor type: {:?}", fns),
+ }
+ }
+
+ fn get_enum_generic(&self, m: &Message) -> &'static EnumValueDescriptor {
+ match self.fns {
+ FieldAccessorFunctions::SingularHasGetSet {
+ get_set: SingularGetSet::Enum(ref get),
+ ..
+ } => get.get_enum(message_down_cast(m)),
+ _ => panic!(),
+ }
+ }
+
+ fn get_str_generic<'a>(&self, m: &'a Message) -> &'a str {
+ match self.get_value_option(message_down_cast(m)) {
+ Some(ReflectValueRef::String(v)) => v,
+ Some(_) => panic!("wrong type"),
+ None => "", // TODO: check type
+ }
+ }
+
+ fn get_bytes_generic<'a>(&self, m: &'a Message) -> &'a [u8] {
+ match self.get_value_option(message_down_cast(m)) {
+ Some(ReflectValueRef::Bytes(v)) => v,
+ Some(_) => panic!("wrong type"),
+ None => b"", // TODO: check type
+ }
+ }
+
+ fn get_u32_generic(&self, m: &Message) -> u32 {
+ match self.get_value_option(message_down_cast(m)) {
+ Some(ReflectValueRef::U32(v)) => v,
+ Some(_) => panic!("wrong type"),
+ None => 0, // TODO: check type
+ }
+ }
+
+ fn get_u64_generic(&self, m: &Message) -> u64 {
+ match self.get_value_option(message_down_cast(m)) {
+ Some(ReflectValueRef::U64(v)) => v,
+ Some(_) => panic!("wrong type"),
+ None => 0, // TODO: check type
+ }
+ }
+
+ fn get_i32_generic(&self, m: &Message) -> i32 {
+ match self.get_value_option(message_down_cast(m)) {
+ Some(ReflectValueRef::I32(v)) => v,
+ Some(_) => panic!("wrong type"),
+ None => 0, // TODO: check type
+ }
+ }
+
+ fn get_i64_generic(&self, m: &Message) -> i64 {
+ match self.get_value_option(message_down_cast(m)) {
+ Some(ReflectValueRef::I64(v)) => v,
+ Some(_) => panic!("wrong type"),
+ None => 0, // TODO: check type
+ }
+ }
+
+ fn get_f32_generic(&self, m: &Message) -> f32 {
+ match self.get_value_option(message_down_cast(m)) {
+ Some(ReflectValueRef::F32(v)) => v,
+ Some(_) => panic!("wrong type"),
+ None => 0.0, // TODO: check type
+ }
+ }
+
+ fn get_f64_generic(&self, m: &Message) -> f64 {
+ match self.get_value_option(message_down_cast(m)) {
+ Some(ReflectValueRef::F64(v)) => v,
+ Some(_) => panic!("wrong type"),
+ None => 0.0, // TODO: check type
+ }
+ }
+
+ fn get_bool_generic(&self, m: &Message) -> bool {
+ match self.get_value_option(message_down_cast(m)) {
+ Some(ReflectValueRef::Bool(v)) => v,
+ Some(_) => panic!("wrong type"),
+ None => false, // TODO: check type
+ }
+ }
+
+ fn get_reflect<'a>(&self, m: &'a Message) -> ReflectFieldRef<'a> {
+ match self.fns {
+ FieldAccessorFunctions::Repeated(ref accessor2) => {
+ ReflectFieldRef::Repeated(accessor2.get_field(message_down_cast(m)))
+ }
+ FieldAccessorFunctions::Map(ref accessor2) => {
+ ReflectFieldRef::Map(accessor2.get_field(message_down_cast(m)))
+ }
+ FieldAccessorFunctions::Optional(ref accessor2) => ReflectFieldRef::Optional(
+ accessor2
+ .get_field(message_down_cast(m))
+ .to_option()
+ .map(|v| v.as_ref()),
+ ),
+ FieldAccessorFunctions::Simple(ref accessor2) => ReflectFieldRef::Optional({
+ let v = accessor2.get_field(message_down_cast(m));
+ if v.is_non_zero() {
+ Some(v.as_ref())
+ } else {
+ None
+ }
+ }),
+ FieldAccessorFunctions::SingularHasGetSet {
+ ref has,
+ ref get_set,
+ } => ReflectFieldRef::Optional(if has(message_down_cast(m)) {
+ Some(get_set.get_ref(message_down_cast(m)))
+ } else {
+ None
+ }),
+ }
+ }
+}
+
+// singular
+
+fn set_panic<A, B>(_: &mut A, _: B) {
+ panic!()
+}
+
+// TODO: make_singular_xxx_accessor are used only for oneof fields
+// oneof codegen should be changed
+
+pub fn make_singular_u32_accessor<M: Message + 'static>(
+ name: &'static str,
+ has: fn(&M) -> bool,
+ get: fn(&M) -> u32,
+) -> Box<FieldAccessor + 'static> {
+ Box::new(FieldAccessorImpl {
+ name: name,
+ fns: FieldAccessorFunctions::SingularHasGetSet {
+ has: has,
+ get_set: SingularGetSet::Copy(Box::new(GetSetCopyFnsImpl {
+ get: get,
+ _set: set_panic,
+ })),
+ },
+ })
+}
+
+pub fn make_singular_i32_accessor<M: Message + 'static>(
+ name: &'static str,
+ has: fn(&M) -> bool,
+ get: fn(&M) -> i32,
+) -> Box<FieldAccessor + 'static> {
+ Box::new(FieldAccessorImpl {
+ name: name,
+ fns: FieldAccessorFunctions::SingularHasGetSet {
+ has: has,
+ get_set: SingularGetSet::Copy(Box::new(GetSetCopyFnsImpl {
+ get: get,
+ _set: set_panic,
+ })),
+ },
+ })
+}
+
+pub fn make_singular_u64_accessor<M: Message + 'static>(
+ name: &'static str,
+ has: fn(&M) -> bool,
+ get: fn(&M) -> u64,
+) -> Box<FieldAccessor + 'static> {
+ Box::new(FieldAccessorImpl {
+ name: name,
+ fns: FieldAccessorFunctions::SingularHasGetSet {
+ has: has,
+ get_set: SingularGetSet::Copy(Box::new(GetSetCopyFnsImpl {
+ get: get,
+ _set: set_panic,
+ })),
+ },
+ })
+}
+
+pub fn make_singular_i64_accessor<M: Message + 'static>(
+ name: &'static str,
+ has: fn(&M) -> bool,
+ get: fn(&M) -> i64,
+) -> Box<FieldAccessor + 'static> {
+ Box::new(FieldAccessorImpl {
+ name: name,
+ fns: FieldAccessorFunctions::SingularHasGetSet {
+ has: has,
+ get_set: SingularGetSet::Copy(Box::new(GetSetCopyFnsImpl {
+ get: get,
+ _set: set_panic,
+ })),
+ },
+ })
+}
+
+pub fn make_singular_f32_accessor<M: Message + 'static>(
+ name: &'static str,
+ has: fn(&M) -> bool,
+ get: fn(&M) -> f32,
+) -> Box<FieldAccessor + 'static> {
+ Box::new(FieldAccessorImpl {
+ name: name,
+ fns: FieldAccessorFunctions::SingularHasGetSet {
+ has: has,
+ get_set: SingularGetSet::Copy(Box::new(GetSetCopyFnsImpl {
+ get: get,
+ _set: set_panic,
+ })),
+ },
+ })
+}
+
+pub fn make_singular_f64_accessor<M: Message + 'static>(
+ name: &'static str,
+ has: fn(&M) -> bool,
+ get: fn(&M) -> f64,
+) -> Box<FieldAccessor + 'static> {
+ Box::new(FieldAccessorImpl {
+ name: name,
+ fns: FieldAccessorFunctions::SingularHasGetSet {
+ has: has,
+ get_set: SingularGetSet::Copy(Box::new(GetSetCopyFnsImpl {
+ get: get,
+ _set: set_panic,
+ })),
+ },
+ })
+}
+
+pub fn make_singular_bool_accessor<M: Message + 'static>(
+ name: &'static str,
+ has: fn(&M) -> bool,
+ get: fn(&M) -> bool,
+) -> Box<FieldAccessor + 'static> {
+ Box::new(FieldAccessorImpl {
+ name: name,
+ fns: FieldAccessorFunctions::SingularHasGetSet {
+ has: has,
+ get_set: SingularGetSet::Copy(Box::new(GetSetCopyFnsImpl {
+ get: get,
+ _set: set_panic,
+ })),
+ },
+ })
+}
+
+pub fn make_singular_enum_accessor<M: Message + 'static, E: ProtobufEnum + 'static>(
+ name: &'static str,
+ has: fn(&M) -> bool,
+ get: fn(&M) -> E,
+) -> Box<FieldAccessor + 'static> {
+ Box::new(FieldAccessorImpl {
+ name: name,
+ fns: FieldAccessorFunctions::SingularHasGetSet {
+ has: has,
+ get_set: SingularGetSet::Enum(Box::new(GetSingularEnumImpl { get: get })),
+ },
+ })
+}
+
+pub fn make_singular_string_accessor<M: Message + 'static>(
+ name: &'static str,
+ has: fn(&M) -> bool,
+ get: for<'a> fn(&'a M) -> &'a str,
+) -> Box<FieldAccessor + 'static> {
+ Box::new(FieldAccessorImpl {
+ name: name,
+ fns: FieldAccessorFunctions::SingularHasGetSet {
+ has: has,
+ get_set: SingularGetSet::String(get, set_panic),
+ },
+ })
+}
+
+pub fn make_singular_bytes_accessor<M: Message + 'static>(
+ name: &'static str,
+ has: fn(&M) -> bool,
+ get: for<'a> fn(&'a M) -> &'a [u8],
+) -> Box<FieldAccessor + 'static> {
+ Box::new(FieldAccessorImpl {
+ name: name,
+ fns: FieldAccessorFunctions::SingularHasGetSet {
+ has: has,
+ get_set: SingularGetSet::Bytes(get, set_panic),
+ },
+ })
+}
+
+pub fn make_singular_message_accessor<M: Message + 'static, F: Message + 'static>(
+ name: &'static str,
+ has: fn(&M) -> bool,
+ get: for<'a> fn(&'a M) -> &'a F,
+) -> Box<FieldAccessor + 'static> {
+ Box::new(FieldAccessorImpl {
+ name: name,
+ fns: FieldAccessorFunctions::SingularHasGetSet {
+ has: has,
+ get_set: SingularGetSet::Message(Box::new(GetSingularMessageImpl { get: get })),
+ },
+ })
+}
+
+// repeated
+
+impl<M, V> FieldAccessor2<M, ReflectRepeated> for MessageGetMut<M, Vec<V>>
+where
+ M: Message + 'static,
+ V: ProtobufValue + 'static,
+{
+ fn get_field<'a>(&self, m: &'a M) -> &'a ReflectRepeated {
+ (self.get_field)(m) as &ReflectRepeated
+ }
+
+ fn mut_field<'a>(&self, m: &'a mut M) -> &'a mut ReflectRepeated {
+ (self.mut_field)(m) as &mut ReflectRepeated
+ }
+}
+
+pub fn make_vec_accessor<M, V>(
+ name: &'static str,
+ get_vec: for<'a> fn(&'a M) -> &'a Vec<V::Value>,
+ mut_vec: for<'a> fn(&'a mut M) -> &'a mut Vec<V::Value>,
+) -> Box<FieldAccessor + 'static>
+where
+ M: Message + 'static,
+ V: ProtobufType + 'static,
+{
+ Box::new(FieldAccessorImpl {
+ name: name,
+ fns: FieldAccessorFunctions::Repeated(Box::new(MessageGetMut::<M, Vec<V::Value>> {
+ get_field: get_vec,
+ mut_field: mut_vec,
+ })),
+ })
+}
+
+impl<M, V> FieldAccessor2<M, ReflectRepeated> for MessageGetMut<M, RepeatedField<V>>
+where
+ M: Message + 'static,
+ V: ProtobufValue + 'static,
+{
+ fn get_field<'a>(&self, m: &'a M) -> &'a ReflectRepeated {
+ (self.get_field)(m) as &ReflectRepeated
+ }
+
+ fn mut_field<'a>(&self, m: &'a mut M) -> &'a mut ReflectRepeated {
+ (self.mut_field)(m) as &mut ReflectRepeated
+ }
+}
+
+pub fn make_repeated_field_accessor<M, V>(
+ name: &'static str,
+ get_vec: for<'a> fn(&'a M) -> &'a RepeatedField<V::Value>,
+ mut_vec: for<'a> fn(&'a mut M) -> &'a mut RepeatedField<V::Value>,
+) -> Box<FieldAccessor + 'static>
+where
+ M: Message + 'static,
+ V: ProtobufType + 'static,
+{
+ Box::new(FieldAccessorImpl {
+ name: name,
+ fns: FieldAccessorFunctions::Repeated(Box::new(MessageGetMut::<
+ M,
+ RepeatedField<V::Value>,
+ > {
+ get_field: get_vec,
+ mut_field: mut_vec,
+ })),
+ })
+}
+
+impl<M, V> FieldAccessor2<M, ReflectOptional> for MessageGetMut<M, Option<V>>
+where
+ M: Message + 'static,
+ V: ProtobufValue + Clone + 'static,
+{
+ fn get_field<'a>(&self, m: &'a M) -> &'a ReflectOptional {
+ (self.get_field)(m) as &ReflectOptional
+ }
+
+ fn mut_field<'a>(&self, m: &'a mut M) -> &'a mut ReflectOptional {
+ (self.mut_field)(m) as &mut ReflectOptional
+ }
+}
+
+pub fn make_option_accessor<M, V>(
+ name: &'static str,
+ get_field: for<'a> fn(&'a M) -> &'a Option<V::Value>,
+ mut_field: for<'a> fn(&'a mut M) -> &'a mut Option<V::Value>,
+) -> Box<FieldAccessor + 'static>
+where
+ M: Message + 'static,
+ V: ProtobufType + 'static,
+{
+ Box::new(FieldAccessorImpl {
+ name: name,
+ fns: FieldAccessorFunctions::Optional(Box::new(MessageGetMut::<M, Option<V::Value>> {
+ get_field: get_field,
+ mut_field: mut_field,
+ })),
+ })
+}
+
+impl<M, V> FieldAccessor2<M, ReflectOptional> for MessageGetMut<M, SingularField<V>>
+where
+ M: Message + 'static,
+ V: ProtobufValue + Clone + 'static,
+{
+ fn get_field<'a>(&self, m: &'a M) -> &'a ReflectOptional {
+ (self.get_field)(m) as &ReflectOptional
+ }
+
+ fn mut_field<'a>(&self, m: &'a mut M) -> &'a mut ReflectOptional {
+ (self.mut_field)(m) as &mut ReflectOptional
+ }
+}
+
+pub fn make_singular_field_accessor<M, V>(
+ name: &'static str,
+ get_field: for<'a> fn(&'a M) -> &'a SingularField<V::Value>,
+ mut_field: for<'a> fn(&'a mut M) -> &'a mut SingularField<V::Value>,
+) -> Box<FieldAccessor + 'static>
+where
+ M: Message + 'static,
+ V: ProtobufType + 'static,
+{
+ Box::new(FieldAccessorImpl {
+ name: name,
+ fns: FieldAccessorFunctions::Optional(Box::new(MessageGetMut::<
+ M,
+ SingularField<V::Value>,
+ > {
+ get_field: get_field,
+ mut_field: mut_field,
+ })),
+ })
+}
+
+impl<M, V> FieldAccessor2<M, ReflectOptional> for MessageGetMut<M, SingularPtrField<V>>
+where
+ M: Message + 'static,
+ V: ProtobufValue + Clone + 'static,
+{
+ fn get_field<'a>(&self, m: &'a M) -> &'a ReflectOptional {
+ (self.get_field)(m) as &ReflectOptional
+ }
+
+ fn mut_field<'a>(&self, m: &'a mut M) -> &'a mut ReflectOptional {
+ (self.mut_field)(m) as &mut ReflectOptional
+ }
+}
+
+pub fn make_singular_ptr_field_accessor<M, V>(
+ name: &'static str,
+ get_field: for<'a> fn(&'a M) -> &'a SingularPtrField<V::Value>,
+ mut_field: for<'a> fn(&'a mut M) -> &'a mut SingularPtrField<V::Value>,
+) -> Box<FieldAccessor + 'static>
+where
+ M: Message + 'static,
+ V: ProtobufType + 'static,
+{
+ Box::new(FieldAccessorImpl {
+ name: name,
+ fns: FieldAccessorFunctions::Optional(Box::new(MessageGetMut::<
+ M,
+ SingularPtrField<V::Value>,
+ > {
+ get_field: get_field,
+ mut_field: mut_field,
+ })),
+ })
+}
+
+impl<M, V> FieldAccessor2<M, ProtobufValue> for MessageGetMut<M, V>
+where
+ M: Message + 'static,
+ V: ProtobufValue + Clone + 'static,
+{
+ fn get_field<'a>(&self, m: &'a M) -> &'a ProtobufValue {
+ (self.get_field)(m) as &ProtobufValue
+ }
+
+ fn mut_field<'a>(&self, m: &'a mut M) -> &'a mut ProtobufValue {
+ (self.mut_field)(m) as &mut ProtobufValue
+ }
+}
+
+pub fn make_simple_field_accessor<M, V>(
+ name: &'static str,
+ get_field: for<'a> fn(&'a M) -> &'a V::Value,
+ mut_field: for<'a> fn(&'a mut M) -> &'a mut V::Value,
+) -> Box<FieldAccessor + 'static>
+where
+ M: Message + 'static,
+ V: ProtobufType + 'static,
+{
+ Box::new(FieldAccessorImpl {
+ name: name,
+ fns: FieldAccessorFunctions::Simple(Box::new(MessageGetMut::<M, V::Value> {
+ get_field: get_field,
+ mut_field: mut_field,
+ })),
+ })
+}
+
+impl<M, K, V> FieldAccessor2<M, ReflectMap> for MessageGetMut<M, HashMap<K, V>>
+where
+ M: Message + 'static,
+ K: ProtobufValue + 'static,
+ V: ProtobufValue + 'static,
+ K: Hash + Eq,
+{
+ fn get_field<'a>(&self, m: &'a M) -> &'a ReflectMap {
+ (self.get_field)(m) as &ReflectMap
+ }
+
+ fn mut_field<'a>(&self, m: &'a mut M) -> &'a mut ReflectMap {
+ (self.mut_field)(m) as &mut ReflectMap
+ }
+}
+
+pub fn make_map_accessor<M, K, V>(
+ name: &'static str,
+ get_field: for<'a> fn(&'a M) -> &'a HashMap<K::Value, V::Value>,
+ mut_field: for<'a> fn(&'a mut M) -> &'a mut HashMap<K::Value, V::Value>,
+) -> Box<FieldAccessor + 'static>
+where
+ M: Message + 'static,
+ K: ProtobufType + 'static,
+ V: ProtobufType + 'static,
+ <K as ProtobufType>::Value: Hash + Eq,
+{
+ Box::new(FieldAccessorImpl {
+ name: name,
+ fns: FieldAccessorFunctions::Map(Box::new(
+ MessageGetMut::<M, HashMap<K::Value, V::Value>> {
+ get_field: get_field,
+ mut_field: mut_field,
+ },
+ )),
+ })
+}
diff --git a/src/reflect/enums.rs b/src/reflect/enums.rs
new file mode 100644
index 0000000..e4ba4f6
--- /dev/null
+++ b/src/reflect/enums.rs
@@ -0,0 +1,127 @@
+use descriptor::EnumDescriptorProto;
+use descriptor::EnumValueDescriptorProto;
+use descriptor::FileDescriptorProto;
+use descriptorx::find_enum_by_rust_name;
+use reflect::find_message_or_enum::find_message_or_enum;
+use reflect::find_message_or_enum::MessageOrEnum;
+use std::collections::HashMap;
+use ProtobufEnum;
+
+/// Description for enum variant.
+///
+/// Used in reflection.
+#[derive(Clone, Debug)]
+pub struct EnumValueDescriptor {
+ proto: &'static EnumValueDescriptorProto,
+}
+
+impl Copy for EnumValueDescriptor {}
+
+impl EnumValueDescriptor {
+ /// Name of enum variant as specified in proto file
+ pub fn name(&self) -> &'static str {
+ self.proto.get_name()
+ }
+
+ /// `i32` value of the enum variant
+ pub fn value(&self) -> i32 {
+ self.proto.get_number()
+ }
+}
+
+/// Dynamic representation of enum type.
+///
+/// Can be used in reflective operations.
+pub struct EnumDescriptor {
+ proto: &'static EnumDescriptorProto,
+ values: Vec<EnumValueDescriptor>,
+
+ index_by_name: HashMap<String, usize>,
+ index_by_number: HashMap<i32, usize>,
+}
+
+impl EnumDescriptor {
+ /// Enum name as given in `.proto` file
+ pub fn name(&self) -> &'static str {
+ self.proto.get_name()
+ }
+
+ /// `EnumDescriptor` for enum type
+ pub fn for_type<E: ProtobufEnum>() -> &'static EnumDescriptor {
+ E::enum_descriptor_static()
+ }
+
+ /// Create new enum descriptor.
+ ///
+ /// This function is called by generated code, and should not be called manually.
+ #[deprecated(
+ since = "2.12",
+ note = "Please regenerate .rs files from .proto files to use newer APIs"
+ )]
+ pub fn new(rust_name: &'static str, file: &'static FileDescriptorProto) -> EnumDescriptor {
+ let proto = find_enum_by_rust_name(file, rust_name);
+ let mut index_by_name = HashMap::new();
+ let mut index_by_number = HashMap::new();
+ for (i, v) in proto.en.get_value().iter().enumerate() {
+ index_by_number.insert(v.get_number(), i);
+ index_by_name.insert(v.get_name().to_string(), i);
+ }
+ EnumDescriptor {
+ proto: proto.en,
+ values: proto
+ .en
+ .get_value()
+ .iter()
+ .map(|v| EnumValueDescriptor { proto: v })
+ .collect(),
+ index_by_name: index_by_name,
+ index_by_number: index_by_number,
+ }
+ }
+
+ /// Create new enum descriptor.
+ ///
+ /// This function is called by generated code, and should not be called manually.
+ pub fn new_pb_name<E>(
+ name_in_file: &'static str,
+ file: &'static FileDescriptorProto,
+ ) -> EnumDescriptor
+ where
+ E: ProtobufEnum,
+ {
+ let (_path_to_package, proto) = match find_message_or_enum(file, name_in_file) {
+ (path_to_package, MessageOrEnum::Enum(e)) => (path_to_package, e),
+ (_, MessageOrEnum::Message(_)) => panic!("not an enum"),
+ };
+
+ let mut index_by_name = HashMap::new();
+ let mut index_by_number = HashMap::new();
+ for (i, v) in proto.get_value().iter().enumerate() {
+ index_by_number.insert(v.get_number(), i);
+ index_by_name.insert(v.get_name().to_string(), i);
+ }
+ EnumDescriptor {
+ proto,
+ values: proto
+ .get_value()
+ .iter()
+ .map(|v| EnumValueDescriptor { proto: v })
+ .collect(),
+ index_by_name: index_by_name,
+ index_by_number: index_by_number,
+ }
+ }
+
+ /// Find enum value by name
+ pub fn value_by_name<'a>(&'a self, name: &str) -> &'a EnumValueDescriptor {
+ // TODO: clone is weird
+ let &index = self.index_by_name.get(&name.to_string()).unwrap();
+ &self.values[index]
+ }
+
+ /// Find enum value by number
+ pub fn value_by_number<'a>(&'a self, number: i32) -> &'a EnumValueDescriptor {
+ let &index = self.index_by_number.get(&number).unwrap();
+ &self.values[index]
+ }
+}
diff --git a/src/reflect/field.rs b/src/reflect/field.rs
new file mode 100644
index 0000000..ecac510
--- /dev/null
+++ b/src/reflect/field.rs
@@ -0,0 +1,191 @@
+use descriptor::{FieldDescriptorProto, FieldDescriptorProto_Label};
+use reflect::accessor::FieldAccessor;
+use reflect::map::ReflectMap;
+use reflect::repeated::ReflectRepeated;
+use reflect::{EnumValueDescriptor, ReflectValueRef};
+use Message;
+
+/// Reference to a value stored in a field, optional, repeated or map.
+// TODO: implement Eq
+pub enum ReflectFieldRef<'a> {
+ /// Singular field, optional or required in proto3 and just plain field in proto3
+ Optional(Option<ReflectValueRef<'a>>),
+ /// Repeated field
+ Repeated(&'a ReflectRepeated),
+ /// Map field
+ Map(&'a ReflectMap),
+}
+
+/// Field descriptor.
+///
+/// Can be used for runtime reflection.
+pub struct FieldDescriptor {
+ proto: &'static FieldDescriptorProto,
+ accessor: Box<FieldAccessor + 'static>,
+}
+
+impl FieldDescriptor {
+ pub(crate) fn new(
+ accessor: Box<FieldAccessor + 'static>,
+ proto: &'static FieldDescriptorProto,
+ ) -> FieldDescriptor {
+ assert_eq!(proto.get_name(), accessor.name_generic());
+ FieldDescriptor { proto, accessor }
+ }
+
+ /// Get `.proto` description of field
+ pub fn proto(&self) -> &'static FieldDescriptorProto {
+ self.proto
+ }
+
+ /// Field name as specified in `.proto` file
+ pub fn name(&self) -> &'static str {
+ self.proto.get_name()
+ }
+
+ /// If this field repeated?
+ pub fn is_repeated(&self) -> bool {
+ self.proto.get_label() == FieldDescriptorProto_Label::LABEL_REPEATED
+ }
+
+ /// Check if field is set in given message.
+ ///
+ /// For repeated field or map field return `true` if
+ /// collection is not empty.
+ ///
+ /// # Panics
+ ///
+ /// If this field belongs to a different message type.
+ pub fn has_field(&self, m: &Message) -> bool {
+ self.accessor.has_field_generic(m)
+ }
+
+ /// Return length of repeated field.
+ ///
+ /// For singualar field return `1` if field is set and `0` otherwise.
+ ///
+ /// # Panics
+ ///
+ /// If this field belongs to a different message type.
+ pub fn len_field(&self, m: &dyn Message) -> usize {
+ self.accessor.len_field_generic(m)
+ }
+
+ /// Get message field or default instance if field is unset.
+ ///
+ /// # Panics
+ /// If this field belongs to a different message type or
+ /// field type is not message.
+ pub fn get_message<'a>(&self, m: &'a dyn Message) -> &'a dyn Message {
+ self.accessor.get_message_generic(m)
+ }
+
+ /// Get `enum` field.
+ ///
+ /// # Panics
+ ///
+ /// If this field belongs to a different message type
+ /// or field type is not singular `enum`.
+ pub fn get_enum(&self, m: &dyn Message) -> &'static EnumValueDescriptor {
+ self.accessor.get_enum_generic(m)
+ }
+
+ /// Get `string` field.
+ ///
+ /// # Panics
+ ///
+ /// If this field belongs to a different message type
+ /// or field type is not singular `string`.
+ pub fn get_str<'a>(&self, m: &'a dyn Message) -> &'a str {
+ self.accessor.get_str_generic(m)
+ }
+
+ /// Get `bytes` field.
+ ///
+ /// # Panics
+ ///
+ /// If this field belongs to a different message type
+ /// or field type is not singular `bytes`.
+ pub fn get_bytes<'a>(&self, m: &'a dyn Message) -> &'a [u8] {
+ self.accessor.get_bytes_generic(m)
+ }
+
+ /// Get `u32` field.
+ ///
+ /// # Panics
+ ///
+ /// If this field belongs to a different message type
+ /// or field type is not singular `u32`.
+ pub fn get_u32(&self, m: &dyn Message) -> u32 {
+ self.accessor.get_u32_generic(m)
+ }
+
+ /// Get `u64` field.
+ ///
+ /// # Panics
+ ///
+ /// If this field belongs to a different message type
+ /// or field type is not singular `u64`.
+ pub fn get_u64(&self, m: &dyn Message) -> u64 {
+ self.accessor.get_u64_generic(m)
+ }
+
+ /// Get `i32` field.
+ ///
+ /// # Panics
+ ///
+ /// If this field belongs to a different message type
+ /// or field type is not singular `i32`.
+ pub fn get_i32(&self, m: &dyn Message) -> i32 {
+ self.accessor.get_i32_generic(m)
+ }
+
+ /// Get `i64` field.
+ ///
+ /// # Panics
+ ///
+ /// If this field belongs to a different message type
+ /// or field type is not singular `i64`.
+ pub fn get_i64(&self, m: &dyn Message) -> i64 {
+ self.accessor.get_i64_generic(m)
+ }
+
+ /// Get `bool` field.
+ ///
+ /// # Panics
+ ///
+ /// If this field belongs to a different message type or
+ /// field type is not singular `bool`.
+ pub fn get_bool(&self, m: &dyn Message) -> bool {
+ self.accessor.get_bool_generic(m)
+ }
+
+ /// Get `float` field.
+ ///
+ /// # Panics
+ ///
+ /// If this field belongs to a different message type or
+ /// field type is not singular `float`.
+ pub fn get_f32(&self, m: &dyn Message) -> f32 {
+ self.accessor.get_f32_generic(m)
+ }
+
+ /// Get `double` field.
+ ///
+ /// # Panics
+ ///
+ /// If this field belongs to a different message type
+ /// or field type is not singular `double`.
+ pub fn get_f64(&self, m: &dyn Message) -> f64 {
+ self.accessor.get_f64_generic(m)
+ }
+
+ /// Get field of any type.
+ ///
+ /// # Panics
+ ///
+ /// If this field belongs to a different message type.
+ pub fn get_reflect<'a>(&self, m: &'a dyn Message) -> ReflectFieldRef<'a> {
+ self.accessor.get_reflect(m)
+ }
+}
diff --git a/src/reflect/find_message_or_enum.rs b/src/reflect/find_message_or_enum.rs
new file mode 100644
index 0000000..7ee3915
--- /dev/null
+++ b/src/reflect/find_message_or_enum.rs
@@ -0,0 +1,62 @@
+use crate::descriptor::DescriptorProto;
+use crate::descriptor::EnumDescriptorProto;
+use crate::descriptor::FileDescriptorProto;
+
+pub(crate) enum MessageOrEnum<'a> {
+ Message(&'a DescriptorProto),
+ Enum(&'a EnumDescriptorProto),
+}
+
+impl<'a> MessageOrEnum<'a> {
+ fn from_two_options(
+ m: Option<&'a DescriptorProto>,
+ e: Option<&'a EnumDescriptorProto>,
+ ) -> MessageOrEnum<'a> {
+ match (m, e) {
+ (Some(_), Some(_)) => panic!("enum and message with the same name"),
+ (Some(m), None) => MessageOrEnum::Message(m),
+ (None, Some(e)) => MessageOrEnum::Enum(e),
+ (None, None) => panic!("not found"),
+ }
+ }
+}
+
+pub(crate) fn find_message_or_enum<'a>(
+ file: &'a FileDescriptorProto,
+ name_to_package: &str,
+) -> (String, MessageOrEnum<'a>) {
+ let mut path = name_to_package.split('.');
+ let first = path.next().unwrap();
+ let child_message = file
+ .get_message_type()
+ .iter()
+ .find(|m| m.get_name() == first);
+ let child_enum = file.get_enum_type().iter().find(|e| e.get_name() == first);
+
+ let mut package_to_name = String::new();
+ let mut me = MessageOrEnum::from_two_options(child_message, child_enum);
+
+ for name in path {
+ let message = match me {
+ MessageOrEnum::Message(m) => m,
+ MessageOrEnum::Enum(_) => panic!("enum has no children"),
+ };
+
+ if !package_to_name.is_empty() {
+ package_to_name.push_str(".");
+ }
+ package_to_name.push_str(message.get_name());
+
+ let child_message = message
+ .get_nested_type()
+ .iter()
+ .find(|m| m.get_name() == name);
+ let child_enum = message
+ .get_enum_type()
+ .iter()
+ .find(|e| e.get_name() == name);
+ me = MessageOrEnum::from_two_options(child_message, child_enum)
+ }
+
+ (package_to_name, me)
+}
diff --git a/src/reflect/map.rs b/src/reflect/map.rs
new file mode 100644
index 0000000..9f03123
--- /dev/null
+++ b/src/reflect/map.rs
@@ -0,0 +1,66 @@
+use std::collections::hash_map;
+use std::collections::HashMap;
+use std::hash::Hash;
+
+use super::value::ProtobufValue;
+
+/// Implemented for `HashMap` with appropriate keys and values
+pub trait ReflectMap: 'static {
+ fn reflect_iter(&self) -> ReflectMapIter;
+
+ fn len(&self) -> usize;
+}
+
+impl<K: ProtobufValue + Eq + Hash + 'static, V: ProtobufValue + 'static> ReflectMap
+ for HashMap<K, V>
+{
+ fn reflect_iter<'a>(&'a self) -> ReflectMapIter<'a> {
+ ReflectMapIter {
+ imp: Box::new(ReflectMapIterImpl::<'a, K, V> { iter: self.iter() }),
+ }
+ }
+
+ fn len(&self) -> usize {
+ HashMap::len(self)
+ }
+}
+
+trait ReflectMapIterTrait<'a> {
+ fn next(&mut self) -> Option<(&'a ProtobufValue, &'a ProtobufValue)>;
+}
+
+struct ReflectMapIterImpl<'a, K: Eq + Hash + 'static, V: 'static> {
+ iter: hash_map::Iter<'a, K, V>,
+}
+
+impl<'a, K: ProtobufValue + Eq + Hash + 'static, V: ProtobufValue + 'static> ReflectMapIterTrait<'a>
+ for ReflectMapIterImpl<'a, K, V>
+{
+ fn next(&mut self) -> Option<(&'a ProtobufValue, &'a ProtobufValue)> {
+ match self.iter.next() {
+ Some((k, v)) => Some((k as &ProtobufValue, v as &ProtobufValue)),
+ None => None,
+ }
+ }
+}
+
+pub struct ReflectMapIter<'a> {
+ imp: Box<ReflectMapIterTrait<'a> + 'a>,
+}
+
+impl<'a> Iterator for ReflectMapIter<'a> {
+ type Item = (&'a ProtobufValue, &'a ProtobufValue);
+
+ fn next(&mut self) -> Option<(&'a ProtobufValue, &'a ProtobufValue)> {
+ self.imp.next()
+ }
+}
+
+impl<'a> IntoIterator for &'a ReflectMap {
+ type IntoIter = ReflectMapIter<'a>;
+ type Item = (&'a ProtobufValue, &'a ProtobufValue);
+
+ fn into_iter(self) -> Self::IntoIter {
+ self.reflect_iter()
+ }
+}
diff --git a/src/reflect/message.rs b/src/reflect/message.rs
new file mode 100644
index 0000000..c35a854
--- /dev/null
+++ b/src/reflect/message.rs
@@ -0,0 +1,223 @@
+use descriptor::{DescriptorProto, FileDescriptorProto};
+use descriptorx::find_message_by_rust_name;
+use reflect::accessor::FieldAccessor;
+use reflect::find_message_or_enum::find_message_or_enum;
+use reflect::find_message_or_enum::MessageOrEnum;
+use reflect::FieldDescriptor;
+use std::collections::HashMap;
+use std::marker;
+use Message;
+
+trait MessageFactory: Send + Sync + 'static {
+ fn new_instance(&self) -> Box<dyn Message>;
+}
+
+struct MessageFactoryImpl<M>(marker::PhantomData<M>);
+
+impl<M> MessageFactory for MessageFactoryImpl<M>
+where
+ M: 'static + Message + Default + Clone + PartialEq,
+{
+ fn new_instance(&self) -> Box<dyn Message> {
+ let m: M = Default::default();
+ Box::new(m)
+ }
+}
+
+/// Dynamic message type
+pub struct MessageDescriptor {
+ full_name: String,
+ proto: &'static DescriptorProto,
+ factory: &'static dyn MessageFactory,
+ fields: Vec<FieldDescriptor>,
+
+ index_by_name: HashMap<String, usize>,
+ index_by_number: HashMap<u32, usize>,
+}
+
+impl MessageDescriptor {
+ /// Get underlying `DescriptorProto` object.
+ pub fn get_proto(&self) -> &DescriptorProto {
+ self.proto
+ }
+
+ /// Get a message descriptor for given message type
+ pub fn for_type<M: Message>() -> &'static MessageDescriptor {
+ M::descriptor_static()
+ }
+
+ fn compute_full_name(package: &str, path_to_package: &str, proto: &DescriptorProto) -> String {
+ let mut full_name = package.to_owned();
+ if path_to_package.len() != 0 {
+ if full_name.len() != 0 {
+ full_name.push('.');
+ }
+ full_name.push_str(path_to_package);
+ }
+ if full_name.len() != 0 {
+ full_name.push('.');
+ }
+ full_name.push_str(proto.get_name());
+ full_name
+ }
+
+ // Non-generic part of `new` is a separate function
+ // to reduce code bloat from multiple instantiations.
+ fn new_non_generic_by_rust_name(
+ rust_name: &'static str,
+ fields: Vec<Box<FieldAccessor + 'static>>,
+ file: &'static FileDescriptorProto,
+ factory: &'static dyn MessageFactory,
+ ) -> MessageDescriptor {
+ let proto = find_message_by_rust_name(file, rust_name);
+
+ let mut field_proto_by_name = HashMap::new();
+ for field_proto in proto.message.get_field() {
+ field_proto_by_name.insert(field_proto.get_name(), field_proto);
+ }
+
+ let mut index_by_name = HashMap::new();
+ let mut index_by_number = HashMap::new();
+ for (i, f) in proto.message.get_field().iter().enumerate() {
+ index_by_number.insert(f.get_number() as u32, i);
+ index_by_name.insert(f.get_name().to_string(), i);
+ }
+
+ let mut full_name = file.get_package().to_string();
+ if full_name.len() > 0 {
+ full_name.push('.');
+ }
+ full_name.push_str(proto.message.get_name());
+
+ MessageDescriptor {
+ full_name: full_name,
+ proto: proto.message,
+ factory,
+ fields: fields
+ .into_iter()
+ .map(|f| {
+ let proto = *field_proto_by_name.get(&f.name_generic()).unwrap();
+ FieldDescriptor::new(f, proto)
+ })
+ .collect(),
+ index_by_name,
+ index_by_number,
+ }
+ }
+
+ // Non-generic part of `new` is a separate function
+ // to reduce code bloat from multiple instantiations.
+ fn new_non_generic_by_pb_name(
+ protobuf_name_to_package: &'static str,
+ fields: Vec<Box<FieldAccessor + 'static>>,
+ file_descriptor_proto: &'static FileDescriptorProto,
+ factory: &'static dyn MessageFactory,
+ ) -> MessageDescriptor {
+ let (path_to_package, proto) =
+ match find_message_or_enum(file_descriptor_proto, protobuf_name_to_package) {
+ (path_to_package, MessageOrEnum::Message(m)) => (path_to_package, m),
+ (_, MessageOrEnum::Enum(_)) => panic!("not a message"),
+ };
+
+ let mut field_proto_by_name = HashMap::new();
+ for field_proto in proto.get_field() {
+ field_proto_by_name.insert(field_proto.get_name(), field_proto);
+ }
+
+ let mut index_by_name = HashMap::new();
+ let mut index_by_number = HashMap::new();
+ for (i, f) in proto.get_field().iter().enumerate() {
+ index_by_number.insert(f.get_number() as u32, i);
+ index_by_name.insert(f.get_name().to_string(), i);
+ }
+
+ MessageDescriptor {
+ full_name: MessageDescriptor::compute_full_name(
+ file_descriptor_proto.get_package(),
+ &path_to_package,
+ &proto,
+ ),
+ proto,
+ factory,
+ fields: fields
+ .into_iter()
+ .map(|f| {
+ let proto = *field_proto_by_name.get(&f.name_generic()).unwrap();
+ FieldDescriptor::new(f, proto)
+ })
+ .collect(),
+ index_by_name,
+ index_by_number,
+ }
+ }
+
+ /// Construct a new message descriptor.
+ ///
+ /// This operation is called from generated code and rarely
+ /// need to be called directly.
+ #[doc(hidden)]
+ #[deprecated(
+ since = "2.12",
+ note = "Please regenerate .rs files from .proto files to use newer APIs"
+ )]
+ pub fn new<M: 'static + Message + Default + Clone + PartialEq>(
+ rust_name: &'static str,
+ fields: Vec<Box<FieldAccessor + 'static>>,
+ file: &'static FileDescriptorProto,
+ ) -> MessageDescriptor {
+ let factory = &MessageFactoryImpl(marker::PhantomData::<M>);
+ MessageDescriptor::new_non_generic_by_rust_name(rust_name, fields, file, factory)
+ }
+
+ /// Construct a new message descriptor.
+ ///
+ /// This operation is called from generated code and rarely
+ /// need to be called directly.
+ #[doc(hidden)]
+ pub fn new_pb_name<M: 'static + Message + Default + Clone + PartialEq>(
+ protobuf_name_to_package: &'static str,
+ fields: Vec<Box<FieldAccessor + 'static>>,
+ file_descriptor_proto: &'static FileDescriptorProto,
+ ) -> MessageDescriptor {
+ let factory = &MessageFactoryImpl(marker::PhantomData::<M>);
+ MessageDescriptor::new_non_generic_by_pb_name(
+ protobuf_name_to_package,
+ fields,
+ file_descriptor_proto,
+ factory,
+ )
+ }
+
+ /// New empty message
+ pub fn new_instance(&self) -> Box<dyn Message> {
+ self.factory.new_instance()
+ }
+
+ /// Protobuf message name
+ pub fn name(&self) -> &'static str {
+ self.proto.get_name()
+ }
+
+ /// Fully qualified protobuf message name
+ pub fn full_name(&self) -> &str {
+ &self.full_name[..]
+ }
+
+ /// Message field descriptors.
+ pub fn fields(&self) -> &[FieldDescriptor] {
+ &self.fields
+ }
+
+ /// Find field by name
+ pub fn field_by_name<'a>(&'a self, name: &str) -> &'a FieldDescriptor {
+ // TODO: clone is weird
+ let &index = self.index_by_name.get(&name.to_string()).unwrap();
+ &self.fields[index]
+ }
+
+ /// Find field by number
+ pub fn field_by_number<'a>(&'a self, number: u32) -> &'a FieldDescriptor {
+ let &index = self.index_by_number.get(&number).unwrap();
+ &self.fields[index]
+ }
+}
diff --git a/src/reflect/mod.rs b/src/reflect/mod.rs
new file mode 100644
index 0000000..ede3743
--- /dev/null
+++ b/src/reflect/mod.rs
@@ -0,0 +1,27 @@
+//! Reflection implementation for protobuf types.
+
+use core::Message;
+
+pub mod accessor;
+mod enums;
+mod field;
+mod find_message_or_enum;
+mod map;
+mod message;
+mod optional;
+mod repeated;
+mod value;
+
+pub use self::value::ProtobufValue;
+pub use self::value::ReflectValueRef;
+#[doc(hidden)]
+#[deprecated(since = "2.11", note = "Use ReflectValueRef instead")]
+pub use self::value::ReflectValueRef as ProtobufValueRef;
+
+pub use self::enums::EnumDescriptor;
+pub use self::enums::EnumValueDescriptor;
+
+pub use self::message::MessageDescriptor;
+
+pub use self::field::FieldDescriptor;
+pub use self::field::ReflectFieldRef;
diff --git a/src/reflect/optional.rs b/src/reflect/optional.rs
new file mode 100644
index 0000000..4d33752
--- /dev/null
+++ b/src/reflect/optional.rs
@@ -0,0 +1,50 @@
+use std::mem;
+
+use super::value::ProtobufValue;
+
+use singular::*;
+
+pub trait ReflectOptional: 'static {
+ fn to_option(&self) -> Option<&ProtobufValue>;
+
+ fn set_value(&mut self, value: &ProtobufValue);
+}
+
+impl<V: ProtobufValue + Clone + 'static> ReflectOptional for Option<V> {
+ fn to_option(&self) -> Option<&ProtobufValue> {
+ self.as_ref().map(|v| v as &ProtobufValue)
+ }
+
+ fn set_value(&mut self, value: &ProtobufValue) {
+ match value.as_any().downcast_ref::<V>() {
+ Some(v) => mem::replace(self, Some(v.clone())),
+ None => panic!(),
+ };
+ }
+}
+
+impl<V: ProtobufValue + Clone + 'static> ReflectOptional for SingularField<V> {
+ fn to_option(&self) -> Option<&ProtobufValue> {
+ self.as_ref().map(|v| v as &ProtobufValue)
+ }
+
+ fn set_value(&mut self, value: &ProtobufValue) {
+ match value.as_any().downcast_ref::<V>() {
+ Some(v) => mem::replace(self, SingularField::some(v.clone())),
+ None => panic!(),
+ };
+ }
+}
+
+impl<V: ProtobufValue + Clone + 'static> ReflectOptional for SingularPtrField<V> {
+ fn to_option(&self) -> Option<&ProtobufValue> {
+ self.as_ref().map(|v| v as &ProtobufValue)
+ }
+
+ fn set_value(&mut self, value: &ProtobufValue) {
+ match value.as_any().downcast_ref::<V>() {
+ Some(v) => mem::replace(self, SingularPtrField::some(v.clone())),
+ None => panic!(),
+ };
+ }
+}
diff --git a/src/reflect/repeated.rs b/src/reflect/repeated.rs
new file mode 100644
index 0000000..7ffc979
--- /dev/null
+++ b/src/reflect/repeated.rs
@@ -0,0 +1,192 @@
+use std::slice;
+
+use super::value::ProtobufValue;
+use super::value::ReflectValueRef;
+
+use repeated::RepeatedField;
+
+pub trait ReflectRepeated: 'static {
+ fn reflect_iter(&self) -> ReflectRepeatedIter;
+ fn len(&self) -> usize;
+ fn get(&self, index: usize) -> &ProtobufValue;
+}
+
+impl<V: ProtobufValue + 'static> ReflectRepeated for Vec<V> {
+ fn reflect_iter<'a>(&'a self) -> ReflectRepeatedIter<'a> {
+ ReflectRepeatedIter {
+ imp: Box::new(ReflectRepeatedIterImplSlice::<'a, V> { iter: self.iter() }),
+ }
+ }
+
+ fn len(&self) -> usize {
+ Vec::len(self)
+ }
+
+ fn get(&self, index: usize) -> &ProtobufValue {
+ &self[index]
+ }
+}
+
+// useless
+impl<V: ProtobufValue + 'static> ReflectRepeated for [V] {
+ fn reflect_iter<'a>(&'a self) -> ReflectRepeatedIter<'a> {
+ ReflectRepeatedIter {
+ imp: Box::new(ReflectRepeatedIterImplSlice::<'a, V> { iter: self.iter() }),
+ }
+ }
+
+ fn len(&self) -> usize {
+ <[_]>::len(self)
+ }
+
+ fn get(&self, index: usize) -> &ProtobufValue {
+ &self[index]
+ }
+}
+
+impl<V: ProtobufValue + 'static> ReflectRepeated for RepeatedField<V> {
+ fn reflect_iter<'a>(&'a self) -> ReflectRepeatedIter<'a> {
+ ReflectRepeatedIter {
+ imp: Box::new(ReflectRepeatedIterImplSlice::<'a, V> { iter: self.iter() }),
+ }
+ }
+
+ fn len(&self) -> usize {
+ RepeatedField::len(self)
+ }
+
+ fn get(&self, index: usize) -> &ProtobufValue {
+ &self[index]
+ }
+}
+
+trait ReflectRepeatedIterTrait<'a> {
+ fn next(&mut self) -> Option<&'a ProtobufValue>;
+}
+
+struct ReflectRepeatedIterImplSlice<'a, V: ProtobufValue + 'static> {
+ iter: slice::Iter<'a, V>,
+}
+
+impl<'a, V: ProtobufValue + 'static> ReflectRepeatedIterTrait<'a>
+ for ReflectRepeatedIterImplSlice<'a, V>
+{
+ fn next(&mut self) -> Option<&'a ProtobufValue> {
+ self.iter.next().map(|v| v as &ProtobufValue)
+ }
+}
+
+pub struct ReflectRepeatedIter<'a> {
+ imp: Box<ReflectRepeatedIterTrait<'a> + 'a>,
+}
+
+impl<'a> Iterator for ReflectRepeatedIter<'a> {
+ type Item = &'a ProtobufValue;
+
+ fn next(&mut self) -> Option<Self::Item> {
+ self.imp.next()
+ }
+}
+
+impl<'a> IntoIterator for &'a ReflectRepeated {
+ type IntoIter = ReflectRepeatedIter<'a>;
+ type Item = &'a ProtobufValue;
+
+ fn into_iter(self) -> Self::IntoIter {
+ self.reflect_iter()
+ }
+}
+
+pub trait ReflectRepeatedEnum<'a> {
+ fn len(&self) -> usize;
+
+ fn get(&self, index: usize) -> ReflectValueRef<'a>;
+}
+
+pub trait ReflectRepeatedMessage<'a> {
+ fn len(&self) -> usize;
+
+ fn get(&self, index: usize) -> ReflectValueRef<'a>;
+}
+
+pub enum ReflectRepeatedRef<'a> {
+ Generic(&'a ReflectRepeated),
+ U32(&'a [u32]),
+ U64(&'a [u64]),
+ I32(&'a [i32]),
+ I64(&'a [i64]),
+ F32(&'a [f32]),
+ F64(&'a [f64]),
+ Bool(&'a [bool]),
+ String(&'a [String]),
+ Bytes(&'a [Vec<u8>]),
+ Enum(Box<ReflectRepeatedEnum<'a> + 'a>),
+ Message(Box<ReflectRepeatedMessage<'a> + 'a>),
+}
+
+impl<'a> ReflectRepeatedRef<'a> {
+ fn len(&self) -> usize {
+ match *self {
+ ReflectRepeatedRef::Generic(ref r) => r.len(),
+ ReflectRepeatedRef::U32(ref r) => r.len(),
+ ReflectRepeatedRef::U64(ref r) => r.len(),
+ ReflectRepeatedRef::I32(ref r) => r.len(),
+ ReflectRepeatedRef::I64(ref r) => r.len(),
+ ReflectRepeatedRef::F32(ref r) => r.len(),
+ ReflectRepeatedRef::F64(ref r) => r.len(),
+ ReflectRepeatedRef::Bool(ref r) => r.len(),
+ ReflectRepeatedRef::String(ref r) => r.len(),
+ ReflectRepeatedRef::Bytes(ref r) => r.len(),
+ ReflectRepeatedRef::Enum(ref r) => r.len(),
+ ReflectRepeatedRef::Message(ref r) => r.len(),
+ }
+ }
+
+ fn get(&self, index: usize) -> ReflectValueRef<'a> {
+ match *self {
+ ReflectRepeatedRef::Generic(ref r) => r.get(index).as_ref(),
+ ReflectRepeatedRef::U32(ref r) => ReflectValueRef::U32(r[index]),
+ ReflectRepeatedRef::U64(ref r) => ReflectValueRef::U64(r[index]),
+ ReflectRepeatedRef::I32(ref r) => ReflectValueRef::I32(r[index]),
+ ReflectRepeatedRef::I64(ref r) => ReflectValueRef::I64(r[index]),
+ ReflectRepeatedRef::F32(ref r) => ReflectValueRef::F32(r[index]),
+ ReflectRepeatedRef::F64(ref r) => ReflectValueRef::F64(r[index]),
+ ReflectRepeatedRef::Bool(ref r) => ReflectValueRef::Bool(r[index]),
+ ReflectRepeatedRef::String(ref r) => ReflectValueRef::String(&r[index]),
+ ReflectRepeatedRef::Bytes(ref r) => ReflectValueRef::Bytes(&r[index]),
+ ReflectRepeatedRef::Enum(ref r) => r.get(index),
+ ReflectRepeatedRef::Message(ref r) => r.get(index),
+ }
+ }
+}
+
+pub struct ReflectRepeatedRefIter<'a> {
+ repeated: &'a ReflectRepeatedRef<'a>,
+ pos: usize,
+}
+
+impl<'a> Iterator for ReflectRepeatedRefIter<'a> {
+ type Item = ReflectValueRef<'a>;
+
+ fn next(&mut self) -> Option<Self::Item> {
+ if self.pos < self.repeated.len() {
+ let pos = self.pos;
+ self.pos += 1;
+ Some(self.repeated.get(pos))
+ } else {
+ None
+ }
+ }
+}
+
+impl<'a> IntoIterator for &'a ReflectRepeatedRef<'a> {
+ type IntoIter = ReflectRepeatedRefIter<'a>;
+ type Item = ReflectValueRef<'a>;
+
+ fn into_iter(self) -> Self::IntoIter {
+ ReflectRepeatedRefIter {
+ repeated: self,
+ pos: 0,
+ }
+ }
+}
diff --git a/src/reflect/value.rs b/src/reflect/value.rs
new file mode 100644
index 0000000..22f76af
--- /dev/null
+++ b/src/reflect/value.rs
@@ -0,0 +1,185 @@
+use std::any::Any;
+
+#[cfg(feature = "bytes")]
+use bytes::Bytes;
+#[cfg(feature = "bytes")]
+use chars::Chars;
+
+use super::*;
+
+/// Type implemented by all protobuf elementary types
+/// (ints, floats, bool, string, bytes, enums, messages).
+pub trait ProtobufValue: Any + 'static {
+ /// As ref
+ fn as_ref(&self) -> ReflectValueRef;
+
+ /// Convert to `Any`
+ fn as_any(&self) -> &Any {
+ unimplemented!()
+ }
+
+ /// Is value non-zero?
+ fn is_non_zero(&self) -> bool {
+ self.as_ref().is_non_zero()
+ }
+
+ /// Return `ProtobufValueRef` if self is `Copy`.
+ ///
+ /// # Panics
+ ///
+ /// if `Self` is not `Copy`.
+ fn as_ref_copy(&self) -> ReflectValueRef<'static>
+//where Self : Copy // TODO
+ {
+ match self.as_ref() {
+ ReflectValueRef::Bool(v) => ReflectValueRef::Bool(v),
+ ReflectValueRef::U32(v) => ReflectValueRef::U32(v),
+ ReflectValueRef::U64(v) => ReflectValueRef::U64(v),
+ ReflectValueRef::I32(v) => ReflectValueRef::I32(v),
+ ReflectValueRef::I64(v) => ReflectValueRef::I64(v),
+ ReflectValueRef::F32(v) => ReflectValueRef::F32(v),
+ ReflectValueRef::F64(v) => ReflectValueRef::F64(v),
+ ReflectValueRef::Enum(v) => ReflectValueRef::Enum(v),
+ ReflectValueRef::String(..)
+ | ReflectValueRef::Bytes(..)
+ | ReflectValueRef::Message(..) => unreachable!(),
+ }
+ }
+}
+
+impl ProtobufValue for u32 {
+ fn as_ref(&self) -> ReflectValueRef {
+ ReflectValueRef::U32(*self)
+ }
+}
+
+impl ProtobufValue for u64 {
+ fn as_ref(&self) -> ReflectValueRef {
+ ReflectValueRef::U64(*self)
+ }
+}
+
+impl ProtobufValue for i32 {
+ fn as_ref(&self) -> ReflectValueRef {
+ ReflectValueRef::I32(*self)
+ }
+}
+
+impl ProtobufValue for i64 {
+ fn as_ref(&self) -> ReflectValueRef {
+ ReflectValueRef::I64(*self)
+ }
+}
+
+impl ProtobufValue for f32 {
+ fn as_ref(&self) -> ReflectValueRef {
+ ReflectValueRef::F32(*self)
+ }
+}
+
+impl ProtobufValue for f64 {
+ fn as_ref(&self) -> ReflectValueRef {
+ ReflectValueRef::F64(*self)
+ }
+}
+
+impl ProtobufValue for bool {
+ fn as_ref(&self) -> ReflectValueRef {
+ ReflectValueRef::Bool(*self)
+ }
+}
+
+impl ProtobufValue for String {
+ fn as_ref(&self) -> ReflectValueRef {
+ ReflectValueRef::String(*&self)
+ }
+}
+
+impl ProtobufValue for str {
+ fn as_ref(&self) -> ReflectValueRef {
+ ReflectValueRef::String(self)
+ }
+}
+
+impl ProtobufValue for Vec<u8> {
+ fn as_ref(&self) -> ReflectValueRef {
+ ReflectValueRef::Bytes(*&self)
+ }
+}
+
+#[cfg(feature = "bytes")]
+impl ProtobufValue for Bytes {
+ fn as_ref(&self) -> ReflectValueRef {
+ ReflectValueRef::Bytes(&*self)
+ }
+}
+
+#[cfg(feature = "bytes")]
+impl ProtobufValue for Chars {
+ fn as_ref(&self) -> ReflectValueRef {
+ ReflectValueRef::String(&*self)
+ }
+}
+
+// conflicting implementations, so generated code is used instead
+/*
+impl<E : ProtobufEnum> ProtobufValue for E {
+ fn as_ref(&self) -> ProtobufValueRef {
+ ProtobufValueRef::Enum(self.descriptor())
+ }
+}
+
+impl<M : Message> ProtobufValue for M {
+ fn as_ref(&self) -> ProtobufValueRef {
+ ProtobufValueRef::Message(self)
+ }
+}
+*/
+
+/// A reference to a value
+#[derive(Debug)]
+pub enum ReflectValueRef<'a> {
+ /// `u32`
+ U32(u32),
+ /// `u64`
+ U64(u64),
+ /// `i32`
+ I32(i32),
+ /// `i64`
+ I64(i64),
+ /// `f32`
+ F32(f32),
+ /// `f64`
+ F64(f64),
+ /// `bool`
+ Bool(bool),
+ /// `string`
+ String(&'a str),
+ /// `bytes`
+ Bytes(&'a [u8]),
+ /// `enum`
+ // TODO: change to (i32, EnumDescriptor)
+ Enum(&'static EnumValueDescriptor),
+ /// `message`
+ Message(&'a dyn Message),
+}
+
+impl<'a> ReflectValueRef<'a> {
+ /// Value is "non-zero"?
+ #[doc(hidden)]
+ pub fn is_non_zero(&self) -> bool {
+ match *self {
+ ReflectValueRef::U32(v) => v != 0,
+ ReflectValueRef::U64(v) => v != 0,
+ ReflectValueRef::I32(v) => v != 0,
+ ReflectValueRef::I64(v) => v != 0,
+ ReflectValueRef::F32(v) => v != 0.,
+ ReflectValueRef::F64(v) => v != 0.,
+ ReflectValueRef::Bool(v) => v,
+ ReflectValueRef::String(v) => !v.is_empty(),
+ ReflectValueRef::Bytes(v) => !v.is_empty(),
+ ReflectValueRef::Enum(v) => v.value() != 0,
+ ReflectValueRef::Message(_) => true,
+ }
+ }
+}
diff --git a/src/repeated.rs b/src/repeated.rs
new file mode 100644
index 0000000..e5072cf
--- /dev/null
+++ b/src/repeated.rs
@@ -0,0 +1,468 @@
+#[cfg(feature = "with-serde")]
+use serde;
+
+use std::borrow::Borrow;
+use std::cmp::Ordering;
+use std::default::Default;
+use std::fmt;
+use std::hash::Hash;
+use std::hash::Hasher;
+use std::iter::FromIterator;
+use std::iter::IntoIterator;
+use std::ops::Deref;
+use std::ops::DerefMut;
+use std::ops::Index;
+use std::ops::IndexMut;
+use std::slice;
+use std::vec;
+
+use clear::Clear;
+
+/// Wrapper around vector to avoid deallocations on clear.
+pub struct RepeatedField<T> {
+ vec: Vec<T>,
+ len: usize,
+}
+
+impl<T> RepeatedField<T> {
+ /// Return number of elements in this container.
+ #[inline]
+ pub fn len(&self) -> usize {
+ self.len
+ }
+
+ /// Clear.
+ #[inline]
+ pub fn clear(&mut self) {
+ self.len = 0;
+ }
+}
+
+impl<T> Clear for RepeatedField<T> {
+ #[inline]
+ fn clear(&mut self) {
+ self.len = 0;
+ }
+}
+
+impl<T> Default for RepeatedField<T> {
+ #[inline]
+ fn default() -> RepeatedField<T> {
+ RepeatedField {
+ vec: Vec::new(),
+ len: 0,
+ }
+ }
+}
+
+impl<T> RepeatedField<T> {
+ /// Create new empty container.
+ #[inline]
+ pub fn new() -> RepeatedField<T> {
+ Default::default()
+ }
+
+ /// Create a contained with data from given vec.
+ #[inline]
+ pub fn from_vec(vec: Vec<T>) -> RepeatedField<T> {
+ let len = vec.len();
+ RepeatedField { vec: vec, len: len }
+ }
+
+ /// Convert data into vec.
+ #[inline]
+ pub fn into_vec(self) -> Vec<T> {
+ let mut vec = self.vec;
+ vec.truncate(self.len);
+ vec
+ }
+
+ /// Return current capacity.
+ #[inline]
+ pub fn capacity(&self) -> usize {
+ self.vec.capacity()
+ }
+
+ /// View data as slice.
+ #[inline]
+ pub fn as_slice<'a>(&'a self) -> &'a [T] {
+ &self.vec[..self.len]
+ }
+
+ /// View data as mutable slice.
+ #[inline]
+ pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
+ &mut self.vec[..self.len]
+ }
+
+ /// Get subslice of this container.
+ #[inline]
+ pub fn slice(&self, start: usize, end: usize) -> &[T] {
+ &self.as_ref()[start..end]
+ }
+
+ /// Get mutable subslice of this container.
+ #[inline]
+ pub fn slice_mut(&mut self, start: usize, end: usize) -> &mut [T] {
+ &mut self.as_mut_slice()[start..end]
+ }
+
+ /// Get slice from given index.
+ #[inline]
+ pub fn slice_from(&self, start: usize) -> &[T] {
+ &self.as_ref()[start..]
+ }
+
+ /// Get mutable slice from given index.
+ #[inline]
+ pub fn slice_from_mut(&mut self, start: usize) -> &mut [T] {
+ &mut self.as_mut_slice()[start..]
+ }
+
+ /// Get slice to given index.
+ #[inline]
+ pub fn slice_to(&self, end: usize) -> &[T] {
+ &self.as_ref()[..end]
+ }
+
+ /// Get mutable slice to given index.
+ #[inline]
+ pub fn slice_to_mut(&mut self, end: usize) -> &mut [T] {
+ &mut self.as_mut_slice()[..end]
+ }
+
+ /// View this container as two slices split at given index.
+ #[inline]
+ pub fn split_at<'a>(&'a self, mid: usize) -> (&'a [T], &'a [T]) {
+ self.as_ref().split_at(mid)
+ }
+
+ /// View this container as two mutable slices split at given index.
+ #[inline]
+ pub fn split_at_mut<'a>(&'a mut self, mid: usize) -> (&'a mut [T], &'a mut [T]) {
+ self.as_mut_slice().split_at_mut(mid)
+ }
+
+ /// View all but first elements of this container.
+ #[inline]
+ pub fn tail(&self) -> &[T] {
+ &self.as_ref()[1..]
+ }
+
+ /// Last element of this container.
+ #[inline]
+ pub fn last(&self) -> Option<&T> {
+ self.as_ref().last()
+ }
+
+ /// Mutable last element of this container.
+ #[inline]
+ pub fn last_mut<'a>(&'a mut self) -> Option<&'a mut T> {
+ self.as_mut_slice().last_mut()
+ }
+
+ /// View all but last elements of this container.
+ #[inline]
+ pub fn init<'a>(&'a self) -> &'a [T] {
+ let s = self.as_ref();
+ &s[0..s.len() - 1]
+ }
+
+ /// Push an element to the end.
+ #[inline]
+ pub fn push(&mut self, value: T) {
+ if self.len == self.vec.len() {
+ self.vec.push(value);
+ } else {
+ self.vec[self.len] = value;
+ }
+ self.len += 1;
+ }
+
+ /// Pop last element.
+ #[inline]
+ pub fn pop(&mut self) -> Option<T> {
+ if self.len == 0 {
+ None
+ } else {
+ self.vec.truncate(self.len);
+ self.len -= 1;
+ self.vec.pop()
+ }
+ }
+
+ /// Insert an element at specified position.
+ #[inline]
+ pub fn insert(&mut self, index: usize, value: T) {
+ assert!(index <= self.len);
+ self.vec.insert(index, value);
+ self.len += 1;
+ }
+
+ /// Remove an element from specified position.
+ #[inline]
+ pub fn remove(&mut self, index: usize) -> T {
+ assert!(index < self.len);
+ self.len -= 1;
+ self.vec.remove(index)
+ }
+
+ /// Truncate at specified length.
+ #[inline]
+ pub fn truncate(&mut self, len: usize) {
+ if self.len > len {
+ self.len = len;
+ }
+ }
+
+ /// Reverse in place.
+ #[inline]
+ pub fn reverse(&mut self) {
+ self.as_mut_slice().reverse()
+ }
+
+ /// Into owned iterator.
+ #[inline]
+ pub fn into_iter(mut self) -> vec::IntoIter<T> {
+ self.vec.truncate(self.len);
+ self.vec.into_iter()
+ }
+
+ /// Immutable data iterator.
+ #[inline]
+ pub fn iter<'a>(&'a self) -> slice::Iter<'a, T> {
+ self.as_ref().iter()
+ }
+
+ /// Mutable data iterator.
+ #[inline]
+ pub fn iter_mut<'a>(&'a mut self) -> slice::IterMut<'a, T> {
+ self.as_mut_slice().iter_mut()
+ }
+
+ /// Sort elements with given comparator.
+ #[inline]
+ pub fn sort_by<F>(&mut self, compare: F)
+ where
+ F: Fn(&T, &T) -> Ordering,
+ {
+ self.as_mut_slice().sort_by(compare)
+ }
+
+ /// Get data as raw pointer.
+ #[inline]
+ pub fn as_ptr(&self) -> *const T {
+ self.vec.as_ptr()
+ }
+
+ /// Get data a mutable raw pointer.
+ #[inline]
+ pub fn as_mut_ptr(&mut self) -> *mut T {
+ self.vec.as_mut_ptr()
+ }
+}
+
+impl<T: Default + Clear> RepeatedField<T> {
+ /// Push default value.
+ /// This operation could be faster than `rf.push(Default::default())`,
+ /// because it may reuse previously allocated and cleared element.
+ pub fn push_default<'a>(&'a mut self) -> &'a mut T {
+ if self.len == self.vec.len() {
+ self.vec.push(Default::default());
+ } else {
+ self.vec[self.len].clear();
+ }
+ self.len += 1;
+ self.last_mut().unwrap()
+ }
+}
+
+impl<T> From<Vec<T>> for RepeatedField<T> {
+ #[inline]
+ fn from(values: Vec<T>) -> RepeatedField<T> {
+ RepeatedField::from_vec(values)
+ }
+}
+
+impl<'a, T: Clone> From<&'a [T]> for RepeatedField<T> {
+ #[inline]
+ fn from(values: &'a [T]) -> RepeatedField<T> {
+ RepeatedField::from_slice(values)
+ }
+}
+
+impl<T> Into<Vec<T>> for RepeatedField<T> {
+ #[inline]
+ fn into(self) -> Vec<T> {
+ self.into_vec()
+ }
+}
+
+impl<T: Clone> RepeatedField<T> {
+ /// Copy slice data to `RepeatedField`
+ #[inline]
+ pub fn from_slice(values: &[T]) -> RepeatedField<T> {
+ RepeatedField::from_vec(values.to_vec())
+ }
+
+ /// Copy slice data to `RepeatedField`
+ #[inline]
+ pub fn from_ref<X: AsRef<[T]>>(values: X) -> RepeatedField<T> {
+ RepeatedField::from_slice(values.as_ref())
+ }
+
+ /// Copy this data into new vec.
+ #[inline]
+ pub fn to_vec(&self) -> Vec<T> {
+ self.as_ref().to_vec()
+ }
+}
+
+impl<T: Clone> Clone for RepeatedField<T> {
+ #[inline]
+ fn clone(&self) -> RepeatedField<T> {
+ RepeatedField {
+ vec: self.to_vec(),
+ len: self.len(),
+ }
+ }
+}
+
+impl<T> FromIterator<T> for RepeatedField<T> {
+ #[inline]
+ fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> RepeatedField<T> {
+ RepeatedField::from_vec(FromIterator::from_iter(iter))
+ }
+}
+
+impl<'a, T> IntoIterator for &'a RepeatedField<T> {
+ type Item = &'a T;
+ type IntoIter = slice::Iter<'a, T>;
+
+ fn into_iter(self) -> slice::Iter<'a, T> {
+ self.iter()
+ }
+}
+
+impl<T: PartialEq> PartialEq for RepeatedField<T> {
+ #[inline]
+ fn eq(&self, other: &RepeatedField<T>) -> bool {
+ self.as_ref() == other.as_ref()
+ }
+}
+
+impl<T: Eq> Eq for RepeatedField<T> {}
+
+impl<T: PartialEq> RepeatedField<T> {
+ /// True iff this container contains given element.
+ #[inline]
+ pub fn contains(&self, value: &T) -> bool {
+ self.as_ref().contains(value)
+ }
+}
+
+impl<T: Hash> Hash for RepeatedField<T> {
+ fn hash<H: Hasher>(&self, state: &mut H) {
+ self.as_ref().hash(state);
+ }
+}
+
+impl<T> AsRef<[T]> for RepeatedField<T> {
+ #[inline]
+ fn as_ref<'a>(&'a self) -> &'a [T] {
+ &self.vec[..self.len]
+ }
+}
+
+impl<T> Borrow<[T]> for RepeatedField<T> {
+ #[inline]
+ fn borrow(&self) -> &[T] {
+ &self.vec[..self.len]
+ }
+}
+
+impl<T> Deref for RepeatedField<T> {
+ type Target = [T];
+ #[inline]
+ fn deref(&self) -> &[T] {
+ &self.vec[..self.len]
+ }
+}
+
+impl<T> DerefMut for RepeatedField<T> {
+ #[inline]
+ fn deref_mut(&mut self) -> &mut [T] {
+ &mut self.vec[..self.len]
+ }
+}
+
+impl<T> Index<usize> for RepeatedField<T> {
+ type Output = T;
+
+ #[inline]
+ fn index<'a>(&'a self, index: usize) -> &'a T {
+ &self.as_ref()[index]
+ }
+}
+
+impl<T> IndexMut<usize> for RepeatedField<T> {
+ #[inline]
+ fn index_mut<'a>(&'a mut self, index: usize) -> &'a mut T {
+ &mut self.as_mut_slice()[index]
+ }
+}
+
+impl<T: fmt::Debug> fmt::Debug for RepeatedField<T> {
+ #[inline]
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ self.as_ref().fmt(f)
+ }
+}
+
+#[cfg(feature = "with-serde")]
+impl<T: serde::Serialize> serde::Serialize for RepeatedField<T> {
+ fn serialize<S>(
+ &self,
+ serializer: S,
+ ) -> Result<<S as serde::Serializer>::Ok, <S as serde::Serializer>::Error>
+ where
+ S: serde::Serializer,
+ {
+ self.as_ref().serialize(serializer)
+ }
+}
+
+#[cfg(feature = "with-serde")]
+impl<'de, T: serde::Deserialize<'de> + Default> serde::Deserialize<'de> for RepeatedField<T> {
+ fn deserialize<D>(deserializer: D) -> Result<Self, <D as serde::Deserializer<'de>>::Error>
+ where
+ D: serde::Deserializer<'de>,
+ {
+ Vec::deserialize(deserializer).map(RepeatedField::from)
+ }
+}
+
+#[cfg(test)]
+mod test {
+ use super::RepeatedField;
+
+ #[test]
+ fn as_mut_slice() {
+ let mut v = RepeatedField::new();
+ v.push(10);
+ v.push(20);
+ v.clear();
+ assert_eq!(v.as_mut_slice(), &mut []);
+ v.push(30);
+ assert_eq!(v.as_mut_slice(), &mut [30]);
+ }
+
+ #[test]
+ fn push_default() {
+ let mut v = RepeatedField::new();
+ v.push("aa".to_string());
+ v.push("bb".to_string());
+ v.clear();
+ assert_eq!("".to_string(), *v.push_default());
+ }
+}
diff --git a/src/rt.rs b/src/rt.rs
new file mode 100644
index 0000000..312bb4f
--- /dev/null
+++ b/src/rt.rs
@@ -0,0 +1,933 @@
+//! Functions used by generated protobuf code.
+//! Should not be used by programs written by hands.
+
+use std::collections::HashMap;
+use std::default::Default;
+use std::hash::Hash;
+
+#[cfg(feature = "bytes")]
+use bytes::Bytes;
+#[cfg(feature = "bytes")]
+use chars::Chars;
+
+use core::*;
+use enums::ProtobufEnum;
+use error::ProtobufError;
+use error::ProtobufResult;
+use error::WireError;
+use repeated::RepeatedField;
+use singular::SingularField;
+use singular::SingularPtrField;
+use stream::wire_format;
+use stream::wire_format::WireType;
+use stream::wire_format::WireTypeFixed32;
+use stream::wire_format::WireTypeFixed64;
+use stream::wire_format::WireTypeLengthDelimited;
+use stream::wire_format::WireTypeVarint;
+use stream::CodedInputStream;
+use stream::CodedOutputStream;
+use types::*;
+use zigzag::*;
+
+use unknown::UnknownFields;
+
+/// Given `u64` value compute varint encoded length.
+pub fn compute_raw_varint64_size(value: u64) -> u32 {
+ if (value & (0xffffffffffffffffu64 << 7)) == 0 {
+ return 1;
+ }
+ if (value & (0xffffffffffffffffu64 << 14)) == 0 {
+ return 2;
+ }
+ if (value & (0xffffffffffffffffu64 << 21)) == 0 {
+ return 3;
+ }
+ if (value & (0xffffffffffffffffu64 << 28)) == 0 {
+ return 4;
+ }
+ if (value & (0xffffffffffffffffu64 << 35)) == 0 {
+ return 5;
+ }
+ if (value & (0xffffffffffffffffu64 << 42)) == 0 {
+ return 6;
+ }
+ if (value & (0xffffffffffffffffu64 << 49)) == 0 {
+ return 7;
+ }
+ if (value & (0xffffffffffffffffu64 << 56)) == 0 {
+ return 8;
+ }
+ if (value & (0xffffffffffffffffu64 << 63)) == 0 {
+ return 9;
+ }
+ 10
+}
+
+/// Given `u32` value compute varint encoded length.
+pub fn compute_raw_varint32_size(value: u32) -> u32 {
+ compute_raw_varint64_size(value as u64)
+}
+
+/// Helper trait implemented by integer types which could be encoded as varint.
+pub trait ProtobufVarint {
+ /// Size of self when encoded as varint.
+ fn len_varint(&self) -> u32;
+}
+
+/// Helper trait implemented by integer types which could be encoded as zigzag varint.
+pub trait ProtobufVarintZigzag {
+ /// Size of self when encoded as zigzag varint.
+ fn len_varint_zigzag(&self) -> u32;
+}
+
+impl ProtobufVarint for u64 {
+ fn len_varint(&self) -> u32 {
+ compute_raw_varint64_size(*self)
+ }
+}
+
+impl ProtobufVarint for u32 {
+ fn len_varint(&self) -> u32 {
+ (*self as u64).len_varint()
+ }
+}
+
+impl ProtobufVarint for i64 {
+ fn len_varint(&self) -> u32 {
+ // same as length of u64
+ (*self as u64).len_varint()
+ }
+}
+
+impl ProtobufVarintZigzag for i64 {
+ fn len_varint_zigzag(&self) -> u32 {
+ compute_raw_varint64_size(encode_zig_zag_64(*self))
+ }
+}
+
+impl ProtobufVarint for i32 {
+ fn len_varint(&self) -> u32 {
+ // sign-extend and then compute
+ (*self as i64).len_varint()
+ }
+}
+
+impl ProtobufVarintZigzag for i32 {
+ fn len_varint_zigzag(&self) -> u32 {
+ compute_raw_varint32_size(encode_zig_zag_32(*self))
+ }
+}
+
+impl ProtobufVarint for bool {
+ fn len_varint(&self) -> u32 {
+ 1
+ }
+}
+
+/* Commented out due to https://github.com/mozilla/rust/issues/8075
+impl<E:ProtobufEnum> ProtobufVarint for E {
+ fn len_varint(&self) -> u32 {
+ self.value().len_varint()
+ }
+}
+*/
+
+/// Size of serialized repeated packed field, excluding length and tag.
+pub fn vec_packed_varint_data_size<T: ProtobufVarint>(vec: &[T]) -> u32 {
+ vec.iter().map(|v| v.len_varint()).fold(0, |a, i| a + i)
+}
+
+/// Size of serialized repeated packed field, excluding length and tag.
+pub fn vec_packed_varint_zigzag_data_size<T: ProtobufVarintZigzag>(vec: &[T]) -> u32 {
+ vec.iter()
+ .map(|v| v.len_varint_zigzag())
+ .fold(0, |a, i| a + i)
+}
+
+/// Size of serialized repeated packed enum field, excluding length and tag.
+pub fn vec_packed_enum_data_size<E: ProtobufEnum>(vec: &[E]) -> u32 {
+ vec.iter()
+ .map(|e| compute_raw_varint32_size(e.value() as u32))
+ .fold(0, |a, i| a + i)
+}
+
+/// Size of serialized data with length prefix and tag
+pub fn vec_packed_varint_size<T: ProtobufVarint>(field_number: u32, vec: &[T]) -> u32 {
+ if vec.is_empty() {
+ 0
+ } else {
+ let data_size = vec_packed_varint_data_size(vec);
+ tag_size(field_number) + data_size.len_varint() + data_size
+ }
+}
+
+/// Size of serialized data with length prefix and tag
+pub fn vec_packed_varint_zigzag_size<T: ProtobufVarintZigzag>(field_number: u32, vec: &[T]) -> u32 {
+ if vec.is_empty() {
+ 0
+ } else {
+ let data_size = vec_packed_varint_zigzag_data_size(vec);
+ tag_size(field_number) + data_size.len_varint() + data_size
+ }
+}
+
+/// Size of serialized data with length prefix and tag
+pub fn vec_packed_enum_size<E: ProtobufEnum>(field_number: u32, vec: &[E]) -> u32 {
+ if vec.is_empty() {
+ 0
+ } else {
+ let data_size = vec_packed_enum_data_size(vec);
+ tag_size(field_number) + data_size.len_varint() + data_size
+ }
+}
+
+/// Compute tag size. Size of tag does not depend on wire type.
+pub fn tag_size(field_number: u32) -> u32 {
+ wire_format::Tag::make(field_number, WireTypeFixed64)
+ .value()
+ .len_varint()
+}
+
+fn value_size_no_tag<T: ProtobufVarint>(value: T, wt: WireType) -> u32 {
+ match wt {
+ WireTypeFixed64 => 8,
+ WireTypeFixed32 => 4,
+ WireTypeVarint => value.len_varint(),
+ _ => panic!(),
+ }
+}
+
+/// Integer value size when encoded as specified wire type.
+pub fn value_size<T: ProtobufVarint>(field_number: u32, value: T, wt: WireType) -> u32 {
+ tag_size(field_number) + value_size_no_tag(value, wt)
+}
+
+/// Integer value size when encoded as specified wire type.
+pub fn value_varint_zigzag_size_no_tag<T: ProtobufVarintZigzag>(value: T) -> u32 {
+ value.len_varint_zigzag()
+}
+
+/// Length of value when encoding with zigzag encoding with tag
+pub fn value_varint_zigzag_size<T: ProtobufVarintZigzag>(field_number: u32, value: T) -> u32 {
+ tag_size(field_number) + value_varint_zigzag_size_no_tag(value)
+}
+
+fn enum_size_no_tag<E: ProtobufEnum>(value: E) -> u32 {
+ value.value().len_varint()
+}
+
+/// Size of encoded enum field value.
+pub fn enum_size<E: ProtobufEnum>(field_number: u32, value: E) -> u32 {
+ tag_size(field_number) + enum_size_no_tag(value)
+}
+
+fn bytes_size_no_tag(bytes: &[u8]) -> u32 {
+ compute_raw_varint64_size(bytes.len() as u64) + bytes.len() as u32
+}
+
+/// Size of encoded bytes field.
+pub fn bytes_size(field_number: u32, bytes: &[u8]) -> u32 {
+ tag_size(field_number) + bytes_size_no_tag(bytes)
+}
+
+fn string_size_no_tag(s: &str) -> u32 {
+ bytes_size_no_tag(s.as_bytes())
+}
+
+/// Size of encoded string field.
+pub fn string_size(field_number: u32, s: &str) -> u32 {
+ tag_size(field_number) + string_size_no_tag(s)
+}
+
+/// Size of encoded unknown fields size.
+pub fn unknown_fields_size(unknown_fields: &UnknownFields) -> u32 {
+ let mut r = 0;
+ for (number, values) in unknown_fields {
+ r += (tag_size(number) + 4) * values.fixed32.len() as u32;
+ r += (tag_size(number) + 8) * values.fixed64.len() as u32;
+
+ r += tag_size(number) * values.varint.len() as u32;
+ for varint in &values.varint {
+ r += varint.len_varint();
+ }
+
+ r += tag_size(number) * values.length_delimited.len() as u32;
+ for bytes in &values.length_delimited {
+ r += bytes_size_no_tag(&bytes);
+ }
+ }
+ r
+}
+
+/// Read repeated `int32` field into given vec.
+pub fn read_repeated_int32_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Vec<i32>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => is.read_repeated_packed_int32_into(target),
+ WireTypeVarint => {
+ target.push(is.read_int32()?);
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read repeated `int64` field into given vec.
+pub fn read_repeated_int64_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Vec<i64>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => is.read_repeated_packed_int64_into(target),
+ WireTypeVarint => {
+ target.push(is.read_int64()?);
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read repeated `uint32` field into given vec.
+pub fn read_repeated_uint32_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Vec<u32>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => is.read_repeated_packed_uint32_into(target),
+ WireTypeVarint => {
+ target.push(is.read_uint32()?);
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read repeated `uint64` field into given vec.
+pub fn read_repeated_uint64_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Vec<u64>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => is.read_repeated_packed_uint64_into(target),
+ WireTypeVarint => {
+ target.push(is.read_uint64()?);
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read repeated `sint32` field into given vec.
+pub fn read_repeated_sint32_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Vec<i32>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => is.read_repeated_packed_sint32_into(target),
+ WireTypeVarint => {
+ target.push(is.read_sint32()?);
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read repeated `sint64` field into given vec.
+pub fn read_repeated_sint64_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Vec<i64>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => is.read_repeated_packed_sint64_into(target),
+ WireTypeVarint => {
+ target.push(is.read_sint64()?);
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read repeated `fixed32` field into given vec.
+pub fn read_repeated_fixed32_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Vec<u32>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => is.read_repeated_packed_fixed32_into(target),
+ WireTypeFixed32 => {
+ target.push(is.read_fixed32()?);
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read repeated `fixed64` field into given vec.
+pub fn read_repeated_fixed64_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Vec<u64>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => is.read_repeated_packed_fixed64_into(target),
+ WireTypeFixed64 => {
+ target.push(is.read_fixed64()?);
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read repeated `sfixed32` field into given vec.
+pub fn read_repeated_sfixed32_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Vec<i32>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => is.read_repeated_packed_sfixed32_into(target),
+ WireTypeFixed32 => {
+ target.push(is.read_sfixed32()?);
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read repeated `sfixed64` field into given vec.
+pub fn read_repeated_sfixed64_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Vec<i64>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => is.read_repeated_packed_sfixed64_into(target),
+ WireTypeFixed64 => {
+ target.push(is.read_sfixed64()?);
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read repeated `double` field into given vec.
+pub fn read_repeated_double_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Vec<f64>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => is.read_repeated_packed_double_into(target),
+ WireTypeFixed64 => {
+ target.push(is.read_double()?);
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read repeated `float` field into given vec.
+pub fn read_repeated_float_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Vec<f32>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => is.read_repeated_packed_float_into(target),
+ WireTypeFixed32 => {
+ target.push(is.read_float()?);
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read repeated `bool` field into given vec.
+pub fn read_repeated_bool_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Vec<bool>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => is.read_repeated_packed_bool_into(target),
+ WireTypeVarint => {
+ target.push(is.read_bool()?);
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read repeated `enum` field into given vec.
+/// This function is no longer called from generated code, remove in 1.5.
+pub fn read_repeated_enum_into<E: ProtobufEnum>(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Vec<E>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => is.read_repeated_packed_enum_into(target),
+ WireTypeVarint => {
+ target.push(is.read_enum()?);
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Helper function to read single enum value.
+#[inline]
+fn read_enum_with_unknown_fields_into<E: ProtobufEnum, C>(
+ is: &mut CodedInputStream,
+ target: C,
+ field_number: u32,
+ unknown_fields: &mut UnknownFields,
+) -> ProtobufResult<()>
+where
+ C: FnOnce(E),
+{
+ let i = is.read_int32()?;
+ match ProtobufEnum::from_i32(i) {
+ Some(e) => target(e),
+ None => unknown_fields.add_varint(field_number, i as i64 as u64),
+ }
+ Ok(())
+}
+
+fn read_repeated_packed_enum_with_unknown_fields_into<E: ProtobufEnum>(
+ is: &mut CodedInputStream,
+ target: &mut Vec<E>,
+ field_number: u32,
+ unknown_fields: &mut UnknownFields,
+) -> ProtobufResult<()> {
+ let len = is.read_raw_varint64()?;
+ let old_limit = is.push_limit(len)?;
+ while !is.eof()? {
+ read_enum_with_unknown_fields_into(is, |e| target.push(e), field_number, unknown_fields)?;
+ }
+ is.pop_limit(old_limit);
+ Ok(())
+}
+
+/// Read repeated `enum` field into given vec,
+/// and when value is unknown store it in unknown fields
+/// which matches proto2 spec.
+///
+/// See explanation
+/// [here](https://github.com/stepancheg/rust-protobuf/issues/233#issuecomment-375142710)
+pub fn read_repeated_enum_with_unknown_fields_into<E: ProtobufEnum>(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Vec<E>,
+ field_number: u32,
+ unknown_fields: &mut UnknownFields,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => read_repeated_packed_enum_with_unknown_fields_into(
+ is,
+ target,
+ field_number,
+ unknown_fields,
+ ),
+ WireTypeVarint => {
+ read_enum_with_unknown_fields_into(is, |e| target.push(e), field_number, unknown_fields)
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read repeated `enum` field into given vec,
+/// and when value is unknown store it in unknown fields
+/// which matches proto2 spec.
+///
+/// See explanation
+/// [here](https://github.com/stepancheg/rust-protobuf/issues/233#issuecomment-375142710)
+pub fn read_proto3_enum_with_unknown_fields_into<E: ProtobufEnum>(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut E,
+ field_number: u32,
+ unknown_fields: &mut UnknownFields,
+) -> ProtobufResult<()> {
+ if wire_type != WireType::WireTypeVarint {
+ return Err(unexpected_wire_type(wire_type));
+ }
+
+ read_enum_with_unknown_fields_into(is, |e| *target = e, field_number, unknown_fields)
+}
+
+/// Read repeated `enum` field into given vec,
+/// and when value is unknown store it in unknown fields
+/// which matches proto2 spec.
+///
+/// See explanation
+/// [here](https://github.com/stepancheg/rust-protobuf/issues/233#issuecomment-375142710)
+pub fn read_proto2_enum_with_unknown_fields_into<E: ProtobufEnum>(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Option<E>,
+ field_number: u32,
+ unknown_fields: &mut UnknownFields,
+) -> ProtobufResult<()> {
+ if wire_type != WireType::WireTypeVarint {
+ return Err(unexpected_wire_type(wire_type));
+ }
+
+ read_enum_with_unknown_fields_into(is, |e| *target = Some(e), field_number, unknown_fields)
+}
+
+/// Read repeated `string` field into given vec.
+pub fn read_repeated_string_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut RepeatedField<String>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => {
+ let tmp = target.push_default();
+ is.read_string_into(tmp)
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read repeated `Chars` field into given vec.
+#[cfg(feature = "bytes")]
+pub fn read_repeated_carllerche_string_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Vec<Chars>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => {
+ target.push(is.read_carllerche_chars()?);
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read singular `string` field.
+pub fn read_singular_string_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut SingularField<String>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => {
+ let tmp = target.set_default();
+ is.read_string_into(tmp)
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read singular `Chars` field.
+#[cfg(feature = "bytes")]
+pub fn read_singular_carllerche_string_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Option<Chars>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => {
+ *target = Some(is.read_carllerche_chars()?);
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read singular `string` field for proto3.
+pub fn read_singular_proto3_string_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut String,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => is.read_string_into(target),
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read singular `Chars` field for proto3.
+#[cfg(feature = "bytes")]
+pub fn read_singular_proto3_carllerche_string_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Chars,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => {
+ *target = is.read_carllerche_chars()?;
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read repeated `bytes` field into given vec.
+pub fn read_repeated_bytes_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut RepeatedField<Vec<u8>>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => {
+ let tmp = target.push_default();
+ is.read_bytes_into(tmp)
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read repeated `Bytes` field into given vec.
+#[cfg(feature = "bytes")]
+pub fn read_repeated_carllerche_bytes_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Vec<Bytes>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => {
+ target.push(is.read_carllerche_bytes()?);
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read singular `bytes` field.
+pub fn read_singular_bytes_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut SingularField<Vec<u8>>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => {
+ let tmp = target.set_default();
+ is.read_bytes_into(tmp)
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read singular `Bytes` field.
+#[cfg(feature = "bytes")]
+pub fn read_singular_carllerche_bytes_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Option<Bytes>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => {
+ *target = Some(is.read_carllerche_bytes()?);
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read singular `bytes` field for proto3.
+pub fn read_singular_proto3_bytes_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Vec<u8>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => is.read_bytes_into(target),
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read singular `Bytes` field for proto3.
+#[cfg(feature = "bytes")]
+pub fn read_singular_proto3_carllerche_bytes_into(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut Bytes,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => {
+ *target = is.read_carllerche_bytes()?;
+ Ok(())
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read repeated `message` field.
+pub fn read_repeated_message_into<M: Message + Default>(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut RepeatedField<M>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => {
+ is.incr_recursion()?;
+ let tmp = target.push_default();
+ let res = is.merge_message(tmp);
+ is.decr_recursion();
+ res
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+/// Read singular `message` field.
+pub fn read_singular_message_into<M: Message + Default>(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut SingularPtrField<M>,
+) -> ProtobufResult<()> {
+ match wire_type {
+ WireTypeLengthDelimited => {
+ is.incr_recursion()?;
+ let tmp = target.set_default();
+ let res = is.merge_message(tmp);
+ is.decr_recursion();
+ res
+ }
+ _ => Err(unexpected_wire_type(wire_type)),
+ }
+}
+
+fn skip_group(is: &mut CodedInputStream) -> ProtobufResult<()> {
+ loop {
+ let (_, wire_type) = is.read_tag_unpack()?;
+ if wire_type == wire_format::WireTypeEndGroup {
+ return Ok(());
+ }
+ is.skip_field(wire_type)?;
+ }
+}
+
+/// Handle unknown field in generated code.
+/// Either store a value in unknown, or skip a group.
+pub fn read_unknown_or_skip_group(
+ field_number: u32,
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ unknown_fields: &mut UnknownFields,
+) -> ProtobufResult<()> {
+ match wire_type {
+ wire_format::WireTypeStartGroup => skip_group(is),
+ _ => {
+ let unknown = is.read_unknown(wire_type)?;
+ unknown_fields.add_value(field_number, unknown);
+ Ok(())
+ }
+ }
+}
+
+/// Create an error for unexpected wire type.
+///
+/// Function is used in generated code, so error types can be changed,
+/// but this function remains unchanged.
+pub fn unexpected_wire_type(wire_type: WireType) -> ProtobufError {
+ ProtobufError::WireError(WireError::UnexpectedWireType(wire_type))
+}
+
+/// Compute serialized size of `map` field and cache nested field sizes.
+pub fn compute_map_size<K, V>(field_number: u32, map: &HashMap<K::Value, V::Value>) -> u32
+where
+ K: ProtobufType,
+ V: ProtobufType,
+ K::Value: Eq + Hash,
+{
+ let mut sum = 0;
+ for (k, v) in map {
+ let key_tag_size = 1;
+ let value_tag_size = 1;
+
+ let key_len = K::compute_size_with_length_delimiter(k);
+ let value_len = V::compute_size_with_length_delimiter(v);
+
+ let entry_len = key_tag_size + key_len + value_tag_size + value_len;
+ sum += tag_size(field_number) + compute_raw_varint32_size(entry_len) + entry_len;
+ }
+ sum
+}
+
+/// Write map, message sizes must be already known.
+pub fn write_map_with_cached_sizes<K, V>(
+ field_number: u32,
+ map: &HashMap<K::Value, V::Value>,
+ os: &mut CodedOutputStream,
+) -> ProtobufResult<()>
+where
+ K: ProtobufType,
+ V: ProtobufType,
+ K::Value: Eq + Hash,
+{
+ for (k, v) in map {
+ let key_tag_size = 1;
+ let value_tag_size = 1;
+
+ let key_len = K::get_cached_size_with_length_delimiter(k);
+ let value_len = V::get_cached_size_with_length_delimiter(v);
+
+ let entry_len = key_tag_size + key_len + value_tag_size + value_len;
+
+ os.write_tag(field_number, WireType::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(entry_len)?;
+ K::write_with_cached_size(1, k, os)?;
+ V::write_with_cached_size(2, v, os)?;
+ }
+ Ok(())
+}
+
+/// Read `map` field.
+pub fn read_map_into<K, V>(
+ wire_type: WireType,
+ is: &mut CodedInputStream,
+ target: &mut HashMap<K::Value, V::Value>,
+) -> ProtobufResult<()>
+where
+ K: ProtobufType,
+ V: ProtobufType,
+ K::Value: Eq + Hash + Default,
+ V::Value: Default,
+{
+ if wire_type != WireType::WireTypeLengthDelimited {
+ return Err(unexpected_wire_type(wire_type));
+ }
+
+ let mut key = Default::default();
+ let mut value = Default::default();
+
+ let len = is.read_raw_varint32()?;
+ let old_limit = is.push_limit(len as u64)?;
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ if wire_type != K::wire_type() {
+ return Err(unexpected_wire_type(wire_type));
+ }
+ key = K::read(is)?;
+ }
+ 2 => {
+ if wire_type != V::wire_type() {
+ return Err(unexpected_wire_type(wire_type));
+ }
+ value = V::read(is)?;
+ }
+ _ => is.skip_field(wire_type)?,
+ }
+ }
+ is.pop_limit(old_limit);
+
+ target.insert(key, value);
+
+ Ok(())
+}
diff --git a/src/rust.rs b/src/rust.rs
new file mode 100644
index 0000000..9d4995b
--- /dev/null
+++ b/src/rust.rs
@@ -0,0 +1,121 @@
+#[cfg_attr(rustfmt, rustfmt_skip)]
+static RUST_KEYWORDS: &'static [&'static str] = &[
+ "as",
+ "async",
+ "await",
+ "break",
+ "crate",
+ "dyn",
+ "else",
+ "enum",
+ "extern",
+ "false",
+ "fn",
+ "for",
+ "if",
+ "impl",
+ "in",
+ "let",
+ "loop",
+ "match",
+ "mod",
+ "move",
+ "mut",
+ "pub",
+ "ref",
+ "return",
+ "static",
+ "self",
+ "Self",
+ "struct",
+ "super",
+ "true",
+ "trait",
+ "type",
+ "unsafe",
+ "use",
+ "while",
+ "continue",
+ "box",
+ "const",
+ "where",
+ "virtual",
+ "proc",
+ "alignof",
+ "become",
+ "offsetof",
+ "priv",
+ "pure",
+ "sizeof",
+ "typeof",
+ "unsized",
+ "yield",
+ "do",
+ "abstract",
+ "final",
+ "override",
+ "macro",
+];
+
+pub fn is_rust_keyword(ident: &str) -> bool {
+ RUST_KEYWORDS.contains(&ident)
+}
+
+fn hex_digit(value: u32) -> char {
+ if value < 10 {
+ (b'0' + value as u8) as char
+ } else if value < 0x10 {
+ (b'a' + value as u8 - 10) as char
+ } else {
+ unreachable!()
+ }
+}
+
+pub fn quote_escape_str(s: &str) -> String {
+ let mut buf = String::new();
+ buf.push('"');
+ buf.extend(s.chars().flat_map(|c| c.escape_default()));
+ buf.push('"');
+ buf
+}
+
+pub fn quote_escape_bytes(bytes: &[u8]) -> String {
+ let mut buf = String::new();
+ buf.push('b');
+ buf.push('"');
+ for &b in bytes {
+ match b {
+ b'\n' => buf.push_str(r"\n"),
+ b'\r' => buf.push_str(r"\r"),
+ b'\t' => buf.push_str(r"\t"),
+ b'"' => buf.push_str("\\\""),
+ b'\\' => buf.push_str(r"\\"),
+ b'\x20'..=b'\x7e' => buf.push(b as char),
+ _ => {
+ buf.push_str(r"\x");
+ buf.push(hex_digit((b as u32) >> 4));
+ buf.push(hex_digit((b as u32) & 0x0f));
+ }
+ }
+ }
+ buf.push('"');
+ buf
+}
+
+#[cfg(test)]
+mod test {
+
+ use super::*;
+
+ #[test]
+ fn test_quote_escape_bytes() {
+ assert_eq!("b\"\"", quote_escape_bytes(b""));
+ assert_eq!("b\"xyZW\"", quote_escape_bytes(b"xyZW"));
+ assert_eq!("b\"aa\\\"bb\"", quote_escape_bytes(b"aa\"bb"));
+ assert_eq!("b\"aa\\r\\n\\tbb\"", quote_escape_bytes(b"aa\r\n\tbb"));
+ assert_eq!(
+ "b\"\\x00\\x01\\x12\\xfe\\xff\"",
+ quote_escape_bytes(b"\x00\x01\x12\xfe\xff")
+ );
+ }
+}
diff --git a/src/rustproto.rs b/src/rustproto.rs
new file mode 100644
index 0000000..92c2547
--- /dev/null
+++ b/src/rustproto.rs
@@ -0,0 +1,200 @@
+// This file is generated by rust-protobuf 2.14.0-pre. Do not edit
+// @generated
+
+// https://github.com/rust-lang/rust-clippy/issues/702
+#![allow(unknown_lints)]
+#![allow(clippy::all)]
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
+#![allow(box_pointers)]
+#![allow(dead_code)]
+#![allow(missing_docs)]
+#![allow(non_camel_case_types)]
+#![allow(non_snake_case)]
+#![allow(non_upper_case_globals)]
+#![allow(trivial_casts)]
+#![allow(unsafe_code)]
+#![allow(unused_imports)]
+#![allow(unused_results)]
+//! Generated file from `rustproto.proto`
+
+use protobuf::Message as Message_imported_for_functions;
+use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
+
+pub mod exts {
+ use protobuf::Message as Message_imported_for_functions;
+
+ pub const expose_oneof_all: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::FileOptions, ::protobuf::types::ProtobufTypeBool> = ::protobuf::ext::ExtFieldOptional { field_number: 17001, phantom: ::std::marker::PhantomData };
+
+ pub const expose_fields_all: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::FileOptions, ::protobuf::types::ProtobufTypeBool> = ::protobuf::ext::ExtFieldOptional { field_number: 17003, phantom: ::std::marker::PhantomData };
+
+ pub const generate_accessors_all: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::FileOptions, ::protobuf::types::ProtobufTypeBool> = ::protobuf::ext::ExtFieldOptional { field_number: 17004, phantom: ::std::marker::PhantomData };
+
+ pub const carllerche_bytes_for_bytes_all: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::FileOptions, ::protobuf::types::ProtobufTypeBool> = ::protobuf::ext::ExtFieldOptional { field_number: 17011, phantom: ::std::marker::PhantomData };
+
+ pub const carllerche_bytes_for_string_all: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::FileOptions, ::protobuf::types::ProtobufTypeBool> = ::protobuf::ext::ExtFieldOptional { field_number: 17012, phantom: ::std::marker::PhantomData };
+
+ pub const serde_derive_all: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::FileOptions, ::protobuf::types::ProtobufTypeBool> = ::protobuf::ext::ExtFieldOptional { field_number: 17030, phantom: ::std::marker::PhantomData };
+
+ pub const serde_derive_cfg_all: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::FileOptions, ::protobuf::types::ProtobufTypeString> = ::protobuf::ext::ExtFieldOptional { field_number: 17031, phantom: ::std::marker::PhantomData };
+
+ pub const lite_runtime_all: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::FileOptions, ::protobuf::types::ProtobufTypeBool> = ::protobuf::ext::ExtFieldOptional { field_number: 17035, phantom: ::std::marker::PhantomData };
+
+ pub const expose_oneof: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::MessageOptions, ::protobuf::types::ProtobufTypeBool> = ::protobuf::ext::ExtFieldOptional { field_number: 17001, phantom: ::std::marker::PhantomData };
+
+ pub const expose_fields: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::MessageOptions, ::protobuf::types::ProtobufTypeBool> = ::protobuf::ext::ExtFieldOptional { field_number: 17003, phantom: ::std::marker::PhantomData };
+
+ pub const generate_accessors: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::MessageOptions, ::protobuf::types::ProtobufTypeBool> = ::protobuf::ext::ExtFieldOptional { field_number: 17004, phantom: ::std::marker::PhantomData };
+
+ pub const carllerche_bytes_for_bytes: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::MessageOptions, ::protobuf::types::ProtobufTypeBool> = ::protobuf::ext::ExtFieldOptional { field_number: 17011, phantom: ::std::marker::PhantomData };
+
+ pub const carllerche_bytes_for_string: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::MessageOptions, ::protobuf::types::ProtobufTypeBool> = ::protobuf::ext::ExtFieldOptional { field_number: 17012, phantom: ::std::marker::PhantomData };
+
+ pub const serde_derive: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::MessageOptions, ::protobuf::types::ProtobufTypeBool> = ::protobuf::ext::ExtFieldOptional { field_number: 17030, phantom: ::std::marker::PhantomData };
+
+ pub const serde_derive_cfg: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::MessageOptions, ::protobuf::types::ProtobufTypeString> = ::protobuf::ext::ExtFieldOptional { field_number: 17031, phantom: ::std::marker::PhantomData };
+
+ pub const expose_fields_field: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::FieldOptions, ::protobuf::types::ProtobufTypeBool> = ::protobuf::ext::ExtFieldOptional { field_number: 17003, phantom: ::std::marker::PhantomData };
+
+ pub const generate_accessors_field: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::FieldOptions, ::protobuf::types::ProtobufTypeBool> = ::protobuf::ext::ExtFieldOptional { field_number: 17004, phantom: ::std::marker::PhantomData };
+
+ pub const carllerche_bytes_for_bytes_field: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::FieldOptions, ::protobuf::types::ProtobufTypeBool> = ::protobuf::ext::ExtFieldOptional { field_number: 17011, phantom: ::std::marker::PhantomData };
+
+ pub const carllerche_bytes_for_string_field: ::protobuf::ext::ExtFieldOptional<::protobuf::descriptor::FieldOptions, ::protobuf::types::ProtobufTypeBool> = ::protobuf::ext::ExtFieldOptional { field_number: 17012, phantom: ::std::marker::PhantomData };
+}
+
+static file_descriptor_proto_data: &'static [u8] = b"\
+ \n\x0frustproto.proto\x12\trustproto\x1a\x20google/protobuf/descriptor.p\
+ roto:H\n\x10expose_oneof_all\x18\xe9\x84\x01\x20\x01(\x08\x12\x1c.google\
+ .protobuf.FileOptionsR\x0eexposeOneofAll:J\n\x11expose_fields_all\x18\
+ \xeb\x84\x01\x20\x01(\x08\x12\x1c.google.protobuf.FileOptionsR\x0fexpose\
+ FieldsAll:T\n\x16generate_accessors_all\x18\xec\x84\x01\x20\x01(\x08\x12\
+ \x1c.google.protobuf.FileOptionsR\x14generateAccessorsAll:b\n\x1ecarller\
+ che_bytes_for_bytes_all\x18\xf3\x84\x01\x20\x01(\x08\x12\x1c.google.prot\
+ obuf.FileOptionsR\x1acarllercheBytesForBytesAll:d\n\x1fcarllerche_bytes_\
+ for_string_all\x18\xf4\x84\x01\x20\x01(\x08\x12\x1c.google.protobuf.File\
+ OptionsR\x1bcarllercheBytesForStringAll:H\n\x10serde_derive_all\x18\x86\
+ \x85\x01\x20\x01(\x08\x12\x1c.google.protobuf.FileOptionsR\x0eserdeDeriv\
+ eAll:O\n\x14serde_derive_cfg_all\x18\x87\x85\x01\x20\x01(\t\x12\x1c.goog\
+ le.protobuf.FileOptionsR\x11serdeDeriveCfgAll:H\n\x10lite_runtime_all\
+ \x18\x8b\x85\x01\x20\x01(\x08\x12\x1c.google.protobuf.FileOptionsR\x0eli\
+ teRuntimeAll:D\n\x0cexpose_oneof\x18\xe9\x84\x01\x20\x01(\x08\x12\x1f.go\
+ ogle.protobuf.MessageOptionsR\x0bexposeOneof:F\n\rexpose_fields\x18\xeb\
+ \x84\x01\x20\x01(\x08\x12\x1f.google.protobuf.MessageOptionsR\x0cexposeF\
+ ields:P\n\x12generate_accessors\x18\xec\x84\x01\x20\x01(\x08\x12\x1f.goo\
+ gle.protobuf.MessageOptionsR\x11generateAccessors:^\n\x1acarllerche_byte\
+ s_for_bytes\x18\xf3\x84\x01\x20\x01(\x08\x12\x1f.google.protobuf.Message\
+ OptionsR\x17carllercheBytesForBytes:`\n\x1bcarllerche_bytes_for_string\
+ \x18\xf4\x84\x01\x20\x01(\x08\x12\x1f.google.protobuf.MessageOptionsR\
+ \x18carllercheBytesForString:D\n\x0cserde_derive\x18\x86\x85\x01\x20\x01\
+ (\x08\x12\x1f.google.protobuf.MessageOptionsR\x0bserdeDerive:K\n\x10serd\
+ e_derive_cfg\x18\x87\x85\x01\x20\x01(\t\x12\x1f.google.protobuf.MessageO\
+ ptionsR\x0eserdeDeriveCfg:O\n\x13expose_fields_field\x18\xeb\x84\x01\x20\
+ \x01(\x08\x12\x1d.google.protobuf.FieldOptionsR\x11exposeFieldsField:Y\n\
+ \x18generate_accessors_field\x18\xec\x84\x01\x20\x01(\x08\x12\x1d.google\
+ .protobuf.FieldOptionsR\x16generateAccessorsField:g\n\x20carllerche_byte\
+ s_for_bytes_field\x18\xf3\x84\x01\x20\x01(\x08\x12\x1d.google.protobuf.F\
+ ieldOptionsR\x1ccarllercheBytesForBytesField:i\n!carllerche_bytes_for_st\
+ ring_field\x18\xf4\x84\x01\x20\x01(\x08\x12\x1d.google.protobuf.FieldOpt\
+ ionsR\x1dcarllercheBytesForStringFieldJ\xf2\x13\n\x06\x12\x04\0\07\x01\n\
+ \x08\n\x01\x0c\x12\x03\0\0\x12\n\t\n\x02\x03\0\x12\x03\x02\0*\nh\n\x01\
+ \x02\x12\x03\x07\0\x122^\x20see\x20https://github.com/gogo/protobuf/blob\
+ /master/gogoproto/gogo.proto\n\x20for\x20the\x20original\x20idea\n\n\t\n\
+ \x01\x07\x12\x04\t\0\x1b\x01\n7\n\x02\x07\0\x12\x03\x0b\x04+\x1a,\x20Whe\
+ n\x20true,\x20oneof\x20field\x20is\x20generated\x20public\n\n\n\n\x03\
+ \x07\0\x02\x12\x03\t\x07\"\n\n\n\x03\x07\0\x04\x12\x03\x0b\x04\x0c\n\n\n\
+ \x03\x07\0\x05\x12\x03\x0b\r\x11\n\n\n\x03\x07\0\x01\x12\x03\x0b\x12\"\n\
+ \n\n\x03\x07\0\x03\x12\x03\x0b%*\nI\n\x02\x07\x01\x12\x03\r\x04,\x1a>\
+ \x20When\x20true\x20all\x20fields\x20are\x20public,\x20and\x20not\x20acc\
+ essors\x20generated\n\n\n\n\x03\x07\x01\x02\x12\x03\t\x07\"\n\n\n\x03\
+ \x07\x01\x04\x12\x03\r\x04\x0c\n\n\n\x03\x07\x01\x05\x12\x03\r\r\x11\n\n\
+ \n\x03\x07\x01\x01\x12\x03\r\x12#\n\n\n\x03\x07\x01\x03\x12\x03\r&+\nP\n\
+ \x02\x07\x02\x12\x03\x0f\x041\x1aE\x20When\x20false,\x20`get_`,\x20`set_\
+ `,\x20`mut_`\x20etc.\x20accessors\x20are\x20not\x20generated\n\n\n\n\x03\
+ \x07\x02\x02\x12\x03\t\x07\"\n\n\n\x03\x07\x02\x04\x12\x03\x0f\x04\x0c\n\
+ \n\n\x03\x07\x02\x05\x12\x03\x0f\r\x11\n\n\n\x03\x07\x02\x01\x12\x03\x0f\
+ \x12(\n\n\n\x03\x07\x02\x03\x12\x03\x0f+0\n2\n\x02\x07\x03\x12\x03\x11\
+ \x049\x1a'\x20Use\x20`bytes::Bytes`\x20for\x20`bytes`\x20fields\n\n\n\n\
+ \x03\x07\x03\x02\x12\x03\t\x07\"\n\n\n\x03\x07\x03\x04\x12\x03\x11\x04\
+ \x0c\n\n\n\x03\x07\x03\x05\x12\x03\x11\r\x11\n\n\n\x03\x07\x03\x01\x12\
+ \x03\x11\x120\n\n\n\x03\x07\x03\x03\x12\x03\x1138\n3\n\x02\x07\x04\x12\
+ \x03\x13\x04:\x1a(\x20Use\x20`bytes::Bytes`\x20for\x20`string`\x20fields\
+ \n\n\n\n\x03\x07\x04\x02\x12\x03\t\x07\"\n\n\n\x03\x07\x04\x04\x12\x03\
+ \x13\x04\x0c\n\n\n\x03\x07\x04\x05\x12\x03\x13\r\x11\n\n\n\x03\x07\x04\
+ \x01\x12\x03\x13\x121\n\n\n\x03\x07\x04\x03\x12\x03\x1349\nJ\n\x02\x07\
+ \x05\x12\x03\x15\x04+\x1a?\x20Use\x20`serde_derive`\x20to\x20implement\
+ \x20`Serialize`\x20and\x20`Deserialize`\n\n\n\n\x03\x07\x05\x02\x12\x03\
+ \t\x07\"\n\n\n\x03\x07\x05\x04\x12\x03\x15\x04\x0c\n\n\n\x03\x07\x05\x05\
+ \x12\x03\x15\r\x11\n\n\n\x03\x07\x05\x01\x12\x03\x15\x12\"\n\n\n\x03\x07\
+ \x05\x03\x12\x03\x15%*\n3\n\x02\x07\x06\x12\x03\x17\x041\x1a(\x20Guard\
+ \x20serde\x20annotations\x20with\x20cfg\x20attr.\n\n\n\n\x03\x07\x06\x02\
+ \x12\x03\t\x07\"\n\n\n\x03\x07\x06\x04\x12\x03\x17\x04\x0c\n\n\n\x03\x07\
+ \x06\x05\x12\x03\x17\r\x13\n\n\n\x03\x07\x06\x01\x12\x03\x17\x14(\n\n\n\
+ \x03\x07\x06\x03\x12\x03\x17+0\nN\n\x02\x07\x07\x12\x03\x1a\x04+\x1aC\
+ \x20When\x20true,\x20will\x20only\x20generate\x20codes\x20that\x20works\
+ \x20with\x20lite\x20runtime.\n\n\n\n\x03\x07\x07\x02\x12\x03\t\x07\"\n\n\
+ \n\x03\x07\x07\x04\x12\x03\x1a\x04\x0c\n\n\n\x03\x07\x07\x05\x12\x03\x1a\
+ \r\x11\n\n\n\x03\x07\x07\x01\x12\x03\x1a\x12\"\n\n\n\x03\x07\x07\x03\x12\
+ \x03\x1a%*\n\t\n\x01\x07\x12\x04\x1d\0,\x01\n7\n\x02\x07\x08\x12\x03\x1f\
+ \x04'\x1a,\x20When\x20true,\x20oneof\x20field\x20is\x20generated\x20publ\
+ ic\n\n\n\n\x03\x07\x08\x02\x12\x03\x1d\x07%\n\n\n\x03\x07\x08\x04\x12\
+ \x03\x1f\x04\x0c\n\n\n\x03\x07\x08\x05\x12\x03\x1f\r\x11\n\n\n\x03\x07\
+ \x08\x01\x12\x03\x1f\x12\x1e\n\n\n\x03\x07\x08\x03\x12\x03\x1f!&\nI\n\
+ \x02\x07\t\x12\x03!\x04(\x1a>\x20When\x20true\x20all\x20fields\x20are\
+ \x20public,\x20and\x20not\x20accessors\x20generated\n\n\n\n\x03\x07\t\
+ \x02\x12\x03\x1d\x07%\n\n\n\x03\x07\t\x04\x12\x03!\x04\x0c\n\n\n\x03\x07\
+ \t\x05\x12\x03!\r\x11\n\n\n\x03\x07\t\x01\x12\x03!\x12\x1f\n\n\n\x03\x07\
+ \t\x03\x12\x03!\"'\nP\n\x02\x07\n\x12\x03#\x04-\x1aE\x20When\x20false,\
+ \x20`get_`,\x20`set_`,\x20`mut_`\x20etc.\x20accessors\x20are\x20not\x20g\
+ enerated\n\n\n\n\x03\x07\n\x02\x12\x03\x1d\x07%\n\n\n\x03\x07\n\x04\x12\
+ \x03#\x04\x0c\n\n\n\x03\x07\n\x05\x12\x03#\r\x11\n\n\n\x03\x07\n\x01\x12\
+ \x03#\x12$\n\n\n\x03\x07\n\x03\x12\x03#',\n2\n\x02\x07\x0b\x12\x03%\x045\
+ \x1a'\x20Use\x20`bytes::Bytes`\x20for\x20`bytes`\x20fields\n\n\n\n\x03\
+ \x07\x0b\x02\x12\x03\x1d\x07%\n\n\n\x03\x07\x0b\x04\x12\x03%\x04\x0c\n\n\
+ \n\x03\x07\x0b\x05\x12\x03%\r\x11\n\n\n\x03\x07\x0b\x01\x12\x03%\x12,\n\
+ \n\n\x03\x07\x0b\x03\x12\x03%/4\n3\n\x02\x07\x0c\x12\x03'\x046\x1a(\x20U\
+ se\x20`bytes::Bytes`\x20for\x20`string`\x20fields\n\n\n\n\x03\x07\x0c\
+ \x02\x12\x03\x1d\x07%\n\n\n\x03\x07\x0c\x04\x12\x03'\x04\x0c\n\n\n\x03\
+ \x07\x0c\x05\x12\x03'\r\x11\n\n\n\x03\x07\x0c\x01\x12\x03'\x12-\n\n\n\
+ \x03\x07\x0c\x03\x12\x03'05\nJ\n\x02\x07\r\x12\x03)\x04'\x1a?\x20Use\x20\
+ `serde_derive`\x20to\x20implement\x20`Serialize`\x20and\x20`Deserialize`\
+ \n\n\n\n\x03\x07\r\x02\x12\x03\x1d\x07%\n\n\n\x03\x07\r\x04\x12\x03)\x04\
+ \x0c\n\n\n\x03\x07\r\x05\x12\x03)\r\x11\n\n\n\x03\x07\r\x01\x12\x03)\x12\
+ \x1e\n\n\n\x03\x07\r\x03\x12\x03)!&\n3\n\x02\x07\x0e\x12\x03+\x04-\x1a(\
+ \x20Guard\x20serde\x20annotations\x20with\x20cfg\x20attr.\n\n\n\n\x03\
+ \x07\x0e\x02\x12\x03\x1d\x07%\n\n\n\x03\x07\x0e\x04\x12\x03+\x04\x0c\n\n\
+ \n\x03\x07\x0e\x05\x12\x03+\r\x13\n\n\n\x03\x07\x0e\x01\x12\x03+\x14$\n\
+ \n\n\x03\x07\x0e\x03\x12\x03+',\n\t\n\x01\x07\x12\x04.\07\x01\nI\n\x02\
+ \x07\x0f\x12\x030\x04.\x1a>\x20When\x20true\x20all\x20fields\x20are\x20p\
+ ublic,\x20and\x20not\x20accessors\x20generated\n\n\n\n\x03\x07\x0f\x02\
+ \x12\x03.\x07#\n\n\n\x03\x07\x0f\x04\x12\x030\x04\x0c\n\n\n\x03\x07\x0f\
+ \x05\x12\x030\r\x11\n\n\n\x03\x07\x0f\x01\x12\x030\x12%\n\n\n\x03\x07\
+ \x0f\x03\x12\x030(-\nP\n\x02\x07\x10\x12\x032\x043\x1aE\x20When\x20false\
+ ,\x20`get_`,\x20`set_`,\x20`mut_`\x20etc.\x20accessors\x20are\x20not\x20\
+ generated\n\n\n\n\x03\x07\x10\x02\x12\x03.\x07#\n\n\n\x03\x07\x10\x04\
+ \x12\x032\x04\x0c\n\n\n\x03\x07\x10\x05\x12\x032\r\x11\n\n\n\x03\x07\x10\
+ \x01\x12\x032\x12*\n\n\n\x03\x07\x10\x03\x12\x032-2\n2\n\x02\x07\x11\x12\
+ \x034\x04;\x1a'\x20Use\x20`bytes::Bytes`\x20for\x20`bytes`\x20fields\n\n\
+ \n\n\x03\x07\x11\x02\x12\x03.\x07#\n\n\n\x03\x07\x11\x04\x12\x034\x04\
+ \x0c\n\n\n\x03\x07\x11\x05\x12\x034\r\x11\n\n\n\x03\x07\x11\x01\x12\x034\
+ \x122\n\n\n\x03\x07\x11\x03\x12\x0345:\n3\n\x02\x07\x12\x12\x036\x04<\
+ \x1a(\x20Use\x20`bytes::Bytes`\x20for\x20`string`\x20fields\n\n\n\n\x03\
+ \x07\x12\x02\x12\x03.\x07#\n\n\n\x03\x07\x12\x04\x12\x036\x04\x0c\n\n\n\
+ \x03\x07\x12\x05\x12\x036\r\x11\n\n\n\x03\x07\x12\x01\x12\x036\x123\n\n\
+ \n\x03\x07\x12\x03\x12\x0366;\
+";
+
+static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+
+fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
+ ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
+}
+
+pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
+ unsafe {
+ file_descriptor_proto_lazy.get(|| {
+ parse_descriptor_proto()
+ })
+ }
+}
diff --git a/src/singular.rs b/src/singular.rs
new file mode 100644
index 0000000..71d4f0a
--- /dev/null
+++ b/src/singular.rs
@@ -0,0 +1,580 @@
+#[cfg(feature = "with-serde")]
+use serde;
+
+use std::default::Default;
+use std::fmt;
+use std::hash::Hash;
+use std::hash::Hasher;
+use std::mem;
+use std::option;
+
+use clear::Clear;
+
+/// Like `Option<T>`, but keeps the actual element on `clear`.
+pub struct SingularField<T> {
+ value: T,
+ set: bool,
+}
+
+/// Like `Option<Box<T>>`, but keeps the actual element on `clear`.
+pub struct SingularPtrField<T> {
+ value: Option<Box<T>>,
+ set: bool,
+}
+
+impl<T> SingularField<T> {
+ /// Construct this object from given value.
+ #[inline]
+ pub fn some(value: T) -> SingularField<T> {
+ SingularField {
+ value: value,
+ set: true,
+ }
+ }
+
+ /// True iff this object contains data.
+ #[inline]
+ pub fn is_some(&self) -> bool {
+ self.set
+ }
+
+ /// True iff this object contains no data.
+ #[inline]
+ pub fn is_none(&self) -> bool {
+ !self.is_some()
+ }
+
+ /// Convert this object into `Option`.
+ #[inline]
+ pub fn into_option(self) -> Option<T> {
+ if self.set {
+ Some(self.value)
+ } else {
+ None
+ }
+ }
+
+ /// View data as `Option`.
+ #[inline]
+ pub fn as_ref<'a>(&'a self) -> Option<&'a T> {
+ if self.set {
+ Some(&self.value)
+ } else {
+ None
+ }
+ }
+
+ /// View data as mutable `Option`.
+ #[inline]
+ pub fn as_mut<'a>(&'a mut self) -> Option<&'a mut T> {
+ if self.set {
+ Some(&mut self.value)
+ } else {
+ None
+ }
+ }
+
+ /// Unwrap data as reference.
+ #[inline]
+ pub fn unwrap_ref<'a>(&'a self) -> &'a T {
+ self.as_ref().unwrap()
+ }
+
+ /// Unwrap data as mutable reference.
+ #[inline]
+ pub fn unwrap_mut_ref<'a>(&'a mut self) -> &'a mut T {
+ self.as_mut().unwrap()
+ }
+
+ /// Unwrap data, panic if not set.
+ #[inline]
+ pub fn unwrap(self) -> T {
+ if self.set {
+ self.value
+ } else {
+ panic!();
+ }
+ }
+
+ /// Unwrap data or return given default value.
+ #[inline]
+ pub fn unwrap_or(self, def: T) -> T {
+ if self.set {
+ self.value
+ } else {
+ def
+ }
+ }
+
+ /// Unwrap data or return given default value.
+ #[inline]
+ pub fn unwrap_or_else<F>(self, f: F) -> T
+ where
+ F: FnOnce() -> T,
+ {
+ if self.set {
+ self.value
+ } else {
+ f()
+ }
+ }
+
+ /// Apply a function to contained element and store result in new `SingularPtrField`.
+ #[inline]
+ pub fn map<U, F>(self, f: F) -> SingularPtrField<U>
+ where
+ F: FnOnce(T) -> U,
+ {
+ SingularPtrField::from_option(self.into_option().map(f))
+ }
+
+ /// View as iterator over references.
+ #[inline]
+ pub fn iter<'a>(&'a self) -> option::IntoIter<&'a T> {
+ self.as_ref().into_iter()
+ }
+
+ /// View as iterator over mutable references.
+ #[inline]
+ pub fn mut_iter<'a>(&'a mut self) -> option::IntoIter<&'a mut T> {
+ self.as_mut().into_iter()
+ }
+
+ /// Clear this object.
+ /// Note, contained object destructor is not called, so allocated memory could be reused.
+ #[inline]
+ pub fn clear(&mut self) {
+ self.set = false;
+ }
+}
+
+impl<T: Default> SingularField<T> {
+ /// Construct a `SingularField` with no data.
+ #[inline]
+ pub fn none() -> SingularField<T> {
+ SingularField {
+ value: Default::default(),
+ set: false,
+ }
+ }
+
+ /// Construct `SingularField` from `Option`.
+ #[inline]
+ pub fn from_option(option: Option<T>) -> SingularField<T> {
+ match option {
+ Some(x) => SingularField::some(x),
+ None => SingularField::none(),
+ }
+ }
+
+ /// Return data as option, clear this object.
+ #[inline]
+ pub fn take(&mut self) -> Option<T> {
+ if self.set {
+ self.set = false;
+ Some(mem::replace(&mut self.value, Default::default()))
+ } else {
+ None
+ }
+ }
+}
+
+impl<T> SingularPtrField<T> {
+ /// Construct `SingularPtrField` from given object.
+ #[inline]
+ pub fn some(value: T) -> SingularPtrField<T> {
+ SingularPtrField {
+ value: Some(Box::new(value)),
+ set: true,
+ }
+ }
+
+ /// Construct an empty `SingularPtrField`.
+ #[inline]
+ pub fn none() -> SingularPtrField<T> {
+ SingularPtrField {
+ value: None,
+ set: false,
+ }
+ }
+
+ /// Construct `SingularPtrField` from optional.
+ #[inline]
+ pub fn from_option(option: Option<T>) -> SingularPtrField<T> {
+ match option {
+ Some(x) => SingularPtrField::some(x),
+ None => SingularPtrField::none(),
+ }
+ }
+
+ /// True iff this object contains data.
+ #[inline]
+ pub fn is_some(&self) -> bool {
+ self.set
+ }
+
+ /// True iff this object contains no data.
+ #[inline]
+ pub fn is_none(&self) -> bool {
+ !self.is_some()
+ }
+
+ /// Convert into `Option<T>`.
+ #[inline]
+ pub fn into_option(self) -> Option<T> {
+ if self.set {
+ Some(*self.value.unwrap())
+ } else {
+ None
+ }
+ }
+
+ /// View data as reference option.
+ #[inline]
+ pub fn as_ref<'a>(&'a self) -> Option<&'a T> {
+ if self.set {
+ Some(&**self.value.as_ref().unwrap())
+ } else {
+ None
+ }
+ }
+
+ /// View data as mutable reference option.
+ #[inline]
+ pub fn as_mut<'a>(&'a mut self) -> Option<&'a mut T> {
+ if self.set {
+ Some(&mut **self.value.as_mut().unwrap())
+ } else {
+ None
+ }
+ }
+
+ /// Get data as reference.
+ /// Panics if empty.
+ #[inline]
+ pub fn get_ref<'a>(&'a self) -> &'a T {
+ self.as_ref().unwrap()
+ }
+
+ /// Get data as mutable reference.
+ /// Panics if empty.
+ #[inline]
+ pub fn get_mut_ref<'a>(&'a mut self) -> &'a mut T {
+ self.as_mut().unwrap()
+ }
+
+ /// Take the data.
+ /// Panics if empty
+ #[inline]
+ pub fn unwrap(self) -> T {
+ if self.set {
+ *self.value.unwrap()
+ } else {
+ panic!();
+ }
+ }
+
+ /// Take the data or return supplied default element if empty.
+ #[inline]
+ pub fn unwrap_or(self, def: T) -> T {
+ if self.set {
+ *self.value.unwrap()
+ } else {
+ def
+ }
+ }
+
+ /// Take the data or return supplied default element if empty.
+ #[inline]
+ pub fn unwrap_or_else<F>(self, f: F) -> T
+ where
+ F: FnOnce() -> T,
+ {
+ if self.set {
+ *self.value.unwrap()
+ } else {
+ f()
+ }
+ }
+
+ /// Apply given function to contained data to construct another `SingularPtrField`.
+ /// Returns empty `SingularPtrField` if this object is empty.
+ #[inline]
+ pub fn map<U, F>(self, f: F) -> SingularPtrField<U>
+ where
+ F: FnOnce(T) -> U,
+ {
+ SingularPtrField::from_option(self.into_option().map(f))
+ }
+
+ /// View data as iterator.
+ #[inline]
+ pub fn iter<'a>(&'a self) -> option::IntoIter<&'a T> {
+ self.as_ref().into_iter()
+ }
+
+ /// View data as mutable iterator.
+ #[inline]
+ pub fn mut_iter<'a>(&'a mut self) -> option::IntoIter<&'a mut T> {
+ self.as_mut().into_iter()
+ }
+
+ /// Take data as option, leaving this object empty.
+ #[inline]
+ pub fn take(&mut self) -> Option<T> {
+ if self.set {
+ self.set = false;
+ Some(*self.value.take().unwrap())
+ } else {
+ None
+ }
+ }
+
+ /// Clear this object, but do not call destructor of underlying data.
+ #[inline]
+ pub fn clear(&mut self) {
+ self.set = false;
+ }
+}
+
+impl<T: Default + Clear> SingularField<T> {
+ /// Get contained data, consume self. Return default value for type if this is empty.
+ #[inline]
+ pub fn unwrap_or_default(mut self) -> T {
+ self.value.clear();
+ self.value
+ }
+
+ /// Initialize this object with default value.
+ /// This operation can be more efficient then construction of clear element,
+ /// because it may reuse previously contained object.
+ #[inline]
+ pub fn set_default<'a>(&'a mut self) -> &'a mut T {
+ self.set = true;
+ self.value.clear();
+ &mut self.value
+ }
+}
+
+impl<T: Default + Clear> SingularPtrField<T> {
+ /// Get contained data, consume self. Return default value for type if this is empty.
+ #[inline]
+ pub fn unwrap_or_default(mut self) -> T {
+ if self.set {
+ self.unwrap()
+ } else if self.value.is_some() {
+ self.value.clear();
+ *self.value.unwrap()
+ } else {
+ Default::default()
+ }
+ }
+
+ /// Initialize this object with default value.
+ /// This operation can be more efficient then construction of clear element,
+ /// because it may reuse previously contained object.
+ #[inline]
+ pub fn set_default<'a>(&'a mut self) -> &'a mut T {
+ self.set = true;
+ if self.value.is_some() {
+ self.value.as_mut().unwrap().clear();
+ } else {
+ self.value = Some(Default::default());
+ }
+ self.as_mut().unwrap()
+ }
+}
+
+impl<T: Default> Default for SingularField<T> {
+ #[inline]
+ fn default() -> SingularField<T> {
+ SingularField::none()
+ }
+}
+
+impl<T> Default for SingularPtrField<T> {
+ #[inline]
+ fn default() -> SingularPtrField<T> {
+ SingularPtrField::none()
+ }
+}
+
+impl<T: Default> From<Option<T>> for SingularField<T> {
+ fn from(o: Option<T>) -> Self {
+ SingularField::from_option(o)
+ }
+}
+
+impl<T> From<Option<T>> for SingularPtrField<T> {
+ fn from(o: Option<T>) -> Self {
+ SingularPtrField::from_option(o)
+ }
+}
+
+impl<T: Clone + Default> Clone for SingularField<T> {
+ #[inline]
+ fn clone(&self) -> SingularField<T> {
+ if self.set {
+ SingularField::some(self.value.clone())
+ } else {
+ SingularField::none()
+ }
+ }
+}
+
+impl<T: Clone> Clone for SingularPtrField<T> {
+ #[inline]
+ fn clone(&self) -> SingularPtrField<T> {
+ if self.set {
+ SingularPtrField::some(self.as_ref().unwrap().clone())
+ } else {
+ SingularPtrField::none()
+ }
+ }
+}
+
+impl<T: fmt::Debug> fmt::Debug for SingularField<T> {
+ #[inline]
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ if self.is_some() {
+ write!(f, "Some({:?})", *self.as_ref().unwrap())
+ } else {
+ write!(f, "None")
+ }
+ }
+}
+
+impl<T: fmt::Debug> fmt::Debug for SingularPtrField<T> {
+ #[inline]
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ if self.is_some() {
+ write!(f, "Some({:?})", *self.as_ref().unwrap())
+ } else {
+ write!(f, "None")
+ }
+ }
+}
+
+impl<T: PartialEq> PartialEq for SingularField<T> {
+ #[inline]
+ fn eq(&self, other: &SingularField<T>) -> bool {
+ self.as_ref() == other.as_ref()
+ }
+}
+
+impl<T: Eq> Eq for SingularField<T> {}
+
+impl<T: PartialEq> PartialEq for SingularPtrField<T> {
+ #[inline]
+ fn eq(&self, other: &SingularPtrField<T>) -> bool {
+ self.as_ref() == other.as_ref()
+ }
+}
+
+impl<T: Eq> Eq for SingularPtrField<T> {}
+
+impl<T: Hash> Hash for SingularField<T> {
+ fn hash<H: Hasher>(&self, state: &mut H) {
+ self.as_ref().hash(state);
+ }
+}
+
+impl<T: Hash> Hash for SingularPtrField<T> {
+ fn hash<H: Hasher>(&self, state: &mut H) {
+ self.as_ref().hash(state);
+ }
+}
+
+impl<'a, T> IntoIterator for &'a SingularField<T> {
+ type Item = &'a T;
+ type IntoIter = option::IntoIter<&'a T>;
+
+ fn into_iter(self) -> option::IntoIter<&'a T> {
+ self.iter()
+ }
+}
+
+impl<'a, T> IntoIterator for &'a SingularPtrField<T> {
+ type Item = &'a T;
+ type IntoIter = option::IntoIter<&'a T>;
+
+ fn into_iter(self) -> option::IntoIter<&'a T> {
+ self.iter()
+ }
+}
+
+#[cfg(feature = "with-serde")]
+impl<T: serde::Serialize> serde::Serialize for SingularPtrField<T> {
+ fn serialize<S>(
+ &self,
+ serializer: S,
+ ) -> Result<<S as serde::Serializer>::Ok, <S as serde::Serializer>::Error>
+ where
+ S: serde::Serializer,
+ {
+ self.as_ref().serialize(serializer)
+ }
+}
+
+#[cfg(feature = "with-serde")]
+impl<T: serde::Serialize> serde::Serialize for SingularField<T> {
+ fn serialize<S>(
+ &self,
+ serializer: S,
+ ) -> Result<<S as serde::Serializer>::Ok, <S as serde::Serializer>::Error>
+ where
+ S: serde::Serializer,
+ {
+ self.as_ref().serialize(serializer)
+ }
+}
+
+#[cfg(feature = "with-serde")]
+impl<'de, T: serde::Deserialize<'de>> serde::Deserialize<'de> for SingularPtrField<T> {
+ fn deserialize<D>(deserializer: D) -> Result<Self, <D as serde::Deserializer<'de>>::Error>
+ where
+ D: serde::Deserializer<'de>,
+ {
+ Option::deserialize(deserializer).map(SingularPtrField::from_option)
+ }
+}
+
+#[cfg(feature = "with-serde")]
+impl<'de, T: serde::Deserialize<'de> + Default> serde::Deserialize<'de> for SingularField<T> {
+ fn deserialize<D>(deserializer: D) -> Result<Self, <D as serde::Deserializer<'de>>::Error>
+ where
+ D: serde::Deserializer<'de>,
+ {
+ Option::deserialize(deserializer).map(SingularField::from_option)
+ }
+}
+
+#[cfg(test)]
+mod test {
+ use super::SingularField;
+ use clear::Clear;
+
+ #[test]
+ fn test_set_default_clears() {
+ #[derive(Default)]
+ struct Foo {
+ b: isize,
+ }
+
+ impl Clear for Foo {
+ fn clear(&mut self) {
+ self.b = 0;
+ }
+ }
+
+ let mut x = SingularField::some(Foo { b: 10 });
+ x.clear();
+ x.set_default();
+ assert_eq!(0, x.as_ref().unwrap().b);
+
+ x.as_mut().unwrap().b = 11;
+ // without clear
+ x.set_default();
+ assert_eq!(0, x.as_ref().unwrap().b);
+ }
+}
diff --git a/src/stream.rs b/src/stream.rs
new file mode 100644
index 0000000..53c3f45
--- /dev/null
+++ b/src/stream.rs
@@ -0,0 +1,1802 @@
+#![doc(hidden)]
+
+//! `CodedInputStream` and `CodedOutputStream` implementations
+
+use std::io;
+use std::io::Write;
+use std::io::{BufRead, Read};
+use std::mem;
+use std::slice;
+
+#[cfg(feature = "bytes")]
+use bytes::Bytes;
+#[cfg(feature = "bytes")]
+use chars::Chars;
+
+use buf_read_iter::BufReadIter;
+use core::Message;
+use enums::ProtobufEnum;
+use error::ProtobufError;
+use error::ProtobufResult;
+use error::WireError;
+use misc::remaining_capacity_as_slice_mut;
+use misc::remove_lifetime_mut;
+use unknown::UnknownFields;
+use unknown::UnknownValue;
+use unknown::UnknownValueRef;
+use varint;
+use zigzag::decode_zig_zag_32;
+use zigzag::decode_zig_zag_64;
+use zigzag::encode_zig_zag_32;
+use zigzag::encode_zig_zag_64;
+
+/// Equal to the default buffer size of `BufWriter`, so when
+/// `CodedOutputStream` wraps `BufWriter`, it often skips double buffering.
+const OUTPUT_STREAM_BUFFER_SIZE: usize = 8 * 1024;
+
+/// Default recursion level limit. 100 is the default value of C++'s implementation.
+const DEFAULT_RECURSION_LIMIT: u32 = 100;
+
+/// Max allocated vec when reading length-delimited from unknown input stream
+pub(crate) const READ_RAW_BYTES_MAX_ALLOC: usize = 10_000_000;
+
+/// Serialization constants.
+pub mod wire_format {
+ // TODO: temporary
+ pub use self::WireType::*;
+
+ /// Tag occupies 3 bits
+ pub const TAG_TYPE_BITS: u32 = 3;
+ /// Tag mask
+ pub const TAG_TYPE_MASK: u32 = (1u32 << TAG_TYPE_BITS as usize) - 1;
+ /// Max possible field number
+ pub const FIELD_NUMBER_MAX: u32 = 0x1fffffff;
+
+ /// One of six defined protobuf wire types
+ #[derive(PartialEq, Eq, Clone, Debug)]
+ pub enum WireType {
+ /// Varint (e. g. `int32` or `sint64`)
+ WireTypeVarint = 0,
+ /// Fixed size 64 bit (e. g. `fixed64` or `double`)
+ WireTypeFixed64 = 1,
+ /// Length-delimited (e. g. `message` or `string`)
+ WireTypeLengthDelimited = 2,
+ /// Groups are not supported by rust-protobuf
+ WireTypeStartGroup = 3,
+ /// Groups are not supported by rust-protobuf
+ WireTypeEndGroup = 4,
+ /// Fixed size 64 bit (e. g. `fixed32` or `float`)
+ WireTypeFixed32 = 5,
+ }
+
+ impl Copy for WireType {}
+
+ impl WireType {
+ /// Parse wire type
+ pub fn new(n: u32) -> Option<WireType> {
+ match n {
+ 0 => Some(WireTypeVarint),
+ 1 => Some(WireTypeFixed64),
+ 2 => Some(WireTypeLengthDelimited),
+ 3 => Some(WireTypeStartGroup),
+ 4 => Some(WireTypeEndGroup),
+ 5 => Some(WireTypeFixed32),
+ _ => None,
+ }
+ }
+ }
+
+ /// Parsed protobuf tag, which is a pair of field number and wire type
+ #[derive(Clone)]
+ pub struct Tag {
+ field_number: u32,
+ wire_type: WireType,
+ }
+
+ impl Copy for Tag {}
+
+ impl Tag {
+ /// Pack a tag to integer
+ pub fn value(self) -> u32 {
+ (self.field_number << TAG_TYPE_BITS) | (self.wire_type as u32)
+ }
+
+ /// Parse integer into `Tag` object
+ // TODO: should return Result instead of Option
+ pub fn new(value: u32) -> Option<Tag> {
+ let wire_type = WireType::new(value & TAG_TYPE_MASK);
+ if wire_type.is_none() {
+ return None;
+ }
+ let field_number = value >> TAG_TYPE_BITS;
+ if field_number == 0 {
+ return None;
+ }
+ Some(Tag {
+ field_number: field_number,
+ wire_type: wire_type.unwrap(),
+ })
+ }
+
+ /// Create a tag from a field number and wire type.
+ ///
+ /// # Panics
+ ///
+ /// If field number is outside of allowed range.
+ pub fn make(field_number: u32, wire_type: WireType) -> Tag {
+ assert!(field_number > 0 && field_number <= FIELD_NUMBER_MAX);
+ Tag {
+ field_number: field_number,
+ wire_type: wire_type,
+ }
+ }
+
+ /// Tag as pair of (field number, wire type)
+ pub fn unpack(self) -> (u32, WireType) {
+ (self.field_number(), self.wire_type())
+ }
+
+ fn wire_type(self) -> WireType {
+ self.wire_type
+ }
+
+ /// Protobuf field number
+ pub fn field_number(self) -> u32 {
+ self.field_number
+ }
+ }
+}
+
+/// Buffered read with handy utilities.
+pub struct CodedInputStream<'a> {
+ source: BufReadIter<'a>,
+ recursion_level: u32,
+ recursion_limit: u32,
+}
+
+impl<'a> CodedInputStream<'a> {
+ /// Wrap a `Read`.
+ ///
+ /// Note resulting `CodedInputStream` is buffered even if `Read` is not.
+ pub fn new(read: &'a mut Read) -> CodedInputStream<'a> {
+ CodedInputStream::from_buf_read_iter(BufReadIter::from_read(read))
+ }
+
+ /// Create from `BufRead`.
+ ///
+ /// `CodedInputStream` will utilize `BufRead` buffer.
+ pub fn from_buffered_reader(buf_read: &'a mut BufRead) -> CodedInputStream<'a> {
+ CodedInputStream::from_buf_read_iter(BufReadIter::from_buf_read(buf_read))
+ }
+
+ /// Read from byte slice
+ pub fn from_bytes(bytes: &'a [u8]) -> CodedInputStream<'a> {
+ CodedInputStream::from_buf_read_iter(BufReadIter::from_byte_slice(bytes))
+ }
+
+ /// Read from `Bytes`.
+ ///
+ /// `CodedInputStream` operations like
+ /// [`read_carllerche_bytes`](crate::CodedInputStream::read_carllerche_bytes)
+ /// will return a shared copy of this bytes object.
+ #[cfg(feature = "bytes")]
+ pub fn from_carllerche_bytes(bytes: &'a Bytes) -> CodedInputStream<'a> {
+ CodedInputStream::from_buf_read_iter(BufReadIter::from_bytes(bytes))
+ }
+
+ fn from_buf_read_iter(source: BufReadIter<'a>) -> CodedInputStream<'a> {
+ CodedInputStream {
+ source: source,
+ recursion_level: 0,
+ recursion_limit: DEFAULT_RECURSION_LIMIT,
+ }
+ }
+
+ /// Set the recursion limit.
+ pub fn set_recursion_limit(&mut self, limit: u32) {
+ self.recursion_limit = limit;
+ }
+
+ #[inline]
+ pub(crate) fn incr_recursion(&mut self) -> ProtobufResult<()> {
+ if self.recursion_level >= self.recursion_limit {
+ return Err(ProtobufError::WireError(WireError::OverRecursionLimit));
+ }
+ self.recursion_level += 1;
+ Ok(())
+ }
+
+ #[inline]
+ pub(crate) fn decr_recursion(&mut self) {
+ self.recursion_level -= 1;
+ }
+
+ /// How many bytes processed
+ pub fn pos(&self) -> u64 {
+ self.source.pos()
+ }
+
+ /// How many bytes until current limit
+ pub fn bytes_until_limit(&self) -> u64 {
+ self.source.bytes_until_limit()
+ }
+
+ /// Read bytes into given `buf`.
+ ///
+ /// Return `0` on EOF.
+ // TODO: overload with `Read::read`
+ pub fn read(&mut self, buf: &mut [u8]) -> ProtobufResult<()> {
+ self.source.read_exact(buf)?;
+ Ok(())
+ }
+
+ /// Read exact number of bytes as `Bytes` object.
+ ///
+ /// This operation returns a shared view if `CodedInputStream` is
+ /// constructed with `Bytes` parameter.
+ #[cfg(feature = "bytes")]
+ fn read_raw_callerche_bytes(&mut self, count: usize) -> ProtobufResult<Bytes> {
+ self.source.read_exact_bytes(count)
+ }
+
+ /// Read one byte
+ #[inline(always)]
+ pub fn read_raw_byte(&mut self) -> ProtobufResult<u8> {
+ self.source.read_byte()
+ }
+
+ /// Push new limit, return previous limit.
+ pub fn push_limit(&mut self, limit: u64) -> ProtobufResult<u64> {
+ self.source.push_limit(limit)
+ }
+
+ /// Restore previous limit.
+ pub fn pop_limit(&mut self, old_limit: u64) {
+ self.source.pop_limit(old_limit);
+ }
+
+ /// Are we at EOF?
+ #[inline(always)]
+ pub fn eof(&mut self) -> ProtobufResult<bool> {
+ self.source.eof()
+ }
+
+ /// Check we are at EOF.
+ ///
+ /// Return error if we are not at EOF.
+ pub fn check_eof(&mut self) -> ProtobufResult<()> {
+ let eof = self.eof()?;
+ if !eof {
+ return Err(ProtobufError::WireError(WireError::UnexpectedEof));
+ }
+ Ok(())
+ }
+
+ fn read_raw_varint64_slow(&mut self) -> ProtobufResult<u64> {
+ let mut r: u64 = 0;
+ let mut i = 0;
+ loop {
+ if i == 10 {
+ return Err(ProtobufError::WireError(WireError::IncorrectVarint));
+ }
+ let b = self.read_raw_byte()?;
+ // TODO: may overflow if i == 9
+ r = r | (((b & 0x7f) as u64) << (i * 7));
+ i += 1;
+ if b < 0x80 {
+ return Ok(r);
+ }
+ }
+ }
+
+ /// Read varint
+ #[inline(always)]
+ pub fn read_raw_varint64(&mut self) -> ProtobufResult<u64> {
+ 'slow: loop {
+ let ret;
+ let consume;
+
+ loop {
+ let rem = self.source.remaining_in_buf();
+
+ if rem.len() >= 1 {
+ // most varints are in practice fit in 1 byte
+ if rem[0] < 0x80 {
+ ret = rem[0] as u64;
+ consume = 1;
+ } else {
+ // handle case of two bytes too
+ if rem.len() >= 2 && rem[1] < 0x80 {
+ ret = (rem[0] & 0x7f) as u64 | (rem[1] as u64) << 7;
+ consume = 2;
+ } else if rem.len() >= 10 {
+ // Read from array when buf at at least 10 bytes,
+ // max len for varint.
+ let mut r: u64 = 0;
+ let mut i: usize = 0;
+ {
+ let rem = rem;
+ loop {
+ if i == 10 {
+ return Err(ProtobufError::WireError(
+ WireError::IncorrectVarint,
+ ));
+ }
+
+ let b = if true {
+ // skip range check
+ unsafe { *rem.get_unchecked(i) }
+ } else {
+ rem[i]
+ };
+
+ // TODO: may overflow if i == 9
+ r = r | (((b & 0x7f) as u64) << (i * 7));
+ i += 1;
+ if b < 0x80 {
+ break;
+ }
+ }
+ }
+ consume = i;
+ ret = r;
+ } else {
+ break 'slow;
+ }
+ }
+ } else {
+ break 'slow;
+ }
+ break;
+ }
+
+ self.source.consume(consume);
+ return Ok(ret);
+ }
+
+ self.read_raw_varint64_slow()
+ }
+
+ /// Read varint
+ #[inline(always)]
+ pub fn read_raw_varint32(&mut self) -> ProtobufResult<u32> {
+ self.read_raw_varint64().map(|v| v as u32)
+ }
+
+ /// Read little-endian 32-bit integer
+ pub fn read_raw_little_endian32(&mut self) -> ProtobufResult<u32> {
+ let mut r = 0u32;
+ let bytes: &mut [u8] = unsafe {
+ let p: *mut u8 = mem::transmute(&mut r);
+ slice::from_raw_parts_mut(p, mem::size_of::<u32>())
+ };
+ self.read(bytes)?;
+ Ok(r.to_le())
+ }
+
+ /// Read little-endian 64-bit integer
+ pub fn read_raw_little_endian64(&mut self) -> ProtobufResult<u64> {
+ let mut r = 0u64;
+ let bytes: &mut [u8] = unsafe {
+ let p: *mut u8 = mem::transmute(&mut r);
+ slice::from_raw_parts_mut(p, mem::size_of::<u64>())
+ };
+ self.read(bytes)?;
+ Ok(r.to_le())
+ }
+
+ /// Read tag
+ #[inline]
+ pub fn read_tag(&mut self) -> ProtobufResult<wire_format::Tag> {
+ let v = self.read_raw_varint32()?;
+ match wire_format::Tag::new(v) {
+ Some(tag) => Ok(tag),
+ None => Err(ProtobufError::WireError(WireError::IncorrectTag(v))),
+ }
+ }
+
+ /// Read tag, return it is pair (field number, wire type)
+ #[inline]
+ pub fn read_tag_unpack(&mut self) -> ProtobufResult<(u32, wire_format::WireType)> {
+ self.read_tag().map(|t| t.unpack())
+ }
+
+ /// Read `double`
+ pub fn read_double(&mut self) -> ProtobufResult<f64> {
+ let bits = self.read_raw_little_endian64()?;
+ unsafe { Ok(mem::transmute::<u64, f64>(bits)) }
+ }
+
+ /// Read `float`
+ pub fn read_float(&mut self) -> ProtobufResult<f32> {
+ let bits = self.read_raw_little_endian32()?;
+ unsafe { Ok(mem::transmute::<u32, f32>(bits)) }
+ }
+
+ /// Read `int64`
+ pub fn read_int64(&mut self) -> ProtobufResult<i64> {
+ self.read_raw_varint64().map(|v| v as i64)
+ }
+
+ /// Read `int32`
+ pub fn read_int32(&mut self) -> ProtobufResult<i32> {
+ self.read_raw_varint32().map(|v| v as i32)
+ }
+
+ /// Read `uint64`
+ pub fn read_uint64(&mut self) -> ProtobufResult<u64> {
+ self.read_raw_varint64()
+ }
+
+ /// Read `uint32`
+ pub fn read_uint32(&mut self) -> ProtobufResult<u32> {
+ self.read_raw_varint32()
+ }
+
+ /// Read `sint64`
+ pub fn read_sint64(&mut self) -> ProtobufResult<i64> {
+ self.read_uint64().map(decode_zig_zag_64)
+ }
+
+ /// Read `sint32`
+ pub fn read_sint32(&mut self) -> ProtobufResult<i32> {
+ self.read_uint32().map(decode_zig_zag_32)
+ }
+
+ /// Read `fixed64`
+ pub fn read_fixed64(&mut self) -> ProtobufResult<u64> {
+ self.read_raw_little_endian64()
+ }
+
+ /// Read `fixed32`
+ pub fn read_fixed32(&mut self) -> ProtobufResult<u32> {
+ self.read_raw_little_endian32()
+ }
+
+ /// Read `sfixed64`
+ pub fn read_sfixed64(&mut self) -> ProtobufResult<i64> {
+ self.read_raw_little_endian64().map(|v| v as i64)
+ }
+
+ /// Read `sfixed32`
+ pub fn read_sfixed32(&mut self) -> ProtobufResult<i32> {
+ self.read_raw_little_endian32().map(|v| v as i32)
+ }
+
+ /// Read `bool`
+ pub fn read_bool(&mut self) -> ProtobufResult<bool> {
+ self.read_raw_varint32().map(|v| v != 0)
+ }
+
+ /// Read `enum` as `ProtobufEnum`
+ pub fn read_enum<E: ProtobufEnum>(&mut self) -> ProtobufResult<E> {
+ let i = self.read_int32()?;
+ match ProtobufEnum::from_i32(i) {
+ Some(e) => Ok(e),
+ None => Err(ProtobufError::WireError(WireError::InvalidEnumValue(i))),
+ }
+ }
+
+ /// Read `repeated` packed `double`
+ pub fn read_repeated_packed_double_into(
+ &mut self,
+ target: &mut Vec<f64>,
+ ) -> ProtobufResult<()> {
+ let len = self.read_raw_varint64()?;
+
+ target.reserve((len / 4) as usize);
+
+ let old_limit = self.push_limit(len)?;
+ while !self.eof()? {
+ target.push(self.read_double()?);
+ }
+ self.pop_limit(old_limit);
+ Ok(())
+ }
+
+ /// Read `repeated` packed `float`
+ pub fn read_repeated_packed_float_into(&mut self, target: &mut Vec<f32>) -> ProtobufResult<()> {
+ let len = self.read_raw_varint64()?;
+
+ target.reserve((len / 4) as usize);
+
+ let old_limit = self.push_limit(len)?;
+ while !self.eof()? {
+ target.push(self.read_float()?);
+ }
+ self.pop_limit(old_limit);
+ Ok(())
+ }
+
+ /// Read `repeated` packed `int64`
+ pub fn read_repeated_packed_int64_into(&mut self, target: &mut Vec<i64>) -> ProtobufResult<()> {
+ let len = self.read_raw_varint64()?;
+ let old_limit = self.push_limit(len as u64)?;
+ while !self.eof()? {
+ target.push(self.read_int64()?);
+ }
+ self.pop_limit(old_limit);
+ Ok(())
+ }
+
+ /// Read repeated packed `int32`
+ pub fn read_repeated_packed_int32_into(&mut self, target: &mut Vec<i32>) -> ProtobufResult<()> {
+ let len = self.read_raw_varint64()?;
+ let old_limit = self.push_limit(len)?;
+ while !self.eof()? {
+ target.push(self.read_int32()?);
+ }
+ self.pop_limit(old_limit);
+ Ok(())
+ }
+
+ /// Read repeated packed `uint64`
+ pub fn read_repeated_packed_uint64_into(
+ &mut self,
+ target: &mut Vec<u64>,
+ ) -> ProtobufResult<()> {
+ let len = self.read_raw_varint64()?;
+ let old_limit = self.push_limit(len)?;
+ while !self.eof()? {
+ target.push(self.read_uint64()?);
+ }
+ self.pop_limit(old_limit);
+ Ok(())
+ }
+
+ /// Read repeated packed `uint32`
+ pub fn read_repeated_packed_uint32_into(
+ &mut self,
+ target: &mut Vec<u32>,
+ ) -> ProtobufResult<()> {
+ let len = self.read_raw_varint64()?;
+ let old_limit = self.push_limit(len)?;
+ while !self.eof()? {
+ target.push(self.read_uint32()?);
+ }
+ self.pop_limit(old_limit);
+ Ok(())
+ }
+
+ /// Read repeated packed `sint64`
+ pub fn read_repeated_packed_sint64_into(
+ &mut self,
+ target: &mut Vec<i64>,
+ ) -> ProtobufResult<()> {
+ let len = self.read_raw_varint64()?;
+ let old_limit = self.push_limit(len)?;
+ while !self.eof()? {
+ target.push(self.read_sint64()?);
+ }
+ self.pop_limit(old_limit);
+ Ok(())
+ }
+
+ /// Read repeated packed `sint32`
+ pub fn read_repeated_packed_sint32_into(
+ &mut self,
+ target: &mut Vec<i32>,
+ ) -> ProtobufResult<()> {
+ let len = self.read_raw_varint64()?;
+ let old_limit = self.push_limit(len)?;
+ while !self.eof()? {
+ target.push(self.read_sint32()?);
+ }
+ self.pop_limit(old_limit);
+ Ok(())
+ }
+
+ /// Read repeated packed `fixed64`
+ pub fn read_repeated_packed_fixed64_into(
+ &mut self,
+ target: &mut Vec<u64>,
+ ) -> ProtobufResult<()> {
+ let len = self.read_raw_varint64()?;
+
+ target.reserve((len / 8) as usize);
+
+ let old_limit = self.push_limit(len)?;
+ while !self.eof()? {
+ target.push(self.read_fixed64()?);
+ }
+ self.pop_limit(old_limit);
+ Ok(())
+ }
+
+ /// Read repeated packed `fixed32`
+ pub fn read_repeated_packed_fixed32_into(
+ &mut self,
+ target: &mut Vec<u32>,
+ ) -> ProtobufResult<()> {
+ let len = self.read_raw_varint64()?;
+
+ target.reserve((len / 4) as usize);
+
+ let old_limit = self.push_limit(len)?;
+ while !self.eof()? {
+ target.push(self.read_fixed32()?);
+ }
+ self.pop_limit(old_limit);
+ Ok(())
+ }
+
+ /// Read repeated packed `sfixed64`
+ pub fn read_repeated_packed_sfixed64_into(
+ &mut self,
+ target: &mut Vec<i64>,
+ ) -> ProtobufResult<()> {
+ let len = self.read_raw_varint64()?;
+
+ target.reserve((len / 8) as usize);
+
+ let old_limit = self.push_limit(len)?;
+ while !self.eof()? {
+ target.push(self.read_sfixed64()?);
+ }
+ self.pop_limit(old_limit);
+ Ok(())
+ }
+
+ /// Read repeated packed `sfixed32`
+ pub fn read_repeated_packed_sfixed32_into(
+ &mut self,
+ target: &mut Vec<i32>,
+ ) -> ProtobufResult<()> {
+ let len = self.read_raw_varint64()?;
+
+ target.reserve((len / 4) as usize);
+
+ let old_limit = self.push_limit(len)?;
+ while !self.eof()? {
+ target.push(self.read_sfixed32()?);
+ }
+ self.pop_limit(old_limit);
+ Ok(())
+ }
+
+ /// Read repeated packed `bool`
+ pub fn read_repeated_packed_bool_into(&mut self, target: &mut Vec<bool>) -> ProtobufResult<()> {
+ let len = self.read_raw_varint64()?;
+
+ // regular bool value is 1-byte size
+ target.reserve(len as usize);
+
+ let old_limit = self.push_limit(len)?;
+ while !self.eof()? {
+ target.push(self.read_bool()?);
+ }
+ self.pop_limit(old_limit);
+ Ok(())
+ }
+
+ /// Read repeated packed `enum` into `ProtobufEnum`
+ pub fn read_repeated_packed_enum_into<E: ProtobufEnum>(
+ &mut self,
+ target: &mut Vec<E>,
+ ) -> ProtobufResult<()> {
+ let len = self.read_raw_varint64()?;
+ let old_limit = self.push_limit(len)?;
+ while !self.eof()? {
+ target.push(self.read_enum()?);
+ }
+ self.pop_limit(old_limit);
+ Ok(())
+ }
+
+ /// Read `UnknownValue`
+ pub fn read_unknown(
+ &mut self,
+ wire_type: wire_format::WireType,
+ ) -> ProtobufResult<UnknownValue> {
+ match wire_type {
+ wire_format::WireTypeVarint => {
+ self.read_raw_varint64().map(|v| UnknownValue::Varint(v))
+ }
+ wire_format::WireTypeFixed64 => self.read_fixed64().map(|v| UnknownValue::Fixed64(v)),
+ wire_format::WireTypeFixed32 => self.read_fixed32().map(|v| UnknownValue::Fixed32(v)),
+ wire_format::WireTypeLengthDelimited => {
+ let len = self.read_raw_varint32()?;
+ self.read_raw_bytes(len)
+ .map(|v| UnknownValue::LengthDelimited(v))
+ }
+ _ => Err(ProtobufError::WireError(WireError::UnexpectedWireType(
+ wire_type,
+ ))),
+ }
+ }
+
+ /// Skip field
+ pub fn skip_field(&mut self, wire_type: wire_format::WireType) -> ProtobufResult<()> {
+ self.read_unknown(wire_type).map(|_| ())
+ }
+
+ /// Read raw bytes into the supplied vector. The vector will be resized as needed and
+ /// overwritten.
+ pub fn read_raw_bytes_into(&mut self, count: u32, target: &mut Vec<u8>) -> ProtobufResult<()> {
+ if false {
+ // Master uses this version, but keep existing version for a while
+ // to avoid possible breakages.
+ return self.source.read_exact_to_vec(count as usize, target);
+ }
+
+ let count = count as usize;
+
+ // TODO: also do some limits when reading from unlimited source
+ if count as u64 > self.source.bytes_until_limit() {
+ return Err(ProtobufError::WireError(WireError::TruncatedMessage));
+ }
+
+ unsafe {
+ target.set_len(0);
+ }
+
+ if count >= READ_RAW_BYTES_MAX_ALLOC {
+ // avoid calling `reserve` on buf with very large buffer: could be a malformed message
+
+ let mut take = self.by_ref().take(count as u64);
+ take.read_to_end(target)?;
+
+ if target.len() != count {
+ return Err(ProtobufError::WireError(WireError::TruncatedMessage));
+ }
+ } else {
+ target.reserve(count);
+ unsafe {
+ target.set_len(count);
+ }
+
+ self.source.read_exact(target)?;
+ }
+ Ok(())
+ }
+
+ /// Read exact number of bytes
+ pub fn read_raw_bytes(&mut self, count: u32) -> ProtobufResult<Vec<u8>> {
+ let mut r = Vec::new();
+ self.read_raw_bytes_into(count, &mut r)?;
+ Ok(r)
+ }
+
+ /// Skip exact number of bytes
+ pub fn skip_raw_bytes(&mut self, count: u32) -> ProtobufResult<()> {
+ // TODO: make it more efficient
+ self.read_raw_bytes(count).map(|_| ())
+ }
+
+ /// Read `bytes` field, length delimited
+ pub fn read_bytes(&mut self) -> ProtobufResult<Vec<u8>> {
+ let mut r = Vec::new();
+ self.read_bytes_into(&mut r)?;
+ Ok(r)
+ }
+
+ /// Read `bytes` field, length delimited
+ #[cfg(feature = "bytes")]
+ pub fn read_carllerche_bytes(&mut self) -> ProtobufResult<Bytes> {
+ let len = self.read_raw_varint32()?;
+ self.read_raw_callerche_bytes(len as usize)
+ }
+
+ /// Read `string` field, length delimited
+ #[cfg(feature = "bytes")]
+ pub fn read_carllerche_chars(&mut self) -> ProtobufResult<Chars> {
+ let bytes = self.read_carllerche_bytes()?;
+ Ok(Chars::from_bytes(bytes)?)
+ }
+
+ /// Read `bytes` field, length delimited
+ pub fn read_bytes_into(&mut self, target: &mut Vec<u8>) -> ProtobufResult<()> {
+ let len = self.read_raw_varint32()?;
+ self.read_raw_bytes_into(len, target)?;
+ Ok(())
+ }
+
+ /// Read `string` field, length delimited
+ pub fn read_string(&mut self) -> ProtobufResult<String> {
+ let mut r = String::new();
+ self.read_string_into(&mut r)?;
+ Ok(r)
+ }
+
+ /// Read `string` field, length delimited
+ pub fn read_string_into(&mut self, target: &mut String) -> ProtobufResult<()> {
+ target.clear();
+ // take target's buffer
+ let mut vec = mem::replace(target, String::new()).into_bytes();
+ self.read_bytes_into(&mut vec)?;
+
+ let s = match String::from_utf8(vec) {
+ Ok(t) => t,
+ Err(_) => return Err(ProtobufError::WireError(WireError::Utf8Error)),
+ };
+ mem::replace(target, s);
+ Ok(())
+ }
+
+ /// Read message, do not check if message is initialized
+ pub fn merge_message<M: Message>(&mut self, message: &mut M) -> ProtobufResult<()> {
+ let len = self.read_raw_varint64()?;
+ let old_limit = self.push_limit(len)?;
+ message.merge_from(self)?;
+ self.pop_limit(old_limit);
+ Ok(())
+ }
+
+ /// Read message
+ pub fn read_message<M: Message>(&mut self) -> ProtobufResult<M> {
+ let mut r: M = Message::new();
+ self.merge_message(&mut r)?;
+ r.check_initialized()?;
+ Ok(r)
+ }
+}
+
+impl<'a> Read for CodedInputStream<'a> {
+ fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+ self.source.read(buf).map_err(Into::into)
+ }
+}
+
+impl<'a> BufRead for CodedInputStream<'a> {
+ fn fill_buf(&mut self) -> io::Result<&[u8]> {
+ self.source.fill_buf().map_err(Into::into)
+ }
+
+ fn consume(&mut self, amt: usize) {
+ self.source.consume(amt)
+ }
+}
+
+#[doc(hidden)]
+pub trait WithCodedOutputStream {
+ fn with_coded_output_stream<T, F>(self, cb: F) -> ProtobufResult<T>
+ where
+ F: FnOnce(&mut CodedOutputStream) -> ProtobufResult<T>;
+}
+
+impl<'a> WithCodedOutputStream for &'a mut (Write + 'a) {
+ fn with_coded_output_stream<T, F>(self, cb: F) -> ProtobufResult<T>
+ where
+ F: FnOnce(&mut CodedOutputStream) -> ProtobufResult<T>,
+ {
+ let mut os = CodedOutputStream::new(self);
+ let r = cb(&mut os)?;
+ os.flush()?;
+ Ok(r)
+ }
+}
+
+impl<'a> WithCodedOutputStream for &'a mut Vec<u8> {
+ fn with_coded_output_stream<T, F>(mut self, cb: F) -> ProtobufResult<T>
+ where
+ F: FnOnce(&mut CodedOutputStream) -> ProtobufResult<T>,
+ {
+ let mut os = CodedOutputStream::vec(&mut self);
+ let r = cb(&mut os)?;
+ os.flush()?;
+ Ok(r)
+ }
+}
+
+#[doc(hidden)]
+pub fn with_coded_output_stream_to_bytes<F>(cb: F) -> ProtobufResult<Vec<u8>>
+where
+ F: FnOnce(&mut CodedOutputStream) -> ProtobufResult<()>,
+{
+ let mut v = Vec::new();
+ v.with_coded_output_stream(cb)?;
+ Ok(v)
+}
+
+/// Helper internal utility, should not be used directly
+#[doc(hidden)]
+pub trait WithCodedInputStream {
+ fn with_coded_input_stream<T, F>(self, cb: F) -> ProtobufResult<T>
+ where
+ F: FnOnce(&mut CodedInputStream) -> ProtobufResult<T>;
+}
+
+impl<'a> WithCodedInputStream for &'a mut (Read + 'a) {
+ fn with_coded_input_stream<T, F>(self, cb: F) -> ProtobufResult<T>
+ where
+ F: FnOnce(&mut CodedInputStream) -> ProtobufResult<T>,
+ {
+ let mut is = CodedInputStream::new(self);
+ let r = cb(&mut is)?;
+ is.check_eof()?;
+ Ok(r)
+ }
+}
+
+impl<'a> WithCodedInputStream for &'a mut (BufRead + 'a) {
+ fn with_coded_input_stream<T, F>(self, cb: F) -> ProtobufResult<T>
+ where
+ F: FnOnce(&mut CodedInputStream) -> ProtobufResult<T>,
+ {
+ let mut is = CodedInputStream::from_buffered_reader(self);
+ let r = cb(&mut is)?;
+ is.check_eof()?;
+ Ok(r)
+ }
+}
+
+impl<'a> WithCodedInputStream for &'a [u8] {
+ fn with_coded_input_stream<T, F>(self, cb: F) -> ProtobufResult<T>
+ where
+ F: FnOnce(&mut CodedInputStream) -> ProtobufResult<T>,
+ {
+ let mut is = CodedInputStream::from_bytes(self);
+ let r = cb(&mut is)?;
+ is.check_eof()?;
+ Ok(r)
+ }
+}
+
+#[cfg(feature = "bytes")]
+impl<'a> WithCodedInputStream for &'a Bytes {
+ fn with_coded_input_stream<T, F>(self, cb: F) -> ProtobufResult<T>
+ where
+ F: FnOnce(&mut CodedInputStream) -> ProtobufResult<T>,
+ {
+ let mut is = CodedInputStream::from_carllerche_bytes(self);
+ let r = cb(&mut is)?;
+ is.check_eof()?;
+ Ok(r)
+ }
+}
+
+enum OutputTarget<'a> {
+ Write(&'a mut Write, Vec<u8>),
+ Vec(&'a mut Vec<u8>),
+ Bytes,
+}
+
+/// Buffered write with handy utilities
+pub struct CodedOutputStream<'a> {
+ target: OutputTarget<'a>,
+ // alias to buf from target
+ buffer: &'a mut [u8],
+ // within buffer
+ position: usize,
+}
+
+impl<'a> CodedOutputStream<'a> {
+ /// Construct from given `Write`.
+ ///
+ /// `CodedOutputStream` is buffered even if `Write` is not
+ pub fn new(writer: &'a mut Write) -> CodedOutputStream<'a> {
+ let buffer_len = OUTPUT_STREAM_BUFFER_SIZE;
+
+ let mut buffer_storage = Vec::with_capacity(buffer_len);
+ unsafe {
+ buffer_storage.set_len(buffer_len);
+ }
+
+ let buffer = unsafe { remove_lifetime_mut(&mut buffer_storage as &mut [u8]) };
+
+ CodedOutputStream {
+ target: OutputTarget::Write(writer, buffer_storage),
+ buffer: buffer,
+ position: 0,
+ }
+ }
+
+ /// `CodedOutputStream` which writes directly to bytes.
+ ///
+ /// Attempt to write more than bytes capacity results in error.
+ pub fn bytes(bytes: &'a mut [u8]) -> CodedOutputStream<'a> {
+ CodedOutputStream {
+ target: OutputTarget::Bytes,
+ buffer: bytes,
+ position: 0,
+ }
+ }
+
+ /// `CodedOutputStream` which writes directly to `Vec<u8>`.
+ ///
+ /// Caller should call `flush` at the end to guarantee vec contains
+ /// all written data.
+ pub fn vec(vec: &'a mut Vec<u8>) -> CodedOutputStream<'a> {
+ CodedOutputStream {
+ target: OutputTarget::Vec(vec),
+ buffer: &mut [],
+ position: 0,
+ }
+ }
+
+ /// Check if EOF is reached.
+ ///
+ /// # Panics
+ ///
+ /// If underlying write has no EOF
+ pub fn check_eof(&self) {
+ match self.target {
+ OutputTarget::Bytes => {
+ assert_eq!(self.buffer.len() as u64, self.position as u64);
+ }
+ OutputTarget::Write(..) | OutputTarget::Vec(..) => {
+ panic!("must not be called with Writer or Vec");
+ }
+ }
+ }
+
+ fn refresh_buffer(&mut self) -> ProtobufResult<()> {
+ match self.target {
+ OutputTarget::Write(ref mut write, _) => {
+ write.write_all(&self.buffer[0..self.position as usize])?;
+ self.position = 0;
+ }
+ OutputTarget::Vec(ref mut vec) => unsafe {
+ let vec_len = vec.len();
+ assert!(vec_len + self.position <= vec.capacity());
+ vec.set_len(vec_len + self.position);
+ vec.reserve(1);
+ self.buffer = remove_lifetime_mut(remaining_capacity_as_slice_mut(vec));
+ self.position = 0;
+ },
+ OutputTarget::Bytes => {
+ panic!("refresh_buffer must not be called on CodedOutputStream create from slice");
+ }
+ }
+ Ok(())
+ }
+
+ /// Flush the buffer to underlying write
+ pub fn flush(&mut self) -> ProtobufResult<()> {
+ match self.target {
+ OutputTarget::Bytes => Ok(()),
+ OutputTarget::Write(..) | OutputTarget::Vec(..) => {
+ // TODO: must not reserve additional in Vec
+ self.refresh_buffer()
+ }
+ }
+ }
+
+ /// Write a byte
+ pub fn write_raw_byte(&mut self, byte: u8) -> ProtobufResult<()> {
+ if self.position as usize == self.buffer.len() {
+ self.refresh_buffer()?;
+ }
+ self.buffer[self.position as usize] = byte;
+ self.position += 1;
+ Ok(())
+ }
+
+ /// Write bytes
+ pub fn write_raw_bytes(&mut self, bytes: &[u8]) -> ProtobufResult<()> {
+ if bytes.len() <= self.buffer.len() - self.position {
+ let bottom = self.position as usize;
+ let top = bottom + (bytes.len() as usize);
+ self.buffer[bottom..top].copy_from_slice(bytes);
+ self.position += bytes.len();
+ return Ok(());
+ }
+
+ self.refresh_buffer()?;
+
+ assert!(self.position == 0);
+
+ if self.position + bytes.len() < self.buffer.len() {
+ &mut self.buffer[self.position..self.position + bytes.len()].copy_from_slice(bytes);
+ self.position += bytes.len();
+ return Ok(());
+ }
+
+ match self.target {
+ OutputTarget::Bytes => {
+ unreachable!();
+ }
+ OutputTarget::Write(ref mut write, _) => {
+ write.write_all(bytes)?;
+ }
+ OutputTarget::Vec(ref mut vec) => {
+ vec.extend(bytes);
+ unsafe {
+ self.buffer = remove_lifetime_mut(remaining_capacity_as_slice_mut(vec));
+ }
+ }
+ }
+ Ok(())
+ }
+
+ /// Write a tag
+ pub fn write_tag(
+ &mut self,
+ field_number: u32,
+ wire_type: wire_format::WireType,
+ ) -> ProtobufResult<()> {
+ self.write_raw_varint32(wire_format::Tag::make(field_number, wire_type).value())
+ }
+
+ /// Write varint
+ pub fn write_raw_varint32(&mut self, value: u32) -> ProtobufResult<()> {
+ if self.buffer.len() - self.position >= 5 {
+ // fast path
+ let len = varint::encode_varint32(value, &mut self.buffer[self.position..]);
+ self.position += len;
+ Ok(())
+ } else {
+ // slow path
+ let buf = &mut [0u8; 5];
+ let len = varint::encode_varint32(value, buf);
+ self.write_raw_bytes(&buf[..len])
+ }
+ }
+
+ /// Write varint
+ pub fn write_raw_varint64(&mut self, value: u64) -> ProtobufResult<()> {
+ if self.buffer.len() - self.position >= 10 {
+ // fast path
+ let len = varint::encode_varint64(value, &mut self.buffer[self.position..]);
+ self.position += len;
+ Ok(())
+ } else {
+ // slow path
+ let buf = &mut [0u8; 10];
+ let len = varint::encode_varint64(value, buf);
+ self.write_raw_bytes(&buf[..len])
+ }
+ }
+
+ /// Write 32-bit integer little endian
+ pub fn write_raw_little_endian32(&mut self, value: u32) -> ProtobufResult<()> {
+ let bytes = unsafe { mem::transmute::<_, [u8; 4]>(value.to_le()) };
+ self.write_raw_bytes(&bytes)
+ }
+
+ /// Write 64-bit integer little endian
+ pub fn write_raw_little_endian64(&mut self, value: u64) -> ProtobufResult<()> {
+ let bytes = unsafe { mem::transmute::<_, [u8; 8]>(value.to_le()) };
+ self.write_raw_bytes(&bytes)
+ }
+
+ /// Write `float`
+ pub fn write_float_no_tag(&mut self, value: f32) -> ProtobufResult<()> {
+ let bits = unsafe { mem::transmute::<f32, u32>(value) };
+ self.write_raw_little_endian32(bits)
+ }
+
+ /// Write `double`
+ pub fn write_double_no_tag(&mut self, value: f64) -> ProtobufResult<()> {
+ let bits = unsafe { mem::transmute::<f64, u64>(value) };
+ self.write_raw_little_endian64(bits)
+ }
+
+ /// Write `float` field
+ pub fn write_float(&mut self, field_number: u32, value: f32) -> ProtobufResult<()> {
+ self.write_tag(field_number, wire_format::WireTypeFixed32)?;
+ self.write_float_no_tag(value)?;
+ Ok(())
+ }
+
+ /// Write `double` field
+ pub fn write_double(&mut self, field_number: u32, value: f64) -> ProtobufResult<()> {
+ self.write_tag(field_number, wire_format::WireTypeFixed64)?;
+ self.write_double_no_tag(value)?;
+ Ok(())
+ }
+
+ /// Write varint
+ pub fn write_uint64_no_tag(&mut self, value: u64) -> ProtobufResult<()> {
+ self.write_raw_varint64(value)
+ }
+
+ /// Write varint
+ pub fn write_uint32_no_tag(&mut self, value: u32) -> ProtobufResult<()> {
+ self.write_raw_varint32(value)
+ }
+
+ /// Write varint
+ pub fn write_int64_no_tag(&mut self, value: i64) -> ProtobufResult<()> {
+ self.write_raw_varint64(value as u64)
+ }
+
+ /// Write varint
+ pub fn write_int32_no_tag(&mut self, value: i32) -> ProtobufResult<()> {
+ self.write_raw_varint64(value as u64)
+ }
+
+ /// Write zigzag varint
+ pub fn write_sint64_no_tag(&mut self, value: i64) -> ProtobufResult<()> {
+ self.write_uint64_no_tag(encode_zig_zag_64(value))
+ }
+
+ /// Write zigzag varint
+ pub fn write_sint32_no_tag(&mut self, value: i32) -> ProtobufResult<()> {
+ self.write_uint32_no_tag(encode_zig_zag_32(value))
+ }
+
+ /// Write `fixed64`
+ pub fn write_fixed64_no_tag(&mut self, value: u64) -> ProtobufResult<()> {
+ self.write_raw_little_endian64(value)
+ }
+
+ /// Write `fixed32`
+ pub fn write_fixed32_no_tag(&mut self, value: u32) -> ProtobufResult<()> {
+ self.write_raw_little_endian32(value)
+ }
+
+ /// Write `sfixed64`
+ pub fn write_sfixed64_no_tag(&mut self, value: i64) -> ProtobufResult<()> {
+ self.write_raw_little_endian64(value as u64)
+ }
+
+ /// Write `sfixed32`
+ pub fn write_sfixed32_no_tag(&mut self, value: i32) -> ProtobufResult<()> {
+ self.write_raw_little_endian32(value as u32)
+ }
+
+ /// Write `bool`
+ pub fn write_bool_no_tag(&mut self, value: bool) -> ProtobufResult<()> {
+ self.write_raw_varint32(if value { 1 } else { 0 })
+ }
+
+ /// Write `enum`
+ pub fn write_enum_no_tag(&mut self, value: i32) -> ProtobufResult<()> {
+ self.write_int32_no_tag(value)
+ }
+
+ /// Write `enum`
+ pub fn write_enum_obj_no_tag<E>(&mut self, value: E) -> ProtobufResult<()>
+ where
+ E: ProtobufEnum,
+ {
+ self.write_enum_no_tag(value.value())
+ }
+
+ /// Write unknown value
+ pub fn write_unknown_no_tag(&mut self, unknown: UnknownValueRef) -> ProtobufResult<()> {
+ match unknown {
+ UnknownValueRef::Fixed64(fixed64) => self.write_raw_little_endian64(fixed64),
+ UnknownValueRef::Fixed32(fixed32) => self.write_raw_little_endian32(fixed32),
+ UnknownValueRef::Varint(varint) => self.write_raw_varint64(varint),
+ UnknownValueRef::LengthDelimited(bytes) => self.write_bytes_no_tag(bytes),
+ }
+ }
+
+ /// Write `uint64` field
+ pub fn write_uint64(&mut self, field_number: u32, value: u64) -> ProtobufResult<()> {
+ self.write_tag(field_number, wire_format::WireTypeVarint)?;
+ self.write_uint64_no_tag(value)?;
+ Ok(())
+ }
+
+ /// Write `uint32` field
+ pub fn write_uint32(&mut self, field_number: u32, value: u32) -> ProtobufResult<()> {
+ self.write_tag(field_number, wire_format::WireTypeVarint)?;
+ self.write_uint32_no_tag(value)?;
+ Ok(())
+ }
+
+ /// Write `int64` field
+ pub fn write_int64(&mut self, field_number: u32, value: i64) -> ProtobufResult<()> {
+ self.write_tag(field_number, wire_format::WireTypeVarint)?;
+ self.write_int64_no_tag(value)?;
+ Ok(())
+ }
+
+ /// Write `int32` field
+ pub fn write_int32(&mut self, field_number: u32, value: i32) -> ProtobufResult<()> {
+ self.write_tag(field_number, wire_format::WireTypeVarint)?;
+ self.write_int32_no_tag(value)?;
+ Ok(())
+ }
+
+ /// Write `sint64` field
+ pub fn write_sint64(&mut self, field_number: u32, value: i64) -> ProtobufResult<()> {
+ self.write_tag(field_number, wire_format::WireTypeVarint)?;
+ self.write_sint64_no_tag(value)?;
+ Ok(())
+ }
+
+ /// Write `sint32` field
+ pub fn write_sint32(&mut self, field_number: u32, value: i32) -> ProtobufResult<()> {
+ self.write_tag(field_number, wire_format::WireTypeVarint)?;
+ self.write_sint32_no_tag(value)?;
+ Ok(())
+ }
+
+ /// Write `fixed64` field
+ pub fn write_fixed64(&mut self, field_number: u32, value: u64) -> ProtobufResult<()> {
+ self.write_tag(field_number, wire_format::WireTypeFixed64)?;
+ self.write_fixed64_no_tag(value)?;
+ Ok(())
+ }
+
+ /// Write `fixed32` field
+ pub fn write_fixed32(&mut self, field_number: u32, value: u32) -> ProtobufResult<()> {
+ self.write_tag(field_number, wire_format::WireTypeFixed32)?;
+ self.write_fixed32_no_tag(value)?;
+ Ok(())
+ }
+
+ /// Write `sfixed64` field
+ pub fn write_sfixed64(&mut self, field_number: u32, value: i64) -> ProtobufResult<()> {
+ self.write_tag(field_number, wire_format::WireTypeFixed64)?;
+ self.write_sfixed64_no_tag(value)?;
+ Ok(())
+ }
+
+ /// Write `sfixed32` field
+ pub fn write_sfixed32(&mut self, field_number: u32, value: i32) -> ProtobufResult<()> {
+ self.write_tag(field_number, wire_format::WireTypeFixed32)?;
+ self.write_sfixed32_no_tag(value)?;
+ Ok(())
+ }
+
+ /// Write `bool` field
+ pub fn write_bool(&mut self, field_number: u32, value: bool) -> ProtobufResult<()> {
+ self.write_tag(field_number, wire_format::WireTypeVarint)?;
+ self.write_bool_no_tag(value)?;
+ Ok(())
+ }
+
+ /// Write `enum` field
+ pub fn write_enum(&mut self, field_number: u32, value: i32) -> ProtobufResult<()> {
+ self.write_tag(field_number, wire_format::WireTypeVarint)?;
+ self.write_enum_no_tag(value)?;
+ Ok(())
+ }
+
+ /// Write `enum` field
+ pub fn write_enum_obj<E>(&mut self, field_number: u32, value: E) -> ProtobufResult<()>
+ where
+ E: ProtobufEnum,
+ {
+ self.write_enum(field_number, value.value())
+ }
+
+ /// Write unknown field
+ pub fn write_unknown(
+ &mut self,
+ field_number: u32,
+ value: UnknownValueRef,
+ ) -> ProtobufResult<()> {
+ self.write_tag(field_number, value.wire_type())?;
+ self.write_unknown_no_tag(value)?;
+ Ok(())
+ }
+
+ /// Write unknown fields
+ pub fn write_unknown_fields(&mut self, fields: &UnknownFields) -> ProtobufResult<()> {
+ for (number, values) in fields {
+ for value in values {
+ self.write_unknown(number, value)?;
+ }
+ }
+ Ok(())
+ }
+
+ /// Write bytes
+ pub fn write_bytes_no_tag(&mut self, bytes: &[u8]) -> ProtobufResult<()> {
+ self.write_raw_varint32(bytes.len() as u32)?;
+ self.write_raw_bytes(bytes)?;
+ Ok(())
+ }
+
+ /// Write string
+ pub fn write_string_no_tag(&mut self, s: &str) -> ProtobufResult<()> {
+ self.write_bytes_no_tag(s.as_bytes())
+ }
+
+ /// Write message
+ pub fn write_message_no_tag<M: Message>(&mut self, msg: &M) -> ProtobufResult<()> {
+ msg.write_length_delimited_to(self)
+ }
+
+ /// Write `bytes` field
+ pub fn write_bytes(&mut self, field_number: u32, bytes: &[u8]) -> ProtobufResult<()> {
+ self.write_tag(field_number, wire_format::WireTypeLengthDelimited)?;
+ self.write_bytes_no_tag(bytes)?;
+ Ok(())
+ }
+
+ /// Write `string` field
+ pub fn write_string(&mut self, field_number: u32, s: &str) -> ProtobufResult<()> {
+ self.write_tag(field_number, wire_format::WireTypeLengthDelimited)?;
+ self.write_string_no_tag(s)?;
+ Ok(())
+ }
+
+ /// Write `message` field
+ pub fn write_message<M: Message>(&mut self, field_number: u32, msg: &M) -> ProtobufResult<()> {
+ self.write_tag(field_number, wire_format::WireTypeLengthDelimited)?;
+ self.write_message_no_tag(msg)?;
+ Ok(())
+ }
+}
+
+impl<'a> Write for CodedOutputStream<'a> {
+ fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+ self.write_raw_bytes(buf)?;
+ Ok(buf.len())
+ }
+
+ fn flush(&mut self) -> io::Result<()> {
+ CodedOutputStream::flush(self).map_err(Into::into)
+ }
+}
+
+#[cfg(test)]
+mod test {
+
+ use std::fmt::Debug;
+ use std::io;
+ use std::io::BufRead;
+ use std::io::Read;
+ use std::io::Write;
+ use std::iter::repeat;
+
+ use error::ProtobufError;
+ use error::ProtobufResult;
+ use hex::decode_hex;
+ use hex::encode_hex;
+
+ use super::wire_format;
+ use super::CodedInputStream;
+ use super::CodedOutputStream;
+ use super::READ_RAW_BYTES_MAX_ALLOC;
+
+ fn test_read_partial<F>(hex: &str, mut callback: F)
+ where
+ F: FnMut(&mut CodedInputStream),
+ {
+ let d = decode_hex(hex);
+ let mut reader = io::Cursor::new(d);
+ let mut is = CodedInputStream::from_buffered_reader(&mut reader as &mut dyn BufRead);
+ assert_eq!(0, is.pos());
+ callback(&mut is);
+ }
+
+ fn test_read<F>(hex: &str, mut callback: F)
+ where
+ F: FnMut(&mut CodedInputStream),
+ {
+ let len = decode_hex(hex).len();
+ test_read_partial(hex, |reader| {
+ callback(reader);
+ assert!(reader.eof().expect("eof"));
+ assert_eq!(len as u64, reader.pos());
+ });
+ }
+
+ fn test_read_v<F, V>(hex: &str, v: V, mut callback: F)
+ where
+ F: FnMut(&mut CodedInputStream) -> ProtobufResult<V>,
+ V: PartialEq + Debug,
+ {
+ test_read(hex, |reader| {
+ assert_eq!(v, callback(reader).unwrap());
+ });
+ }
+
+ #[test]
+ fn test_input_stream_read_raw_byte() {
+ test_read("17", |is| {
+ assert_eq!(23, is.read_raw_byte().unwrap());
+ });
+ }
+
+ #[test]
+ fn test_input_stream_read_raw_varint() {
+ test_read_v("07", 7, |reader| reader.read_raw_varint32());
+ test_read_v("07", 7, |reader| reader.read_raw_varint64());
+
+ test_read_v("96 01", 150, |reader| reader.read_raw_varint32());
+ test_read_v("96 01", 150, |reader| reader.read_raw_varint64());
+
+ test_read_v(
+ "ff ff ff ff ff ff ff ff ff 01",
+ 0xffffffffffffffff,
+ |reader| reader.read_raw_varint64(),
+ );
+
+ test_read_v("ff ff ff ff 0f", 0xffffffff, |reader| {
+ reader.read_raw_varint32()
+ });
+ test_read_v("ff ff ff ff 0f", 0xffffffff, |reader| {
+ reader.read_raw_varint64()
+ });
+ }
+
+ #[test]
+ fn test_input_stream_read_raw_vaint_malformed() {
+ // varint cannot have length > 10
+ test_read_partial("ff ff ff ff ff ff ff ff ff ff 01", |reader| {
+ let result = reader.read_raw_varint64();
+ match result {
+ // TODO: make an enum variant
+ Err(ProtobufError::WireError(..)) => (),
+ _ => panic!(),
+ }
+ });
+ test_read_partial("ff ff ff ff ff ff ff ff ff ff 01", |reader| {
+ let result = reader.read_raw_varint32();
+ match result {
+ // TODO: make an enum variant
+ Err(ProtobufError::WireError(..)) => (),
+ _ => panic!(),
+ }
+ });
+ }
+
+ #[test]
+ fn test_input_stream_read_raw_varint_unexpected_eof() {
+ test_read_partial("96 97", |reader| {
+ let result = reader.read_raw_varint32();
+ match result {
+ Err(ProtobufError::WireError(..)) => (),
+ _ => panic!(),
+ }
+ });
+ }
+
+ #[test]
+ fn test_input_stream_read_raw_varint_pos() {
+ test_read_partial("95 01 98", |reader| {
+ assert_eq!(149, reader.read_raw_varint32().unwrap());
+ assert_eq!(2, reader.pos());
+ });
+ }
+
+ #[test]
+ fn test_input_stream_read_int32() {
+ test_read_v("02", 2, |reader| reader.read_int32());
+ }
+
+ #[test]
+ fn test_input_stream_read_float() {
+ test_read_v("95 73 13 61", 17e19, |is| is.read_float());
+ }
+
+ #[test]
+ fn test_input_stream_read_double() {
+ test_read_v("40 d5 ab 68 b3 07 3d 46", 23e29, |is| is.read_double());
+ }
+
+ #[test]
+ fn test_input_stream_skip_raw_bytes() {
+ test_read("", |reader| {
+ reader.skip_raw_bytes(0).unwrap();
+ });
+ test_read("aa bb", |reader| {
+ reader.skip_raw_bytes(2).unwrap();
+ });
+ test_read("aa bb cc dd ee ff", |reader| {
+ reader.skip_raw_bytes(6).unwrap();
+ });
+ }
+
+ #[test]
+ fn test_input_stream_read_raw_bytes() {
+ test_read("", |reader| {
+ assert_eq!(
+ Vec::from(&b""[..]),
+ reader.read_raw_bytes(0).expect("read_raw_bytes")
+ );
+ })
+ }
+
+ #[test]
+ fn test_input_stream_limits() {
+ test_read("aa bb cc", |is| {
+ let old_limit = is.push_limit(1).unwrap();
+ assert_eq!(1, is.bytes_until_limit());
+ let r1 = is.read_raw_bytes(1).unwrap();
+ assert_eq!(&[0xaa as u8], &r1[..]);
+ is.pop_limit(old_limit);
+ let r2 = is.read_raw_bytes(2).unwrap();
+ assert_eq!(&[0xbb as u8, 0xcc], &r2[..]);
+ });
+ }
+
+ #[test]
+ fn test_input_stream_io_read() {
+ test_read("aa bb cc", |is| {
+ let mut buf = [0; 3];
+ assert_eq!(Read::read(is, &mut buf).expect("io::Read"), 3);
+ assert_eq!(buf, [0xaa, 0xbb, 0xcc]);
+ });
+ }
+
+ #[test]
+ fn test_input_stream_io_bufread() {
+ test_read("aa bb cc", |is| {
+ assert_eq!(
+ BufRead::fill_buf(is).expect("io::BufRead::fill_buf"),
+ &[0xaa, 0xbb, 0xcc]
+ );
+ BufRead::consume(is, 3);
+ });
+ }
+
+ #[test]
+ fn test_input_stream_read_raw_bytes_into_huge() {
+ let mut v = Vec::new();
+ for i in 0..READ_RAW_BYTES_MAX_ALLOC + 1000 {
+ v.push((i % 10) as u8);
+ }
+
+ let mut slice: &[u8] = v.as_slice();
+
+ let mut is = CodedInputStream::new(&mut slice);
+
+ let mut buf = Vec::new();
+
+ is.read_raw_bytes_into(READ_RAW_BYTES_MAX_ALLOC as u32 + 10, &mut buf)
+ .expect("read");
+
+ assert_eq!(READ_RAW_BYTES_MAX_ALLOC + 10, buf.len());
+
+ buf.clear();
+
+ is.read_raw_bytes_into(1000 - 10, &mut buf).expect("read");
+
+ assert_eq!(1000 - 10, buf.len());
+
+ assert!(is.eof().expect("eof"));
+ }
+
+ fn test_write<F>(expected: &str, mut gen: F)
+ where
+ F: FnMut(&mut CodedOutputStream) -> ProtobufResult<()>,
+ {
+ let expected_bytes = decode_hex(expected);
+
+ // write to Write
+ {
+ let mut v = Vec::new();
+ {
+ let mut os = CodedOutputStream::new(&mut v as &mut dyn Write);
+ gen(&mut os).unwrap();
+ os.flush().unwrap();
+ }
+ assert_eq!(encode_hex(&expected_bytes), encode_hex(&v));
+ }
+
+ // write to &[u8]
+ {
+ let mut r = Vec::with_capacity(expected_bytes.len());
+ r.resize(expected_bytes.len(), 0);
+ {
+ let mut os = CodedOutputStream::bytes(&mut r);
+ gen(&mut os).unwrap();
+ os.check_eof();
+ }
+ assert_eq!(encode_hex(&expected_bytes), encode_hex(&r));
+ }
+
+ // write to Vec<u8>
+ {
+ let mut r = Vec::new();
+ r.extend(&[11, 22, 33, 44, 55, 66, 77]);
+ {
+ let mut os = CodedOutputStream::vec(&mut r);
+ gen(&mut os).unwrap();
+ os.flush().unwrap();
+ }
+
+ r.drain(..7);
+ assert_eq!(encode_hex(&expected_bytes), encode_hex(&r));
+ }
+ }
+
+ #[test]
+ fn test_output_stream_write_raw_byte() {
+ test_write("a1", |os| os.write_raw_byte(0xa1));
+ }
+
+ #[test]
+ fn test_output_stream_write_tag() {
+ test_write("08", |os| os.write_tag(1, wire_format::WireTypeVarint));
+ }
+
+ #[test]
+ fn test_output_stream_write_raw_bytes() {
+ test_write("00 ab", |os| os.write_raw_bytes(&[0x00, 0xab]));
+
+ let expected = repeat("01 02 03 04")
+ .take(2048)
+ .collect::<Vec<_>>()
+ .join(" ");
+ test_write(&expected, |os| {
+ for _ in 0..2048 {
+ os.write_raw_bytes(&[0x01, 0x02, 0x03, 0x04])?;
+ }
+
+ Ok(())
+ });
+ }
+
+ #[test]
+ fn test_output_stream_write_raw_varint32() {
+ test_write("96 01", |os| os.write_raw_varint32(150));
+ test_write("ff ff ff ff 0f", |os| os.write_raw_varint32(0xffffffff));
+ }
+
+ #[test]
+ fn test_output_stream_write_raw_varint64() {
+ test_write("96 01", |os| os.write_raw_varint64(150));
+ test_write("ff ff ff ff ff ff ff ff ff 01", |os| {
+ os.write_raw_varint64(0xffffffffffffffff)
+ });
+ }
+
+ #[test]
+ fn test_output_stream_write_int32_no_tag() {
+ test_write("ff ff ff ff ff ff ff ff ff 01", |os| {
+ os.write_int32_no_tag(-1)
+ });
+ }
+
+ #[test]
+ fn test_output_stream_write_int64_no_tag() {
+ test_write("ff ff ff ff ff ff ff ff ff 01", |os| {
+ os.write_int64_no_tag(-1)
+ });
+ }
+
+ #[test]
+ fn test_output_stream_write_raw_little_endian32() {
+ test_write("f1 e2 d3 c4", |os| os.write_raw_little_endian32(0xc4d3e2f1));
+ }
+
+ #[test]
+ fn test_output_stream_write_float_no_tag() {
+ test_write("95 73 13 61", |os| os.write_float_no_tag(17e19));
+ }
+
+ #[test]
+ fn test_output_stream_write_double_no_tag() {
+ test_write("40 d5 ab 68 b3 07 3d 46", |os| {
+ os.write_double_no_tag(23e29)
+ });
+ }
+
+ #[test]
+ fn test_output_stream_write_raw_little_endian64() {
+ test_write("f1 e2 d3 c4 b5 a6 07 f8", |os| {
+ os.write_raw_little_endian64(0xf807a6b5c4d3e2f1)
+ });
+ }
+
+ #[test]
+ fn test_output_stream_io_write() {
+ let expected = [0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77];
+
+ // write to Write
+ {
+ let mut v = Vec::new();
+ {
+ let mut os = CodedOutputStream::new(&mut v as &mut dyn Write);
+ Write::write(&mut os, &expected).expect("io::Write::write");
+ Write::flush(&mut os).expect("io::Write::flush");
+ }
+ assert_eq!(expected, *v);
+ }
+
+ // write to &[u8]
+ {
+ let mut v = Vec::with_capacity(expected.len());
+ v.resize(expected.len(), 0);
+ {
+ let mut os = CodedOutputStream::bytes(&mut v);
+ Write::write(&mut os, &expected).expect("io::Write::write");
+ Write::flush(&mut os).expect("io::Write::flush");
+ os.check_eof();
+ }
+ assert_eq!(expected, *v);
+ }
+
+ // write to Vec<u8>
+ {
+ let mut v = Vec::new();
+ {
+ let mut os = CodedOutputStream::vec(&mut v);
+ Write::write(&mut os, &expected).expect("io::Write::write");
+ Write::flush(&mut os).expect("io::Write::flush");
+ }
+ assert_eq!(expected, *v);
+ }
+ }
+}
diff --git a/src/strx.rs b/src/strx.rs
new file mode 100644
index 0000000..af09de2
--- /dev/null
+++ b/src/strx.rs
@@ -0,0 +1,34 @@
+pub fn remove_to<'s>(s: &'s str, c: char) -> &'s str {
+ match s.rfind(c) {
+ Some(pos) => &s[(pos + 1)..],
+ None => s,
+ }
+}
+
+pub fn remove_suffix<'s>(s: &'s str, suffix: &str) -> &'s str {
+ if !s.ends_with(suffix) {
+ s
+ } else {
+ &s[..(s.len() - suffix.len())]
+ }
+}
+
+#[cfg(test)]
+mod test {
+
+ use super::remove_suffix;
+ use super::remove_to;
+
+ #[test]
+ fn test_remove_to() {
+ assert_eq!("aaa", remove_to("aaa", '.'));
+ assert_eq!("bbb", remove_to("aaa.bbb", '.'));
+ assert_eq!("ccc", remove_to("aaa.bbb.ccc", '.'));
+ }
+
+ #[test]
+ fn test_remove_suffix() {
+ assert_eq!("bbb", remove_suffix("bbbaaa", "aaa"));
+ assert_eq!("aaa", remove_suffix("aaa", "bbb"));
+ }
+}
diff --git a/src/text_format.rs b/src/text_format.rs
new file mode 100644
index 0000000..7ba3721
--- /dev/null
+++ b/src/text_format.rs
@@ -0,0 +1,328 @@
+//! Protobuf "text format" implementation.
+//!
+//! Text format message look like this:
+//!
+//! ```text,ignore
+//! size: 17
+//! color: "red"
+//! children {
+//! size: 18
+//! color: "blue"
+//! }
+//! children {
+//! size: 19
+//! color: "green"
+//! }
+//! ```
+//!
+//! This format is not specified, but it is implemented by all official
+//! protobuf implementations, including `protoc` command which can decode
+//! and encode messages using text format.
+
+use core::Message;
+use reflect::ReflectFieldRef;
+use reflect::ReflectValueRef;
+use std;
+use std::fmt;
+use std::fmt::Write;
+
+fn quote_bytes_to(bytes: &[u8], buf: &mut String) {
+ for &c in bytes {
+ match c {
+ b'\n' => buf.push_str(r"\n"),
+ b'\r' => buf.push_str(r"\r"),
+ b'\t' => buf.push_str(r"\t"),
+ b'"' => buf.push_str("\\\""),
+ b'\\' => buf.push_str(r"\\"),
+ b'\x20'..=b'\x7e' => buf.push(c as char),
+ _ => {
+ buf.push('\\');
+ buf.push((b'0' + (c >> 6)) as char);
+ buf.push((b'0' + ((c >> 3) & 7)) as char);
+ buf.push((b'0' + (c & 7)) as char);
+ }
+ }
+ }
+}
+
+fn quote_escape_bytes_to(bytes: &[u8], buf: &mut String) {
+ buf.push('"');
+ quote_bytes_to(bytes, buf);
+ buf.push('"');
+}
+
+#[doc(hidden)]
+pub fn quote_escape_bytes(bytes: &[u8]) -> String {
+ let mut r = String::new();
+ quote_escape_bytes_to(bytes, &mut r);
+ r
+}
+
+#[doc(hidden)]
+pub fn unescape_string(string: &str) -> Vec<u8> {
+ fn parse_if_digit(chars: &mut std::str::Chars) -> u8 {
+ let mut copy = chars.clone();
+ let f = match copy.next() {
+ None => return 0,
+ Some(f) => f,
+ };
+ let d = match f {
+ '0'..='9' => (f as u8 - b'0'),
+ _ => return 0,
+ };
+ *chars = copy;
+ d
+ }
+
+ fn parse_hex_digit(chars: &mut std::str::Chars) -> u8 {
+ match chars.next().unwrap() {
+ c @ '0'..='9' => (c as u8) - b'0',
+ c @ 'a'..='f' => (c as u8) - b'a' + 10,
+ c @ 'A'..='F' => (c as u8) - b'A' + 10,
+ _ => panic!("incorrect hex escape"),
+ }
+ }
+
+ fn parse_escape_rem(chars: &mut std::str::Chars) -> u8 {
+ let n = chars.next().unwrap();
+ match n {
+ 'a' => return b'\x07',
+ 'b' => return b'\x08',
+ 'f' => return b'\x0c',
+ 'n' => return b'\n',
+ 'r' => return b'\r',
+ 't' => return b'\t',
+ 'v' => return b'\x0b',
+ '"' => return b'"',
+ '\'' => return b'\'',
+ '0'..='9' => {
+ let d1 = n as u8 - b'0';
+ let d2 = parse_if_digit(chars);
+ let d3 = parse_if_digit(chars);
+ return (d1 * 64 + d2 * 8 + d3) as u8;
+ }
+ 'x' => {
+ let d1 = parse_hex_digit(chars);
+ let d2 = parse_hex_digit(chars);
+ return d1 * 16 + d2;
+ }
+ c => return c as u8, // TODO: validate ASCII
+ };
+ }
+
+ let mut chars = string.chars();
+ let mut r = Vec::new();
+
+ loop {
+ let f = match chars.next() {
+ None => return r,
+ Some(f) => f,
+ };
+
+ if f == '\\' {
+ r.push(parse_escape_rem(&mut chars));
+ } else {
+ r.push(f as u8); // TODO: escape UTF-8
+ }
+ }
+}
+
+fn print_str_to(s: &str, buf: &mut String) {
+ // TODO: keep printable Unicode
+ quote_escape_bytes_to(s.as_bytes(), buf);
+}
+
+fn do_indent(buf: &mut String, pretty: bool, indent: usize) {
+ if pretty && indent > 0 {
+ for _ in 0..indent {
+ buf.push_str(" ");
+ }
+ }
+}
+
+fn print_start_field(
+ buf: &mut String,
+ pretty: bool,
+ indent: usize,
+ first: &mut bool,
+ field_name: &str,
+) {
+ if !*first && !pretty {
+ buf.push_str(" ");
+ }
+ do_indent(buf, pretty, indent);
+ *first = false;
+ buf.push_str(field_name);
+}
+
+fn print_end_field(buf: &mut String, pretty: bool) {
+ if pretty {
+ buf.push_str("\n");
+ }
+}
+
+fn print_field(
+ buf: &mut String,
+ pretty: bool,
+ indent: usize,
+ first: &mut bool,
+ field_name: &str,
+ value: ReflectValueRef,
+) {
+ print_start_field(buf, pretty, indent, first, field_name);
+
+ match value {
+ ReflectValueRef::Message(m) => {
+ buf.push_str(" {");
+ if pretty {
+ buf.push_str("\n");
+ }
+ print_to_internal(m, buf, pretty, indent + 1);
+ do_indent(buf, pretty, indent);
+ buf.push_str("}");
+ }
+ ReflectValueRef::Enum(e) => {
+ buf.push_str(": ");
+ buf.push_str(e.name());
+ }
+ ReflectValueRef::String(s) => {
+ buf.push_str(": ");
+ print_str_to(s, buf);
+ }
+ ReflectValueRef::Bytes(b) => {
+ buf.push_str(": ");
+ quote_escape_bytes_to(b, buf);
+ }
+ ReflectValueRef::I32(v) => {
+ write!(buf, ": {}", v).unwrap();
+ }
+ ReflectValueRef::I64(v) => {
+ write!(buf, ": {}", v).unwrap();
+ }
+ ReflectValueRef::U32(v) => {
+ write!(buf, ": {}", v).unwrap();
+ }
+ ReflectValueRef::U64(v) => {
+ write!(buf, ": {}", v).unwrap();
+ }
+ ReflectValueRef::Bool(v) => {
+ write!(buf, ": {}", v).unwrap();
+ }
+ ReflectValueRef::F32(v) => {
+ write!(buf, ": {}", v).unwrap();
+ }
+ ReflectValueRef::F64(v) => {
+ write!(buf, ": {}", v).unwrap();
+ }
+ }
+
+ print_end_field(buf, pretty);
+}
+
+fn print_to_internal(m: &Message, buf: &mut String, pretty: bool, indent: usize) {
+ let d = m.descriptor();
+ let mut first = true;
+ for f in d.fields() {
+ match f.get_reflect(m) {
+ ReflectFieldRef::Map(map) => {
+ for (k, v) in map {
+ print_start_field(buf, pretty, indent, &mut first, f.name());
+ buf.push_str(" {");
+ if pretty {
+ buf.push_str("\n");
+ }
+
+ let mut entry_first = true;
+
+ print_field(buf, pretty, indent + 1, &mut entry_first, "key", k.as_ref());
+ print_field(
+ buf,
+ pretty,
+ indent + 1,
+ &mut entry_first,
+ "value",
+ v.as_ref(),
+ );
+ do_indent(buf, pretty, indent);
+ buf.push_str("}");
+ print_end_field(buf, pretty);
+ }
+ }
+ ReflectFieldRef::Repeated(repeated) => {
+ // TODO: do not print zeros for v3
+ for v in repeated {
+ print_field(buf, pretty, indent, &mut first, f.name(), v.as_ref());
+ }
+ }
+ ReflectFieldRef::Optional(optional) => {
+ if let Some(v) = optional {
+ print_field(buf, pretty, indent, &mut first, f.name(), v);
+ }
+ }
+ }
+ }
+
+ // TODO: unknown fields
+}
+
+/// Text-format
+pub fn print_to(m: &Message, buf: &mut String) {
+ print_to_internal(m, buf, false, 0)
+}
+
+fn print_to_string_internal(m: &Message, pretty: bool) -> String {
+ let mut r = String::new();
+ print_to_internal(m, &mut r, pretty, 0);
+ r.to_string()
+}
+
+/// Text-format
+pub fn print_to_string(m: &Message) -> String {
+ print_to_string_internal(m, false)
+}
+
+/// Text-format to `fmt::Formatter`.
+pub fn fmt(m: &Message, f: &mut fmt::Formatter) -> fmt::Result {
+ let pretty = f.alternate();
+ f.write_str(&print_to_string_internal(m, pretty))
+}
+
+#[cfg(test)]
+mod test {
+
+ fn escape(data: &[u8]) -> String {
+ let mut s = String::with_capacity(data.len() * 4);
+ super::quote_bytes_to(data, &mut s);
+ s
+ }
+
+ fn test_escape_unescape(text: &str, escaped: &str) {
+ assert_eq!(text.as_bytes(), &super::unescape_string(escaped)[..]);
+ assert_eq!(escaped, &escape(text.as_bytes())[..]);
+ }
+
+ #[test]
+ fn test_print_to_bytes() {
+ assert_eq!("ab", escape(b"ab"));
+ assert_eq!("a\\\\023", escape(b"a\\023"));
+ assert_eq!("a\\r\\n\\t '\\\"\\\\", escape(b"a\r\n\t '\"\\"));
+ assert_eq!("\\344\\275\\240\\345\\245\\275", escape("你好".as_bytes()));
+ }
+
+ #[test]
+ fn test_unescape_string() {
+ test_escape_unescape("", "");
+ test_escape_unescape("aa", "aa");
+ test_escape_unescape("\n", "\\n");
+ test_escape_unescape("\r", "\\r");
+ test_escape_unescape("\t", "\\t");
+ test_escape_unescape("你好", "\\344\\275\\240\\345\\245\\275");
+ // hex
+ assert_eq!(b"aaa\x01bbb", &super::unescape_string("aaa\\x01bbb")[..]);
+ assert_eq!(b"aaa\xcdbbb", &super::unescape_string("aaa\\xCDbbb")[..]);
+ assert_eq!(b"aaa\xcdbbb", &super::unescape_string("aaa\\xCDbbb")[..]);
+ // quotes
+ assert_eq!(b"aaa\"bbb", &super::unescape_string("aaa\\\"bbb")[..]);
+ assert_eq!(b"aaa\'bbb", &super::unescape_string("aaa\\\'bbb")[..]);
+ }
+}
diff --git a/src/types.rs b/src/types.rs
new file mode 100644
index 0000000..2c3863a
--- /dev/null
+++ b/src/types.rs
@@ -0,0 +1,685 @@
+//! Implementations of `ProtobufType` for all types.
+
+use std::marker;
+use std::mem;
+
+#[cfg(feature = "bytes")]
+use bytes::Bytes;
+#[cfg(feature = "bytes")]
+use chars::Chars;
+
+use core::Message;
+use enums::ProtobufEnum;
+use error::ProtobufResult;
+use parse_from_bytes;
+use reflect::ProtobufValue;
+use rt;
+use stream::CodedInputStream;
+use stream::CodedOutputStream;
+use unknown::UnknownValues;
+use wire_format::WireType;
+use zigzag::decode_zig_zag_32;
+use zigzag::decode_zig_zag_64;
+
+/// Protobuf elementary type as generic trait
+pub trait ProtobufType {
+ /// Rust type of value
+ type Value: ProtobufValue + Clone + 'static;
+
+ /// Wire type when writing to stream
+ fn wire_type() -> WireType;
+
+ /// Read value from `CodedInputStream`
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<Self::Value>;
+
+ /// Compute wire size
+ fn compute_size(value: &Self::Value) -> u32;
+
+ /// Get value from `UnknownValues`
+ fn get_from_unknown(unknown_values: &UnknownValues) -> Option<Self::Value>;
+
+ /// Compute size adding length prefix if wire type is length delimited
+ /// (i. e. string, bytes, message)
+ fn compute_size_with_length_delimiter(value: &Self::Value) -> u32 {
+ let size = Self::compute_size(value);
+ if Self::wire_type() == WireType::WireTypeLengthDelimited {
+ rt::compute_raw_varint32_size(size) + size
+ } else {
+ size
+ }
+ }
+
+ /// Get previously computed size
+ #[inline]
+ fn get_cached_size(value: &Self::Value) -> u32 {
+ Self::compute_size(value)
+ }
+
+ /// Get previously cached size with length prefix
+ #[inline]
+ fn get_cached_size_with_length_delimiter(value: &Self::Value) -> u32 {
+ let size = Self::get_cached_size(value);
+ if Self::wire_type() == WireType::WireTypeLengthDelimited {
+ rt::compute_raw_varint32_size(size) + size
+ } else {
+ size
+ }
+ }
+
+ /// Write a value with previously cached size
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &Self::Value,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()>;
+}
+
+/// `float`
+pub struct ProtobufTypeFloat;
+/// `double`
+pub struct ProtobufTypeDouble;
+/// `uint32`
+pub struct ProtobufTypeInt32;
+/// `int64`
+pub struct ProtobufTypeInt64;
+/// `uint32`
+pub struct ProtobufTypeUint32;
+/// `uint64`
+pub struct ProtobufTypeUint64;
+/// `sint32`
+pub struct ProtobufTypeSint32;
+/// `sint64`
+pub struct ProtobufTypeSint64;
+/// `fixed32`
+pub struct ProtobufTypeFixed32;
+/// `fixed64`
+pub struct ProtobufTypeFixed64;
+/// `sfixed32`
+pub struct ProtobufTypeSfixed32;
+/// `sfixed64`
+pub struct ProtobufTypeSfixed64;
+/// `bool`
+pub struct ProtobufTypeBool;
+/// `string`
+pub struct ProtobufTypeString;
+/// `bytes`
+pub struct ProtobufTypeBytes;
+/// Something which should be deleted
+pub struct ProtobufTypeChars;
+
+/// `bytes` as [`Bytes`](bytes::Bytes)
+#[cfg(feature = "bytes")]
+pub struct ProtobufTypeCarllercheBytes;
+/// `string` as [`Chars`](crate::Chars)
+#[cfg(feature = "bytes")]
+pub struct ProtobufTypeCarllercheChars;
+
+/// `enum`
+pub struct ProtobufTypeEnum<E: ProtobufEnum>(marker::PhantomData<E>);
+/// `message`
+pub struct ProtobufTypeMessage<M: Message>(marker::PhantomData<M>);
+
+impl ProtobufType for ProtobufTypeFloat {
+ type Value = f32;
+
+ fn wire_type() -> WireType {
+ WireType::WireTypeFixed32
+ }
+
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<f32> {
+ is.read_float()
+ }
+
+ fn compute_size(_value: &f32) -> u32 {
+ 4
+ }
+
+ fn get_from_unknown(unknown_values: &UnknownValues) -> Option<f32> {
+ unknown_values
+ .fixed32
+ .iter()
+ .rev()
+ .next()
+ .map(|&bits| unsafe { mem::transmute::<u32, f32>(bits) })
+ }
+
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &f32,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()> {
+ os.write_float(field_number, *value)
+ }
+}
+
+impl ProtobufType for ProtobufTypeDouble {
+ type Value = f64;
+
+ fn wire_type() -> WireType {
+ WireType::WireTypeFixed64
+ }
+
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<f64> {
+ is.read_double()
+ }
+
+ fn get_from_unknown(unknown_values: &UnknownValues) -> Option<f64> {
+ unknown_values
+ .fixed64
+ .iter()
+ .rev()
+ .next()
+ .map(|&bits| unsafe { mem::transmute::<u64, f64>(bits) })
+ }
+
+ fn compute_size(_value: &f64) -> u32 {
+ 8
+ }
+
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &f64,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()> {
+ os.write_double(field_number, *value)
+ }
+}
+
+impl ProtobufType for ProtobufTypeInt32 {
+ type Value = i32;
+
+ fn wire_type() -> WireType {
+ WireType::WireTypeVarint
+ }
+
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<i32> {
+ is.read_int32()
+ }
+
+ fn compute_size(value: &i32) -> u32 {
+ // See also: https://github.com/protocolbuffers/protobuf/blob/bd00671b924310c0353a730bf8fa77c44e0a9c72/src/google/protobuf/io/coded_stream.h#L1300-L1306
+ if *value < 0 {
+ return 10;
+ }
+ rt::compute_raw_varint32_size(*value as u32)
+ }
+
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &i32,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()> {
+ os.write_int32(field_number, *value)
+ }
+
+ fn get_from_unknown(unknown_values: &UnknownValues) -> Option<i32> {
+ unknown_values.varint.iter().rev().next().map(|&v| v as i32)
+ }
+}
+
+impl ProtobufType for ProtobufTypeInt64 {
+ type Value = i64;
+
+ fn wire_type() -> WireType {
+ WireType::WireTypeVarint
+ }
+
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<i64> {
+ is.read_int64()
+ }
+
+ fn get_from_unknown(unknown_values: &UnknownValues) -> Option<i64> {
+ unknown_values.varint.iter().rev().next().map(|&v| v as i64)
+ }
+
+ fn compute_size(value: &i64) -> u32 {
+ rt::compute_raw_varint64_size(*value as u64)
+ }
+
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &i64,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()> {
+ os.write_int64(field_number, *value)
+ }
+}
+
+impl ProtobufType for ProtobufTypeUint32 {
+ type Value = u32;
+
+ fn wire_type() -> WireType {
+ WireType::WireTypeVarint
+ }
+
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<u32> {
+ is.read_uint32()
+ }
+
+ fn get_from_unknown(unknown_values: &UnknownValues) -> Option<u32> {
+ unknown_values.varint.iter().rev().next().map(|&v| v as u32)
+ }
+
+ fn compute_size(value: &u32) -> u32 {
+ rt::compute_raw_varint32_size(*value)
+ }
+
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &u32,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()> {
+ os.write_uint32(field_number, *value)
+ }
+}
+
+impl ProtobufType for ProtobufTypeUint64 {
+ type Value = u64;
+
+ fn wire_type() -> WireType {
+ WireType::WireTypeVarint
+ }
+
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<u64> {
+ is.read_uint64()
+ }
+
+ fn get_from_unknown(unknown_values: &UnknownValues) -> Option<u64> {
+ unknown_values.varint.iter().cloned().rev().next()
+ }
+
+ fn compute_size(value: &u64) -> u32 {
+ rt::compute_raw_varint64_size(*value)
+ }
+
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &u64,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()> {
+ os.write_uint64(field_number, *value)
+ }
+}
+
+impl ProtobufType for ProtobufTypeSint32 {
+ type Value = i32;
+
+ fn wire_type() -> WireType {
+ WireType::WireTypeVarint
+ }
+
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<i32> {
+ is.read_sint32()
+ }
+
+ fn get_from_unknown(unknown_values: &UnknownValues) -> Option<i32> {
+ ProtobufTypeUint32::get_from_unknown(unknown_values).map(decode_zig_zag_32)
+ }
+
+ fn compute_size(value: &i32) -> u32 {
+ rt::value_varint_zigzag_size_no_tag(*value)
+ }
+
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &i32,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()> {
+ os.write_sint32(field_number, *value)
+ }
+}
+
+impl ProtobufType for ProtobufTypeSint64 {
+ type Value = i64;
+
+ fn wire_type() -> WireType {
+ WireType::WireTypeVarint
+ }
+
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<i64> {
+ is.read_sint64()
+ }
+
+ fn get_from_unknown(unknown_values: &UnknownValues) -> Option<i64> {
+ ProtobufTypeUint64::get_from_unknown(unknown_values).map(decode_zig_zag_64)
+ }
+
+ fn compute_size(value: &i64) -> u32 {
+ rt::value_varint_zigzag_size_no_tag(*value)
+ }
+
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &i64,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()> {
+ os.write_sint64(field_number, *value)
+ }
+}
+
+impl ProtobufType for ProtobufTypeFixed32 {
+ type Value = u32;
+
+ fn wire_type() -> WireType {
+ WireType::WireTypeFixed32
+ }
+
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<u32> {
+ is.read_fixed32()
+ }
+
+ fn get_from_unknown(unknown_values: &UnknownValues) -> Option<u32> {
+ unknown_values.fixed32.iter().cloned().rev().next()
+ }
+
+ fn compute_size(_value: &u32) -> u32 {
+ 4
+ }
+
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &u32,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()> {
+ os.write_fixed32(field_number, *value)
+ }
+}
+
+impl ProtobufType for ProtobufTypeFixed64 {
+ type Value = u64;
+
+ fn wire_type() -> WireType {
+ WireType::WireTypeFixed64
+ }
+
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<u64> {
+ is.read_fixed64()
+ }
+
+ fn get_from_unknown(unknown_values: &UnknownValues) -> Option<u64> {
+ unknown_values.fixed64.iter().cloned().rev().next()
+ }
+
+ fn compute_size(_value: &u64) -> u32 {
+ 8
+ }
+
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &u64,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()> {
+ os.write_fixed64(field_number, *value)
+ }
+}
+
+impl ProtobufType for ProtobufTypeSfixed32 {
+ type Value = i32;
+
+ fn wire_type() -> WireType {
+ WireType::WireTypeFixed32
+ }
+
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<i32> {
+ is.read_sfixed32()
+ }
+
+ fn get_from_unknown(unknown_values: &UnknownValues) -> Option<i32> {
+ ProtobufTypeFixed32::get_from_unknown(unknown_values).map(|u| u as i32)
+ }
+
+ fn compute_size(_value: &i32) -> u32 {
+ 4
+ }
+
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &i32,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()> {
+ os.write_sfixed32(field_number, *value)
+ }
+}
+
+impl ProtobufType for ProtobufTypeSfixed64 {
+ type Value = i64;
+
+ fn wire_type() -> WireType {
+ WireType::WireTypeFixed64
+ }
+
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<i64> {
+ is.read_sfixed64()
+ }
+
+ fn get_from_unknown(unknown_values: &UnknownValues) -> Option<i64> {
+ ProtobufTypeFixed64::get_from_unknown(unknown_values).map(|u| u as i64)
+ }
+
+ fn compute_size(_value: &i64) -> u32 {
+ 8
+ }
+
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &i64,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()> {
+ os.write_sfixed64(field_number, *value)
+ }
+}
+
+impl ProtobufType for ProtobufTypeBool {
+ type Value = bool;
+
+ fn wire_type() -> WireType {
+ WireType::WireTypeVarint
+ }
+
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<bool> {
+ is.read_bool()
+ }
+
+ fn get_from_unknown(unknown: &UnknownValues) -> Option<bool> {
+ unknown.varint.iter().rev().next().map(|&v| v != 0)
+ }
+
+ fn compute_size(_value: &bool) -> u32 {
+ 1
+ }
+
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &bool,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()> {
+ os.write_bool(field_number, *value)
+ }
+}
+
+impl ProtobufType for ProtobufTypeString {
+ type Value = String;
+
+ fn wire_type() -> WireType {
+ WireType::WireTypeLengthDelimited
+ }
+
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<String> {
+ is.read_string()
+ }
+
+ fn get_from_unknown(unknown_values: &UnknownValues) -> Option<String> {
+ // TODO: should not panic
+ ProtobufTypeBytes::get_from_unknown(unknown_values)
+ .map(|b| String::from_utf8(b).expect("not a valid string"))
+ }
+
+ fn compute_size(value: &String) -> u32 {
+ value.len() as u32
+ }
+
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &String,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()> {
+ os.write_string(field_number, &value)
+ }
+}
+
+impl ProtobufType for ProtobufTypeBytes {
+ type Value = Vec<u8>;
+
+ fn wire_type() -> WireType {
+ WireType::WireTypeLengthDelimited
+ }
+
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<Vec<u8>> {
+ is.read_bytes()
+ }
+
+ fn get_from_unknown(unknown_values: &UnknownValues) -> Option<Vec<u8>> {
+ unknown_values.length_delimited.iter().cloned().rev().next()
+ }
+
+ fn compute_size(value: &Vec<u8>) -> u32 {
+ value.len() as u32
+ }
+
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &Vec<u8>,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()> {
+ os.write_bytes(field_number, &value)
+ }
+}
+
+#[cfg(feature = "bytes")]
+impl ProtobufType for ProtobufTypeCarllercheBytes {
+ type Value = Bytes;
+
+ fn wire_type() -> WireType {
+ ProtobufTypeBytes::wire_type()
+ }
+
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<Self::Value> {
+ is.read_carllerche_bytes()
+ }
+
+ fn get_from_unknown(unknown_values: &UnknownValues) -> Option<Bytes> {
+ ProtobufTypeBytes::get_from_unknown(unknown_values).map(Bytes::from)
+ }
+
+ fn compute_size(value: &Bytes) -> u32 {
+ value.len() as u32
+ }
+
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &Bytes,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()> {
+ os.write_bytes(field_number, &value)
+ }
+}
+
+#[cfg(feature = "bytes")]
+impl ProtobufType for ProtobufTypeCarllercheChars {
+ type Value = Chars;
+
+ fn wire_type() -> WireType {
+ ProtobufTypeBytes::wire_type()
+ }
+
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<Self::Value> {
+ is.read_carllerche_chars()
+ }
+
+ fn get_from_unknown(unknown_values: &UnknownValues) -> Option<Chars> {
+ ProtobufTypeString::get_from_unknown(unknown_values).map(Chars::from)
+ }
+
+ fn compute_size(value: &Chars) -> u32 {
+ value.len() as u32
+ }
+
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &Chars,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()> {
+ os.write_string(field_number, &value)
+ }
+}
+
+impl<E: ProtobufEnum + ProtobufValue> ProtobufType for ProtobufTypeEnum<E> {
+ type Value = E;
+
+ fn wire_type() -> WireType {
+ WireType::WireTypeVarint
+ }
+
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<E> {
+ is.read_enum()
+ }
+
+ fn get_from_unknown(unknown_values: &UnknownValues) -> Option<E> {
+ // TODO: do not panic
+ ProtobufTypeInt32::get_from_unknown(unknown_values)
+ .map(|i| E::from_i32(i).expect("not a valid enum value"))
+ }
+
+ fn compute_size(value: &E) -> u32 {
+ rt::compute_raw_varint32_size(value.value() as u32) // TODO: wrap
+ }
+
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &E,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()> {
+ os.write_enum_obj(field_number, *value)
+ }
+}
+
+impl<M: Message + Clone + ProtobufValue> ProtobufType for ProtobufTypeMessage<M> {
+ type Value = M;
+
+ fn wire_type() -> WireType {
+ WireType::WireTypeLengthDelimited
+ }
+
+ fn read(is: &mut CodedInputStream) -> ProtobufResult<M> {
+ is.read_message()
+ }
+
+ fn get_from_unknown(unknown_values: &UnknownValues) -> Option<M> {
+ // TODO: do not panic
+ unknown_values
+ .length_delimited
+ .iter()
+ .rev()
+ .next()
+ .map(|bytes| parse_from_bytes(bytes).expect("cannot parse message"))
+ }
+
+ fn compute_size(value: &M) -> u32 {
+ value.compute_size()
+ }
+
+ fn get_cached_size(value: &M) -> u32 {
+ value.get_cached_size()
+ }
+
+ fn write_with_cached_size(
+ field_number: u32,
+ value: &Self::Value,
+ os: &mut CodedOutputStream,
+ ) -> ProtobufResult<()> {
+ os.write_tag(field_number, WireType::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(value.get_cached_size())?;
+ value.write_to_with_cached_sizes(os)?;
+ Ok(())
+ }
+}
diff --git a/src/unknown.rs b/src/unknown.rs
new file mode 100644
index 0000000..2ab9a94
--- /dev/null
+++ b/src/unknown.rs
@@ -0,0 +1,325 @@
+use clear::Clear;
+use std::collections::hash_map;
+use std::collections::hash_map::DefaultHasher;
+use std::collections::HashMap;
+use std::default::Default;
+use std::hash::Hash;
+use std::hash::Hasher;
+use std::slice;
+use stream::wire_format;
+use zigzag::encode_zig_zag_32;
+use zigzag::encode_zig_zag_64;
+
+/// Unknown value.
+///
+/// See [`UnknownFields`](crate::UnknownFields) for the explanations.
+#[derive(Debug)]
+pub enum UnknownValue {
+ /// 32-bit unknown (e. g. `fixed32` or `float`)
+ Fixed32(u32),
+ /// 64-bit unknown (e. g. `fixed64` or `double`)
+ Fixed64(u64),
+ /// Varint unknown (e. g. `int32` or `bool`)
+ Varint(u64),
+ /// Length-delimited unknown (e. g. `message` or `string`)
+ LengthDelimited(Vec<u8>),
+}
+
+impl UnknownValue {
+ /// Wire type for this unknown
+ pub fn wire_type(&self) -> wire_format::WireType {
+ self.get_ref().wire_type()
+ }
+
+ /// As ref
+ pub fn get_ref<'s>(&'s self) -> UnknownValueRef<'s> {
+ match *self {
+ UnknownValue::Fixed32(fixed32) => UnknownValueRef::Fixed32(fixed32),
+ UnknownValue::Fixed64(fixed64) => UnknownValueRef::Fixed64(fixed64),
+ UnknownValue::Varint(varint) => UnknownValueRef::Varint(varint),
+ UnknownValue::LengthDelimited(ref bytes) => UnknownValueRef::LengthDelimited(&bytes),
+ }
+ }
+
+ /// Construct unknown value from `sint32` value.
+ pub fn sint32(i: i32) -> UnknownValue {
+ UnknownValue::Varint(encode_zig_zag_32(i) as u64)
+ }
+
+ /// Construct unknown value from `sint64` value.
+ pub fn sint64(i: i64) -> UnknownValue {
+ UnknownValue::Varint(encode_zig_zag_64(i))
+ }
+}
+
+/// Reference to unknown value.
+///
+/// See [`UnknownFields`](crate::UnknownFields) for explanations.
+pub enum UnknownValueRef<'o> {
+ /// 32-bit unknown
+ Fixed32(u32),
+ /// 64-bit unknown
+ Fixed64(u64),
+ /// Varint unknown
+ Varint(u64),
+ /// Length-delimited unknown
+ LengthDelimited(&'o [u8]),
+}
+
+impl<'o> UnknownValueRef<'o> {
+ /// Wire-type to serialize this unknown
+ pub fn wire_type(&self) -> wire_format::WireType {
+ match *self {
+ UnknownValueRef::Fixed32(_) => wire_format::WireTypeFixed32,
+ UnknownValueRef::Fixed64(_) => wire_format::WireTypeFixed64,
+ UnknownValueRef::Varint(_) => wire_format::WireTypeVarint,
+ UnknownValueRef::LengthDelimited(_) => wire_format::WireTypeLengthDelimited,
+ }
+ }
+}
+
+/// Field unknown values.
+///
+/// See [`UnknownFields`](crate::UnknownFields) for explanations.
+#[derive(Clone, PartialEq, Eq, Debug, Default, Hash)]
+pub struct UnknownValues {
+ /// 32-bit unknowns
+ pub fixed32: Vec<u32>,
+ /// 64-bit unknowns
+ pub fixed64: Vec<u64>,
+ /// Varint unknowns
+ pub varint: Vec<u64>,
+ /// Length-delimited unknowns
+ pub length_delimited: Vec<Vec<u8>>,
+}
+
+impl UnknownValues {
+ /// Add unknown value
+ pub fn add_value(&mut self, value: UnknownValue) {
+ match value {
+ UnknownValue::Fixed64(fixed64) => self.fixed64.push(fixed64),
+ UnknownValue::Fixed32(fixed32) => self.fixed32.push(fixed32),
+ UnknownValue::Varint(varint) => self.varint.push(varint),
+ UnknownValue::LengthDelimited(length_delimited) => {
+ self.length_delimited.push(length_delimited)
+ }
+ };
+ }
+
+ /// Iterate over unknown values
+ pub fn iter<'s>(&'s self) -> UnknownValuesIter<'s> {
+ UnknownValuesIter {
+ fixed32: self.fixed32.iter(),
+ fixed64: self.fixed64.iter(),
+ varint: self.varint.iter(),
+ length_delimited: self.length_delimited.iter(),
+ }
+ }
+}
+
+impl<'a> IntoIterator for &'a UnknownValues {
+ type Item = UnknownValueRef<'a>;
+ type IntoIter = UnknownValuesIter<'a>;
+
+ fn into_iter(self) -> UnknownValuesIter<'a> {
+ self.iter()
+ }
+}
+
+/// Iterator over unknown values
+pub struct UnknownValuesIter<'o> {
+ fixed32: slice::Iter<'o, u32>,
+ fixed64: slice::Iter<'o, u64>,
+ varint: slice::Iter<'o, u64>,
+ length_delimited: slice::Iter<'o, Vec<u8>>,
+}
+
+impl<'o> Iterator for UnknownValuesIter<'o> {
+ type Item = UnknownValueRef<'o>;
+
+ fn next(&mut self) -> Option<UnknownValueRef<'o>> {
+ let fixed32 = self.fixed32.next();
+ if fixed32.is_some() {
+ return Some(UnknownValueRef::Fixed32(*fixed32.unwrap()));
+ }
+ let fixed64 = self.fixed64.next();
+ if fixed64.is_some() {
+ return Some(UnknownValueRef::Fixed64(*fixed64.unwrap()));
+ }
+ let varint = self.varint.next();
+ if varint.is_some() {
+ return Some(UnknownValueRef::Varint(*varint.unwrap()));
+ }
+ let length_delimited = self.length_delimited.next();
+ if length_delimited.is_some() {
+ return Some(UnknownValueRef::LengthDelimited(&length_delimited.unwrap()));
+ }
+ None
+ }
+}
+
+/// Hold "unknown" fields in parsed message.
+///
+/// Field may be unknown if it they are added in newer version of `.proto`.
+/// Unknown fields are stored in `UnknownFields` structure, so
+/// protobuf message could process messages without losing data.
+///
+/// For example, in this operation: load from DB, modify, store to DB,
+/// even when working with older `.proto` file, new fields won't be lost.
+#[derive(Clone, PartialEq, Eq, Debug, Default)]
+pub struct UnknownFields {
+ /// The map.
+ // option is needed, because HashMap constructor performs allocation,
+ // and very expensive
+ // TODO: hide
+ pub fields: Option<Box<HashMap<u32, UnknownValues>>>,
+}
+
+/// Very simple hash implementation of `Hash` for `UnknownFields`.
+/// Since map is unordered, we cannot put entry hashes into hasher,
+/// instead we summing hashes of entries.
+impl Hash for UnknownFields {
+ fn hash<H: Hasher>(&self, state: &mut H) {
+ if let Some(ref map) = self.fields {
+ if !map.is_empty() {
+ let mut hash: u64 = 0;
+ for (k, v) in &**map {
+ let mut entry_hasher = DefaultHasher::new();
+ Hash::hash(&(k, v), &mut entry_hasher);
+ hash = hash.wrapping_add(entry_hasher.finish());
+ }
+ Hash::hash(&map.len(), state);
+ Hash::hash(&hash, state);
+ }
+ }
+ }
+}
+
+impl UnknownFields {
+ /// Empty unknown fields
+ pub fn new() -> UnknownFields {
+ Default::default()
+ }
+
+ fn init_map(&mut self) {
+ if self.fields.is_none() {
+ self.fields = Some(Default::default());
+ }
+ }
+
+ fn find_field<'a>(&'a mut self, number: &'a u32) -> &'a mut UnknownValues {
+ self.init_map();
+
+ match self.fields.as_mut().unwrap().entry(*number) {
+ hash_map::Entry::Occupied(e) => e.into_mut(),
+ hash_map::Entry::Vacant(e) => e.insert(Default::default()),
+ }
+ }
+
+ /// Add unknown fixed 32-bit
+ pub fn add_fixed32(&mut self, number: u32, fixed32: u32) {
+ self.find_field(&number).fixed32.push(fixed32);
+ }
+
+ /// Add unknown fixed 64-bit
+ pub fn add_fixed64(&mut self, number: u32, fixed64: u64) {
+ self.find_field(&number).fixed64.push(fixed64);
+ }
+
+ /// Add unknown varint
+ pub fn add_varint(&mut self, number: u32, varint: u64) {
+ self.find_field(&number).varint.push(varint);
+ }
+
+ /// Add unknown length delimited
+ pub fn add_length_delimited(&mut self, number: u32, length_delimited: Vec<u8>) {
+ self.find_field(&number)
+ .length_delimited
+ .push(length_delimited);
+ }
+
+ /// Add unknown value
+ pub fn add_value(&mut self, number: u32, value: UnknownValue) {
+ self.find_field(&number).add_value(value);
+ }
+
+ /// Iterate over all unknowns
+ pub fn iter<'s>(&'s self) -> UnknownFieldsIter<'s> {
+ UnknownFieldsIter {
+ entries: self.fields.as_ref().map(|m| m.iter()),
+ }
+ }
+
+ /// Find unknown field by number
+ pub fn get(&self, field_number: u32) -> Option<&UnknownValues> {
+ match self.fields {
+ Some(ref map) => map.get(&field_number),
+ None => None,
+ }
+ }
+}
+
+impl Clear for UnknownFields {
+ fn clear(&mut self) {
+ if let Some(ref mut fields) = self.fields {
+ fields.clear();
+ }
+ }
+}
+
+impl<'a> IntoIterator for &'a UnknownFields {
+ type Item = (u32, &'a UnknownValues);
+ type IntoIter = UnknownFieldsIter<'a>;
+
+ fn into_iter(self) -> UnknownFieldsIter<'a> {
+ self.iter()
+ }
+}
+
+/// Iterator over [`UnknownFields`](crate::UnknownFields)
+pub struct UnknownFieldsIter<'s> {
+ entries: Option<hash_map::Iter<'s, u32, UnknownValues>>,
+}
+
+impl<'s> Iterator for UnknownFieldsIter<'s> {
+ type Item = (u32, &'s UnknownValues);
+
+ fn next(&mut self) -> Option<(u32, &'s UnknownValues)> {
+ match self.entries {
+ Some(ref mut entries) => entries.next().map(|(&number, values)| (number, values)),
+ None => None,
+ }
+ }
+}
+
+#[cfg(test)]
+mod test {
+ use super::UnknownFields;
+ use std::collections::hash_map::DefaultHasher;
+ use std::hash::Hash;
+ use std::hash::Hasher;
+
+ #[test]
+ fn unknown_fields_hash() {
+ let mut unknown_fields_1 = UnknownFields::new();
+ let mut unknown_fields_2 = UnknownFields::new();
+
+ // Check field order is not important
+
+ unknown_fields_1.add_fixed32(10, 222);
+ unknown_fields_1.add_fixed32(10, 223);
+ unknown_fields_1.add_fixed64(14, 224);
+
+ unknown_fields_2.add_fixed32(10, 222);
+ unknown_fields_2.add_fixed64(14, 224);
+ unknown_fields_2.add_fixed32(10, 223);
+
+ fn hash(unknown_fields: &UnknownFields) -> u64 {
+ let mut hasher = DefaultHasher::new();
+ Hash::hash(unknown_fields, &mut hasher);
+ hasher.finish()
+ }
+
+ assert_eq!(hash(&unknown_fields_1), hash(&unknown_fields_2));
+ }
+}
diff --git a/src/varint.rs b/src/varint.rs
new file mode 100644
index 0000000..1f1cb1c
--- /dev/null
+++ b/src/varint.rs
@@ -0,0 +1,35 @@
+/// Encode u64 as varint.
+/// Panics if buffer length is less than 10.
+#[inline]
+pub fn encode_varint64(mut value: u64, buf: &mut [u8]) -> usize {
+ assert!(buf.len() >= 10);
+
+ unsafe {
+ let mut i = 0;
+ while (value & !0x7F) > 0 {
+ *buf.get_unchecked_mut(i) = ((value & 0x7F) | 0x80) as u8;
+ value >>= 7;
+ i += 1;
+ }
+ *buf.get_unchecked_mut(i) = value as u8;
+ i + 1
+ }
+}
+
+/// Encode u32 value as varint.
+/// Panics if buffer length is less than 5.
+#[inline]
+pub fn encode_varint32(mut value: u32, buf: &mut [u8]) -> usize {
+ assert!(buf.len() >= 5);
+
+ unsafe {
+ let mut i = 0;
+ while (value & !0x7F) > 0 {
+ *buf.get_unchecked_mut(i) = ((value & 0x7F) | 0x80) as u8;
+ value >>= 7;
+ i += 1;
+ }
+ *buf.get_unchecked_mut(i) = value as u8;
+ i + 1
+ }
+}
diff --git a/src/well_known_types/any.rs b/src/well_known_types/any.rs
new file mode 100644
index 0000000..25166a0
--- /dev/null
+++ b/src/well_known_types/any.rs
@@ -0,0 +1,368 @@
+// This file is generated by rust-protobuf 2.14.0-pre. Do not edit
+// @generated
+
+// https://github.com/rust-lang/rust-clippy/issues/702
+#![allow(unknown_lints)]
+#![allow(clippy::all)]
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
+#![allow(box_pointers)]
+#![allow(dead_code)]
+#![allow(missing_docs)]
+#![allow(non_camel_case_types)]
+#![allow(non_snake_case)]
+#![allow(non_upper_case_globals)]
+#![allow(trivial_casts)]
+#![allow(unsafe_code)]
+#![allow(unused_imports)]
+#![allow(unused_results)]
+//! Generated file from `google/protobuf/any.proto`
+
+use protobuf::Message as Message_imported_for_functions;
+use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct Any {
+ // message fields
+ pub type_url: ::std::string::String,
+ pub value: ::std::vec::Vec<u8>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a Any {
+ fn default() -> &'a Any {
+ <Any as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl Any {
+ pub fn new() -> Any {
+ ::std::default::Default::default()
+ }
+
+ // string type_url = 1;
+
+
+ pub fn get_type_url(&self) -> &str {
+ &self.type_url
+ }
+ pub fn clear_type_url(&mut self) {
+ self.type_url.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_type_url(&mut self, v: ::std::string::String) {
+ self.type_url = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_type_url(&mut self) -> &mut ::std::string::String {
+ &mut self.type_url
+ }
+
+ // Take field
+ pub fn take_type_url(&mut self) -> ::std::string::String {
+ ::std::mem::replace(&mut self.type_url, ::std::string::String::new())
+ }
+
+ // bytes value = 2;
+
+
+ pub fn get_value(&self) -> &[u8] {
+ &self.value
+ }
+ pub fn clear_value(&mut self) {
+ self.value.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_value(&mut self, v: ::std::vec::Vec<u8>) {
+ self.value = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_value(&mut self) -> &mut ::std::vec::Vec<u8> {
+ &mut self.value
+ }
+
+ // Take field
+ pub fn take_value(&mut self) -> ::std::vec::Vec<u8> {
+ ::std::mem::replace(&mut self.value, ::std::vec::Vec::new())
+ }
+}
+
+impl ::protobuf::Message for Any {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.type_url)?;
+ },
+ 2 => {
+ ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if !self.type_url.is_empty() {
+ my_size += ::protobuf::rt::string_size(1, &self.type_url);
+ }
+ if !self.value.is_empty() {
+ my_size += ::protobuf::rt::bytes_size(2, &self.value);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if !self.type_url.is_empty() {
+ os.write_string(1, &self.type_url)?;
+ }
+ if !self.value.is_empty() {
+ os.write_bytes(2, &self.value)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> Any {
+ Any::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "type_url",
+ |m: &Any| { &m.type_url },
+ |m: &mut Any| { &mut m.type_url },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
+ "value",
+ |m: &Any| { &m.value },
+ |m: &mut Any| { &mut m.value },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<Any>(
+ "Any",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static Any {
+ static mut instance: ::protobuf::lazy::Lazy<Any> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(Any::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for Any {
+ fn clear(&mut self) {
+ self.type_url.clear();
+ self.value.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for Any {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for Any {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+static file_descriptor_proto_data: &'static [u8] = b"\
+ \n\x19google/protobuf/any.proto\x12\x0fgoogle.protobuf\"6\n\x03Any\x12\
+ \x19\n\x08type_url\x18\x01\x20\x01(\tR\x07typeUrl\x12\x14\n\x05value\x18\
+ \x02\x20\x01(\x0cR\x05valueBo\n\x13com.google.protobufB\x08AnyProtoP\x01\
+ Z%github.com/golang/protobuf/ptypes/any\xa2\x02\x03GPB\xaa\x02\x1eGoogle\
+ .Protobuf.WellKnownTypesJ\x8a&\n\x07\x12\x05\x1e\0\x8a\x01\x01\n\xcc\x0c\
+ \n\x01\x0c\x12\x03\x1e\0\x122\xc1\x0c\x20Protocol\x20Buffers\x20-\x20Goo\
+ gle's\x20data\x20interchange\x20format\n\x20Copyright\x202008\x20Google\
+ \x20Inc.\x20\x20All\x20rights\x20reserved.\n\x20https://developers.googl\
+ e.com/protocol-buffers/\n\n\x20Redistribution\x20and\x20use\x20in\x20sou\
+ rce\x20and\x20binary\x20forms,\x20with\x20or\x20without\n\x20modificatio\
+ n,\x20are\x20permitted\x20provided\x20that\x20the\x20following\x20condit\
+ ions\x20are\n\x20met:\n\n\x20\x20\x20\x20\x20*\x20Redistributions\x20of\
+ \x20source\x20code\x20must\x20retain\x20the\x20above\x20copyright\n\x20n\
+ otice,\x20this\x20list\x20of\x20conditions\x20and\x20the\x20following\
+ \x20disclaimer.\n\x20\x20\x20\x20\x20*\x20Redistributions\x20in\x20binar\
+ y\x20form\x20must\x20reproduce\x20the\x20above\n\x20copyright\x20notice,\
+ \x20this\x20list\x20of\x20conditions\x20and\x20the\x20following\x20discl\
+ aimer\n\x20in\x20the\x20documentation\x20and/or\x20other\x20materials\
+ \x20provided\x20with\x20the\n\x20distribution.\n\x20\x20\x20\x20\x20*\
+ \x20Neither\x20the\x20name\x20of\x20Google\x20Inc.\x20nor\x20the\x20name\
+ s\x20of\x20its\n\x20contributors\x20may\x20be\x20used\x20to\x20endorse\
+ \x20or\x20promote\x20products\x20derived\x20from\n\x20this\x20software\
+ \x20without\x20specific\x20prior\x20written\x20permission.\n\n\x20THIS\
+ \x20SOFTWARE\x20IS\x20PROVIDED\x20BY\x20THE\x20COPYRIGHT\x20HOLDERS\x20A\
+ ND\x20CONTRIBUTORS\n\x20\"AS\x20IS\"\x20AND\x20ANY\x20EXPRESS\x20OR\x20I\
+ MPLIED\x20WARRANTIES,\x20INCLUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\
+ \x20THE\x20IMPLIED\x20WARRANTIES\x20OF\x20MERCHANTABILITY\x20AND\x20FITN\
+ ESS\x20FOR\n\x20A\x20PARTICULAR\x20PURPOSE\x20ARE\x20DISCLAIMED.\x20IN\
+ \x20NO\x20EVENT\x20SHALL\x20THE\x20COPYRIGHT\n\x20OWNER\x20OR\x20CONTRIB\
+ UTORS\x20BE\x20LIABLE\x20FOR\x20ANY\x20DIRECT,\x20INDIRECT,\x20INCIDENTA\
+ L,\n\x20SPECIAL,\x20EXEMPLARY,\x20OR\x20CONSEQUENTIAL\x20DAMAGES\x20(INC\
+ LUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\x20PROCUREMENT\x20OF\x20SUBSTI\
+ TUTE\x20GOODS\x20OR\x20SERVICES;\x20LOSS\x20OF\x20USE,\n\x20DATA,\x20OR\
+ \x20PROFITS;\x20OR\x20BUSINESS\x20INTERRUPTION)\x20HOWEVER\x20CAUSED\x20\
+ AND\x20ON\x20ANY\n\x20THEORY\x20OF\x20LIABILITY,\x20WHETHER\x20IN\x20CON\
+ TRACT,\x20STRICT\x20LIABILITY,\x20OR\x20TORT\n\x20(INCLUDING\x20NEGLIGEN\
+ CE\x20OR\x20OTHERWISE)\x20ARISING\x20IN\x20ANY\x20WAY\x20OUT\x20OF\x20TH\
+ E\x20USE\n\x20OF\x20THIS\x20SOFTWARE,\x20EVEN\x20IF\x20ADVISED\x20OF\x20\
+ THE\x20POSSIBILITY\x20OF\x20SUCH\x20DAMAGE.\n\n\x08\n\x01\x02\x12\x03\
+ \x20\0\x18\n\x08\n\x01\x08\x12\x03\"\0;\n\t\n\x02\x08%\x12\x03\"\0;\n\
+ \x08\n\x01\x08\x12\x03#\0<\n\t\n\x02\x08\x0b\x12\x03#\0<\n\x08\n\x01\x08\
+ \x12\x03$\0,\n\t\n\x02\x08\x01\x12\x03$\0,\n\x08\n\x01\x08\x12\x03%\0)\n\
+ \t\n\x02\x08\x08\x12\x03%\0)\n\x08\n\x01\x08\x12\x03&\0\"\n\t\n\x02\x08\
+ \n\x12\x03&\0\"\n\x08\n\x01\x08\x12\x03'\0!\n\t\n\x02\x08$\x12\x03'\0!\n\
+ \x81\x0f\n\x02\x04\0\x12\x05o\0\x8a\x01\x01\x1a\xf3\x0e\x20`Any`\x20cont\
+ ains\x20an\x20arbitrary\x20serialized\x20protocol\x20buffer\x20message\
+ \x20along\x20with\x20a\n\x20URL\x20that\x20describes\x20the\x20type\x20o\
+ f\x20the\x20serialized\x20message.\n\n\x20Protobuf\x20library\x20provide\
+ s\x20support\x20to\x20pack/unpack\x20Any\x20values\x20in\x20the\x20form\
+ \n\x20of\x20utility\x20functions\x20or\x20additional\x20generated\x20met\
+ hods\x20of\x20the\x20Any\x20type.\n\n\x20Example\x201:\x20Pack\x20and\
+ \x20unpack\x20a\x20message\x20in\x20C++.\n\n\x20\x20\x20\x20\x20Foo\x20f\
+ oo\x20=\x20...;\n\x20\x20\x20\x20\x20Any\x20any;\n\x20\x20\x20\x20\x20an\
+ y.PackFrom(foo);\n\x20\x20\x20\x20\x20...\n\x20\x20\x20\x20\x20if\x20(an\
+ y.UnpackTo(&foo))\x20{\n\x20\x20\x20\x20\x20\x20\x20...\n\x20\x20\x20\
+ \x20\x20}\n\n\x20Example\x202:\x20Pack\x20and\x20unpack\x20a\x20message\
+ \x20in\x20Java.\n\n\x20\x20\x20\x20\x20Foo\x20foo\x20=\x20...;\n\x20\x20\
+ \x20\x20\x20Any\x20any\x20=\x20Any.pack(foo);\n\x20\x20\x20\x20\x20...\n\
+ \x20\x20\x20\x20\x20if\x20(any.is(Foo.class))\x20{\n\x20\x20\x20\x20\x20\
+ \x20\x20foo\x20=\x20any.unpack(Foo.class);\n\x20\x20\x20\x20\x20}\n\n\
+ \x20\x20Example\x203:\x20Pack\x20and\x20unpack\x20a\x20message\x20in\x20\
+ Python.\n\n\x20\x20\x20\x20\x20foo\x20=\x20Foo(...)\n\x20\x20\x20\x20\
+ \x20any\x20=\x20Any()\n\x20\x20\x20\x20\x20any.Pack(foo)\n\x20\x20\x20\
+ \x20\x20...\n\x20\x20\x20\x20\x20if\x20any.Is(Foo.DESCRIPTOR):\n\x20\x20\
+ \x20\x20\x20\x20\x20any.Unpack(foo)\n\x20\x20\x20\x20\x20\x20\x20...\n\n\
+ \x20The\x20pack\x20methods\x20provided\x20by\x20protobuf\x20library\x20w\
+ ill\x20by\x20default\x20use\n\x20'type.googleapis.com/full.type.name'\
+ \x20as\x20the\x20type\x20URL\x20and\x20the\x20unpack\n\x20methods\x20onl\
+ y\x20use\x20the\x20fully\x20qualified\x20type\x20name\x20after\x20the\
+ \x20last\x20'/'\n\x20in\x20the\x20type\x20URL,\x20for\x20example\x20\"fo\
+ o.bar.com/x/y.z\"\x20will\x20yield\x20type\n\x20name\x20\"y.z\".\n\n\n\
+ \x20JSON\n\x20====\n\x20The\x20JSON\x20representation\x20of\x20an\x20`An\
+ y`\x20value\x20uses\x20the\x20regular\n\x20representation\x20of\x20the\
+ \x20deserialized,\x20embedded\x20message,\x20with\x20an\n\x20additional\
+ \x20field\x20`@type`\x20which\x20contains\x20the\x20type\x20URL.\x20Exam\
+ ple:\n\n\x20\x20\x20\x20\x20package\x20google.profile;\n\x20\x20\x20\x20\
+ \x20message\x20Person\x20{\n\x20\x20\x20\x20\x20\x20\x20string\x20first_\
+ name\x20=\x201;\n\x20\x20\x20\x20\x20\x20\x20string\x20last_name\x20=\
+ \x202;\n\x20\x20\x20\x20\x20}\n\n\x20\x20\x20\x20\x20{\n\x20\x20\x20\x20\
+ \x20\x20\x20\"@type\":\x20\"type.googleapis.com/google.profile.Person\",\
+ \n\x20\x20\x20\x20\x20\x20\x20\"firstName\":\x20<string>,\n\x20\x20\x20\
+ \x20\x20\x20\x20\"lastName\":\x20<string>\n\x20\x20\x20\x20\x20}\n\n\x20\
+ If\x20the\x20embedded\x20message\x20type\x20is\x20well-known\x20and\x20h\
+ as\x20a\x20custom\x20JSON\n\x20representation,\x20that\x20representation\
+ \x20will\x20be\x20embedded\x20adding\x20a\x20field\n\x20`value`\x20which\
+ \x20holds\x20the\x20custom\x20JSON\x20in\x20addition\x20to\x20the\x20`@t\
+ ype`\n\x20field.\x20Example\x20(for\x20message\x20[google.protobuf.Durat\
+ ion][]):\n\n\x20\x20\x20\x20\x20{\n\x20\x20\x20\x20\x20\x20\x20\"@type\"\
+ :\x20\"type.googleapis.com/google.protobuf.Duration\",\n\x20\x20\x20\x20\
+ \x20\x20\x20\"value\":\x20\"1.212s\"\n\x20\x20\x20\x20\x20}\n\n\n\n\n\
+ \x03\x04\0\x01\x12\x03o\x08\x0b\n\xe4\x07\n\x04\x04\0\x02\0\x12\x04\x86\
+ \x01\x02\x16\x1a\xd5\x07\x20A\x20URL/resource\x20name\x20whose\x20conten\
+ t\x20describes\x20the\x20type\x20of\x20the\n\x20serialized\x20protocol\
+ \x20buffer\x20message.\n\n\x20For\x20URLs\x20which\x20use\x20the\x20sche\
+ me\x20`http`,\x20`https`,\x20or\x20no\x20scheme,\x20the\n\x20following\
+ \x20restrictions\x20and\x20interpretations\x20apply:\n\n\x20*\x20If\x20n\
+ o\x20scheme\x20is\x20provided,\x20`https`\x20is\x20assumed.\n\x20*\x20Th\
+ e\x20last\x20segment\x20of\x20the\x20URL's\x20path\x20must\x20represent\
+ \x20the\x20fully\n\x20\x20\x20qualified\x20name\x20of\x20the\x20type\x20\
+ (as\x20in\x20`path/google.protobuf.Duration`).\n\x20\x20\x20The\x20name\
+ \x20should\x20be\x20in\x20a\x20canonical\x20form\x20(e.g.,\x20leading\
+ \x20\".\"\x20is\n\x20\x20\x20not\x20accepted).\n\x20*\x20An\x20HTTP\x20G\
+ ET\x20on\x20the\x20URL\x20must\x20yield\x20a\x20[google.protobuf.Type][]\
+ \n\x20\x20\x20value\x20in\x20binary\x20format,\x20or\x20produce\x20an\
+ \x20error.\n\x20*\x20Applications\x20are\x20allowed\x20to\x20cache\x20lo\
+ okup\x20results\x20based\x20on\x20the\n\x20\x20\x20URL,\x20or\x20have\
+ \x20them\x20precompiled\x20into\x20a\x20binary\x20to\x20avoid\x20any\n\
+ \x20\x20\x20lookup.\x20Therefore,\x20binary\x20compatibility\x20needs\
+ \x20to\x20be\x20preserved\n\x20\x20\x20on\x20changes\x20to\x20types.\x20\
+ (Use\x20versioned\x20type\x20names\x20to\x20manage\n\x20\x20\x20breaking\
+ \x20changes.)\n\n\x20Schemes\x20other\x20than\x20`http`,\x20`https`\x20(\
+ or\x20the\x20empty\x20scheme)\x20might\x20be\n\x20used\x20with\x20implem\
+ entation\x20specific\x20semantics.\n\n\n\r\n\x05\x04\0\x02\0\x05\x12\x04\
+ \x86\x01\x02\x08\n\r\n\x05\x04\0\x02\0\x01\x12\x04\x86\x01\t\x11\n\r\n\
+ \x05\x04\0\x02\0\x03\x12\x04\x86\x01\x14\x15\nW\n\x04\x04\0\x02\x01\x12\
+ \x04\x89\x01\x02\x12\x1aI\x20Must\x20be\x20a\x20valid\x20serialized\x20p\
+ rotocol\x20buffer\x20of\x20the\x20above\x20specified\x20type.\n\n\r\n\
+ \x05\x04\0\x02\x01\x05\x12\x04\x89\x01\x02\x07\n\r\n\x05\x04\0\x02\x01\
+ \x01\x12\x04\x89\x01\x08\r\n\r\n\x05\x04\0\x02\x01\x03\x12\x04\x89\x01\
+ \x10\x11b\x06proto3\
+";
+
+static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+
+fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
+ ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
+}
+
+pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
+ unsafe {
+ file_descriptor_proto_lazy.get(|| {
+ parse_descriptor_proto()
+ })
+ }
+}
diff --git a/src/well_known_types/api.rs b/src/well_known_types/api.rs
new file mode 100644
index 0000000..c4848f2
--- /dev/null
+++ b/src/well_known_types/api.rs
@@ -0,0 +1,1296 @@
+// This file is generated by rust-protobuf 2.14.0-pre. Do not edit
+// @generated
+
+// https://github.com/rust-lang/rust-clippy/issues/702
+#![allow(unknown_lints)]
+#![allow(clippy::all)]
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
+#![allow(box_pointers)]
+#![allow(dead_code)]
+#![allow(missing_docs)]
+#![allow(non_camel_case_types)]
+#![allow(non_snake_case)]
+#![allow(non_upper_case_globals)]
+#![allow(trivial_casts)]
+#![allow(unsafe_code)]
+#![allow(unused_imports)]
+#![allow(unused_results)]
+//! Generated file from `google/protobuf/api.proto`
+
+use protobuf::Message as Message_imported_for_functions;
+use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct Api {
+ // message fields
+ pub name: ::std::string::String,
+ pub methods: ::protobuf::RepeatedField<Method>,
+ pub options: ::protobuf::RepeatedField<::protobuf::well_known_types::Option>,
+ pub version: ::std::string::String,
+ pub source_context: ::protobuf::SingularPtrField<::protobuf::well_known_types::SourceContext>,
+ pub mixins: ::protobuf::RepeatedField<Mixin>,
+ pub syntax: ::protobuf::well_known_types::Syntax,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a Api {
+ fn default() -> &'a Api {
+ <Api as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl Api {
+ pub fn new() -> Api {
+ ::std::default::Default::default()
+ }
+
+ // string name = 1;
+
+
+ pub fn get_name(&self) -> &str {
+ &self.name
+ }
+ pub fn clear_name(&mut self) {
+ self.name.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_name(&mut self, v: ::std::string::String) {
+ self.name = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_name(&mut self) -> &mut ::std::string::String {
+ &mut self.name
+ }
+
+ // Take field
+ pub fn take_name(&mut self) -> ::std::string::String {
+ ::std::mem::replace(&mut self.name, ::std::string::String::new())
+ }
+
+ // repeated .google.protobuf.Method methods = 2;
+
+
+ pub fn get_methods(&self) -> &[Method] {
+ &self.methods
+ }
+ pub fn clear_methods(&mut self) {
+ self.methods.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_methods(&mut self, v: ::protobuf::RepeatedField<Method>) {
+ self.methods = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_methods(&mut self) -> &mut ::protobuf::RepeatedField<Method> {
+ &mut self.methods
+ }
+
+ // Take field
+ pub fn take_methods(&mut self) -> ::protobuf::RepeatedField<Method> {
+ ::std::mem::replace(&mut self.methods, ::protobuf::RepeatedField::new())
+ }
+
+ // repeated .google.protobuf.Option options = 3;
+
+
+ pub fn get_options(&self) -> &[::protobuf::well_known_types::Option] {
+ &self.options
+ }
+ pub fn clear_options(&mut self) {
+ self.options.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_options(&mut self, v: ::protobuf::RepeatedField<::protobuf::well_known_types::Option>) {
+ self.options = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_options(&mut self) -> &mut ::protobuf::RepeatedField<::protobuf::well_known_types::Option> {
+ &mut self.options
+ }
+
+ // Take field
+ pub fn take_options(&mut self) -> ::protobuf::RepeatedField<::protobuf::well_known_types::Option> {
+ ::std::mem::replace(&mut self.options, ::protobuf::RepeatedField::new())
+ }
+
+ // string version = 4;
+
+
+ pub fn get_version(&self) -> &str {
+ &self.version
+ }
+ pub fn clear_version(&mut self) {
+ self.version.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_version(&mut self, v: ::std::string::String) {
+ self.version = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_version(&mut self) -> &mut ::std::string::String {
+ &mut self.version
+ }
+
+ // Take field
+ pub fn take_version(&mut self) -> ::std::string::String {
+ ::std::mem::replace(&mut self.version, ::std::string::String::new())
+ }
+
+ // .google.protobuf.SourceContext source_context = 5;
+
+
+ pub fn get_source_context(&self) -> &::protobuf::well_known_types::SourceContext {
+ self.source_context.as_ref().unwrap_or_else(|| ::protobuf::well_known_types::SourceContext::default_instance())
+ }
+ pub fn clear_source_context(&mut self) {
+ self.source_context.clear();
+ }
+
+ pub fn has_source_context(&self) -> bool {
+ self.source_context.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_source_context(&mut self, v: ::protobuf::well_known_types::SourceContext) {
+ self.source_context = ::protobuf::SingularPtrField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_source_context(&mut self) -> &mut ::protobuf::well_known_types::SourceContext {
+ if self.source_context.is_none() {
+ self.source_context.set_default();
+ }
+ self.source_context.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_source_context(&mut self) -> ::protobuf::well_known_types::SourceContext {
+ self.source_context.take().unwrap_or_else(|| ::protobuf::well_known_types::SourceContext::new())
+ }
+
+ // repeated .google.protobuf.Mixin mixins = 6;
+
+
+ pub fn get_mixins(&self) -> &[Mixin] {
+ &self.mixins
+ }
+ pub fn clear_mixins(&mut self) {
+ self.mixins.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_mixins(&mut self, v: ::protobuf::RepeatedField<Mixin>) {
+ self.mixins = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_mixins(&mut self) -> &mut ::protobuf::RepeatedField<Mixin> {
+ &mut self.mixins
+ }
+
+ // Take field
+ pub fn take_mixins(&mut self) -> ::protobuf::RepeatedField<Mixin> {
+ ::std::mem::replace(&mut self.mixins, ::protobuf::RepeatedField::new())
+ }
+
+ // .google.protobuf.Syntax syntax = 7;
+
+
+ pub fn get_syntax(&self) -> ::protobuf::well_known_types::Syntax {
+ self.syntax
+ }
+ pub fn clear_syntax(&mut self) {
+ self.syntax = ::protobuf::well_known_types::Syntax::SYNTAX_PROTO2;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_syntax(&mut self, v: ::protobuf::well_known_types::Syntax) {
+ self.syntax = v;
+ }
+}
+
+impl ::protobuf::Message for Api {
+ fn is_initialized(&self) -> bool {
+ for v in &self.methods {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.options {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.source_context {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.mixins {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?;
+ },
+ 2 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.methods)?;
+ },
+ 3 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.options)?;
+ },
+ 4 => {
+ ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.version)?;
+ },
+ 5 => {
+ ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.source_context)?;
+ },
+ 6 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.mixins)?;
+ },
+ 7 => {
+ ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.syntax, 7, &mut self.unknown_fields)?
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if !self.name.is_empty() {
+ my_size += ::protobuf::rt::string_size(1, &self.name);
+ }
+ for value in &self.methods {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ for value in &self.options {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ if !self.version.is_empty() {
+ my_size += ::protobuf::rt::string_size(4, &self.version);
+ }
+ if let Some(ref v) = self.source_context.as_ref() {
+ let len = v.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ }
+ for value in &self.mixins {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ if self.syntax != ::protobuf::well_known_types::Syntax::SYNTAX_PROTO2 {
+ my_size += ::protobuf::rt::enum_size(7, self.syntax);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if !self.name.is_empty() {
+ os.write_string(1, &self.name)?;
+ }
+ for v in &self.methods {
+ os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ for v in &self.options {
+ os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ if !self.version.is_empty() {
+ os.write_string(4, &self.version)?;
+ }
+ if let Some(ref v) = self.source_context.as_ref() {
+ os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ }
+ for v in &self.mixins {
+ os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ if self.syntax != ::protobuf::well_known_types::Syntax::SYNTAX_PROTO2 {
+ os.write_enum(7, self.syntax.value())?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> Api {
+ Api::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "name",
+ |m: &Api| { &m.name },
+ |m: &mut Api| { &mut m.name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<Method>>(
+ "methods",
+ |m: &Api| { &m.methods },
+ |m: &mut Api| { &mut m.methods },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<::protobuf::well_known_types::Option>>(
+ "options",
+ |m: &Api| { &m.options },
+ |m: &mut Api| { &mut m.options },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "version",
+ |m: &Api| { &m.version },
+ |m: &mut Api| { &mut m.version },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<::protobuf::well_known_types::SourceContext>>(
+ "source_context",
+ |m: &Api| { &m.source_context },
+ |m: &mut Api| { &mut m.source_context },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<Mixin>>(
+ "mixins",
+ |m: &Api| { &m.mixins },
+ |m: &mut Api| { &mut m.mixins },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum<::protobuf::well_known_types::Syntax>>(
+ "syntax",
+ |m: &Api| { &m.syntax },
+ |m: &mut Api| { &mut m.syntax },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<Api>(
+ "Api",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static Api {
+ static mut instance: ::protobuf::lazy::Lazy<Api> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(Api::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for Api {
+ fn clear(&mut self) {
+ self.name.clear();
+ self.methods.clear();
+ self.options.clear();
+ self.version.clear();
+ self.source_context.clear();
+ self.mixins.clear();
+ self.syntax = ::protobuf::well_known_types::Syntax::SYNTAX_PROTO2;
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for Api {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for Api {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct Method {
+ // message fields
+ pub name: ::std::string::String,
+ pub request_type_url: ::std::string::String,
+ pub request_streaming: bool,
+ pub response_type_url: ::std::string::String,
+ pub response_streaming: bool,
+ pub options: ::protobuf::RepeatedField<::protobuf::well_known_types::Option>,
+ pub syntax: ::protobuf::well_known_types::Syntax,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a Method {
+ fn default() -> &'a Method {
+ <Method as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl Method {
+ pub fn new() -> Method {
+ ::std::default::Default::default()
+ }
+
+ // string name = 1;
+
+
+ pub fn get_name(&self) -> &str {
+ &self.name
+ }
+ pub fn clear_name(&mut self) {
+ self.name.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_name(&mut self, v: ::std::string::String) {
+ self.name = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_name(&mut self) -> &mut ::std::string::String {
+ &mut self.name
+ }
+
+ // Take field
+ pub fn take_name(&mut self) -> ::std::string::String {
+ ::std::mem::replace(&mut self.name, ::std::string::String::new())
+ }
+
+ // string request_type_url = 2;
+
+
+ pub fn get_request_type_url(&self) -> &str {
+ &self.request_type_url
+ }
+ pub fn clear_request_type_url(&mut self) {
+ self.request_type_url.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_request_type_url(&mut self, v: ::std::string::String) {
+ self.request_type_url = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_request_type_url(&mut self) -> &mut ::std::string::String {
+ &mut self.request_type_url
+ }
+
+ // Take field
+ pub fn take_request_type_url(&mut self) -> ::std::string::String {
+ ::std::mem::replace(&mut self.request_type_url, ::std::string::String::new())
+ }
+
+ // bool request_streaming = 3;
+
+
+ pub fn get_request_streaming(&self) -> bool {
+ self.request_streaming
+ }
+ pub fn clear_request_streaming(&mut self) {
+ self.request_streaming = false;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_request_streaming(&mut self, v: bool) {
+ self.request_streaming = v;
+ }
+
+ // string response_type_url = 4;
+
+
+ pub fn get_response_type_url(&self) -> &str {
+ &self.response_type_url
+ }
+ pub fn clear_response_type_url(&mut self) {
+ self.response_type_url.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_response_type_url(&mut self, v: ::std::string::String) {
+ self.response_type_url = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_response_type_url(&mut self) -> &mut ::std::string::String {
+ &mut self.response_type_url
+ }
+
+ // Take field
+ pub fn take_response_type_url(&mut self) -> ::std::string::String {
+ ::std::mem::replace(&mut self.response_type_url, ::std::string::String::new())
+ }
+
+ // bool response_streaming = 5;
+
+
+ pub fn get_response_streaming(&self) -> bool {
+ self.response_streaming
+ }
+ pub fn clear_response_streaming(&mut self) {
+ self.response_streaming = false;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_response_streaming(&mut self, v: bool) {
+ self.response_streaming = v;
+ }
+
+ // repeated .google.protobuf.Option options = 6;
+
+
+ pub fn get_options(&self) -> &[::protobuf::well_known_types::Option] {
+ &self.options
+ }
+ pub fn clear_options(&mut self) {
+ self.options.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_options(&mut self, v: ::protobuf::RepeatedField<::protobuf::well_known_types::Option>) {
+ self.options = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_options(&mut self) -> &mut ::protobuf::RepeatedField<::protobuf::well_known_types::Option> {
+ &mut self.options
+ }
+
+ // Take field
+ pub fn take_options(&mut self) -> ::protobuf::RepeatedField<::protobuf::well_known_types::Option> {
+ ::std::mem::replace(&mut self.options, ::protobuf::RepeatedField::new())
+ }
+
+ // .google.protobuf.Syntax syntax = 7;
+
+
+ pub fn get_syntax(&self) -> ::protobuf::well_known_types::Syntax {
+ self.syntax
+ }
+ pub fn clear_syntax(&mut self) {
+ self.syntax = ::protobuf::well_known_types::Syntax::SYNTAX_PROTO2;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_syntax(&mut self, v: ::protobuf::well_known_types::Syntax) {
+ self.syntax = v;
+ }
+}
+
+impl ::protobuf::Message for Method {
+ fn is_initialized(&self) -> bool {
+ for v in &self.options {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?;
+ },
+ 2 => {
+ ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.request_type_url)?;
+ },
+ 3 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.request_streaming = tmp;
+ },
+ 4 => {
+ ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.response_type_url)?;
+ },
+ 5 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.response_streaming = tmp;
+ },
+ 6 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.options)?;
+ },
+ 7 => {
+ ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.syntax, 7, &mut self.unknown_fields)?
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if !self.name.is_empty() {
+ my_size += ::protobuf::rt::string_size(1, &self.name);
+ }
+ if !self.request_type_url.is_empty() {
+ my_size += ::protobuf::rt::string_size(2, &self.request_type_url);
+ }
+ if self.request_streaming != false {
+ my_size += 2;
+ }
+ if !self.response_type_url.is_empty() {
+ my_size += ::protobuf::rt::string_size(4, &self.response_type_url);
+ }
+ if self.response_streaming != false {
+ my_size += 2;
+ }
+ for value in &self.options {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ if self.syntax != ::protobuf::well_known_types::Syntax::SYNTAX_PROTO2 {
+ my_size += ::protobuf::rt::enum_size(7, self.syntax);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if !self.name.is_empty() {
+ os.write_string(1, &self.name)?;
+ }
+ if !self.request_type_url.is_empty() {
+ os.write_string(2, &self.request_type_url)?;
+ }
+ if self.request_streaming != false {
+ os.write_bool(3, self.request_streaming)?;
+ }
+ if !self.response_type_url.is_empty() {
+ os.write_string(4, &self.response_type_url)?;
+ }
+ if self.response_streaming != false {
+ os.write_bool(5, self.response_streaming)?;
+ }
+ for v in &self.options {
+ os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ if self.syntax != ::protobuf::well_known_types::Syntax::SYNTAX_PROTO2 {
+ os.write_enum(7, self.syntax.value())?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> Method {
+ Method::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "name",
+ |m: &Method| { &m.name },
+ |m: &mut Method| { &mut m.name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "request_type_url",
+ |m: &Method| { &m.request_type_url },
+ |m: &mut Method| { &mut m.request_type_url },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "request_streaming",
+ |m: &Method| { &m.request_streaming },
+ |m: &mut Method| { &mut m.request_streaming },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "response_type_url",
+ |m: &Method| { &m.response_type_url },
+ |m: &mut Method| { &mut m.response_type_url },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "response_streaming",
+ |m: &Method| { &m.response_streaming },
+ |m: &mut Method| { &mut m.response_streaming },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<::protobuf::well_known_types::Option>>(
+ "options",
+ |m: &Method| { &m.options },
+ |m: &mut Method| { &mut m.options },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum<::protobuf::well_known_types::Syntax>>(
+ "syntax",
+ |m: &Method| { &m.syntax },
+ |m: &mut Method| { &mut m.syntax },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<Method>(
+ "Method",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static Method {
+ static mut instance: ::protobuf::lazy::Lazy<Method> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(Method::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for Method {
+ fn clear(&mut self) {
+ self.name.clear();
+ self.request_type_url.clear();
+ self.request_streaming = false;
+ self.response_type_url.clear();
+ self.response_streaming = false;
+ self.options.clear();
+ self.syntax = ::protobuf::well_known_types::Syntax::SYNTAX_PROTO2;
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for Method {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for Method {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct Mixin {
+ // message fields
+ pub name: ::std::string::String,
+ pub root: ::std::string::String,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a Mixin {
+ fn default() -> &'a Mixin {
+ <Mixin as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl Mixin {
+ pub fn new() -> Mixin {
+ ::std::default::Default::default()
+ }
+
+ // string name = 1;
+
+
+ pub fn get_name(&self) -> &str {
+ &self.name
+ }
+ pub fn clear_name(&mut self) {
+ self.name.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_name(&mut self, v: ::std::string::String) {
+ self.name = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_name(&mut self) -> &mut ::std::string::String {
+ &mut self.name
+ }
+
+ // Take field
+ pub fn take_name(&mut self) -> ::std::string::String {
+ ::std::mem::replace(&mut self.name, ::std::string::String::new())
+ }
+
+ // string root = 2;
+
+
+ pub fn get_root(&self) -> &str {
+ &self.root
+ }
+ pub fn clear_root(&mut self) {
+ self.root.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_root(&mut self, v: ::std::string::String) {
+ self.root = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_root(&mut self) -> &mut ::std::string::String {
+ &mut self.root
+ }
+
+ // Take field
+ pub fn take_root(&mut self) -> ::std::string::String {
+ ::std::mem::replace(&mut self.root, ::std::string::String::new())
+ }
+}
+
+impl ::protobuf::Message for Mixin {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?;
+ },
+ 2 => {
+ ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.root)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if !self.name.is_empty() {
+ my_size += ::protobuf::rt::string_size(1, &self.name);
+ }
+ if !self.root.is_empty() {
+ my_size += ::protobuf::rt::string_size(2, &self.root);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if !self.name.is_empty() {
+ os.write_string(1, &self.name)?;
+ }
+ if !self.root.is_empty() {
+ os.write_string(2, &self.root)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> Mixin {
+ Mixin::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "name",
+ |m: &Mixin| { &m.name },
+ |m: &mut Mixin| { &mut m.name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "root",
+ |m: &Mixin| { &m.root },
+ |m: &mut Mixin| { &mut m.root },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<Mixin>(
+ "Mixin",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static Mixin {
+ static mut instance: ::protobuf::lazy::Lazy<Mixin> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(Mixin::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for Mixin {
+ fn clear(&mut self) {
+ self.name.clear();
+ self.root.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for Mixin {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for Mixin {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+static file_descriptor_proto_data: &'static [u8] = b"\
+ \n\x19google/protobuf/api.proto\x12\x0fgoogle.protobuf\x1a$google/protob\
+ uf/source_context.proto\x1a\x1agoogle/protobuf/type.proto\"\xc1\x02\n\
+ \x03Api\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x121\n\x07methods\
+ \x18\x02\x20\x03(\x0b2\x17.google.protobuf.MethodR\x07methods\x121\n\x07\
+ options\x18\x03\x20\x03(\x0b2\x17.google.protobuf.OptionR\x07options\x12\
+ \x18\n\x07version\x18\x04\x20\x01(\tR\x07version\x12E\n\x0esource_contex\
+ t\x18\x05\x20\x01(\x0b2\x1e.google.protobuf.SourceContextR\rsourceContex\
+ t\x12.\n\x06mixins\x18\x06\x20\x03(\x0b2\x16.google.protobuf.MixinR\x06m\
+ ixins\x12/\n\x06syntax\x18\x07\x20\x01(\x0e2\x17.google.protobuf.SyntaxR\
+ \x06syntax\"\xb2\x02\n\x06Method\x12\x12\n\x04name\x18\x01\x20\x01(\tR\
+ \x04name\x12(\n\x10request_type_url\x18\x02\x20\x01(\tR\x0erequestTypeUr\
+ l\x12+\n\x11request_streaming\x18\x03\x20\x01(\x08R\x10requestStreaming\
+ \x12*\n\x11response_type_url\x18\x04\x20\x01(\tR\x0fresponseTypeUrl\x12-\
+ \n\x12response_streaming\x18\x05\x20\x01(\x08R\x11responseStreaming\x121\
+ \n\x07options\x18\x06\x20\x03(\x0b2\x17.google.protobuf.OptionR\x07optio\
+ ns\x12/\n\x06syntax\x18\x07\x20\x01(\x0e2\x17.google.protobuf.SyntaxR\
+ \x06syntax\"/\n\x05Mixin\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\
+ \x12\x12\n\x04root\x18\x02\x20\x01(\tR\x04rootBH\n\x13com.google.protobu\
+ fB\x08ApiProtoP\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownT\
+ ypesJ\xa97\n\x07\x12\x05\x1e\0\xc8\x01\x01\n\xcc\x0c\n\x01\x0c\x12\x03\
+ \x1e\0\x122\xc1\x0c\x20Protocol\x20Buffers\x20-\x20Google's\x20data\x20i\
+ nterchange\x20format\n\x20Copyright\x202008\x20Google\x20Inc.\x20\x20All\
+ \x20rights\x20reserved.\n\x20https://developers.google.com/protocol-buff\
+ ers/\n\n\x20Redistribution\x20and\x20use\x20in\x20source\x20and\x20binar\
+ y\x20forms,\x20with\x20or\x20without\n\x20modification,\x20are\x20permit\
+ ted\x20provided\x20that\x20the\x20following\x20conditions\x20are\n\x20me\
+ t:\n\n\x20\x20\x20\x20\x20*\x20Redistributions\x20of\x20source\x20code\
+ \x20must\x20retain\x20the\x20above\x20copyright\n\x20notice,\x20this\x20\
+ list\x20of\x20conditions\x20and\x20the\x20following\x20disclaimer.\n\x20\
+ \x20\x20\x20\x20*\x20Redistributions\x20in\x20binary\x20form\x20must\x20\
+ reproduce\x20the\x20above\n\x20copyright\x20notice,\x20this\x20list\x20o\
+ f\x20conditions\x20and\x20the\x20following\x20disclaimer\n\x20in\x20the\
+ \x20documentation\x20and/or\x20other\x20materials\x20provided\x20with\
+ \x20the\n\x20distribution.\n\x20\x20\x20\x20\x20*\x20Neither\x20the\x20n\
+ ame\x20of\x20Google\x20Inc.\x20nor\x20the\x20names\x20of\x20its\n\x20con\
+ tributors\x20may\x20be\x20used\x20to\x20endorse\x20or\x20promote\x20prod\
+ ucts\x20derived\x20from\n\x20this\x20software\x20without\x20specific\x20\
+ prior\x20written\x20permission.\n\n\x20THIS\x20SOFTWARE\x20IS\x20PROVIDE\
+ D\x20BY\x20THE\x20COPYRIGHT\x20HOLDERS\x20AND\x20CONTRIBUTORS\n\x20\"AS\
+ \x20IS\"\x20AND\x20ANY\x20EXPRESS\x20OR\x20IMPLIED\x20WARRANTIES,\x20INC\
+ LUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\x20THE\x20IMPLIED\x20WARRANTIE\
+ S\x20OF\x20MERCHANTABILITY\x20AND\x20FITNESS\x20FOR\n\x20A\x20PARTICULAR\
+ \x20PURPOSE\x20ARE\x20DISCLAIMED.\x20IN\x20NO\x20EVENT\x20SHALL\x20THE\
+ \x20COPYRIGHT\n\x20OWNER\x20OR\x20CONTRIBUTORS\x20BE\x20LIABLE\x20FOR\
+ \x20ANY\x20DIRECT,\x20INDIRECT,\x20INCIDENTAL,\n\x20SPECIAL,\x20EXEMPLAR\
+ Y,\x20OR\x20CONSEQUENTIAL\x20DAMAGES\x20(INCLUDING,\x20BUT\x20NOT\n\x20L\
+ IMITED\x20TO,\x20PROCUREMENT\x20OF\x20SUBSTITUTE\x20GOODS\x20OR\x20SERVI\
+ CES;\x20LOSS\x20OF\x20USE,\n\x20DATA,\x20OR\x20PROFITS;\x20OR\x20BUSINES\
+ S\x20INTERRUPTION)\x20HOWEVER\x20CAUSED\x20AND\x20ON\x20ANY\n\x20THEORY\
+ \x20OF\x20LIABILITY,\x20WHETHER\x20IN\x20CONTRACT,\x20STRICT\x20LIABILIT\
+ Y,\x20OR\x20TORT\n\x20(INCLUDING\x20NEGLIGENCE\x20OR\x20OTHERWISE)\x20AR\
+ ISING\x20IN\x20ANY\x20WAY\x20OUT\x20OF\x20THE\x20USE\n\x20OF\x20THIS\x20\
+ SOFTWARE,\x20EVEN\x20IF\x20ADVISED\x20OF\x20THE\x20POSSIBILITY\x20OF\x20\
+ SUCH\x20DAMAGE.\n\n\x08\n\x01\x02\x12\x03\x20\0\x18\n\t\n\x02\x03\0\x12\
+ \x03\"\0.\n\t\n\x02\x03\x01\x12\x03#\0$\n\x08\n\x01\x08\x12\x03%\0;\n\t\
+ \n\x02\x08%\x12\x03%\0;\n\x08\n\x01\x08\x12\x03&\0,\n\t\n\x02\x08\x01\
+ \x12\x03&\0,\n\x08\n\x01\x08\x12\x03'\0)\n\t\n\x02\x08\x08\x12\x03'\0)\n\
+ \x08\n\x01\x08\x12\x03(\0\"\n\t\n\x02\x08\n\x12\x03(\0\"\n\x08\n\x01\x08\
+ \x12\x03)\0!\n\t\n\x02\x08$\x12\x03)\0!\nM\n\x02\x04\0\x12\x04,\0Y\x01\
+ \x1aA\x20Api\x20is\x20a\x20light-weight\x20descriptor\x20for\x20a\x20pro\
+ tocol\x20buffer\x20service.\n\n\n\n\x03\x04\0\x01\x12\x03,\x08\x0b\no\n\
+ \x04\x04\0\x02\0\x12\x030\x02\x12\x1ab\x20The\x20fully\x20qualified\x20n\
+ ame\x20of\x20this\x20api,\x20including\x20package\x20name\n\x20followed\
+ \x20by\x20the\x20api's\x20simple\x20name.\n\n\x0c\n\x05\x04\0\x02\0\x05\
+ \x12\x030\x02\x08\n\x0c\n\x05\x04\0\x02\0\x01\x12\x030\t\r\n\x0c\n\x05\
+ \x04\0\x02\0\x03\x12\x030\x10\x11\n=\n\x04\x04\0\x02\x01\x12\x033\x02\
+ \x1e\x1a0\x20The\x20methods\x20of\x20this\x20api,\x20in\x20unspecified\
+ \x20order.\n\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x033\x02\n\n\x0c\n\x05\
+ \x04\0\x02\x01\x06\x12\x033\x0b\x11\n\x0c\n\x05\x04\0\x02\x01\x01\x12\
+ \x033\x12\x19\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x033\x1c\x1d\n0\n\x04\
+ \x04\0\x02\x02\x12\x036\x02\x1e\x1a#\x20Any\x20metadata\x20attached\x20t\
+ o\x20the\x20API.\n\n\x0c\n\x05\x04\0\x02\x02\x04\x12\x036\x02\n\n\x0c\n\
+ \x05\x04\0\x02\x02\x06\x12\x036\x0b\x11\n\x0c\n\x05\x04\0\x02\x02\x01\
+ \x12\x036\x12\x19\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x036\x1c\x1d\n\xf2\
+ \x07\n\x04\x04\0\x02\x03\x12\x03N\x02\x15\x1a\xe4\x07\x20A\x20version\
+ \x20string\x20for\x20this\x20api.\x20If\x20specified,\x20must\x20have\
+ \x20the\x20form\n\x20`major-version.minor-version`,\x20as\x20in\x20`1.10\
+ `.\x20If\x20the\x20minor\x20version\n\x20is\x20omitted,\x20it\x20default\
+ s\x20to\x20zero.\x20If\x20the\x20entire\x20version\x20field\x20is\n\x20e\
+ mpty,\x20the\x20major\x20version\x20is\x20derived\x20from\x20the\x20pack\
+ age\x20name,\x20as\n\x20outlined\x20below.\x20If\x20the\x20field\x20is\
+ \x20not\x20empty,\x20the\x20version\x20in\x20the\n\x20package\x20name\
+ \x20will\x20be\x20verified\x20to\x20be\x20consistent\x20with\x20what\x20\
+ is\n\x20provided\x20here.\n\n\x20The\x20versioning\x20schema\x20uses\x20\
+ [semantic\n\x20versioning](http://semver.org)\x20where\x20the\x20major\
+ \x20version\x20number\n\x20indicates\x20a\x20breaking\x20change\x20and\
+ \x20the\x20minor\x20version\x20an\x20additive,\n\x20non-breaking\x20chan\
+ ge.\x20Both\x20version\x20numbers\x20are\x20signals\x20to\x20users\n\x20\
+ what\x20to\x20expect\x20from\x20different\x20versions,\x20and\x20should\
+ \x20be\x20carefully\n\x20chosen\x20based\x20on\x20the\x20product\x20plan\
+ .\n\n\x20The\x20major\x20version\x20is\x20also\x20reflected\x20in\x20the\
+ \x20package\x20name\x20of\x20the\n\x20API,\x20which\x20must\x20end\x20in\
+ \x20`v<major-version>`,\x20as\x20in\n\x20`google.feature.v1`.\x20For\x20\
+ major\x20versions\x200\x20and\x201,\x20the\x20suffix\x20can\n\x20be\x20o\
+ mitted.\x20Zero\x20major\x20versions\x20must\x20only\x20be\x20used\x20fo\
+ r\n\x20experimental,\x20none-GA\x20apis.\n\n\n\n\x0c\n\x05\x04\0\x02\x03\
+ \x05\x12\x03N\x02\x08\n\x0c\n\x05\x04\0\x02\x03\x01\x12\x03N\t\x10\n\x0c\
+ \n\x05\x04\0\x02\x03\x03\x12\x03N\x13\x14\n[\n\x04\x04\0\x02\x04\x12\x03\
+ R\x02#\x1aN\x20Source\x20context\x20for\x20the\x20protocol\x20buffer\x20\
+ service\x20represented\x20by\x20this\n\x20message.\n\n\x0c\n\x05\x04\0\
+ \x02\x04\x06\x12\x03R\x02\x0f\n\x0c\n\x05\x04\0\x02\x04\x01\x12\x03R\x10\
+ \x1e\n\x0c\n\x05\x04\0\x02\x04\x03\x12\x03R!\"\n,\n\x04\x04\0\x02\x05\
+ \x12\x03U\x02\x1c\x1a\x1f\x20Included\x20APIs.\x20See\x20[Mixin][].\n\n\
+ \x0c\n\x05\x04\0\x02\x05\x04\x12\x03U\x02\n\n\x0c\n\x05\x04\0\x02\x05\
+ \x06\x12\x03U\x0b\x10\n\x0c\n\x05\x04\0\x02\x05\x01\x12\x03U\x11\x17\n\
+ \x0c\n\x05\x04\0\x02\x05\x03\x12\x03U\x1a\x1b\n0\n\x04\x04\0\x02\x06\x12\
+ \x03X\x02\x14\x1a#\x20The\x20source\x20syntax\x20of\x20the\x20service.\n\
+ \n\x0c\n\x05\x04\0\x02\x06\x06\x12\x03X\x02\x08\n\x0c\n\x05\x04\0\x02\
+ \x06\x01\x12\x03X\t\x0f\n\x0c\n\x05\x04\0\x02\x06\x03\x12\x03X\x12\x13\n\
+ 3\n\x02\x04\x01\x12\x04\\\0r\x01\x1a'\x20Method\x20represents\x20a\x20me\
+ thod\x20of\x20an\x20api.\n\n\n\n\x03\x04\x01\x01\x12\x03\\\x08\x0e\n.\n\
+ \x04\x04\x01\x02\0\x12\x03_\x02\x12\x1a!\x20The\x20simple\x20name\x20of\
+ \x20this\x20method.\n\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03_\x02\x08\n\
+ \x0c\n\x05\x04\x01\x02\0\x01\x12\x03_\t\r\n\x0c\n\x05\x04\x01\x02\0\x03\
+ \x12\x03_\x10\x11\n/\n\x04\x04\x01\x02\x01\x12\x03b\x02\x1e\x1a\"\x20A\
+ \x20URL\x20of\x20the\x20input\x20message\x20type.\n\n\x0c\n\x05\x04\x01\
+ \x02\x01\x05\x12\x03b\x02\x08\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03b\t\
+ \x19\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03b\x1c\x1d\n0\n\x04\x04\x01\
+ \x02\x02\x12\x03e\x02\x1d\x1a#\x20If\x20true,\x20the\x20request\x20is\
+ \x20streamed.\n\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03e\x02\x06\n\x0c\n\
+ \x05\x04\x01\x02\x02\x01\x12\x03e\x07\x18\n\x0c\n\x05\x04\x01\x02\x02\
+ \x03\x12\x03e\x1b\x1c\n2\n\x04\x04\x01\x02\x03\x12\x03h\x02\x1f\x1a%\x20\
+ The\x20URL\x20of\x20the\x20output\x20message\x20type.\n\n\x0c\n\x05\x04\
+ \x01\x02\x03\x05\x12\x03h\x02\x08\n\x0c\n\x05\x04\x01\x02\x03\x01\x12\
+ \x03h\t\x1a\n\x0c\n\x05\x04\x01\x02\x03\x03\x12\x03h\x1d\x1e\n1\n\x04\
+ \x04\x01\x02\x04\x12\x03k\x02\x1e\x1a$\x20If\x20true,\x20the\x20response\
+ \x20is\x20streamed.\n\n\x0c\n\x05\x04\x01\x02\x04\x05\x12\x03k\x02\x06\n\
+ \x0c\n\x05\x04\x01\x02\x04\x01\x12\x03k\x07\x19\n\x0c\n\x05\x04\x01\x02\
+ \x04\x03\x12\x03k\x1c\x1d\n3\n\x04\x04\x01\x02\x05\x12\x03n\x02\x1e\x1a&\
+ \x20Any\x20metadata\x20attached\x20to\x20the\x20method.\n\n\x0c\n\x05\
+ \x04\x01\x02\x05\x04\x12\x03n\x02\n\n\x0c\n\x05\x04\x01\x02\x05\x06\x12\
+ \x03n\x0b\x11\n\x0c\n\x05\x04\x01\x02\x05\x01\x12\x03n\x12\x19\n\x0c\n\
+ \x05\x04\x01\x02\x05\x03\x12\x03n\x1c\x1d\n0\n\x04\x04\x01\x02\x06\x12\
+ \x03q\x02\x14\x1a#\x20The\x20source\x20syntax\x20of\x20this\x20method.\n\
+ \n\x0c\n\x05\x04\x01\x02\x06\x06\x12\x03q\x02\x08\n\x0c\n\x05\x04\x01\
+ \x02\x06\x01\x12\x03q\t\x0f\n\x0c\n\x05\x04\x01\x02\x06\x03\x12\x03q\x12\
+ \x13\n\xa4\x13\n\x02\x04\x02\x12\x06\xc1\x01\0\xc8\x01\x01\x1a\x95\x13\
+ \x20Declares\x20an\x20API\x20to\x20be\x20included\x20in\x20this\x20API.\
+ \x20The\x20including\x20API\x20must\n\x20redeclare\x20all\x20the\x20meth\
+ ods\x20from\x20the\x20included\x20API,\x20but\x20documentation\n\x20and\
+ \x20options\x20are\x20inherited\x20as\x20follows:\n\n\x20-\x20If\x20afte\
+ r\x20comment\x20and\x20whitespace\x20stripping,\x20the\x20documentation\
+ \n\x20\x20\x20string\x20of\x20the\x20redeclared\x20method\x20is\x20empty\
+ ,\x20it\x20will\x20be\x20inherited\n\x20\x20\x20from\x20the\x20original\
+ \x20method.\n\n\x20-\x20Each\x20annotation\x20belonging\x20to\x20the\x20\
+ service\x20config\x20(http,\n\x20\x20\x20visibility)\x20which\x20is\x20n\
+ ot\x20set\x20in\x20the\x20redeclared\x20method\x20will\x20be\n\x20\x20\
+ \x20inherited.\n\n\x20-\x20If\x20an\x20http\x20annotation\x20is\x20inher\
+ ited,\x20the\x20path\x20pattern\x20will\x20be\n\x20\x20\x20modified\x20a\
+ s\x20follows.\x20Any\x20version\x20prefix\x20will\x20be\x20replaced\x20b\
+ y\x20the\n\x20\x20\x20version\x20of\x20the\x20including\x20API\x20plus\
+ \x20the\x20[root][]\x20path\x20if\x20specified.\n\n\x20Example\x20of\x20\
+ a\x20simple\x20mixin:\n\n\x20\x20\x20\x20\x20package\x20google.acl.v1;\n\
+ \x20\x20\x20\x20\x20service\x20AccessControl\x20{\n\x20\x20\x20\x20\x20\
+ \x20\x20//\x20Get\x20the\x20underlying\x20ACL\x20object.\n\x20\x20\x20\
+ \x20\x20\x20\x20rpc\x20GetAcl(GetAclRequest)\x20returns\x20(Acl)\x20{\n\
+ \x20\x20\x20\x20\x20\x20\x20\x20\x20option\x20(google.api.http).get\x20=\
+ \x20\"/v1/{resource=**}:getAcl\";\n\x20\x20\x20\x20\x20\x20\x20}\n\x20\
+ \x20\x20\x20\x20}\n\n\x20\x20\x20\x20\x20package\x20google.storage.v2;\n\
+ \x20\x20\x20\x20\x20service\x20Storage\x20{\n\x20\x20\x20\x20\x20\x20\
+ \x20rpc\x20GetAcl(GetAclRequest)\x20returns\x20(Acl);\n\n\x20\x20\x20\
+ \x20\x20\x20\x20//\x20Get\x20a\x20data\x20record.\n\x20\x20\x20\x20\x20\
+ \x20\x20rpc\x20GetData(GetDataRequest)\x20returns\x20(Data)\x20{\n\x20\
+ \x20\x20\x20\x20\x20\x20\x20\x20option\x20(google.api.http).get\x20=\x20\
+ \"/v2/{resource=**}\";\n\x20\x20\x20\x20\x20\x20\x20}\n\x20\x20\x20\x20\
+ \x20}\n\n\x20Example\x20of\x20a\x20mixin\x20configuration:\n\n\x20\x20\
+ \x20\x20\x20apis:\n\x20\x20\x20\x20\x20-\x20name:\x20google.storage.v2.S\
+ torage\n\x20\x20\x20\x20\x20\x20\x20mixins:\n\x20\x20\x20\x20\x20\x20\
+ \x20-\x20name:\x20google.acl.v1.AccessControl\n\n\x20The\x20mixin\x20con\
+ struct\x20implies\x20that\x20all\x20methods\x20in\x20`AccessControl`\x20\
+ are\n\x20also\x20declared\x20with\x20same\x20name\x20and\x20request/resp\
+ onse\x20types\x20in\n\x20`Storage`.\x20A\x20documentation\x20generator\
+ \x20or\x20annotation\x20processor\x20will\n\x20see\x20the\x20effective\
+ \x20`Storage.GetAcl`\x20method\x20after\x20inherting\n\x20documentation\
+ \x20and\x20annotations\x20as\x20follows:\n\n\x20\x20\x20\x20\x20service\
+ \x20Storage\x20{\n\x20\x20\x20\x20\x20\x20\x20//\x20Get\x20the\x20underl\
+ ying\x20ACL\x20object.\n\x20\x20\x20\x20\x20\x20\x20rpc\x20GetAcl(GetAcl\
+ Request)\x20returns\x20(Acl)\x20{\n\x20\x20\x20\x20\x20\x20\x20\x20\x20o\
+ ption\x20(google.api.http).get\x20=\x20\"/v2/{resource=**}:getAcl\";\n\
+ \x20\x20\x20\x20\x20\x20\x20}\n\x20\x20\x20\x20\x20\x20\x20...\n\x20\x20\
+ \x20\x20\x20}\n\n\x20Note\x20how\x20the\x20version\x20in\x20the\x20path\
+ \x20pattern\x20changed\x20from\x20`v1`\x20to\x20`v2`.\n\n\x20If\x20the\
+ \x20`root`\x20field\x20in\x20the\x20mixin\x20is\x20specified,\x20it\x20s\
+ hould\x20be\x20a\n\x20relative\x20path\x20under\x20which\x20inherited\
+ \x20HTTP\x20paths\x20are\x20placed.\x20Example:\n\n\x20\x20\x20\x20\x20a\
+ pis:\n\x20\x20\x20\x20\x20-\x20name:\x20google.storage.v2.Storage\n\x20\
+ \x20\x20\x20\x20\x20\x20mixins:\n\x20\x20\x20\x20\x20\x20\x20-\x20name:\
+ \x20google.acl.v1.AccessControl\n\x20\x20\x20\x20\x20\x20\x20\x20\x20roo\
+ t:\x20acls\n\n\x20This\x20implies\x20the\x20following\x20inherited\x20HT\
+ TP\x20annotation:\n\n\x20\x20\x20\x20\x20service\x20Storage\x20{\n\x20\
+ \x20\x20\x20\x20\x20\x20//\x20Get\x20the\x20underlying\x20ACL\x20object.\
+ \n\x20\x20\x20\x20\x20\x20\x20rpc\x20GetAcl(GetAclRequest)\x20returns\
+ \x20(Acl)\x20{\n\x20\x20\x20\x20\x20\x20\x20\x20\x20option\x20(google.ap\
+ i.http).get\x20=\x20\"/v2/acls/{resource=**}:getAcl\";\n\x20\x20\x20\x20\
+ \x20\x20\x20}\n\x20\x20\x20\x20\x20\x20\x20...\n\x20\x20\x20\x20\x20}\n\
+ \n\x0b\n\x03\x04\x02\x01\x12\x04\xc1\x01\x08\r\nF\n\x04\x04\x02\x02\0\
+ \x12\x04\xc3\x01\x02\x12\x1a8\x20The\x20fully\x20qualified\x20name\x20of\
+ \x20the\x20API\x20which\x20is\x20included.\n\n\r\n\x05\x04\x02\x02\0\x05\
+ \x12\x04\xc3\x01\x02\x08\n\r\n\x05\x04\x02\x02\0\x01\x12\x04\xc3\x01\t\r\
+ \n\r\n\x05\x04\x02\x02\0\x03\x12\x04\xc3\x01\x10\x11\n[\n\x04\x04\x02\
+ \x02\x01\x12\x04\xc7\x01\x02\x12\x1aM\x20If\x20non-empty\x20specifies\
+ \x20a\x20path\x20under\x20which\x20inherited\x20HTTP\x20paths\n\x20are\
+ \x20rooted.\n\n\r\n\x05\x04\x02\x02\x01\x05\x12\x04\xc7\x01\x02\x08\n\r\
+ \n\x05\x04\x02\x02\x01\x01\x12\x04\xc7\x01\t\r\n\r\n\x05\x04\x02\x02\x01\
+ \x03\x12\x04\xc7\x01\x10\x11b\x06proto3\
+";
+
+static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+
+fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
+ ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
+}
+
+pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
+ unsafe {
+ file_descriptor_proto_lazy.get(|| {
+ parse_descriptor_proto()
+ })
+ }
+}
diff --git a/src/well_known_types/duration.rs b/src/well_known_types/duration.rs
new file mode 100644
index 0000000..303173d
--- /dev/null
+++ b/src/well_known_types/duration.rs
@@ -0,0 +1,332 @@
+// This file is generated by rust-protobuf 2.14.0-pre. Do not edit
+// @generated
+
+// https://github.com/rust-lang/rust-clippy/issues/702
+#![allow(unknown_lints)]
+#![allow(clippy::all)]
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
+#![allow(box_pointers)]
+#![allow(dead_code)]
+#![allow(missing_docs)]
+#![allow(non_camel_case_types)]
+#![allow(non_snake_case)]
+#![allow(non_upper_case_globals)]
+#![allow(trivial_casts)]
+#![allow(unsafe_code)]
+#![allow(unused_imports)]
+#![allow(unused_results)]
+//! Generated file from `google/protobuf/duration.proto`
+
+use protobuf::Message as Message_imported_for_functions;
+use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct Duration {
+ // message fields
+ pub seconds: i64,
+ pub nanos: i32,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a Duration {
+ fn default() -> &'a Duration {
+ <Duration as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl Duration {
+ pub fn new() -> Duration {
+ ::std::default::Default::default()
+ }
+
+ // int64 seconds = 1;
+
+
+ pub fn get_seconds(&self) -> i64 {
+ self.seconds
+ }
+ pub fn clear_seconds(&mut self) {
+ self.seconds = 0;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_seconds(&mut self, v: i64) {
+ self.seconds = v;
+ }
+
+ // int32 nanos = 2;
+
+
+ pub fn get_nanos(&self) -> i32 {
+ self.nanos
+ }
+ pub fn clear_nanos(&mut self) {
+ self.nanos = 0;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_nanos(&mut self, v: i32) {
+ self.nanos = v;
+ }
+}
+
+impl ::protobuf::Message for Duration {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_int64()?;
+ self.seconds = tmp;
+ },
+ 2 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_int32()?;
+ self.nanos = tmp;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if self.seconds != 0 {
+ my_size += ::protobuf::rt::value_size(1, self.seconds, ::protobuf::wire_format::WireTypeVarint);
+ }
+ if self.nanos != 0 {
+ my_size += ::protobuf::rt::value_size(2, self.nanos, ::protobuf::wire_format::WireTypeVarint);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if self.seconds != 0 {
+ os.write_int64(1, self.seconds)?;
+ }
+ if self.nanos != 0 {
+ os.write_int32(2, self.nanos)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> Duration {
+ Duration::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>(
+ "seconds",
+ |m: &Duration| { &m.seconds },
+ |m: &mut Duration| { &mut m.seconds },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "nanos",
+ |m: &Duration| { &m.nanos },
+ |m: &mut Duration| { &mut m.nanos },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<Duration>(
+ "Duration",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static Duration {
+ static mut instance: ::protobuf::lazy::Lazy<Duration> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(Duration::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for Duration {
+ fn clear(&mut self) {
+ self.seconds = 0;
+ self.nanos = 0;
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for Duration {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for Duration {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+static file_descriptor_proto_data: &'static [u8] = b"\
+ \n\x1egoogle/protobuf/duration.proto\x12\x0fgoogle.protobuf\":\n\x08Dura\
+ tion\x12\x18\n\x07seconds\x18\x01\x20\x01(\x03R\x07seconds\x12\x14\n\x05\
+ nanos\x18\x02\x20\x01(\x05R\x05nanosB|\n\x13com.google.protobufB\rDurati\
+ onProtoP\x01Z*github.com/golang/protobuf/ptypes/duration\xf8\x01\x01\xa2\
+ \x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesJ\xe1\x1e\n\x06\x12\
+ \x04\x1e\0g\x01\n\xcc\x0c\n\x01\x0c\x12\x03\x1e\0\x122\xc1\x0c\x20Protoc\
+ ol\x20Buffers\x20-\x20Google's\x20data\x20interchange\x20format\n\x20Cop\
+ yright\x202008\x20Google\x20Inc.\x20\x20All\x20rights\x20reserved.\n\x20\
+ https://developers.google.com/protocol-buffers/\n\n\x20Redistribution\
+ \x20and\x20use\x20in\x20source\x20and\x20binary\x20forms,\x20with\x20or\
+ \x20without\n\x20modification,\x20are\x20permitted\x20provided\x20that\
+ \x20the\x20following\x20conditions\x20are\n\x20met:\n\n\x20\x20\x20\x20\
+ \x20*\x20Redistributions\x20of\x20source\x20code\x20must\x20retain\x20th\
+ e\x20above\x20copyright\n\x20notice,\x20this\x20list\x20of\x20conditions\
+ \x20and\x20the\x20following\x20disclaimer.\n\x20\x20\x20\x20\x20*\x20Red\
+ istributions\x20in\x20binary\x20form\x20must\x20reproduce\x20the\x20abov\
+ e\n\x20copyright\x20notice,\x20this\x20list\x20of\x20conditions\x20and\
+ \x20the\x20following\x20disclaimer\n\x20in\x20the\x20documentation\x20an\
+ d/or\x20other\x20materials\x20provided\x20with\x20the\n\x20distribution.\
+ \n\x20\x20\x20\x20\x20*\x20Neither\x20the\x20name\x20of\x20Google\x20Inc\
+ .\x20nor\x20the\x20names\x20of\x20its\n\x20contributors\x20may\x20be\x20\
+ used\x20to\x20endorse\x20or\x20promote\x20products\x20derived\x20from\n\
+ \x20this\x20software\x20without\x20specific\x20prior\x20written\x20permi\
+ ssion.\n\n\x20THIS\x20SOFTWARE\x20IS\x20PROVIDED\x20BY\x20THE\x20COPYRIG\
+ HT\x20HOLDERS\x20AND\x20CONTRIBUTORS\n\x20\"AS\x20IS\"\x20AND\x20ANY\x20\
+ EXPRESS\x20OR\x20IMPLIED\x20WARRANTIES,\x20INCLUDING,\x20BUT\x20NOT\n\
+ \x20LIMITED\x20TO,\x20THE\x20IMPLIED\x20WARRANTIES\x20OF\x20MERCHANTABIL\
+ ITY\x20AND\x20FITNESS\x20FOR\n\x20A\x20PARTICULAR\x20PURPOSE\x20ARE\x20D\
+ ISCLAIMED.\x20IN\x20NO\x20EVENT\x20SHALL\x20THE\x20COPYRIGHT\n\x20OWNER\
+ \x20OR\x20CONTRIBUTORS\x20BE\x20LIABLE\x20FOR\x20ANY\x20DIRECT,\x20INDIR\
+ ECT,\x20INCIDENTAL,\n\x20SPECIAL,\x20EXEMPLARY,\x20OR\x20CONSEQUENTIAL\
+ \x20DAMAGES\x20(INCLUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\x20PROCUREM\
+ ENT\x20OF\x20SUBSTITUTE\x20GOODS\x20OR\x20SERVICES;\x20LOSS\x20OF\x20USE\
+ ,\n\x20DATA,\x20OR\x20PROFITS;\x20OR\x20BUSINESS\x20INTERRUPTION)\x20HOW\
+ EVER\x20CAUSED\x20AND\x20ON\x20ANY\n\x20THEORY\x20OF\x20LIABILITY,\x20WH\
+ ETHER\x20IN\x20CONTRACT,\x20STRICT\x20LIABILITY,\x20OR\x20TORT\n\x20(INC\
+ LUDING\x20NEGLIGENCE\x20OR\x20OTHERWISE)\x20ARISING\x20IN\x20ANY\x20WAY\
+ \x20OUT\x20OF\x20THE\x20USE\n\x20OF\x20THIS\x20SOFTWARE,\x20EVEN\x20IF\
+ \x20ADVISED\x20OF\x20THE\x20POSSIBILITY\x20OF\x20SUCH\x20DAMAGE.\n\n\x08\
+ \n\x01\x02\x12\x03\x20\0\x18\n\x08\n\x01\x08\x12\x03\"\0;\n\t\n\x02\x08%\
+ \x12\x03\"\0;\n\x08\n\x01\x08\x12\x03#\0\x1f\n\t\n\x02\x08\x1f\x12\x03#\
+ \0\x1f\n\x08\n\x01\x08\x12\x03$\0A\n\t\n\x02\x08\x0b\x12\x03$\0A\n\x08\n\
+ \x01\x08\x12\x03%\0,\n\t\n\x02\x08\x01\x12\x03%\0,\n\x08\n\x01\x08\x12\
+ \x03&\0.\n\t\n\x02\x08\x08\x12\x03&\0.\n\x08\n\x01\x08\x12\x03'\0\"\n\t\
+ \n\x02\x08\n\x12\x03'\0\"\n\x08\n\x01\x08\x12\x03(\0!\n\t\n\x02\x08$\x12\
+ \x03(\0!\n\x92\x0c\n\x02\x04\0\x12\x04Z\0g\x01\x1a\x85\x0c\x20A\x20Durat\
+ ion\x20represents\x20a\x20signed,\x20fixed-length\x20span\x20of\x20time\
+ \x20represented\n\x20as\x20a\x20count\x20of\x20seconds\x20and\x20fractio\
+ ns\x20of\x20seconds\x20at\x20nanosecond\n\x20resolution.\x20It\x20is\x20\
+ independent\x20of\x20any\x20calendar\x20and\x20concepts\x20like\x20\"day\
+ \"\n\x20or\x20\"month\".\x20It\x20is\x20related\x20to\x20Timestamp\x20in\
+ \x20that\x20the\x20difference\x20between\n\x20two\x20Timestamp\x20values\
+ \x20is\x20a\x20Duration\x20and\x20it\x20can\x20be\x20added\x20or\x20subt\
+ racted\n\x20from\x20a\x20Timestamp.\x20Range\x20is\x20approximately\x20+\
+ -10,000\x20years.\n\n\x20Example\x201:\x20Compute\x20Duration\x20from\
+ \x20two\x20Timestamps\x20in\x20pseudo\x20code.\n\n\x20\x20\x20\x20\x20Ti\
+ mestamp\x20start\x20=\x20...;\n\x20\x20\x20\x20\x20Timestamp\x20end\x20=\
+ \x20...;\n\x20\x20\x20\x20\x20Duration\x20duration\x20=\x20...;\n\n\x20\
+ \x20\x20\x20\x20duration.seconds\x20=\x20end.seconds\x20-\x20start.secon\
+ ds;\n\x20\x20\x20\x20\x20duration.nanos\x20=\x20end.nanos\x20-\x20start.\
+ nanos;\n\n\x20\x20\x20\x20\x20if\x20(duration.seconds\x20<\x200\x20&&\
+ \x20duration.nanos\x20>\x200)\x20{\n\x20\x20\x20\x20\x20\x20\x20duration\
+ .seconds\x20+=\x201;\n\x20\x20\x20\x20\x20\x20\x20duration.nanos\x20-=\
+ \x201000000000;\n\x20\x20\x20\x20\x20}\x20else\x20if\x20(durations.secon\
+ ds\x20>\x200\x20&&\x20duration.nanos\x20<\x200)\x20{\n\x20\x20\x20\x20\
+ \x20\x20\x20duration.seconds\x20-=\x201;\n\x20\x20\x20\x20\x20\x20\x20du\
+ ration.nanos\x20+=\x201000000000;\n\x20\x20\x20\x20\x20}\n\n\x20Example\
+ \x202:\x20Compute\x20Timestamp\x20from\x20Timestamp\x20+\x20Duration\x20\
+ in\x20pseudo\x20code.\n\n\x20\x20\x20\x20\x20Timestamp\x20start\x20=\x20\
+ ...;\n\x20\x20\x20\x20\x20Duration\x20duration\x20=\x20...;\n\x20\x20\
+ \x20\x20\x20Timestamp\x20end\x20=\x20...;\n\n\x20\x20\x20\x20\x20end.sec\
+ onds\x20=\x20start.seconds\x20+\x20duration.seconds;\n\x20\x20\x20\x20\
+ \x20end.nanos\x20=\x20start.nanos\x20+\x20duration.nanos;\n\n\x20\x20\
+ \x20\x20\x20if\x20(end.nanos\x20<\x200)\x20{\n\x20\x20\x20\x20\x20\x20\
+ \x20end.seconds\x20-=\x201;\n\x20\x20\x20\x20\x20\x20\x20end.nanos\x20+=\
+ \x201000000000;\n\x20\x20\x20\x20\x20}\x20else\x20if\x20(end.nanos\x20>=\
+ \x201000000000)\x20{\n\x20\x20\x20\x20\x20\x20\x20end.seconds\x20+=\x201\
+ ;\n\x20\x20\x20\x20\x20\x20\x20end.nanos\x20-=\x201000000000;\n\x20\x20\
+ \x20\x20\x20}\n\n\x20Example\x203:\x20Compute\x20Duration\x20from\x20dat\
+ etime.timedelta\x20in\x20Python.\n\n\x20\x20\x20\x20\x20td\x20=\x20datet\
+ ime.timedelta(days=3,\x20minutes=10)\n\x20\x20\x20\x20\x20duration\x20=\
+ \x20Duration()\n\x20\x20\x20\x20\x20duration.FromTimedelta(td)\n\n\n\n\n\
+ \n\x03\x04\0\x01\x12\x03Z\x08\x10\np\n\x04\x04\0\x02\0\x12\x03^\x02\x14\
+ \x1ac\x20Signed\x20seconds\x20of\x20the\x20span\x20of\x20time.\x20Must\
+ \x20be\x20from\x20-315,576,000,000\n\x20to\x20+315,576,000,000\x20inclus\
+ ive.\n\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03^\x02\x07\n\x0c\n\x05\x04\0\
+ \x02\0\x01\x12\x03^\x08\x0f\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03^\x12\x13\
+ \n\x83\x03\n\x04\x04\0\x02\x01\x12\x03f\x02\x12\x1a\xf5\x02\x20Signed\
+ \x20fractions\x20of\x20a\x20second\x20at\x20nanosecond\x20resolution\x20\
+ of\x20the\x20span\n\x20of\x20time.\x20Durations\x20less\x20than\x20one\
+ \x20second\x20are\x20represented\x20with\x20a\x200\n\x20`seconds`\x20fie\
+ ld\x20and\x20a\x20positive\x20or\x20negative\x20`nanos`\x20field.\x20For\
+ \x20durations\n\x20of\x20one\x20second\x20or\x20more,\x20a\x20non-zero\
+ \x20value\x20for\x20the\x20`nanos`\x20field\x20must\x20be\n\x20of\x20the\
+ \x20same\x20sign\x20as\x20the\x20`seconds`\x20field.\x20Must\x20be\x20fr\
+ om\x20-999,999,999\n\x20to\x20+999,999,999\x20inclusive.\n\n\x0c\n\x05\
+ \x04\0\x02\x01\x05\x12\x03f\x02\x07\n\x0c\n\x05\x04\0\x02\x01\x01\x12\
+ \x03f\x08\r\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03f\x10\x11b\x06proto3\
+";
+
+static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+
+fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
+ ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
+}
+
+pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
+ unsafe {
+ file_descriptor_proto_lazy.get(|| {
+ parse_descriptor_proto()
+ })
+ }
+}
diff --git a/src/well_known_types/empty.rs b/src/well_known_types/empty.rs
new file mode 100644
index 0000000..df64a48
--- /dev/null
+++ b/src/well_known_types/empty.rs
@@ -0,0 +1,217 @@
+// This file is generated by rust-protobuf 2.14.0-pre. Do not edit
+// @generated
+
+// https://github.com/rust-lang/rust-clippy/issues/702
+#![allow(unknown_lints)]
+#![allow(clippy::all)]
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
+#![allow(box_pointers)]
+#![allow(dead_code)]
+#![allow(missing_docs)]
+#![allow(non_camel_case_types)]
+#![allow(non_snake_case)]
+#![allow(non_upper_case_globals)]
+#![allow(trivial_casts)]
+#![allow(unsafe_code)]
+#![allow(unused_imports)]
+#![allow(unused_results)]
+//! Generated file from `google/protobuf/empty.proto`
+
+use protobuf::Message as Message_imported_for_functions;
+use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct Empty {
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a Empty {
+ fn default() -> &'a Empty {
+ <Empty as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl Empty {
+ pub fn new() -> Empty {
+ ::std::default::Default::default()
+ }
+}
+
+impl ::protobuf::Message for Empty {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> Empty {
+ Empty::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let fields = ::std::vec::Vec::new();
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<Empty>(
+ "Empty",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static Empty {
+ static mut instance: ::protobuf::lazy::Lazy<Empty> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(Empty::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for Empty {
+ fn clear(&mut self) {
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for Empty {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for Empty {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+static file_descriptor_proto_data: &'static [u8] = b"\
+ \n\x1bgoogle/protobuf/empty.proto\x12\x0fgoogle.protobuf\"\x07\n\x05Empt\
+ yBv\n\x13com.google.protobufB\nEmptyProtoP\x01Z'github.com/golang/protob\
+ uf/ptypes/empty\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.We\
+ llKnownTypesJ\xfe\x10\n\x06\x12\x04\x1e\03\x10\n\xcc\x0c\n\x01\x0c\x12\
+ \x03\x1e\0\x122\xc1\x0c\x20Protocol\x20Buffers\x20-\x20Google's\x20data\
+ \x20interchange\x20format\n\x20Copyright\x202008\x20Google\x20Inc.\x20\
+ \x20All\x20rights\x20reserved.\n\x20https://developers.google.com/protoc\
+ ol-buffers/\n\n\x20Redistribution\x20and\x20use\x20in\x20source\x20and\
+ \x20binary\x20forms,\x20with\x20or\x20without\n\x20modification,\x20are\
+ \x20permitted\x20provided\x20that\x20the\x20following\x20conditions\x20a\
+ re\n\x20met:\n\n\x20\x20\x20\x20\x20*\x20Redistributions\x20of\x20source\
+ \x20code\x20must\x20retain\x20the\x20above\x20copyright\n\x20notice,\x20\
+ this\x20list\x20of\x20conditions\x20and\x20the\x20following\x20disclaime\
+ r.\n\x20\x20\x20\x20\x20*\x20Redistributions\x20in\x20binary\x20form\x20\
+ must\x20reproduce\x20the\x20above\n\x20copyright\x20notice,\x20this\x20l\
+ ist\x20of\x20conditions\x20and\x20the\x20following\x20disclaimer\n\x20in\
+ \x20the\x20documentation\x20and/or\x20other\x20materials\x20provided\x20\
+ with\x20the\n\x20distribution.\n\x20\x20\x20\x20\x20*\x20Neither\x20the\
+ \x20name\x20of\x20Google\x20Inc.\x20nor\x20the\x20names\x20of\x20its\n\
+ \x20contributors\x20may\x20be\x20used\x20to\x20endorse\x20or\x20promote\
+ \x20products\x20derived\x20from\n\x20this\x20software\x20without\x20spec\
+ ific\x20prior\x20written\x20permission.\n\n\x20THIS\x20SOFTWARE\x20IS\
+ \x20PROVIDED\x20BY\x20THE\x20COPYRIGHT\x20HOLDERS\x20AND\x20CONTRIBUTORS\
+ \n\x20\"AS\x20IS\"\x20AND\x20ANY\x20EXPRESS\x20OR\x20IMPLIED\x20WARRANTI\
+ ES,\x20INCLUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\x20THE\x20IMPLIED\
+ \x20WARRANTIES\x20OF\x20MERCHANTABILITY\x20AND\x20FITNESS\x20FOR\n\x20A\
+ \x20PARTICULAR\x20PURPOSE\x20ARE\x20DISCLAIMED.\x20IN\x20NO\x20EVENT\x20\
+ SHALL\x20THE\x20COPYRIGHT\n\x20OWNER\x20OR\x20CONTRIBUTORS\x20BE\x20LIAB\
+ LE\x20FOR\x20ANY\x20DIRECT,\x20INDIRECT,\x20INCIDENTAL,\n\x20SPECIAL,\
+ \x20EXEMPLARY,\x20OR\x20CONSEQUENTIAL\x20DAMAGES\x20(INCLUDING,\x20BUT\
+ \x20NOT\n\x20LIMITED\x20TO,\x20PROCUREMENT\x20OF\x20SUBSTITUTE\x20GOODS\
+ \x20OR\x20SERVICES;\x20LOSS\x20OF\x20USE,\n\x20DATA,\x20OR\x20PROFITS;\
+ \x20OR\x20BUSINESS\x20INTERRUPTION)\x20HOWEVER\x20CAUSED\x20AND\x20ON\
+ \x20ANY\n\x20THEORY\x20OF\x20LIABILITY,\x20WHETHER\x20IN\x20CONTRACT,\
+ \x20STRICT\x20LIABILITY,\x20OR\x20TORT\n\x20(INCLUDING\x20NEGLIGENCE\x20\
+ OR\x20OTHERWISE)\x20ARISING\x20IN\x20ANY\x20WAY\x20OUT\x20OF\x20THE\x20U\
+ SE\n\x20OF\x20THIS\x20SOFTWARE,\x20EVEN\x20IF\x20ADVISED\x20OF\x20THE\
+ \x20POSSIBILITY\x20OF\x20SUCH\x20DAMAGE.\n\n\x08\n\x01\x02\x12\x03\x20\0\
+ \x18\n\x08\n\x01\x08\x12\x03\"\0;\n\t\n\x02\x08%\x12\x03\"\0;\n\x08\n\
+ \x01\x08\x12\x03#\0>\n\t\n\x02\x08\x0b\x12\x03#\0>\n\x08\n\x01\x08\x12\
+ \x03$\0,\n\t\n\x02\x08\x01\x12\x03$\0,\n\x08\n\x01\x08\x12\x03%\0+\n\t\n\
+ \x02\x08\x08\x12\x03%\0+\n\x08\n\x01\x08\x12\x03&\0\"\n\t\n\x02\x08\n\
+ \x12\x03&\0\"\n\x08\n\x01\x08\x12\x03'\0!\n\t\n\x02\x08$\x12\x03'\0!\n\
+ \x08\n\x01\x08\x12\x03(\0\x1f\n\t\n\x02\x08\x1f\x12\x03(\0\x1f\n\xfb\x02\
+ \n\x02\x04\0\x12\x033\0\x10\x1a\xef\x02\x20A\x20generic\x20empty\x20mess\
+ age\x20that\x20you\x20can\x20re-use\x20to\x20avoid\x20defining\x20duplic\
+ ated\n\x20empty\x20messages\x20in\x20your\x20APIs.\x20A\x20typical\x20ex\
+ ample\x20is\x20to\x20use\x20it\x20as\x20the\x20request\n\x20or\x20the\
+ \x20response\x20type\x20of\x20an\x20API\x20method.\x20For\x20instance:\n\
+ \n\x20\x20\x20\x20\x20service\x20Foo\x20{\n\x20\x20\x20\x20\x20\x20\x20r\
+ pc\x20Bar(google.protobuf.Empty)\x20returns\x20(google.protobuf.Empty);\
+ \n\x20\x20\x20\x20\x20}\n\n\x20The\x20JSON\x20representation\x20for\x20`\
+ Empty`\x20is\x20empty\x20JSON\x20object\x20`{}`.\n\n\n\n\x03\x04\0\x01\
+ \x12\x033\x08\rb\x06proto3\
+";
+
+static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+
+fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
+ ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
+}
+
+pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
+ unsafe {
+ file_descriptor_proto_lazy.get(|| {
+ parse_descriptor_proto()
+ })
+ }
+}
diff --git a/src/well_known_types/field_mask.rs b/src/well_known_types/field_mask.rs
new file mode 100644
index 0000000..421d15c
--- /dev/null
+++ b/src/well_known_types/field_mask.rs
@@ -0,0 +1,388 @@
+// This file is generated by rust-protobuf 2.14.0-pre. Do not edit
+// @generated
+
+// https://github.com/rust-lang/rust-clippy/issues/702
+#![allow(unknown_lints)]
+#![allow(clippy::all)]
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
+#![allow(box_pointers)]
+#![allow(dead_code)]
+#![allow(missing_docs)]
+#![allow(non_camel_case_types)]
+#![allow(non_snake_case)]
+#![allow(non_upper_case_globals)]
+#![allow(trivial_casts)]
+#![allow(unsafe_code)]
+#![allow(unused_imports)]
+#![allow(unused_results)]
+//! Generated file from `google/protobuf/field_mask.proto`
+
+use protobuf::Message as Message_imported_for_functions;
+use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct FieldMask {
+ // message fields
+ pub paths: ::protobuf::RepeatedField<::std::string::String>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a FieldMask {
+ fn default() -> &'a FieldMask {
+ <FieldMask as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl FieldMask {
+ pub fn new() -> FieldMask {
+ ::std::default::Default::default()
+ }
+
+ // repeated string paths = 1;
+
+
+ pub fn get_paths(&self) -> &[::std::string::String] {
+ &self.paths
+ }
+ pub fn clear_paths(&mut self) {
+ self.paths.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_paths(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) {
+ self.paths = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_paths(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> {
+ &mut self.paths
+ }
+
+ // Take field
+ pub fn take_paths(&mut self) -> ::protobuf::RepeatedField<::std::string::String> {
+ ::std::mem::replace(&mut self.paths, ::protobuf::RepeatedField::new())
+ }
+}
+
+impl ::protobuf::Message for FieldMask {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.paths)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ for value in &self.paths {
+ my_size += ::protobuf::rt::string_size(1, &value);
+ };
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ for v in &self.paths {
+ os.write_string(1, &v)?;
+ };
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> FieldMask {
+ FieldMask::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "paths",
+ |m: &FieldMask| { &m.paths },
+ |m: &mut FieldMask| { &mut m.paths },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<FieldMask>(
+ "FieldMask",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static FieldMask {
+ static mut instance: ::protobuf::lazy::Lazy<FieldMask> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(FieldMask::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for FieldMask {
+ fn clear(&mut self) {
+ self.paths.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for FieldMask {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for FieldMask {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+static file_descriptor_proto_data: &'static [u8] = b"\
+ \n\x20google/protobuf/field_mask.proto\x12\x0fgoogle.protobuf\"!\n\tFiel\
+ dMask\x12\x14\n\x05paths\x18\x01\x20\x03(\tR\x05pathsBN\n\x13com.google.\
+ protobufB\x0eFieldMaskProtoP\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protob\
+ uf.WellKnownTypesJ\x929\n\x07\x12\x05\x1e\0\xf4\x01\x01\n\xcc\x0c\n\x01\
+ \x0c\x12\x03\x1e\0\x122\xc1\x0c\x20Protocol\x20Buffers\x20-\x20Google's\
+ \x20data\x20interchange\x20format\n\x20Copyright\x202008\x20Google\x20In\
+ c.\x20\x20All\x20rights\x20reserved.\n\x20https://developers.google.com/\
+ protocol-buffers/\n\n\x20Redistribution\x20and\x20use\x20in\x20source\
+ \x20and\x20binary\x20forms,\x20with\x20or\x20without\n\x20modification,\
+ \x20are\x20permitted\x20provided\x20that\x20the\x20following\x20conditio\
+ ns\x20are\n\x20met:\n\n\x20\x20\x20\x20\x20*\x20Redistributions\x20of\
+ \x20source\x20code\x20must\x20retain\x20the\x20above\x20copyright\n\x20n\
+ otice,\x20this\x20list\x20of\x20conditions\x20and\x20the\x20following\
+ \x20disclaimer.\n\x20\x20\x20\x20\x20*\x20Redistributions\x20in\x20binar\
+ y\x20form\x20must\x20reproduce\x20the\x20above\n\x20copyright\x20notice,\
+ \x20this\x20list\x20of\x20conditions\x20and\x20the\x20following\x20discl\
+ aimer\n\x20in\x20the\x20documentation\x20and/or\x20other\x20materials\
+ \x20provided\x20with\x20the\n\x20distribution.\n\x20\x20\x20\x20\x20*\
+ \x20Neither\x20the\x20name\x20of\x20Google\x20Inc.\x20nor\x20the\x20name\
+ s\x20of\x20its\n\x20contributors\x20may\x20be\x20used\x20to\x20endorse\
+ \x20or\x20promote\x20products\x20derived\x20from\n\x20this\x20software\
+ \x20without\x20specific\x20prior\x20written\x20permission.\n\n\x20THIS\
+ \x20SOFTWARE\x20IS\x20PROVIDED\x20BY\x20THE\x20COPYRIGHT\x20HOLDERS\x20A\
+ ND\x20CONTRIBUTORS\n\x20\"AS\x20IS\"\x20AND\x20ANY\x20EXPRESS\x20OR\x20I\
+ MPLIED\x20WARRANTIES,\x20INCLUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\
+ \x20THE\x20IMPLIED\x20WARRANTIES\x20OF\x20MERCHANTABILITY\x20AND\x20FITN\
+ ESS\x20FOR\n\x20A\x20PARTICULAR\x20PURPOSE\x20ARE\x20DISCLAIMED.\x20IN\
+ \x20NO\x20EVENT\x20SHALL\x20THE\x20COPYRIGHT\n\x20OWNER\x20OR\x20CONTRIB\
+ UTORS\x20BE\x20LIABLE\x20FOR\x20ANY\x20DIRECT,\x20INDIRECT,\x20INCIDENTA\
+ L,\n\x20SPECIAL,\x20EXEMPLARY,\x20OR\x20CONSEQUENTIAL\x20DAMAGES\x20(INC\
+ LUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\x20PROCUREMENT\x20OF\x20SUBSTI\
+ TUTE\x20GOODS\x20OR\x20SERVICES;\x20LOSS\x20OF\x20USE,\n\x20DATA,\x20OR\
+ \x20PROFITS;\x20OR\x20BUSINESS\x20INTERRUPTION)\x20HOWEVER\x20CAUSED\x20\
+ AND\x20ON\x20ANY\n\x20THEORY\x20OF\x20LIABILITY,\x20WHETHER\x20IN\x20CON\
+ TRACT,\x20STRICT\x20LIABILITY,\x20OR\x20TORT\n\x20(INCLUDING\x20NEGLIGEN\
+ CE\x20OR\x20OTHERWISE)\x20ARISING\x20IN\x20ANY\x20WAY\x20OUT\x20OF\x20TH\
+ E\x20USE\n\x20OF\x20THIS\x20SOFTWARE,\x20EVEN\x20IF\x20ADVISED\x20OF\x20\
+ THE\x20POSSIBILITY\x20OF\x20SUCH\x20DAMAGE.\n\n\x08\n\x01\x02\x12\x03\
+ \x20\0\x18\n\x08\n\x01\x08\x12\x03\"\0;\n\t\n\x02\x08%\x12\x03\"\0;\n\
+ \x08\n\x01\x08\x12\x03#\0,\n\t\n\x02\x08\x01\x12\x03#\0,\n\x08\n\x01\x08\
+ \x12\x03$\0/\n\t\n\x02\x08\x08\x12\x03$\0/\n\x08\n\x01\x08\x12\x03%\0\"\
+ \n\t\n\x02\x08\n\x12\x03%\0\"\n\x08\n\x01\x08\x12\x03&\0!\n\t\n\x02\x08$\
+ \x12\x03&\0!\n\xcd*\n\x02\x04\0\x12\x06\xf1\x01\0\xf4\x01\x01\x1a\xbe*\
+ \x20`FieldMask`\x20represents\x20a\x20set\x20of\x20symbolic\x20field\x20\
+ paths,\x20for\x20example:\n\n\x20\x20\x20\x20\x20paths:\x20\"f.a\"\n\x20\
+ \x20\x20\x20\x20paths:\x20\"f.b.d\"\n\n\x20Here\x20`f`\x20represents\x20\
+ a\x20field\x20in\x20some\x20root\x20message,\x20`a`\x20and\x20`b`\n\x20f\
+ ields\x20in\x20the\x20message\x20found\x20in\x20`f`,\x20and\x20`d`\x20a\
+ \x20field\x20found\x20in\x20the\n\x20message\x20in\x20`f.b`.\n\n\x20Fiel\
+ d\x20masks\x20are\x20used\x20to\x20specify\x20a\x20subset\x20of\x20field\
+ s\x20that\x20should\x20be\n\x20returned\x20by\x20a\x20get\x20operation\
+ \x20or\x20modified\x20by\x20an\x20update\x20operation.\n\x20Field\x20mas\
+ ks\x20also\x20have\x20a\x20custom\x20JSON\x20encoding\x20(see\x20below).\
+ \n\n\x20#\x20Field\x20Masks\x20in\x20Projections\n\n\x20When\x20used\x20\
+ in\x20the\x20context\x20of\x20a\x20projection,\x20a\x20response\x20messa\
+ ge\x20or\n\x20sub-message\x20is\x20filtered\x20by\x20the\x20API\x20to\
+ \x20only\x20contain\x20those\x20fields\x20as\n\x20specified\x20in\x20the\
+ \x20mask.\x20For\x20example,\x20if\x20the\x20mask\x20in\x20the\x20previo\
+ us\n\x20example\x20is\x20applied\x20to\x20a\x20response\x20message\x20as\
+ \x20follows:\n\n\x20\x20\x20\x20\x20f\x20{\n\x20\x20\x20\x20\x20\x20\x20\
+ a\x20:\x2022\n\x20\x20\x20\x20\x20\x20\x20b\x20{\n\x20\x20\x20\x20\x20\
+ \x20\x20\x20\x20d\x20:\x201\n\x20\x20\x20\x20\x20\x20\x20\x20\x20x\x20:\
+ \x202\n\x20\x20\x20\x20\x20\x20\x20}\n\x20\x20\x20\x20\x20\x20\x20y\x20:\
+ \x2013\n\x20\x20\x20\x20\x20}\n\x20\x20\x20\x20\x20z:\x208\n\n\x20The\
+ \x20result\x20will\x20not\x20contain\x20specific\x20values\x20for\x20fie\
+ lds\x20x,y\x20and\x20z\n\x20(their\x20value\x20will\x20be\x20set\x20to\
+ \x20the\x20default,\x20and\x20omitted\x20in\x20proto\x20text\n\x20output\
+ ):\n\n\n\x20\x20\x20\x20\x20f\x20{\n\x20\x20\x20\x20\x20\x20\x20a\x20:\
+ \x2022\n\x20\x20\x20\x20\x20\x20\x20b\x20{\n\x20\x20\x20\x20\x20\x20\x20\
+ \x20\x20d\x20:\x201\n\x20\x20\x20\x20\x20\x20\x20}\n\x20\x20\x20\x20\x20\
+ }\n\n\x20A\x20repeated\x20field\x20is\x20not\x20allowed\x20except\x20at\
+ \x20the\x20last\x20position\x20of\x20a\n\x20paths\x20string.\n\n\x20If\
+ \x20a\x20FieldMask\x20object\x20is\x20not\x20present\x20in\x20a\x20get\
+ \x20operation,\x20the\n\x20operation\x20applies\x20to\x20all\x20fields\
+ \x20(as\x20if\x20a\x20FieldMask\x20of\x20all\x20fields\n\x20had\x20been\
+ \x20specified).\n\n\x20Note\x20that\x20a\x20field\x20mask\x20does\x20not\
+ \x20necessarily\x20apply\x20to\x20the\n\x20top-level\x20response\x20mess\
+ age.\x20In\x20case\x20of\x20a\x20REST\x20get\x20operation,\x20the\n\x20f\
+ ield\x20mask\x20applies\x20directly\x20to\x20the\x20response,\x20but\x20\
+ in\x20case\x20of\x20a\x20REST\n\x20list\x20operation,\x20the\x20mask\x20\
+ instead\x20applies\x20to\x20each\x20individual\x20message\n\x20in\x20the\
+ \x20returned\x20resource\x20list.\x20In\x20case\x20of\x20a\x20REST\x20cu\
+ stom\x20method,\n\x20other\x20definitions\x20may\x20be\x20used.\x20Where\
+ \x20the\x20mask\x20applies\x20will\x20be\n\x20clearly\x20documented\x20t\
+ ogether\x20with\x20its\x20declaration\x20in\x20the\x20API.\x20\x20In\n\
+ \x20any\x20case,\x20the\x20effect\x20on\x20the\x20returned\x20resource/r\
+ esources\x20is\x20required\n\x20behavior\x20for\x20APIs.\n\n\x20#\x20Fie\
+ ld\x20Masks\x20in\x20Update\x20Operations\n\n\x20A\x20field\x20mask\x20i\
+ n\x20update\x20operations\x20specifies\x20which\x20fields\x20of\x20the\n\
+ \x20targeted\x20resource\x20are\x20going\x20to\x20be\x20updated.\x20The\
+ \x20API\x20is\x20required\n\x20to\x20only\x20change\x20the\x20values\x20\
+ of\x20the\x20fields\x20as\x20specified\x20in\x20the\x20mask\n\x20and\x20\
+ leave\x20the\x20others\x20untouched.\x20If\x20a\x20resource\x20is\x20pas\
+ sed\x20in\x20to\n\x20describe\x20the\x20updated\x20values,\x20the\x20API\
+ \x20ignores\x20the\x20values\x20of\x20all\n\x20fields\x20not\x20covered\
+ \x20by\x20the\x20mask.\n\n\x20If\x20a\x20repeated\x20field\x20is\x20spec\
+ ified\x20for\x20an\x20update\x20operation,\x20the\x20existing\n\x20repea\
+ ted\x20values\x20in\x20the\x20target\x20resource\x20will\x20be\x20overwr\
+ itten\x20by\x20the\x20new\x20values.\n\x20Note\x20that\x20a\x20repeated\
+ \x20field\x20is\x20only\x20allowed\x20in\x20the\x20last\x20position\x20o\
+ f\x20a\x20`paths`\n\x20string.\n\n\x20If\x20a\x20sub-message\x20is\x20sp\
+ ecified\x20in\x20the\x20last\x20position\x20of\x20the\x20field\x20mask\
+ \x20for\x20an\n\x20update\x20operation,\x20then\x20the\x20existing\x20su\
+ b-message\x20in\x20the\x20target\x20resource\x20is\n\x20overwritten.\x20\
+ Given\x20the\x20target\x20message:\n\n\x20\x20\x20\x20\x20f\x20{\n\x20\
+ \x20\x20\x20\x20\x20\x20b\x20{\n\x20\x20\x20\x20\x20\x20\x20\x20\x20d\
+ \x20:\x201\n\x20\x20\x20\x20\x20\x20\x20\x20\x20x\x20:\x202\n\x20\x20\
+ \x20\x20\x20\x20\x20}\n\x20\x20\x20\x20\x20\x20\x20c\x20:\x201\n\x20\x20\
+ \x20\x20\x20}\n\n\x20And\x20an\x20update\x20message:\n\n\x20\x20\x20\x20\
+ \x20f\x20{\n\x20\x20\x20\x20\x20\x20\x20b\x20{\n\x20\x20\x20\x20\x20\x20\
+ \x20\x20\x20d\x20:\x2010\n\x20\x20\x20\x20\x20\x20\x20}\n\x20\x20\x20\
+ \x20\x20}\n\n\x20then\x20if\x20the\x20field\x20mask\x20is:\n\n\x20\x20pa\
+ ths:\x20\"f.b\"\n\n\x20then\x20the\x20result\x20will\x20be:\n\n\x20\x20\
+ \x20\x20\x20f\x20{\n\x20\x20\x20\x20\x20\x20\x20b\x20{\n\x20\x20\x20\x20\
+ \x20\x20\x20\x20\x20d\x20:\x2010\n\x20\x20\x20\x20\x20\x20\x20}\n\x20\
+ \x20\x20\x20\x20\x20\x20c\x20:\x201\n\x20\x20\x20\x20\x20}\n\n\x20Howeve\
+ r,\x20if\x20the\x20update\x20mask\x20was:\n\n\x20\x20paths:\x20\"f.b.d\"\
+ \n\n\x20then\x20the\x20result\x20would\x20be:\n\n\x20\x20\x20\x20\x20f\
+ \x20{\n\x20\x20\x20\x20\x20\x20\x20b\x20{\n\x20\x20\x20\x20\x20\x20\x20\
+ \x20\x20d\x20:\x2010\n\x20\x20\x20\x20\x20\x20\x20\x20\x20x\x20:\x202\n\
+ \x20\x20\x20\x20\x20\x20\x20}\n\x20\x20\x20\x20\x20\x20\x20c\x20:\x201\n\
+ \x20\x20\x20\x20\x20}\n\n\x20In\x20order\x20to\x20reset\x20a\x20field's\
+ \x20value\x20to\x20the\x20default,\x20the\x20field\x20must\n\x20be\x20in\
+ \x20the\x20mask\x20and\x20set\x20to\x20the\x20default\x20value\x20in\x20\
+ the\x20provided\x20resource.\n\x20Hence,\x20in\x20order\x20to\x20reset\
+ \x20all\x20fields\x20of\x20a\x20resource,\x20provide\x20a\x20default\n\
+ \x20instance\x20of\x20the\x20resource\x20and\x20set\x20all\x20fields\x20\
+ in\x20the\x20mask,\x20or\x20do\n\x20not\x20provide\x20a\x20mask\x20as\
+ \x20described\x20below.\n\n\x20If\x20a\x20field\x20mask\x20is\x20not\x20\
+ present\x20on\x20update,\x20the\x20operation\x20applies\x20to\n\x20all\
+ \x20fields\x20(as\x20if\x20a\x20field\x20mask\x20of\x20all\x20fields\x20\
+ has\x20been\x20specified).\n\x20Note\x20that\x20in\x20the\x20presence\
+ \x20of\x20schema\x20evolution,\x20this\x20may\x20mean\x20that\n\x20field\
+ s\x20the\x20client\x20does\x20not\x20know\x20and\x20has\x20therefore\x20\
+ not\x20filled\x20into\n\x20the\x20request\x20will\x20be\x20reset\x20to\
+ \x20their\x20default.\x20If\x20this\x20is\x20unwanted\n\x20behavior,\x20\
+ a\x20specific\x20service\x20may\x20require\x20a\x20client\x20to\x20alway\
+ s\x20specify\n\x20a\x20field\x20mask,\x20producing\x20an\x20error\x20if\
+ \x20not.\n\n\x20As\x20with\x20get\x20operations,\x20the\x20location\x20o\
+ f\x20the\x20resource\x20which\n\x20describes\x20the\x20updated\x20values\
+ \x20in\x20the\x20request\x20message\x20depends\x20on\x20the\n\x20operati\
+ on\x20kind.\x20In\x20any\x20case,\x20the\x20effect\x20of\x20the\x20field\
+ \x20mask\x20is\n\x20required\x20to\x20be\x20honored\x20by\x20the\x20API.\
+ \n\n\x20##\x20Considerations\x20for\x20HTTP\x20REST\n\n\x20The\x20HTTP\
+ \x20kind\x20of\x20an\x20update\x20operation\x20which\x20uses\x20a\x20fie\
+ ld\x20mask\x20must\n\x20be\x20set\x20to\x20PATCH\x20instead\x20of\x20PUT\
+ \x20in\x20order\x20to\x20satisfy\x20HTTP\x20semantics\n\x20(PUT\x20must\
+ \x20only\x20be\x20used\x20for\x20full\x20updates).\n\n\x20#\x20JSON\x20E\
+ ncoding\x20of\x20Field\x20Masks\n\n\x20In\x20JSON,\x20a\x20field\x20mask\
+ \x20is\x20encoded\x20as\x20a\x20single\x20string\x20where\x20paths\x20ar\
+ e\n\x20separated\x20by\x20a\x20comma.\x20Fields\x20name\x20in\x20each\
+ \x20path\x20are\x20converted\n\x20to/from\x20lower-camel\x20naming\x20co\
+ nventions.\n\n\x20As\x20an\x20example,\x20consider\x20the\x20following\
+ \x20message\x20declarations:\n\n\x20\x20\x20\x20\x20message\x20Profile\
+ \x20{\n\x20\x20\x20\x20\x20\x20\x20User\x20user\x20=\x201;\n\x20\x20\x20\
+ \x20\x20\x20\x20Photo\x20photo\x20=\x202;\n\x20\x20\x20\x20\x20}\n\x20\
+ \x20\x20\x20\x20message\x20User\x20{\n\x20\x20\x20\x20\x20\x20\x20string\
+ \x20display_name\x20=\x201;\n\x20\x20\x20\x20\x20\x20\x20string\x20addre\
+ ss\x20=\x202;\n\x20\x20\x20\x20\x20}\n\n\x20In\x20proto\x20a\x20field\
+ \x20mask\x20for\x20`Profile`\x20may\x20look\x20as\x20such:\n\n\x20\x20\
+ \x20\x20\x20mask\x20{\n\x20\x20\x20\x20\x20\x20\x20paths:\x20\"user.disp\
+ lay_name\"\n\x20\x20\x20\x20\x20\x20\x20paths:\x20\"photo\"\n\x20\x20\
+ \x20\x20\x20}\n\n\x20In\x20JSON,\x20the\x20same\x20mask\x20is\x20represe\
+ nted\x20as\x20below:\n\n\x20\x20\x20\x20\x20{\n\x20\x20\x20\x20\x20\x20\
+ \x20mask:\x20\"user.displayName,photo\"\n\x20\x20\x20\x20\x20}\n\n\x20#\
+ \x20Field\x20Masks\x20and\x20Oneof\x20Fields\n\n\x20Field\x20masks\x20tr\
+ eat\x20fields\x20in\x20oneofs\x20just\x20as\x20regular\x20fields.\x20Con\
+ sider\x20the\n\x20following\x20message:\n\n\x20\x20\x20\x20\x20message\
+ \x20SampleMessage\x20{\n\x20\x20\x20\x20\x20\x20\x20oneof\x20test_oneof\
+ \x20{\n\x20\x20\x20\x20\x20\x20\x20\x20\x20string\x20name\x20=\x204;\n\
+ \x20\x20\x20\x20\x20\x20\x20\x20\x20SubMessage\x20sub_message\x20=\x209;\
+ \n\x20\x20\x20\x20\x20\x20\x20}\n\x20\x20\x20\x20\x20}\n\n\x20The\x20fie\
+ ld\x20mask\x20can\x20be:\n\n\x20\x20\x20\x20\x20mask\x20{\n\x20\x20\x20\
+ \x20\x20\x20\x20paths:\x20\"name\"\n\x20\x20\x20\x20\x20}\n\n\x20Or:\n\n\
+ \x20\x20\x20\x20\x20mask\x20{\n\x20\x20\x20\x20\x20\x20\x20paths:\x20\"s\
+ ub_message\"\n\x20\x20\x20\x20\x20}\n\n\x20Note\x20that\x20oneof\x20type\
+ \x20names\x20(\"test_oneof\"\x20in\x20this\x20case)\x20cannot\x20be\x20u\
+ sed\x20in\n\x20paths.\n\n\x0b\n\x03\x04\0\x01\x12\x04\xf1\x01\x08\x11\n,\
+ \n\x04\x04\0\x02\0\x12\x04\xf3\x01\x02\x1c\x1a\x1e\x20The\x20set\x20of\
+ \x20field\x20mask\x20paths.\n\n\r\n\x05\x04\0\x02\0\x04\x12\x04\xf3\x01\
+ \x02\n\n\r\n\x05\x04\0\x02\0\x05\x12\x04\xf3\x01\x0b\x11\n\r\n\x05\x04\0\
+ \x02\0\x01\x12\x04\xf3\x01\x12\x17\n\r\n\x05\x04\0\x02\0\x03\x12\x04\xf3\
+ \x01\x1a\x1bb\x06proto3\
+";
+
+static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+
+fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
+ ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
+}
+
+pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
+ unsafe {
+ file_descriptor_proto_lazy.get(|| {
+ parse_descriptor_proto()
+ })
+ }
+}
diff --git a/src/well_known_types/mod.rs b/src/well_known_types/mod.rs
new file mode 100644
index 0000000..9ecf8fb
--- /dev/null
+++ b/src/well_known_types/mod.rs
@@ -0,0 +1,26 @@
+// This file is generated. Do not edit
+//! Generated code for "well known types"
+//!
+//! [This document](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) describes these types.
+
+mod any;
+mod api;
+mod duration;
+mod empty;
+mod field_mask;
+mod source_context;
+mod struct_pb;
+mod timestamp;
+mod type_pb;
+mod wrappers;
+
+pub use self::any::*;
+pub use self::api::*;
+pub use self::duration::*;
+pub use self::empty::*;
+pub use self::field_mask::*;
+pub use self::source_context::*;
+pub use self::struct_pb::*;
+pub use self::timestamp::*;
+pub use self::type_pb::*;
+pub use self::wrappers::*;
diff --git a/src/well_known_types/source_context.rs b/src/well_known_types/source_context.rs
new file mode 100644
index 0000000..c9a9e26
--- /dev/null
+++ b/src/well_known_types/source_context.rs
@@ -0,0 +1,258 @@
+// This file is generated by rust-protobuf 2.14.0-pre. Do not edit
+// @generated
+
+// https://github.com/rust-lang/rust-clippy/issues/702
+#![allow(unknown_lints)]
+#![allow(clippy::all)]
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
+#![allow(box_pointers)]
+#![allow(dead_code)]
+#![allow(missing_docs)]
+#![allow(non_camel_case_types)]
+#![allow(non_snake_case)]
+#![allow(non_upper_case_globals)]
+#![allow(trivial_casts)]
+#![allow(unsafe_code)]
+#![allow(unused_imports)]
+#![allow(unused_results)]
+//! Generated file from `google/protobuf/source_context.proto`
+
+use protobuf::Message as Message_imported_for_functions;
+use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct SourceContext {
+ // message fields
+ pub file_name: ::std::string::String,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a SourceContext {
+ fn default() -> &'a SourceContext {
+ <SourceContext as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl SourceContext {
+ pub fn new() -> SourceContext {
+ ::std::default::Default::default()
+ }
+
+ // string file_name = 1;
+
+
+ pub fn get_file_name(&self) -> &str {
+ &self.file_name
+ }
+ pub fn clear_file_name(&mut self) {
+ self.file_name.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_file_name(&mut self, v: ::std::string::String) {
+ self.file_name = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_file_name(&mut self) -> &mut ::std::string::String {
+ &mut self.file_name
+ }
+
+ // Take field
+ pub fn take_file_name(&mut self) -> ::std::string::String {
+ ::std::mem::replace(&mut self.file_name, ::std::string::String::new())
+ }
+}
+
+impl ::protobuf::Message for SourceContext {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.file_name)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if !self.file_name.is_empty() {
+ my_size += ::protobuf::rt::string_size(1, &self.file_name);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if !self.file_name.is_empty() {
+ os.write_string(1, &self.file_name)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> SourceContext {
+ SourceContext::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "file_name",
+ |m: &SourceContext| { &m.file_name },
+ |m: &mut SourceContext| { &mut m.file_name },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<SourceContext>(
+ "SourceContext",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static SourceContext {
+ static mut instance: ::protobuf::lazy::Lazy<SourceContext> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(SourceContext::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for SourceContext {
+ fn clear(&mut self) {
+ self.file_name.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for SourceContext {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for SourceContext {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+static file_descriptor_proto_data: &'static [u8] = b"\
+ \n$google/protobuf/source_context.proto\x12\x0fgoogle.protobuf\",\n\rSou\
+ rceContext\x12\x1b\n\tfile_name\x18\x01\x20\x01(\tR\x08fileNameBR\n\x13c\
+ om.google.protobufB\x12SourceContextProtoP\x01\xa2\x02\x03GPB\xaa\x02\
+ \x1eGoogle.Protobuf.WellKnownTypesJ\xac\x10\n\x06\x12\x04\x1e\0.\x01\n\
+ \xcc\x0c\n\x01\x0c\x12\x03\x1e\0\x122\xc1\x0c\x20Protocol\x20Buffers\x20\
+ -\x20Google's\x20data\x20interchange\x20format\n\x20Copyright\x202008\
+ \x20Google\x20Inc.\x20\x20All\x20rights\x20reserved.\n\x20https://develo\
+ pers.google.com/protocol-buffers/\n\n\x20Redistribution\x20and\x20use\
+ \x20in\x20source\x20and\x20binary\x20forms,\x20with\x20or\x20without\n\
+ \x20modification,\x20are\x20permitted\x20provided\x20that\x20the\x20foll\
+ owing\x20conditions\x20are\n\x20met:\n\n\x20\x20\x20\x20\x20*\x20Redistr\
+ ibutions\x20of\x20source\x20code\x20must\x20retain\x20the\x20above\x20co\
+ pyright\n\x20notice,\x20this\x20list\x20of\x20conditions\x20and\x20the\
+ \x20following\x20disclaimer.\n\x20\x20\x20\x20\x20*\x20Redistributions\
+ \x20in\x20binary\x20form\x20must\x20reproduce\x20the\x20above\n\x20copyr\
+ ight\x20notice,\x20this\x20list\x20of\x20conditions\x20and\x20the\x20fol\
+ lowing\x20disclaimer\n\x20in\x20the\x20documentation\x20and/or\x20other\
+ \x20materials\x20provided\x20with\x20the\n\x20distribution.\n\x20\x20\
+ \x20\x20\x20*\x20Neither\x20the\x20name\x20of\x20Google\x20Inc.\x20nor\
+ \x20the\x20names\x20of\x20its\n\x20contributors\x20may\x20be\x20used\x20\
+ to\x20endorse\x20or\x20promote\x20products\x20derived\x20from\n\x20this\
+ \x20software\x20without\x20specific\x20prior\x20written\x20permission.\n\
+ \n\x20THIS\x20SOFTWARE\x20IS\x20PROVIDED\x20BY\x20THE\x20COPYRIGHT\x20HO\
+ LDERS\x20AND\x20CONTRIBUTORS\n\x20\"AS\x20IS\"\x20AND\x20ANY\x20EXPRESS\
+ \x20OR\x20IMPLIED\x20WARRANTIES,\x20INCLUDING,\x20BUT\x20NOT\n\x20LIMITE\
+ D\x20TO,\x20THE\x20IMPLIED\x20WARRANTIES\x20OF\x20MERCHANTABILITY\x20AND\
+ \x20FITNESS\x20FOR\n\x20A\x20PARTICULAR\x20PURPOSE\x20ARE\x20DISCLAIMED.\
+ \x20IN\x20NO\x20EVENT\x20SHALL\x20THE\x20COPYRIGHT\n\x20OWNER\x20OR\x20C\
+ ONTRIBUTORS\x20BE\x20LIABLE\x20FOR\x20ANY\x20DIRECT,\x20INDIRECT,\x20INC\
+ IDENTAL,\n\x20SPECIAL,\x20EXEMPLARY,\x20OR\x20CONSEQUENTIAL\x20DAMAGES\
+ \x20(INCLUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\x20PROCUREMENT\x20OF\
+ \x20SUBSTITUTE\x20GOODS\x20OR\x20SERVICES;\x20LOSS\x20OF\x20USE,\n\x20DA\
+ TA,\x20OR\x20PROFITS;\x20OR\x20BUSINESS\x20INTERRUPTION)\x20HOWEVER\x20C\
+ AUSED\x20AND\x20ON\x20ANY\n\x20THEORY\x20OF\x20LIABILITY,\x20WHETHER\x20\
+ IN\x20CONTRACT,\x20STRICT\x20LIABILITY,\x20OR\x20TORT\n\x20(INCLUDING\
+ \x20NEGLIGENCE\x20OR\x20OTHERWISE)\x20ARISING\x20IN\x20ANY\x20WAY\x20OUT\
+ \x20OF\x20THE\x20USE\n\x20OF\x20THIS\x20SOFTWARE,\x20EVEN\x20IF\x20ADVIS\
+ ED\x20OF\x20THE\x20POSSIBILITY\x20OF\x20SUCH\x20DAMAGE.\n\n\x08\n\x01\
+ \x02\x12\x03\x20\0\x18\n\x08\n\x01\x08\x12\x03\"\0;\n\t\n\x02\x08%\x12\
+ \x03\"\0;\n\x08\n\x01\x08\x12\x03#\0,\n\t\n\x02\x08\x01\x12\x03#\0,\n\
+ \x08\n\x01\x08\x12\x03$\03\n\t\n\x02\x08\x08\x12\x03$\03\n\x08\n\x01\x08\
+ \x12\x03%\0\"\n\t\n\x02\x08\n\x12\x03%\0\"\n\x08\n\x01\x08\x12\x03&\0!\n\
+ \t\n\x02\x08$\x12\x03&\0!\n\x83\x01\n\x02\x04\0\x12\x04*\0.\x01\x1aw\x20\
+ `SourceContext`\x20represents\x20information\x20about\x20the\x20source\
+ \x20of\x20a\n\x20protobuf\x20element,\x20like\x20the\x20file\x20in\x20wh\
+ ich\x20it\x20is\x20defined.\n\n\n\n\x03\x04\0\x01\x12\x03*\x08\x15\n\xa3\
+ \x01\n\x04\x04\0\x02\0\x12\x03-\x02\x17\x1a\x95\x01\x20The\x20path-quali\
+ fied\x20name\x20of\x20the\x20.proto\x20file\x20that\x20contained\x20the\
+ \x20associated\n\x20protobuf\x20element.\x20\x20For\x20example:\x20`\"go\
+ ogle/protobuf/source_context.proto\"`.\n\n\x0c\n\x05\x04\0\x02\0\x05\x12\
+ \x03-\x02\x08\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03-\t\x12\n\x0c\n\x05\x04\
+ \0\x02\0\x03\x12\x03-\x15\x16b\x06proto3\
+";
+
+static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+
+fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
+ ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
+}
+
+pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
+ unsafe {
+ file_descriptor_proto_lazy.get(|| {
+ parse_descriptor_proto()
+ })
+ }
+}
diff --git a/src/well_known_types/struct_pb.rs b/src/well_known_types/struct_pb.rs
new file mode 100644
index 0000000..f644b20
--- /dev/null
+++ b/src/well_known_types/struct_pb.rs
@@ -0,0 +1,1028 @@
+// This file is generated by rust-protobuf 2.14.0-pre. Do not edit
+// @generated
+
+// https://github.com/rust-lang/rust-clippy/issues/702
+#![allow(unknown_lints)]
+#![allow(clippy::all)]
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
+#![allow(box_pointers)]
+#![allow(dead_code)]
+#![allow(missing_docs)]
+#![allow(non_camel_case_types)]
+#![allow(non_snake_case)]
+#![allow(non_upper_case_globals)]
+#![allow(trivial_casts)]
+#![allow(unsafe_code)]
+#![allow(unused_imports)]
+#![allow(unused_results)]
+//! Generated file from `google/protobuf/struct.proto`
+
+use protobuf::Message as Message_imported_for_functions;
+use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct Struct {
+ // message fields
+ pub fields: ::std::collections::HashMap<::std::string::String, Value>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a Struct {
+ fn default() -> &'a Struct {
+ <Struct as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl Struct {
+ pub fn new() -> Struct {
+ ::std::default::Default::default()
+ }
+
+ // repeated .google.protobuf.Struct.FieldsEntry fields = 1;
+
+
+ pub fn get_fields(&self) -> &::std::collections::HashMap<::std::string::String, Value> {
+ &self.fields
+ }
+ pub fn clear_fields(&mut self) {
+ self.fields.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_fields(&mut self, v: ::std::collections::HashMap<::std::string::String, Value>) {
+ self.fields = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_fields(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, Value> {
+ &mut self.fields
+ }
+
+ // Take field
+ pub fn take_fields(&mut self) -> ::std::collections::HashMap<::std::string::String, Value> {
+ ::std::mem::replace(&mut self.fields, ::std::collections::HashMap::new())
+ }
+}
+
+impl ::protobuf::Message for Struct {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage<Value>>(wire_type, is, &mut self.fields)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage<Value>>(1, &self.fields);
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage<Value>>(1, &self.fields, os)?;
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> Struct {
+ Struct::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage<Value>>(
+ "fields",
+ |m: &Struct| { &m.fields },
+ |m: &mut Struct| { &mut m.fields },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<Struct>(
+ "Struct",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static Struct {
+ static mut instance: ::protobuf::lazy::Lazy<Struct> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(Struct::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for Struct {
+ fn clear(&mut self) {
+ self.fields.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for Struct {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for Struct {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct Value {
+ // message oneof groups
+ pub kind: ::std::option::Option<Value_oneof_kind>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a Value {
+ fn default() -> &'a Value {
+ <Value as ::protobuf::Message>::default_instance()
+ }
+}
+
+#[derive(Clone,PartialEq,Debug)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub enum Value_oneof_kind {
+ null_value(NullValue),
+ number_value(f64),
+ string_value(::std::string::String),
+ bool_value(bool),
+ struct_value(Struct),
+ list_value(ListValue),
+}
+
+impl Value {
+ pub fn new() -> Value {
+ ::std::default::Default::default()
+ }
+
+ // .google.protobuf.NullValue null_value = 1;
+
+
+ pub fn get_null_value(&self) -> NullValue {
+ match self.kind {
+ ::std::option::Option::Some(Value_oneof_kind::null_value(v)) => v,
+ _ => NullValue::NULL_VALUE,
+ }
+ }
+ pub fn clear_null_value(&mut self) {
+ self.kind = ::std::option::Option::None;
+ }
+
+ pub fn has_null_value(&self) -> bool {
+ match self.kind {
+ ::std::option::Option::Some(Value_oneof_kind::null_value(..)) => true,
+ _ => false,
+ }
+ }
+
+ // Param is passed by value, moved
+ pub fn set_null_value(&mut self, v: NullValue) {
+ self.kind = ::std::option::Option::Some(Value_oneof_kind::null_value(v))
+ }
+
+ // double number_value = 2;
+
+
+ pub fn get_number_value(&self) -> f64 {
+ match self.kind {
+ ::std::option::Option::Some(Value_oneof_kind::number_value(v)) => v,
+ _ => 0.,
+ }
+ }
+ pub fn clear_number_value(&mut self) {
+ self.kind = ::std::option::Option::None;
+ }
+
+ pub fn has_number_value(&self) -> bool {
+ match self.kind {
+ ::std::option::Option::Some(Value_oneof_kind::number_value(..)) => true,
+ _ => false,
+ }
+ }
+
+ // Param is passed by value, moved
+ pub fn set_number_value(&mut self, v: f64) {
+ self.kind = ::std::option::Option::Some(Value_oneof_kind::number_value(v))
+ }
+
+ // string string_value = 3;
+
+
+ pub fn get_string_value(&self) -> &str {
+ match self.kind {
+ ::std::option::Option::Some(Value_oneof_kind::string_value(ref v)) => v,
+ _ => "",
+ }
+ }
+ pub fn clear_string_value(&mut self) {
+ self.kind = ::std::option::Option::None;
+ }
+
+ pub fn has_string_value(&self) -> bool {
+ match self.kind {
+ ::std::option::Option::Some(Value_oneof_kind::string_value(..)) => true,
+ _ => false,
+ }
+ }
+
+ // Param is passed by value, moved
+ pub fn set_string_value(&mut self, v: ::std::string::String) {
+ self.kind = ::std::option::Option::Some(Value_oneof_kind::string_value(v))
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_string_value(&mut self) -> &mut ::std::string::String {
+ if let ::std::option::Option::Some(Value_oneof_kind::string_value(_)) = self.kind {
+ } else {
+ self.kind = ::std::option::Option::Some(Value_oneof_kind::string_value(::std::string::String::new()));
+ }
+ match self.kind {
+ ::std::option::Option::Some(Value_oneof_kind::string_value(ref mut v)) => v,
+ _ => panic!(),
+ }
+ }
+
+ // Take field
+ pub fn take_string_value(&mut self) -> ::std::string::String {
+ if self.has_string_value() {
+ match self.kind.take() {
+ ::std::option::Option::Some(Value_oneof_kind::string_value(v)) => v,
+ _ => panic!(),
+ }
+ } else {
+ ::std::string::String::new()
+ }
+ }
+
+ // bool bool_value = 4;
+
+
+ pub fn get_bool_value(&self) -> bool {
+ match self.kind {
+ ::std::option::Option::Some(Value_oneof_kind::bool_value(v)) => v,
+ _ => false,
+ }
+ }
+ pub fn clear_bool_value(&mut self) {
+ self.kind = ::std::option::Option::None;
+ }
+
+ pub fn has_bool_value(&self) -> bool {
+ match self.kind {
+ ::std::option::Option::Some(Value_oneof_kind::bool_value(..)) => true,
+ _ => false,
+ }
+ }
+
+ // Param is passed by value, moved
+ pub fn set_bool_value(&mut self, v: bool) {
+ self.kind = ::std::option::Option::Some(Value_oneof_kind::bool_value(v))
+ }
+
+ // .google.protobuf.Struct struct_value = 5;
+
+
+ pub fn get_struct_value(&self) -> &Struct {
+ match self.kind {
+ ::std::option::Option::Some(Value_oneof_kind::struct_value(ref v)) => v,
+ _ => Struct::default_instance(),
+ }
+ }
+ pub fn clear_struct_value(&mut self) {
+ self.kind = ::std::option::Option::None;
+ }
+
+ pub fn has_struct_value(&self) -> bool {
+ match self.kind {
+ ::std::option::Option::Some(Value_oneof_kind::struct_value(..)) => true,
+ _ => false,
+ }
+ }
+
+ // Param is passed by value, moved
+ pub fn set_struct_value(&mut self, v: Struct) {
+ self.kind = ::std::option::Option::Some(Value_oneof_kind::struct_value(v))
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_struct_value(&mut self) -> &mut Struct {
+ if let ::std::option::Option::Some(Value_oneof_kind::struct_value(_)) = self.kind {
+ } else {
+ self.kind = ::std::option::Option::Some(Value_oneof_kind::struct_value(Struct::new()));
+ }
+ match self.kind {
+ ::std::option::Option::Some(Value_oneof_kind::struct_value(ref mut v)) => v,
+ _ => panic!(),
+ }
+ }
+
+ // Take field
+ pub fn take_struct_value(&mut self) -> Struct {
+ if self.has_struct_value() {
+ match self.kind.take() {
+ ::std::option::Option::Some(Value_oneof_kind::struct_value(v)) => v,
+ _ => panic!(),
+ }
+ } else {
+ Struct::new()
+ }
+ }
+
+ // .google.protobuf.ListValue list_value = 6;
+
+
+ pub fn get_list_value(&self) -> &ListValue {
+ match self.kind {
+ ::std::option::Option::Some(Value_oneof_kind::list_value(ref v)) => v,
+ _ => ListValue::default_instance(),
+ }
+ }
+ pub fn clear_list_value(&mut self) {
+ self.kind = ::std::option::Option::None;
+ }
+
+ pub fn has_list_value(&self) -> bool {
+ match self.kind {
+ ::std::option::Option::Some(Value_oneof_kind::list_value(..)) => true,
+ _ => false,
+ }
+ }
+
+ // Param is passed by value, moved
+ pub fn set_list_value(&mut self, v: ListValue) {
+ self.kind = ::std::option::Option::Some(Value_oneof_kind::list_value(v))
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_list_value(&mut self) -> &mut ListValue {
+ if let ::std::option::Option::Some(Value_oneof_kind::list_value(_)) = self.kind {
+ } else {
+ self.kind = ::std::option::Option::Some(Value_oneof_kind::list_value(ListValue::new()));
+ }
+ match self.kind {
+ ::std::option::Option::Some(Value_oneof_kind::list_value(ref mut v)) => v,
+ _ => panic!(),
+ }
+ }
+
+ // Take field
+ pub fn take_list_value(&mut self) -> ListValue {
+ if self.has_list_value() {
+ match self.kind.take() {
+ ::std::option::Option::Some(Value_oneof_kind::list_value(v)) => v,
+ _ => panic!(),
+ }
+ } else {
+ ListValue::new()
+ }
+ }
+}
+
+impl ::protobuf::Message for Value {
+ fn is_initialized(&self) -> bool {
+ if let Some(Value_oneof_kind::struct_value(ref v)) = self.kind {
+ if !v.is_initialized() {
+ return false;
+ }
+ }
+ if let Some(Value_oneof_kind::list_value(ref v)) = self.kind {
+ if !v.is_initialized() {
+ return false;
+ }
+ }
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ self.kind = ::std::option::Option::Some(Value_oneof_kind::null_value(is.read_enum()?));
+ },
+ 2 => {
+ if wire_type != ::protobuf::wire_format::WireTypeFixed64 {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ self.kind = ::std::option::Option::Some(Value_oneof_kind::number_value(is.read_double()?));
+ },
+ 3 => {
+ if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ self.kind = ::std::option::Option::Some(Value_oneof_kind::string_value(is.read_string()?));
+ },
+ 4 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ self.kind = ::std::option::Option::Some(Value_oneof_kind::bool_value(is.read_bool()?));
+ },
+ 5 => {
+ if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ self.kind = ::std::option::Option::Some(Value_oneof_kind::struct_value(is.read_message()?));
+ },
+ 6 => {
+ if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ self.kind = ::std::option::Option::Some(Value_oneof_kind::list_value(is.read_message()?));
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if let ::std::option::Option::Some(ref v) = self.kind {
+ match v {
+ &Value_oneof_kind::null_value(v) => {
+ my_size += ::protobuf::rt::enum_size(1, v);
+ },
+ &Value_oneof_kind::number_value(v) => {
+ my_size += 9;
+ },
+ &Value_oneof_kind::string_value(ref v) => {
+ my_size += ::protobuf::rt::string_size(3, &v);
+ },
+ &Value_oneof_kind::bool_value(v) => {
+ my_size += 2;
+ },
+ &Value_oneof_kind::struct_value(ref v) => {
+ let len = v.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ },
+ &Value_oneof_kind::list_value(ref v) => {
+ let len = v.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ },
+ };
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if let ::std::option::Option::Some(ref v) = self.kind {
+ match v {
+ &Value_oneof_kind::null_value(v) => {
+ os.write_enum(1, v.value())?;
+ },
+ &Value_oneof_kind::number_value(v) => {
+ os.write_double(2, v)?;
+ },
+ &Value_oneof_kind::string_value(ref v) => {
+ os.write_string(3, v)?;
+ },
+ &Value_oneof_kind::bool_value(v) => {
+ os.write_bool(4, v)?;
+ },
+ &Value_oneof_kind::struct_value(ref v) => {
+ os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ },
+ &Value_oneof_kind::list_value(ref v) => {
+ os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ },
+ };
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> Value {
+ Value::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_singular_enum_accessor::<_, NullValue>(
+ "null_value",
+ Value::has_null_value,
+ Value::get_null_value,
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_f64_accessor::<_>(
+ "number_value",
+ Value::has_number_value,
+ Value::get_number_value,
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>(
+ "string_value",
+ Value::has_string_value,
+ Value::get_string_value,
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_bool_accessor::<_>(
+ "bool_value",
+ Value::has_bool_value,
+ Value::get_bool_value,
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, Struct>(
+ "struct_value",
+ Value::has_struct_value,
+ Value::get_struct_value,
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, ListValue>(
+ "list_value",
+ Value::has_list_value,
+ Value::get_list_value,
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<Value>(
+ "Value",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static Value {
+ static mut instance: ::protobuf::lazy::Lazy<Value> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(Value::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for Value {
+ fn clear(&mut self) {
+ self.kind = ::std::option::Option::None;
+ self.kind = ::std::option::Option::None;
+ self.kind = ::std::option::Option::None;
+ self.kind = ::std::option::Option::None;
+ self.kind = ::std::option::Option::None;
+ self.kind = ::std::option::Option::None;
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for Value {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for Value {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct ListValue {
+ // message fields
+ pub values: ::protobuf::RepeatedField<Value>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a ListValue {
+ fn default() -> &'a ListValue {
+ <ListValue as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl ListValue {
+ pub fn new() -> ListValue {
+ ::std::default::Default::default()
+ }
+
+ // repeated .google.protobuf.Value values = 1;
+
+
+ pub fn get_values(&self) -> &[Value] {
+ &self.values
+ }
+ pub fn clear_values(&mut self) {
+ self.values.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_values(&mut self, v: ::protobuf::RepeatedField<Value>) {
+ self.values = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_values(&mut self) -> &mut ::protobuf::RepeatedField<Value> {
+ &mut self.values
+ }
+
+ // Take field
+ pub fn take_values(&mut self) -> ::protobuf::RepeatedField<Value> {
+ ::std::mem::replace(&mut self.values, ::protobuf::RepeatedField::new())
+ }
+}
+
+impl ::protobuf::Message for ListValue {
+ fn is_initialized(&self) -> bool {
+ for v in &self.values {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.values)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ for value in &self.values {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ for v in &self.values {
+ os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> ListValue {
+ ListValue::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<Value>>(
+ "values",
+ |m: &ListValue| { &m.values },
+ |m: &mut ListValue| { &mut m.values },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<ListValue>(
+ "ListValue",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static ListValue {
+ static mut instance: ::protobuf::lazy::Lazy<ListValue> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(ListValue::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for ListValue {
+ fn clear(&mut self) {
+ self.values.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for ListValue {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for ListValue {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(Clone,PartialEq,Eq,Debug,Hash)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub enum NullValue {
+ NULL_VALUE = 0,
+}
+
+impl ::protobuf::ProtobufEnum for NullValue {
+ fn value(&self) -> i32 {
+ *self as i32
+ }
+
+ fn from_i32(value: i32) -> ::std::option::Option<NullValue> {
+ match value {
+ 0 => ::std::option::Option::Some(NullValue::NULL_VALUE),
+ _ => ::std::option::Option::None
+ }
+ }
+
+ fn values() -> &'static [Self] {
+ static values: &'static [NullValue] = &[
+ NullValue::NULL_VALUE,
+ ];
+ values
+ }
+
+ fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ ::protobuf::reflect::EnumDescriptor::new_pb_name::<NullValue>("NullValue", file_descriptor_proto())
+ })
+ }
+ }
+}
+
+impl ::std::marker::Copy for NullValue {
+}
+
+impl ::std::default::Default for NullValue {
+ fn default() -> Self {
+ NullValue::NULL_VALUE
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for NullValue {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Enum(self.descriptor())
+ }
+}
+
+static file_descriptor_proto_data: &'static [u8] = b"\
+ \n\x1cgoogle/protobuf/struct.proto\x12\x0fgoogle.protobuf\"\x98\x01\n\
+ \x06Struct\x12;\n\x06fields\x18\x01\x20\x03(\x0b2#.google.protobuf.Struc\
+ t.FieldsEntryR\x06fields\x1aQ\n\x0bFieldsEntry\x12\x10\n\x03key\x18\x01\
+ \x20\x01(\tR\x03key\x12,\n\x05value\x18\x02\x20\x01(\x0b2\x16.google.pro\
+ tobuf.ValueR\x05value:\x028\x01\"\xb2\x02\n\x05Value\x12;\n\nnull_value\
+ \x18\x01\x20\x01(\x0e2\x1a.google.protobuf.NullValueH\0R\tnullValue\x12#\
+ \n\x0cnumber_value\x18\x02\x20\x01(\x01H\0R\x0bnumberValue\x12#\n\x0cstr\
+ ing_value\x18\x03\x20\x01(\tH\0R\x0bstringValue\x12\x1f\n\nbool_value\
+ \x18\x04\x20\x01(\x08H\0R\tboolValue\x12<\n\x0cstruct_value\x18\x05\x20\
+ \x01(\x0b2\x17.google.protobuf.StructH\0R\x0bstructValue\x12;\n\nlist_va\
+ lue\x18\x06\x20\x01(\x0b2\x1a.google.protobuf.ListValueH\0R\tlistValueB\
+ \x06\n\x04kind\";\n\tListValue\x12.\n\x06values\x18\x01\x20\x03(\x0b2\
+ \x16.google.protobuf.ValueR\x06values*\x1b\n\tNullValue\x12\x0e\n\nNULL_\
+ VALUE\x10\0B\x81\x01\n\x13com.google.protobufB\x0bStructProtoP\x01Z1gith\
+ ub.com/golang/protobuf/ptypes/struct;structpb\xf8\x01\x01\xa2\x02\x03GPB\
+ \xaa\x02\x1eGoogle.Protobuf.WellKnownTypesJ\x99\x1d\n\x06\x12\x04\x1e\0_\
+ \x01\n\xcc\x0c\n\x01\x0c\x12\x03\x1e\0\x122\xc1\x0c\x20Protocol\x20Buffe\
+ rs\x20-\x20Google's\x20data\x20interchange\x20format\n\x20Copyright\x202\
+ 008\x20Google\x20Inc.\x20\x20All\x20rights\x20reserved.\n\x20https://dev\
+ elopers.google.com/protocol-buffers/\n\n\x20Redistribution\x20and\x20use\
+ \x20in\x20source\x20and\x20binary\x20forms,\x20with\x20or\x20without\n\
+ \x20modification,\x20are\x20permitted\x20provided\x20that\x20the\x20foll\
+ owing\x20conditions\x20are\n\x20met:\n\n\x20\x20\x20\x20\x20*\x20Redistr\
+ ibutions\x20of\x20source\x20code\x20must\x20retain\x20the\x20above\x20co\
+ pyright\n\x20notice,\x20this\x20list\x20of\x20conditions\x20and\x20the\
+ \x20following\x20disclaimer.\n\x20\x20\x20\x20\x20*\x20Redistributions\
+ \x20in\x20binary\x20form\x20must\x20reproduce\x20the\x20above\n\x20copyr\
+ ight\x20notice,\x20this\x20list\x20of\x20conditions\x20and\x20the\x20fol\
+ lowing\x20disclaimer\n\x20in\x20the\x20documentation\x20and/or\x20other\
+ \x20materials\x20provided\x20with\x20the\n\x20distribution.\n\x20\x20\
+ \x20\x20\x20*\x20Neither\x20the\x20name\x20of\x20Google\x20Inc.\x20nor\
+ \x20the\x20names\x20of\x20its\n\x20contributors\x20may\x20be\x20used\x20\
+ to\x20endorse\x20or\x20promote\x20products\x20derived\x20from\n\x20this\
+ \x20software\x20without\x20specific\x20prior\x20written\x20permission.\n\
+ \n\x20THIS\x20SOFTWARE\x20IS\x20PROVIDED\x20BY\x20THE\x20COPYRIGHT\x20HO\
+ LDERS\x20AND\x20CONTRIBUTORS\n\x20\"AS\x20IS\"\x20AND\x20ANY\x20EXPRESS\
+ \x20OR\x20IMPLIED\x20WARRANTIES,\x20INCLUDING,\x20BUT\x20NOT\n\x20LIMITE\
+ D\x20TO,\x20THE\x20IMPLIED\x20WARRANTIES\x20OF\x20MERCHANTABILITY\x20AND\
+ \x20FITNESS\x20FOR\n\x20A\x20PARTICULAR\x20PURPOSE\x20ARE\x20DISCLAIMED.\
+ \x20IN\x20NO\x20EVENT\x20SHALL\x20THE\x20COPYRIGHT\n\x20OWNER\x20OR\x20C\
+ ONTRIBUTORS\x20BE\x20LIABLE\x20FOR\x20ANY\x20DIRECT,\x20INDIRECT,\x20INC\
+ IDENTAL,\n\x20SPECIAL,\x20EXEMPLARY,\x20OR\x20CONSEQUENTIAL\x20DAMAGES\
+ \x20(INCLUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\x20PROCUREMENT\x20OF\
+ \x20SUBSTITUTE\x20GOODS\x20OR\x20SERVICES;\x20LOSS\x20OF\x20USE,\n\x20DA\
+ TA,\x20OR\x20PROFITS;\x20OR\x20BUSINESS\x20INTERRUPTION)\x20HOWEVER\x20C\
+ AUSED\x20AND\x20ON\x20ANY\n\x20THEORY\x20OF\x20LIABILITY,\x20WHETHER\x20\
+ IN\x20CONTRACT,\x20STRICT\x20LIABILITY,\x20OR\x20TORT\n\x20(INCLUDING\
+ \x20NEGLIGENCE\x20OR\x20OTHERWISE)\x20ARISING\x20IN\x20ANY\x20WAY\x20OUT\
+ \x20OF\x20THE\x20USE\n\x20OF\x20THIS\x20SOFTWARE,\x20EVEN\x20IF\x20ADVIS\
+ ED\x20OF\x20THE\x20POSSIBILITY\x20OF\x20SUCH\x20DAMAGE.\n\n\x08\n\x01\
+ \x02\x12\x03\x20\0\x18\n\x08\n\x01\x08\x12\x03\"\0;\n\t\n\x02\x08%\x12\
+ \x03\"\0;\n\x08\n\x01\x08\x12\x03#\0\x1f\n\t\n\x02\x08\x1f\x12\x03#\0\
+ \x1f\n\x08\n\x01\x08\x12\x03$\0H\n\t\n\x02\x08\x0b\x12\x03$\0H\n\x08\n\
+ \x01\x08\x12\x03%\0,\n\t\n\x02\x08\x01\x12\x03%\0,\n\x08\n\x01\x08\x12\
+ \x03&\0,\n\t\n\x02\x08\x08\x12\x03&\0,\n\x08\n\x01\x08\x12\x03'\0\"\n\t\
+ \n\x02\x08\n\x12\x03'\0\"\n\x08\n\x01\x08\x12\x03(\0!\n\t\n\x02\x08$\x12\
+ \x03(\0!\n\xb3\x03\n\x02\x04\0\x12\x043\06\x01\x1a\xa6\x03\x20`Struct`\
+ \x20represents\x20a\x20structured\x20data\x20value,\x20consisting\x20of\
+ \x20fields\n\x20which\x20map\x20to\x20dynamically\x20typed\x20values.\
+ \x20In\x20some\x20languages,\x20`Struct`\n\x20might\x20be\x20supported\
+ \x20by\x20a\x20native\x20representation.\x20For\x20example,\x20in\n\x20s\
+ cripting\x20languages\x20like\x20JS\x20a\x20struct\x20is\x20represented\
+ \x20as\x20an\n\x20object.\x20The\x20details\x20of\x20that\x20representat\
+ ion\x20are\x20described\x20together\n\x20with\x20the\x20proto\x20support\
+ \x20for\x20the\x20language.\n\n\x20The\x20JSON\x20representation\x20for\
+ \x20`Struct`\x20is\x20JSON\x20object.\n\n\n\n\x03\x04\0\x01\x12\x033\x08\
+ \x0e\n9\n\x04\x04\0\x02\0\x12\x035\x02\x20\x1a,\x20Unordered\x20map\x20o\
+ f\x20dynamically\x20typed\x20values.\n\n\x0c\n\x05\x04\0\x02\0\x06\x12\
+ \x035\x02\x14\n\x0c\n\x05\x04\0\x02\0\x01\x12\x035\x15\x1b\n\x0c\n\x05\
+ \x04\0\x02\0\x03\x12\x035\x1e\x1f\n\xc3\x02\n\x02\x04\x01\x12\x04>\0N\
+ \x01\x1a\xb6\x02\x20`Value`\x20represents\x20a\x20dynamically\x20typed\
+ \x20value\x20which\x20can\x20be\x20either\n\x20null,\x20a\x20number,\x20\
+ a\x20string,\x20a\x20boolean,\x20a\x20recursive\x20struct\x20value,\x20o\
+ r\x20a\n\x20list\x20of\x20values.\x20A\x20producer\x20of\x20value\x20is\
+ \x20expected\x20to\x20set\x20one\x20of\x20that\n\x20variants,\x20absence\
+ \x20of\x20any\x20variant\x20indicates\x20an\x20error.\n\n\x20The\x20JSON\
+ \x20representation\x20for\x20`Value`\x20is\x20JSON\x20value.\n\n\n\n\x03\
+ \x04\x01\x01\x12\x03>\x08\r\n\"\n\x04\x04\x01\x08\0\x12\x04@\x02M\x03\
+ \x1a\x14\x20The\x20kind\x20of\x20value.\n\n\x0c\n\x05\x04\x01\x08\0\x01\
+ \x12\x03@\x08\x0c\n'\n\x04\x04\x01\x02\0\x12\x03B\x04\x1d\x1a\x1a\x20Rep\
+ resents\x20a\x20null\x20value.\n\n\x0c\n\x05\x04\x01\x02\0\x06\x12\x03B\
+ \x04\r\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03B\x0e\x18\n\x0c\n\x05\x04\
+ \x01\x02\0\x03\x12\x03B\x1b\x1c\n)\n\x04\x04\x01\x02\x01\x12\x03D\x04\
+ \x1c\x1a\x1c\x20Represents\x20a\x20double\x20value.\n\n\x0c\n\x05\x04\
+ \x01\x02\x01\x05\x12\x03D\x04\n\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03D\
+ \x0b\x17\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03D\x1a\x1b\n)\n\x04\x04\
+ \x01\x02\x02\x12\x03F\x04\x1c\x1a\x1c\x20Represents\x20a\x20string\x20va\
+ lue.\n\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03F\x04\n\n\x0c\n\x05\x04\
+ \x01\x02\x02\x01\x12\x03F\x0b\x17\n\x0c\n\x05\x04\x01\x02\x02\x03\x12\
+ \x03F\x1a\x1b\n*\n\x04\x04\x01\x02\x03\x12\x03H\x04\x18\x1a\x1d\x20Repre\
+ sents\x20a\x20boolean\x20value.\n\n\x0c\n\x05\x04\x01\x02\x03\x05\x12\
+ \x03H\x04\x08\n\x0c\n\x05\x04\x01\x02\x03\x01\x12\x03H\t\x13\n\x0c\n\x05\
+ \x04\x01\x02\x03\x03\x12\x03H\x16\x17\n-\n\x04\x04\x01\x02\x04\x12\x03J\
+ \x04\x1c\x1a\x20\x20Represents\x20a\x20structured\x20value.\n\n\x0c\n\
+ \x05\x04\x01\x02\x04\x06\x12\x03J\x04\n\n\x0c\n\x05\x04\x01\x02\x04\x01\
+ \x12\x03J\x0b\x17\n\x0c\n\x05\x04\x01\x02\x04\x03\x12\x03J\x1a\x1b\n-\n\
+ \x04\x04\x01\x02\x05\x12\x03L\x04\x1d\x1a\x20\x20Represents\x20a\x20repe\
+ ated\x20`Value`.\n\n\x0c\n\x05\x04\x01\x02\x05\x06\x12\x03L\x04\r\n\x0c\
+ \n\x05\x04\x01\x02\x05\x01\x12\x03L\x0e\x18\n\x0c\n\x05\x04\x01\x02\x05\
+ \x03\x12\x03L\x1b\x1c\n\xa9\x01\n\x02\x05\0\x12\x04T\0W\x01\x1a\x9c\x01\
+ \x20`NullValue`\x20is\x20a\x20singleton\x20enumeration\x20to\x20represen\
+ t\x20the\x20null\x20value\x20for\x20the\n\x20`Value`\x20type\x20union.\n\
+ \n\x20\x20The\x20JSON\x20representation\x20for\x20`NullValue`\x20is\x20J\
+ SON\x20`null`.\n\n\n\n\x03\x05\0\x01\x12\x03T\x05\x0e\n\x1a\n\x04\x05\0\
+ \x02\0\x12\x03V\x02\x11\x1a\r\x20Null\x20value.\n\n\x0c\n\x05\x05\0\x02\
+ \0\x01\x12\x03V\x02\x0c\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03V\x0f\x10\n\
+ \x82\x01\n\x02\x04\x02\x12\x04\\\0_\x01\x1av\x20`ListValue`\x20is\x20a\
+ \x20wrapper\x20around\x20a\x20repeated\x20field\x20of\x20values.\n\n\x20\
+ The\x20JSON\x20representation\x20for\x20`ListValue`\x20is\x20JSON\x20arr\
+ ay.\n\n\n\n\x03\x04\x02\x01\x12\x03\\\x08\x11\n:\n\x04\x04\x02\x02\0\x12\
+ \x03^\x02\x1c\x1a-\x20Repeated\x20field\x20of\x20dynamically\x20typed\
+ \x20values.\n\n\x0c\n\x05\x04\x02\x02\0\x04\x12\x03^\x02\n\n\x0c\n\x05\
+ \x04\x02\x02\0\x06\x12\x03^\x0b\x10\n\x0c\n\x05\x04\x02\x02\0\x01\x12\
+ \x03^\x11\x17\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03^\x1a\x1bb\x06proto3\
+";
+
+static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+
+fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
+ ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
+}
+
+pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
+ unsafe {
+ file_descriptor_proto_lazy.get(|| {
+ parse_descriptor_proto()
+ })
+ }
+}
diff --git a/src/well_known_types/timestamp.rs b/src/well_known_types/timestamp.rs
new file mode 100644
index 0000000..2fed143
--- /dev/null
+++ b/src/well_known_types/timestamp.rs
@@ -0,0 +1,335 @@
+// This file is generated by rust-protobuf 2.14.0-pre. Do not edit
+// @generated
+
+// https://github.com/rust-lang/rust-clippy/issues/702
+#![allow(unknown_lints)]
+#![allow(clippy::all)]
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
+#![allow(box_pointers)]
+#![allow(dead_code)]
+#![allow(missing_docs)]
+#![allow(non_camel_case_types)]
+#![allow(non_snake_case)]
+#![allow(non_upper_case_globals)]
+#![allow(trivial_casts)]
+#![allow(unsafe_code)]
+#![allow(unused_imports)]
+#![allow(unused_results)]
+//! Generated file from `google/protobuf/timestamp.proto`
+
+use protobuf::Message as Message_imported_for_functions;
+use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct Timestamp {
+ // message fields
+ pub seconds: i64,
+ pub nanos: i32,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a Timestamp {
+ fn default() -> &'a Timestamp {
+ <Timestamp as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl Timestamp {
+ pub fn new() -> Timestamp {
+ ::std::default::Default::default()
+ }
+
+ // int64 seconds = 1;
+
+
+ pub fn get_seconds(&self) -> i64 {
+ self.seconds
+ }
+ pub fn clear_seconds(&mut self) {
+ self.seconds = 0;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_seconds(&mut self, v: i64) {
+ self.seconds = v;
+ }
+
+ // int32 nanos = 2;
+
+
+ pub fn get_nanos(&self) -> i32 {
+ self.nanos
+ }
+ pub fn clear_nanos(&mut self) {
+ self.nanos = 0;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_nanos(&mut self, v: i32) {
+ self.nanos = v;
+ }
+}
+
+impl ::protobuf::Message for Timestamp {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_int64()?;
+ self.seconds = tmp;
+ },
+ 2 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_int32()?;
+ self.nanos = tmp;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if self.seconds != 0 {
+ my_size += ::protobuf::rt::value_size(1, self.seconds, ::protobuf::wire_format::WireTypeVarint);
+ }
+ if self.nanos != 0 {
+ my_size += ::protobuf::rt::value_size(2, self.nanos, ::protobuf::wire_format::WireTypeVarint);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if self.seconds != 0 {
+ os.write_int64(1, self.seconds)?;
+ }
+ if self.nanos != 0 {
+ os.write_int32(2, self.nanos)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> Timestamp {
+ Timestamp::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>(
+ "seconds",
+ |m: &Timestamp| { &m.seconds },
+ |m: &mut Timestamp| { &mut m.seconds },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "nanos",
+ |m: &Timestamp| { &m.nanos },
+ |m: &mut Timestamp| { &mut m.nanos },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<Timestamp>(
+ "Timestamp",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static Timestamp {
+ static mut instance: ::protobuf::lazy::Lazy<Timestamp> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(Timestamp::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for Timestamp {
+ fn clear(&mut self) {
+ self.seconds = 0;
+ self.nanos = 0;
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for Timestamp {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for Timestamp {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+static file_descriptor_proto_data: &'static [u8] = b"\
+ \n\x1fgoogle/protobuf/timestamp.proto\x12\x0fgoogle.protobuf\";\n\tTimes\
+ tamp\x12\x18\n\x07seconds\x18\x01\x20\x01(\x03R\x07seconds\x12\x14\n\x05\
+ nanos\x18\x02\x20\x01(\x05R\x05nanosB~\n\x13com.google.protobufB\x0eTime\
+ stampProtoP\x01Z+github.com/golang/protobuf/ptypes/timestamp\xf8\x01\x01\
+ \xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesJ\x95!\n\x06\
+ \x12\x04\x1e\0k\x01\n\xcc\x0c\n\x01\x0c\x12\x03\x1e\0\x122\xc1\x0c\x20Pr\
+ otocol\x20Buffers\x20-\x20Google's\x20data\x20interchange\x20format\n\
+ \x20Copyright\x202008\x20Google\x20Inc.\x20\x20All\x20rights\x20reserved\
+ .\n\x20https://developers.google.com/protocol-buffers/\n\n\x20Redistribu\
+ tion\x20and\x20use\x20in\x20source\x20and\x20binary\x20forms,\x20with\
+ \x20or\x20without\n\x20modification,\x20are\x20permitted\x20provided\x20\
+ that\x20the\x20following\x20conditions\x20are\n\x20met:\n\n\x20\x20\x20\
+ \x20\x20*\x20Redistributions\x20of\x20source\x20code\x20must\x20retain\
+ \x20the\x20above\x20copyright\n\x20notice,\x20this\x20list\x20of\x20cond\
+ itions\x20and\x20the\x20following\x20disclaimer.\n\x20\x20\x20\x20\x20*\
+ \x20Redistributions\x20in\x20binary\x20form\x20must\x20reproduce\x20the\
+ \x20above\n\x20copyright\x20notice,\x20this\x20list\x20of\x20conditions\
+ \x20and\x20the\x20following\x20disclaimer\n\x20in\x20the\x20documentatio\
+ n\x20and/or\x20other\x20materials\x20provided\x20with\x20the\n\x20distri\
+ bution.\n\x20\x20\x20\x20\x20*\x20Neither\x20the\x20name\x20of\x20Google\
+ \x20Inc.\x20nor\x20the\x20names\x20of\x20its\n\x20contributors\x20may\
+ \x20be\x20used\x20to\x20endorse\x20or\x20promote\x20products\x20derived\
+ \x20from\n\x20this\x20software\x20without\x20specific\x20prior\x20writte\
+ n\x20permission.\n\n\x20THIS\x20SOFTWARE\x20IS\x20PROVIDED\x20BY\x20THE\
+ \x20COPYRIGHT\x20HOLDERS\x20AND\x20CONTRIBUTORS\n\x20\"AS\x20IS\"\x20AND\
+ \x20ANY\x20EXPRESS\x20OR\x20IMPLIED\x20WARRANTIES,\x20INCLUDING,\x20BUT\
+ \x20NOT\n\x20LIMITED\x20TO,\x20THE\x20IMPLIED\x20WARRANTIES\x20OF\x20MER\
+ CHANTABILITY\x20AND\x20FITNESS\x20FOR\n\x20A\x20PARTICULAR\x20PURPOSE\
+ \x20ARE\x20DISCLAIMED.\x20IN\x20NO\x20EVENT\x20SHALL\x20THE\x20COPYRIGHT\
+ \n\x20OWNER\x20OR\x20CONTRIBUTORS\x20BE\x20LIABLE\x20FOR\x20ANY\x20DIREC\
+ T,\x20INDIRECT,\x20INCIDENTAL,\n\x20SPECIAL,\x20EXEMPLARY,\x20OR\x20CONS\
+ EQUENTIAL\x20DAMAGES\x20(INCLUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\
+ \x20PROCUREMENT\x20OF\x20SUBSTITUTE\x20GOODS\x20OR\x20SERVICES;\x20LOSS\
+ \x20OF\x20USE,\n\x20DATA,\x20OR\x20PROFITS;\x20OR\x20BUSINESS\x20INTERRU\
+ PTION)\x20HOWEVER\x20CAUSED\x20AND\x20ON\x20ANY\n\x20THEORY\x20OF\x20LIA\
+ BILITY,\x20WHETHER\x20IN\x20CONTRACT,\x20STRICT\x20LIABILITY,\x20OR\x20T\
+ ORT\n\x20(INCLUDING\x20NEGLIGENCE\x20OR\x20OTHERWISE)\x20ARISING\x20IN\
+ \x20ANY\x20WAY\x20OUT\x20OF\x20THE\x20USE\n\x20OF\x20THIS\x20SOFTWARE,\
+ \x20EVEN\x20IF\x20ADVISED\x20OF\x20THE\x20POSSIBILITY\x20OF\x20SUCH\x20D\
+ AMAGE.\n\n\x08\n\x01\x02\x12\x03\x20\0\x18\n\x08\n\x01\x08\x12\x03\"\0;\
+ \n\t\n\x02\x08%\x12\x03\"\0;\n\x08\n\x01\x08\x12\x03#\0\x1f\n\t\n\x02\
+ \x08\x1f\x12\x03#\0\x1f\n\x08\n\x01\x08\x12\x03$\0B\n\t\n\x02\x08\x0b\
+ \x12\x03$\0B\n\x08\n\x01\x08\x12\x03%\0,\n\t\n\x02\x08\x01\x12\x03%\0,\n\
+ \x08\n\x01\x08\x12\x03&\0/\n\t\n\x02\x08\x08\x12\x03&\0/\n\x08\n\x01\x08\
+ \x12\x03'\0\"\n\t\n\x02\x08\n\x12\x03'\0\"\n\x08\n\x01\x08\x12\x03(\0!\n\
+ \t\n\x02\x08$\x12\x03(\0!\n\xb8\x0f\n\x02\x04\0\x12\x04_\0k\x01\x1a\xab\
+ \x0f\x20A\x20Timestamp\x20represents\x20a\x20point\x20in\x20time\x20inde\
+ pendent\x20of\x20any\x20time\x20zone\n\x20or\x20calendar,\x20represented\
+ \x20as\x20seconds\x20and\x20fractions\x20of\x20seconds\x20at\n\x20nanose\
+ cond\x20resolution\x20in\x20UTC\x20Epoch\x20time.\x20It\x20is\x20encoded\
+ \x20using\x20the\n\x20Proleptic\x20Gregorian\x20Calendar\x20which\x20ext\
+ ends\x20the\x20Gregorian\x20calendar\n\x20backwards\x20to\x20year\x20one\
+ .\x20It\x20is\x20encoded\x20assuming\x20all\x20minutes\x20are\x2060\n\
+ \x20seconds\x20long,\x20i.e.\x20leap\x20seconds\x20are\x20\"smeared\"\
+ \x20so\x20that\x20no\x20leap\x20second\n\x20table\x20is\x20needed\x20for\
+ \x20interpretation.\x20Range\x20is\x20from\n\x200001-01-01T00:00:00Z\x20\
+ to\x209999-12-31T23:59:59.999999999Z.\n\x20By\x20restricting\x20to\x20th\
+ at\x20range,\x20we\x20ensure\x20that\x20we\x20can\x20convert\x20to\n\x20\
+ and\x20from\x20\x20RFC\x203339\x20date\x20strings.\n\x20See\x20[https://\
+ www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).\n\n\
+ \x20Example\x201:\x20Compute\x20Timestamp\x20from\x20POSIX\x20`time()`.\
+ \n\n\x20\x20\x20\x20\x20Timestamp\x20timestamp;\n\x20\x20\x20\x20\x20tim\
+ estamp.set_seconds(time(NULL));\n\x20\x20\x20\x20\x20timestamp.set_nanos\
+ (0);\n\n\x20Example\x202:\x20Compute\x20Timestamp\x20from\x20POSIX\x20`g\
+ ettimeofday()`.\n\n\x20\x20\x20\x20\x20struct\x20timeval\x20tv;\n\x20\
+ \x20\x20\x20\x20gettimeofday(&tv,\x20NULL);\n\n\x20\x20\x20\x20\x20Times\
+ tamp\x20timestamp;\n\x20\x20\x20\x20\x20timestamp.set_seconds(tv.tv_sec)\
+ ;\n\x20\x20\x20\x20\x20timestamp.set_nanos(tv.tv_usec\x20*\x201000);\n\n\
+ \x20Example\x203:\x20Compute\x20Timestamp\x20from\x20Win32\x20`GetSystem\
+ TimeAsFileTime()`.\n\n\x20\x20\x20\x20\x20FILETIME\x20ft;\n\x20\x20\x20\
+ \x20\x20GetSystemTimeAsFileTime(&ft);\n\x20\x20\x20\x20\x20UINT64\x20tic\
+ ks\x20=\x20(((UINT64)ft.dwHighDateTime)\x20<<\x2032)\x20|\x20ft.dwLowDat\
+ eTime;\n\n\x20\x20\x20\x20\x20//\x20A\x20Windows\x20tick\x20is\x20100\
+ \x20nanoseconds.\x20Windows\x20epoch\x201601-01-01T00:00:00Z\n\x20\x20\
+ \x20\x20\x20//\x20is\x2011644473600\x20seconds\x20before\x20Unix\x20epoc\
+ h\x201970-01-01T00:00:00Z.\n\x20\x20\x20\x20\x20Timestamp\x20timestamp;\
+ \n\x20\x20\x20\x20\x20timestamp.set_seconds((INT64)\x20((ticks\x20/\x201\
+ 0000000)\x20-\x2011644473600LL));\n\x20\x20\x20\x20\x20timestamp.set_nan\
+ os((INT32)\x20((ticks\x20%\x2010000000)\x20*\x20100));\n\n\x20Example\
+ \x204:\x20Compute\x20Timestamp\x20from\x20Java\x20`System.currentTimeMil\
+ lis()`.\n\n\x20\x20\x20\x20\x20long\x20millis\x20=\x20System.currentTime\
+ Millis();\n\n\x20\x20\x20\x20\x20Timestamp\x20timestamp\x20=\x20Timestam\
+ p.newBuilder().setSeconds(millis\x20/\x201000)\n\x20\x20\x20\x20\x20\x20\
+ \x20\x20\x20.setNanos((int)\x20((millis\x20%\x201000)\x20*\x201000000)).\
+ build();\n\n\n\x20Example\x205:\x20Compute\x20Timestamp\x20from\x20curre\
+ nt\x20time\x20in\x20Python.\n\n\x20\x20\x20\x20\x20timestamp\x20=\x20Tim\
+ estamp()\n\x20\x20\x20\x20\x20timestamp.GetCurrentTime()\n\n\n\n\n\n\x03\
+ \x04\0\x01\x12\x03_\x08\x11\n\x9c\x01\n\x04\x04\0\x02\0\x12\x03d\x02\x14\
+ \x1a\x8e\x01\x20Represents\x20seconds\x20of\x20UTC\x20time\x20since\x20U\
+ nix\x20epoch\n\x201970-01-01T00:00:00Z.\x20Must\x20be\x20from\x200001-01\
+ -01T00:00:00Z\x20to\n\x209999-12-31T23:59:59Z\x20inclusive.\n\n\x0c\n\
+ \x05\x04\0\x02\0\x05\x12\x03d\x02\x07\n\x0c\n\x05\x04\0\x02\0\x01\x12\
+ \x03d\x08\x0f\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03d\x12\x13\n\xe4\x01\n\
+ \x04\x04\0\x02\x01\x12\x03j\x02\x12\x1a\xd6\x01\x20Non-negative\x20fract\
+ ions\x20of\x20a\x20second\x20at\x20nanosecond\x20resolution.\x20Negative\
+ \n\x20second\x20values\x20with\x20fractions\x20must\x20still\x20have\x20\
+ non-negative\x20nanos\x20values\n\x20that\x20count\x20forward\x20in\x20t\
+ ime.\x20Must\x20be\x20from\x200\x20to\x20999,999,999\n\x20inclusive.\n\n\
+ \x0c\n\x05\x04\0\x02\x01\x05\x12\x03j\x02\x07\n\x0c\n\x05\x04\0\x02\x01\
+ \x01\x12\x03j\x08\r\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03j\x10\x11b\x06p\
+ roto3\
+";
+
+static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+
+fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
+ ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
+}
+
+pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
+ unsafe {
+ file_descriptor_proto_lazy.get(|| {
+ parse_descriptor_proto()
+ })
+ }
+}
diff --git a/src/well_known_types/type_pb.rs b/src/well_known_types/type_pb.rs
new file mode 100644
index 0000000..23df582
--- /dev/null
+++ b/src/well_known_types/type_pb.rs
@@ -0,0 +1,2254 @@
+// This file is generated by rust-protobuf 2.14.0-pre. Do not edit
+// @generated
+
+// https://github.com/rust-lang/rust-clippy/issues/702
+#![allow(unknown_lints)]
+#![allow(clippy::all)]
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
+#![allow(box_pointers)]
+#![allow(dead_code)]
+#![allow(missing_docs)]
+#![allow(non_camel_case_types)]
+#![allow(non_snake_case)]
+#![allow(non_upper_case_globals)]
+#![allow(trivial_casts)]
+#![allow(unsafe_code)]
+#![allow(unused_imports)]
+#![allow(unused_results)]
+//! Generated file from `google/protobuf/type.proto`
+
+use protobuf::Message as Message_imported_for_functions;
+use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct Type {
+ // message fields
+ pub name: ::std::string::String,
+ pub fields: ::protobuf::RepeatedField<Field>,
+ pub oneofs: ::protobuf::RepeatedField<::std::string::String>,
+ pub options: ::protobuf::RepeatedField<Option>,
+ pub source_context: ::protobuf::SingularPtrField<::protobuf::well_known_types::SourceContext>,
+ pub syntax: Syntax,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a Type {
+ fn default() -> &'a Type {
+ <Type as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl Type {
+ pub fn new() -> Type {
+ ::std::default::Default::default()
+ }
+
+ // string name = 1;
+
+
+ pub fn get_name(&self) -> &str {
+ &self.name
+ }
+ pub fn clear_name(&mut self) {
+ self.name.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_name(&mut self, v: ::std::string::String) {
+ self.name = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_name(&mut self) -> &mut ::std::string::String {
+ &mut self.name
+ }
+
+ // Take field
+ pub fn take_name(&mut self) -> ::std::string::String {
+ ::std::mem::replace(&mut self.name, ::std::string::String::new())
+ }
+
+ // repeated .google.protobuf.Field fields = 2;
+
+
+ pub fn get_fields(&self) -> &[Field] {
+ &self.fields
+ }
+ pub fn clear_fields(&mut self) {
+ self.fields.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_fields(&mut self, v: ::protobuf::RepeatedField<Field>) {
+ self.fields = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_fields(&mut self) -> &mut ::protobuf::RepeatedField<Field> {
+ &mut self.fields
+ }
+
+ // Take field
+ pub fn take_fields(&mut self) -> ::protobuf::RepeatedField<Field> {
+ ::std::mem::replace(&mut self.fields, ::protobuf::RepeatedField::new())
+ }
+
+ // repeated string oneofs = 3;
+
+
+ pub fn get_oneofs(&self) -> &[::std::string::String] {
+ &self.oneofs
+ }
+ pub fn clear_oneofs(&mut self) {
+ self.oneofs.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_oneofs(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) {
+ self.oneofs = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_oneofs(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> {
+ &mut self.oneofs
+ }
+
+ // Take field
+ pub fn take_oneofs(&mut self) -> ::protobuf::RepeatedField<::std::string::String> {
+ ::std::mem::replace(&mut self.oneofs, ::protobuf::RepeatedField::new())
+ }
+
+ // repeated .google.protobuf.Option options = 4;
+
+
+ pub fn get_options(&self) -> &[Option] {
+ &self.options
+ }
+ pub fn clear_options(&mut self) {
+ self.options.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_options(&mut self, v: ::protobuf::RepeatedField<Option>) {
+ self.options = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_options(&mut self) -> &mut ::protobuf::RepeatedField<Option> {
+ &mut self.options
+ }
+
+ // Take field
+ pub fn take_options(&mut self) -> ::protobuf::RepeatedField<Option> {
+ ::std::mem::replace(&mut self.options, ::protobuf::RepeatedField::new())
+ }
+
+ // .google.protobuf.SourceContext source_context = 5;
+
+
+ pub fn get_source_context(&self) -> &::protobuf::well_known_types::SourceContext {
+ self.source_context.as_ref().unwrap_or_else(|| ::protobuf::well_known_types::SourceContext::default_instance())
+ }
+ pub fn clear_source_context(&mut self) {
+ self.source_context.clear();
+ }
+
+ pub fn has_source_context(&self) -> bool {
+ self.source_context.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_source_context(&mut self, v: ::protobuf::well_known_types::SourceContext) {
+ self.source_context = ::protobuf::SingularPtrField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_source_context(&mut self) -> &mut ::protobuf::well_known_types::SourceContext {
+ if self.source_context.is_none() {
+ self.source_context.set_default();
+ }
+ self.source_context.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_source_context(&mut self) -> ::protobuf::well_known_types::SourceContext {
+ self.source_context.take().unwrap_or_else(|| ::protobuf::well_known_types::SourceContext::new())
+ }
+
+ // .google.protobuf.Syntax syntax = 6;
+
+
+ pub fn get_syntax(&self) -> Syntax {
+ self.syntax
+ }
+ pub fn clear_syntax(&mut self) {
+ self.syntax = Syntax::SYNTAX_PROTO2;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_syntax(&mut self, v: Syntax) {
+ self.syntax = v;
+ }
+}
+
+impl ::protobuf::Message for Type {
+ fn is_initialized(&self) -> bool {
+ for v in &self.fields {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.options {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.source_context {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?;
+ },
+ 2 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.fields)?;
+ },
+ 3 => {
+ ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.oneofs)?;
+ },
+ 4 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.options)?;
+ },
+ 5 => {
+ ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.source_context)?;
+ },
+ 6 => {
+ ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.syntax, 6, &mut self.unknown_fields)?
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if !self.name.is_empty() {
+ my_size += ::protobuf::rt::string_size(1, &self.name);
+ }
+ for value in &self.fields {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ for value in &self.oneofs {
+ my_size += ::protobuf::rt::string_size(3, &value);
+ };
+ for value in &self.options {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ if let Some(ref v) = self.source_context.as_ref() {
+ let len = v.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ }
+ if self.syntax != Syntax::SYNTAX_PROTO2 {
+ my_size += ::protobuf::rt::enum_size(6, self.syntax);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if !self.name.is_empty() {
+ os.write_string(1, &self.name)?;
+ }
+ for v in &self.fields {
+ os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ for v in &self.oneofs {
+ os.write_string(3, &v)?;
+ };
+ for v in &self.options {
+ os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ if let Some(ref v) = self.source_context.as_ref() {
+ os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ }
+ if self.syntax != Syntax::SYNTAX_PROTO2 {
+ os.write_enum(6, self.syntax.value())?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> Type {
+ Type::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "name",
+ |m: &Type| { &m.name },
+ |m: &mut Type| { &mut m.name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<Field>>(
+ "fields",
+ |m: &Type| { &m.fields },
+ |m: &mut Type| { &mut m.fields },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "oneofs",
+ |m: &Type| { &m.oneofs },
+ |m: &mut Type| { &mut m.oneofs },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<Option>>(
+ "options",
+ |m: &Type| { &m.options },
+ |m: &mut Type| { &mut m.options },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<::protobuf::well_known_types::SourceContext>>(
+ "source_context",
+ |m: &Type| { &m.source_context },
+ |m: &mut Type| { &mut m.source_context },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum<Syntax>>(
+ "syntax",
+ |m: &Type| { &m.syntax },
+ |m: &mut Type| { &mut m.syntax },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<Type>(
+ "Type",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static Type {
+ static mut instance: ::protobuf::lazy::Lazy<Type> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(Type::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for Type {
+ fn clear(&mut self) {
+ self.name.clear();
+ self.fields.clear();
+ self.oneofs.clear();
+ self.options.clear();
+ self.source_context.clear();
+ self.syntax = Syntax::SYNTAX_PROTO2;
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for Type {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for Type {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct Field {
+ // message fields
+ pub kind: Field_Kind,
+ pub cardinality: Field_Cardinality,
+ pub number: i32,
+ pub name: ::std::string::String,
+ pub type_url: ::std::string::String,
+ pub oneof_index: i32,
+ pub packed: bool,
+ pub options: ::protobuf::RepeatedField<Option>,
+ pub json_name: ::std::string::String,
+ pub default_value: ::std::string::String,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a Field {
+ fn default() -> &'a Field {
+ <Field as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl Field {
+ pub fn new() -> Field {
+ ::std::default::Default::default()
+ }
+
+ // .google.protobuf.Field.Kind kind = 1;
+
+
+ pub fn get_kind(&self) -> Field_Kind {
+ self.kind
+ }
+ pub fn clear_kind(&mut self) {
+ self.kind = Field_Kind::TYPE_UNKNOWN;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_kind(&mut self, v: Field_Kind) {
+ self.kind = v;
+ }
+
+ // .google.protobuf.Field.Cardinality cardinality = 2;
+
+
+ pub fn get_cardinality(&self) -> Field_Cardinality {
+ self.cardinality
+ }
+ pub fn clear_cardinality(&mut self) {
+ self.cardinality = Field_Cardinality::CARDINALITY_UNKNOWN;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_cardinality(&mut self, v: Field_Cardinality) {
+ self.cardinality = v;
+ }
+
+ // int32 number = 3;
+
+
+ pub fn get_number(&self) -> i32 {
+ self.number
+ }
+ pub fn clear_number(&mut self) {
+ self.number = 0;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_number(&mut self, v: i32) {
+ self.number = v;
+ }
+
+ // string name = 4;
+
+
+ pub fn get_name(&self) -> &str {
+ &self.name
+ }
+ pub fn clear_name(&mut self) {
+ self.name.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_name(&mut self, v: ::std::string::String) {
+ self.name = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_name(&mut self) -> &mut ::std::string::String {
+ &mut self.name
+ }
+
+ // Take field
+ pub fn take_name(&mut self) -> ::std::string::String {
+ ::std::mem::replace(&mut self.name, ::std::string::String::new())
+ }
+
+ // string type_url = 6;
+
+
+ pub fn get_type_url(&self) -> &str {
+ &self.type_url
+ }
+ pub fn clear_type_url(&mut self) {
+ self.type_url.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_type_url(&mut self, v: ::std::string::String) {
+ self.type_url = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_type_url(&mut self) -> &mut ::std::string::String {
+ &mut self.type_url
+ }
+
+ // Take field
+ pub fn take_type_url(&mut self) -> ::std::string::String {
+ ::std::mem::replace(&mut self.type_url, ::std::string::String::new())
+ }
+
+ // int32 oneof_index = 7;
+
+
+ pub fn get_oneof_index(&self) -> i32 {
+ self.oneof_index
+ }
+ pub fn clear_oneof_index(&mut self) {
+ self.oneof_index = 0;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_oneof_index(&mut self, v: i32) {
+ self.oneof_index = v;
+ }
+
+ // bool packed = 8;
+
+
+ pub fn get_packed(&self) -> bool {
+ self.packed
+ }
+ pub fn clear_packed(&mut self) {
+ self.packed = false;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_packed(&mut self, v: bool) {
+ self.packed = v;
+ }
+
+ // repeated .google.protobuf.Option options = 9;
+
+
+ pub fn get_options(&self) -> &[Option] {
+ &self.options
+ }
+ pub fn clear_options(&mut self) {
+ self.options.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_options(&mut self, v: ::protobuf::RepeatedField<Option>) {
+ self.options = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_options(&mut self) -> &mut ::protobuf::RepeatedField<Option> {
+ &mut self.options
+ }
+
+ // Take field
+ pub fn take_options(&mut self) -> ::protobuf::RepeatedField<Option> {
+ ::std::mem::replace(&mut self.options, ::protobuf::RepeatedField::new())
+ }
+
+ // string json_name = 10;
+
+
+ pub fn get_json_name(&self) -> &str {
+ &self.json_name
+ }
+ pub fn clear_json_name(&mut self) {
+ self.json_name.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_json_name(&mut self, v: ::std::string::String) {
+ self.json_name = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_json_name(&mut self) -> &mut ::std::string::String {
+ &mut self.json_name
+ }
+
+ // Take field
+ pub fn take_json_name(&mut self) -> ::std::string::String {
+ ::std::mem::replace(&mut self.json_name, ::std::string::String::new())
+ }
+
+ // string default_value = 11;
+
+
+ pub fn get_default_value(&self) -> &str {
+ &self.default_value
+ }
+ pub fn clear_default_value(&mut self) {
+ self.default_value.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_default_value(&mut self, v: ::std::string::String) {
+ self.default_value = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_default_value(&mut self) -> &mut ::std::string::String {
+ &mut self.default_value
+ }
+
+ // Take field
+ pub fn take_default_value(&mut self) -> ::std::string::String {
+ ::std::mem::replace(&mut self.default_value, ::std::string::String::new())
+ }
+}
+
+impl ::protobuf::Message for Field {
+ fn is_initialized(&self) -> bool {
+ for v in &self.options {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.kind, 1, &mut self.unknown_fields)?
+ },
+ 2 => {
+ ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.cardinality, 2, &mut self.unknown_fields)?
+ },
+ 3 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_int32()?;
+ self.number = tmp;
+ },
+ 4 => {
+ ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?;
+ },
+ 6 => {
+ ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.type_url)?;
+ },
+ 7 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_int32()?;
+ self.oneof_index = tmp;
+ },
+ 8 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.packed = tmp;
+ },
+ 9 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.options)?;
+ },
+ 10 => {
+ ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.json_name)?;
+ },
+ 11 => {
+ ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.default_value)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if self.kind != Field_Kind::TYPE_UNKNOWN {
+ my_size += ::protobuf::rt::enum_size(1, self.kind);
+ }
+ if self.cardinality != Field_Cardinality::CARDINALITY_UNKNOWN {
+ my_size += ::protobuf::rt::enum_size(2, self.cardinality);
+ }
+ if self.number != 0 {
+ my_size += ::protobuf::rt::value_size(3, self.number, ::protobuf::wire_format::WireTypeVarint);
+ }
+ if !self.name.is_empty() {
+ my_size += ::protobuf::rt::string_size(4, &self.name);
+ }
+ if !self.type_url.is_empty() {
+ my_size += ::protobuf::rt::string_size(6, &self.type_url);
+ }
+ if self.oneof_index != 0 {
+ my_size += ::protobuf::rt::value_size(7, self.oneof_index, ::protobuf::wire_format::WireTypeVarint);
+ }
+ if self.packed != false {
+ my_size += 2;
+ }
+ for value in &self.options {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ if !self.json_name.is_empty() {
+ my_size += ::protobuf::rt::string_size(10, &self.json_name);
+ }
+ if !self.default_value.is_empty() {
+ my_size += ::protobuf::rt::string_size(11, &self.default_value);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if self.kind != Field_Kind::TYPE_UNKNOWN {
+ os.write_enum(1, self.kind.value())?;
+ }
+ if self.cardinality != Field_Cardinality::CARDINALITY_UNKNOWN {
+ os.write_enum(2, self.cardinality.value())?;
+ }
+ if self.number != 0 {
+ os.write_int32(3, self.number)?;
+ }
+ if !self.name.is_empty() {
+ os.write_string(4, &self.name)?;
+ }
+ if !self.type_url.is_empty() {
+ os.write_string(6, &self.type_url)?;
+ }
+ if self.oneof_index != 0 {
+ os.write_int32(7, self.oneof_index)?;
+ }
+ if self.packed != false {
+ os.write_bool(8, self.packed)?;
+ }
+ for v in &self.options {
+ os.write_tag(9, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ if !self.json_name.is_empty() {
+ os.write_string(10, &self.json_name)?;
+ }
+ if !self.default_value.is_empty() {
+ os.write_string(11, &self.default_value)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> Field {
+ Field::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum<Field_Kind>>(
+ "kind",
+ |m: &Field| { &m.kind },
+ |m: &mut Field| { &mut m.kind },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum<Field_Cardinality>>(
+ "cardinality",
+ |m: &Field| { &m.cardinality },
+ |m: &mut Field| { &mut m.cardinality },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "number",
+ |m: &Field| { &m.number },
+ |m: &mut Field| { &mut m.number },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "name",
+ |m: &Field| { &m.name },
+ |m: &mut Field| { &mut m.name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "type_url",
+ |m: &Field| { &m.type_url },
+ |m: &mut Field| { &mut m.type_url },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "oneof_index",
+ |m: &Field| { &m.oneof_index },
+ |m: &mut Field| { &mut m.oneof_index },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "packed",
+ |m: &Field| { &m.packed },
+ |m: &mut Field| { &mut m.packed },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<Option>>(
+ "options",
+ |m: &Field| { &m.options },
+ |m: &mut Field| { &mut m.options },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "json_name",
+ |m: &Field| { &m.json_name },
+ |m: &mut Field| { &mut m.json_name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "default_value",
+ |m: &Field| { &m.default_value },
+ |m: &mut Field| { &mut m.default_value },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<Field>(
+ "Field",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static Field {
+ static mut instance: ::protobuf::lazy::Lazy<Field> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(Field::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for Field {
+ fn clear(&mut self) {
+ self.kind = Field_Kind::TYPE_UNKNOWN;
+ self.cardinality = Field_Cardinality::CARDINALITY_UNKNOWN;
+ self.number = 0;
+ self.name.clear();
+ self.type_url.clear();
+ self.oneof_index = 0;
+ self.packed = false;
+ self.options.clear();
+ self.json_name.clear();
+ self.default_value.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for Field {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for Field {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(Clone,PartialEq,Eq,Debug,Hash)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub enum Field_Kind {
+ TYPE_UNKNOWN = 0,
+ TYPE_DOUBLE = 1,
+ TYPE_FLOAT = 2,
+ TYPE_INT64 = 3,
+ TYPE_UINT64 = 4,
+ TYPE_INT32 = 5,
+ TYPE_FIXED64 = 6,
+ TYPE_FIXED32 = 7,
+ TYPE_BOOL = 8,
+ TYPE_STRING = 9,
+ TYPE_GROUP = 10,
+ TYPE_MESSAGE = 11,
+ TYPE_BYTES = 12,
+ TYPE_UINT32 = 13,
+ TYPE_ENUM = 14,
+ TYPE_SFIXED32 = 15,
+ TYPE_SFIXED64 = 16,
+ TYPE_SINT32 = 17,
+ TYPE_SINT64 = 18,
+}
+
+impl ::protobuf::ProtobufEnum for Field_Kind {
+ fn value(&self) -> i32 {
+ *self as i32
+ }
+
+ fn from_i32(value: i32) -> ::std::option::Option<Field_Kind> {
+ match value {
+ 0 => ::std::option::Option::Some(Field_Kind::TYPE_UNKNOWN),
+ 1 => ::std::option::Option::Some(Field_Kind::TYPE_DOUBLE),
+ 2 => ::std::option::Option::Some(Field_Kind::TYPE_FLOAT),
+ 3 => ::std::option::Option::Some(Field_Kind::TYPE_INT64),
+ 4 => ::std::option::Option::Some(Field_Kind::TYPE_UINT64),
+ 5 => ::std::option::Option::Some(Field_Kind::TYPE_INT32),
+ 6 => ::std::option::Option::Some(Field_Kind::TYPE_FIXED64),
+ 7 => ::std::option::Option::Some(Field_Kind::TYPE_FIXED32),
+ 8 => ::std::option::Option::Some(Field_Kind::TYPE_BOOL),
+ 9 => ::std::option::Option::Some(Field_Kind::TYPE_STRING),
+ 10 => ::std::option::Option::Some(Field_Kind::TYPE_GROUP),
+ 11 => ::std::option::Option::Some(Field_Kind::TYPE_MESSAGE),
+ 12 => ::std::option::Option::Some(Field_Kind::TYPE_BYTES),
+ 13 => ::std::option::Option::Some(Field_Kind::TYPE_UINT32),
+ 14 => ::std::option::Option::Some(Field_Kind::TYPE_ENUM),
+ 15 => ::std::option::Option::Some(Field_Kind::TYPE_SFIXED32),
+ 16 => ::std::option::Option::Some(Field_Kind::TYPE_SFIXED64),
+ 17 => ::std::option::Option::Some(Field_Kind::TYPE_SINT32),
+ 18 => ::std::option::Option::Some(Field_Kind::TYPE_SINT64),
+ _ => ::std::option::Option::None
+ }
+ }
+
+ fn values() -> &'static [Self] {
+ static values: &'static [Field_Kind] = &[
+ Field_Kind::TYPE_UNKNOWN,
+ Field_Kind::TYPE_DOUBLE,
+ Field_Kind::TYPE_FLOAT,
+ Field_Kind::TYPE_INT64,
+ Field_Kind::TYPE_UINT64,
+ Field_Kind::TYPE_INT32,
+ Field_Kind::TYPE_FIXED64,
+ Field_Kind::TYPE_FIXED32,
+ Field_Kind::TYPE_BOOL,
+ Field_Kind::TYPE_STRING,
+ Field_Kind::TYPE_GROUP,
+ Field_Kind::TYPE_MESSAGE,
+ Field_Kind::TYPE_BYTES,
+ Field_Kind::TYPE_UINT32,
+ Field_Kind::TYPE_ENUM,
+ Field_Kind::TYPE_SFIXED32,
+ Field_Kind::TYPE_SFIXED64,
+ Field_Kind::TYPE_SINT32,
+ Field_Kind::TYPE_SINT64,
+ ];
+ values
+ }
+
+ fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ ::protobuf::reflect::EnumDescriptor::new_pb_name::<Field_Kind>("Field.Kind", file_descriptor_proto())
+ })
+ }
+ }
+}
+
+impl ::std::marker::Copy for Field_Kind {
+}
+
+impl ::std::default::Default for Field_Kind {
+ fn default() -> Self {
+ Field_Kind::TYPE_UNKNOWN
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for Field_Kind {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Enum(self.descriptor())
+ }
+}
+
+#[derive(Clone,PartialEq,Eq,Debug,Hash)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub enum Field_Cardinality {
+ CARDINALITY_UNKNOWN = 0,
+ CARDINALITY_OPTIONAL = 1,
+ CARDINALITY_REQUIRED = 2,
+ CARDINALITY_REPEATED = 3,
+}
+
+impl ::protobuf::ProtobufEnum for Field_Cardinality {
+ fn value(&self) -> i32 {
+ *self as i32
+ }
+
+ fn from_i32(value: i32) -> ::std::option::Option<Field_Cardinality> {
+ match value {
+ 0 => ::std::option::Option::Some(Field_Cardinality::CARDINALITY_UNKNOWN),
+ 1 => ::std::option::Option::Some(Field_Cardinality::CARDINALITY_OPTIONAL),
+ 2 => ::std::option::Option::Some(Field_Cardinality::CARDINALITY_REQUIRED),
+ 3 => ::std::option::Option::Some(Field_Cardinality::CARDINALITY_REPEATED),
+ _ => ::std::option::Option::None
+ }
+ }
+
+ fn values() -> &'static [Self] {
+ static values: &'static [Field_Cardinality] = &[
+ Field_Cardinality::CARDINALITY_UNKNOWN,
+ Field_Cardinality::CARDINALITY_OPTIONAL,
+ Field_Cardinality::CARDINALITY_REQUIRED,
+ Field_Cardinality::CARDINALITY_REPEATED,
+ ];
+ values
+ }
+
+ fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ ::protobuf::reflect::EnumDescriptor::new_pb_name::<Field_Cardinality>("Field.Cardinality", file_descriptor_proto())
+ })
+ }
+ }
+}
+
+impl ::std::marker::Copy for Field_Cardinality {
+}
+
+impl ::std::default::Default for Field_Cardinality {
+ fn default() -> Self {
+ Field_Cardinality::CARDINALITY_UNKNOWN
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for Field_Cardinality {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Enum(self.descriptor())
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct Enum {
+ // message fields
+ pub name: ::std::string::String,
+ pub enumvalue: ::protobuf::RepeatedField<EnumValue>,
+ pub options: ::protobuf::RepeatedField<Option>,
+ pub source_context: ::protobuf::SingularPtrField<::protobuf::well_known_types::SourceContext>,
+ pub syntax: Syntax,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a Enum {
+ fn default() -> &'a Enum {
+ <Enum as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl Enum {
+ pub fn new() -> Enum {
+ ::std::default::Default::default()
+ }
+
+ // string name = 1;
+
+
+ pub fn get_name(&self) -> &str {
+ &self.name
+ }
+ pub fn clear_name(&mut self) {
+ self.name.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_name(&mut self, v: ::std::string::String) {
+ self.name = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_name(&mut self) -> &mut ::std::string::String {
+ &mut self.name
+ }
+
+ // Take field
+ pub fn take_name(&mut self) -> ::std::string::String {
+ ::std::mem::replace(&mut self.name, ::std::string::String::new())
+ }
+
+ // repeated .google.protobuf.EnumValue enumvalue = 2;
+
+
+ pub fn get_enumvalue(&self) -> &[EnumValue] {
+ &self.enumvalue
+ }
+ pub fn clear_enumvalue(&mut self) {
+ self.enumvalue.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_enumvalue(&mut self, v: ::protobuf::RepeatedField<EnumValue>) {
+ self.enumvalue = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_enumvalue(&mut self) -> &mut ::protobuf::RepeatedField<EnumValue> {
+ &mut self.enumvalue
+ }
+
+ // Take field
+ pub fn take_enumvalue(&mut self) -> ::protobuf::RepeatedField<EnumValue> {
+ ::std::mem::replace(&mut self.enumvalue, ::protobuf::RepeatedField::new())
+ }
+
+ // repeated .google.protobuf.Option options = 3;
+
+
+ pub fn get_options(&self) -> &[Option] {
+ &self.options
+ }
+ pub fn clear_options(&mut self) {
+ self.options.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_options(&mut self, v: ::protobuf::RepeatedField<Option>) {
+ self.options = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_options(&mut self) -> &mut ::protobuf::RepeatedField<Option> {
+ &mut self.options
+ }
+
+ // Take field
+ pub fn take_options(&mut self) -> ::protobuf::RepeatedField<Option> {
+ ::std::mem::replace(&mut self.options, ::protobuf::RepeatedField::new())
+ }
+
+ // .google.protobuf.SourceContext source_context = 4;
+
+
+ pub fn get_source_context(&self) -> &::protobuf::well_known_types::SourceContext {
+ self.source_context.as_ref().unwrap_or_else(|| ::protobuf::well_known_types::SourceContext::default_instance())
+ }
+ pub fn clear_source_context(&mut self) {
+ self.source_context.clear();
+ }
+
+ pub fn has_source_context(&self) -> bool {
+ self.source_context.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_source_context(&mut self, v: ::protobuf::well_known_types::SourceContext) {
+ self.source_context = ::protobuf::SingularPtrField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_source_context(&mut self) -> &mut ::protobuf::well_known_types::SourceContext {
+ if self.source_context.is_none() {
+ self.source_context.set_default();
+ }
+ self.source_context.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_source_context(&mut self) -> ::protobuf::well_known_types::SourceContext {
+ self.source_context.take().unwrap_or_else(|| ::protobuf::well_known_types::SourceContext::new())
+ }
+
+ // .google.protobuf.Syntax syntax = 5;
+
+
+ pub fn get_syntax(&self) -> Syntax {
+ self.syntax
+ }
+ pub fn clear_syntax(&mut self) {
+ self.syntax = Syntax::SYNTAX_PROTO2;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_syntax(&mut self, v: Syntax) {
+ self.syntax = v;
+ }
+}
+
+impl ::protobuf::Message for Enum {
+ fn is_initialized(&self) -> bool {
+ for v in &self.enumvalue {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.options {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ for v in &self.source_context {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?;
+ },
+ 2 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.enumvalue)?;
+ },
+ 3 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.options)?;
+ },
+ 4 => {
+ ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.source_context)?;
+ },
+ 5 => {
+ ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.syntax, 5, &mut self.unknown_fields)?
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if !self.name.is_empty() {
+ my_size += ::protobuf::rt::string_size(1, &self.name);
+ }
+ for value in &self.enumvalue {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ for value in &self.options {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ if let Some(ref v) = self.source_context.as_ref() {
+ let len = v.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ }
+ if self.syntax != Syntax::SYNTAX_PROTO2 {
+ my_size += ::protobuf::rt::enum_size(5, self.syntax);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if !self.name.is_empty() {
+ os.write_string(1, &self.name)?;
+ }
+ for v in &self.enumvalue {
+ os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ for v in &self.options {
+ os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ if let Some(ref v) = self.source_context.as_ref() {
+ os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ }
+ if self.syntax != Syntax::SYNTAX_PROTO2 {
+ os.write_enum(5, self.syntax.value())?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> Enum {
+ Enum::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "name",
+ |m: &Enum| { &m.name },
+ |m: &mut Enum| { &mut m.name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<EnumValue>>(
+ "enumvalue",
+ |m: &Enum| { &m.enumvalue },
+ |m: &mut Enum| { &mut m.enumvalue },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<Option>>(
+ "options",
+ |m: &Enum| { &m.options },
+ |m: &mut Enum| { &mut m.options },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<::protobuf::well_known_types::SourceContext>>(
+ "source_context",
+ |m: &Enum| { &m.source_context },
+ |m: &mut Enum| { &mut m.source_context },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum<Syntax>>(
+ "syntax",
+ |m: &Enum| { &m.syntax },
+ |m: &mut Enum| { &mut m.syntax },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<Enum>(
+ "Enum",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static Enum {
+ static mut instance: ::protobuf::lazy::Lazy<Enum> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(Enum::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for Enum {
+ fn clear(&mut self) {
+ self.name.clear();
+ self.enumvalue.clear();
+ self.options.clear();
+ self.source_context.clear();
+ self.syntax = Syntax::SYNTAX_PROTO2;
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for Enum {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for Enum {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct EnumValue {
+ // message fields
+ pub name: ::std::string::String,
+ pub number: i32,
+ pub options: ::protobuf::RepeatedField<Option>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a EnumValue {
+ fn default() -> &'a EnumValue {
+ <EnumValue as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl EnumValue {
+ pub fn new() -> EnumValue {
+ ::std::default::Default::default()
+ }
+
+ // string name = 1;
+
+
+ pub fn get_name(&self) -> &str {
+ &self.name
+ }
+ pub fn clear_name(&mut self) {
+ self.name.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_name(&mut self, v: ::std::string::String) {
+ self.name = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_name(&mut self) -> &mut ::std::string::String {
+ &mut self.name
+ }
+
+ // Take field
+ pub fn take_name(&mut self) -> ::std::string::String {
+ ::std::mem::replace(&mut self.name, ::std::string::String::new())
+ }
+
+ // int32 number = 2;
+
+
+ pub fn get_number(&self) -> i32 {
+ self.number
+ }
+ pub fn clear_number(&mut self) {
+ self.number = 0;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_number(&mut self, v: i32) {
+ self.number = v;
+ }
+
+ // repeated .google.protobuf.Option options = 3;
+
+
+ pub fn get_options(&self) -> &[Option] {
+ &self.options
+ }
+ pub fn clear_options(&mut self) {
+ self.options.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_options(&mut self, v: ::protobuf::RepeatedField<Option>) {
+ self.options = v;
+ }
+
+ // Mutable pointer to the field.
+ pub fn mut_options(&mut self) -> &mut ::protobuf::RepeatedField<Option> {
+ &mut self.options
+ }
+
+ // Take field
+ pub fn take_options(&mut self) -> ::protobuf::RepeatedField<Option> {
+ ::std::mem::replace(&mut self.options, ::protobuf::RepeatedField::new())
+ }
+}
+
+impl ::protobuf::Message for EnumValue {
+ fn is_initialized(&self) -> bool {
+ for v in &self.options {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?;
+ },
+ 2 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_int32()?;
+ self.number = tmp;
+ },
+ 3 => {
+ ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.options)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if !self.name.is_empty() {
+ my_size += ::protobuf::rt::string_size(1, &self.name);
+ }
+ if self.number != 0 {
+ my_size += ::protobuf::rt::value_size(2, self.number, ::protobuf::wire_format::WireTypeVarint);
+ }
+ for value in &self.options {
+ let len = value.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ };
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if !self.name.is_empty() {
+ os.write_string(1, &self.name)?;
+ }
+ if self.number != 0 {
+ os.write_int32(2, self.number)?;
+ }
+ for v in &self.options {
+ os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ };
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> EnumValue {
+ EnumValue::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "name",
+ |m: &EnumValue| { &m.name },
+ |m: &mut EnumValue| { &mut m.name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "number",
+ |m: &EnumValue| { &m.number },
+ |m: &mut EnumValue| { &mut m.number },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<Option>>(
+ "options",
+ |m: &EnumValue| { &m.options },
+ |m: &mut EnumValue| { &mut m.options },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<EnumValue>(
+ "EnumValue",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static EnumValue {
+ static mut instance: ::protobuf::lazy::Lazy<EnumValue> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(EnumValue::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for EnumValue {
+ fn clear(&mut self) {
+ self.name.clear();
+ self.number = 0;
+ self.options.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for EnumValue {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for EnumValue {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct Option {
+ // message fields
+ pub name: ::std::string::String,
+ pub value: ::protobuf::SingularPtrField<::protobuf::well_known_types::Any>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a Option {
+ fn default() -> &'a Option {
+ <Option as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl Option {
+ pub fn new() -> Option {
+ ::std::default::Default::default()
+ }
+
+ // string name = 1;
+
+
+ pub fn get_name(&self) -> &str {
+ &self.name
+ }
+ pub fn clear_name(&mut self) {
+ self.name.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_name(&mut self, v: ::std::string::String) {
+ self.name = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_name(&mut self) -> &mut ::std::string::String {
+ &mut self.name
+ }
+
+ // Take field
+ pub fn take_name(&mut self) -> ::std::string::String {
+ ::std::mem::replace(&mut self.name, ::std::string::String::new())
+ }
+
+ // .google.protobuf.Any value = 2;
+
+
+ pub fn get_value(&self) -> &::protobuf::well_known_types::Any {
+ self.value.as_ref().unwrap_or_else(|| ::protobuf::well_known_types::Any::default_instance())
+ }
+ pub fn clear_value(&mut self) {
+ self.value.clear();
+ }
+
+ pub fn has_value(&self) -> bool {
+ self.value.is_some()
+ }
+
+ // Param is passed by value, moved
+ pub fn set_value(&mut self, v: ::protobuf::well_known_types::Any) {
+ self.value = ::protobuf::SingularPtrField::some(v);
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_value(&mut self) -> &mut ::protobuf::well_known_types::Any {
+ if self.value.is_none() {
+ self.value.set_default();
+ }
+ self.value.as_mut().unwrap()
+ }
+
+ // Take field
+ pub fn take_value(&mut self) -> ::protobuf::well_known_types::Any {
+ self.value.take().unwrap_or_else(|| ::protobuf::well_known_types::Any::new())
+ }
+}
+
+impl ::protobuf::Message for Option {
+ fn is_initialized(&self) -> bool {
+ for v in &self.value {
+ if !v.is_initialized() {
+ return false;
+ }
+ };
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?;
+ },
+ 2 => {
+ ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.value)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if !self.name.is_empty() {
+ my_size += ::protobuf::rt::string_size(1, &self.name);
+ }
+ if let Some(ref v) = self.value.as_ref() {
+ let len = v.compute_size();
+ my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if !self.name.is_empty() {
+ os.write_string(1, &self.name)?;
+ }
+ if let Some(ref v) = self.value.as_ref() {
+ os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+ os.write_raw_varint32(v.get_cached_size())?;
+ v.write_to_with_cached_sizes(os)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> Option {
+ Option::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "name",
+ |m: &Option| { &m.name },
+ |m: &mut Option| { &mut m.name },
+ ));
+ fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<::protobuf::well_known_types::Any>>(
+ "value",
+ |m: &Option| { &m.value },
+ |m: &mut Option| { &mut m.value },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<Option>(
+ "Option",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static Option {
+ static mut instance: ::protobuf::lazy::Lazy<Option> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(Option::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for Option {
+ fn clear(&mut self) {
+ self.name.clear();
+ self.value.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for Option {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for Option {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(Clone,PartialEq,Eq,Debug,Hash)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub enum Syntax {
+ SYNTAX_PROTO2 = 0,
+ SYNTAX_PROTO3 = 1,
+}
+
+impl ::protobuf::ProtobufEnum for Syntax {
+ fn value(&self) -> i32 {
+ *self as i32
+ }
+
+ fn from_i32(value: i32) -> ::std::option::Option<Syntax> {
+ match value {
+ 0 => ::std::option::Option::Some(Syntax::SYNTAX_PROTO2),
+ 1 => ::std::option::Option::Some(Syntax::SYNTAX_PROTO3),
+ _ => ::std::option::Option::None
+ }
+ }
+
+ fn values() -> &'static [Self] {
+ static values: &'static [Syntax] = &[
+ Syntax::SYNTAX_PROTO2,
+ Syntax::SYNTAX_PROTO3,
+ ];
+ values
+ }
+
+ fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ ::protobuf::reflect::EnumDescriptor::new_pb_name::<Syntax>("Syntax", file_descriptor_proto())
+ })
+ }
+ }
+}
+
+impl ::std::marker::Copy for Syntax {
+}
+
+impl ::std::default::Default for Syntax {
+ fn default() -> Self {
+ Syntax::SYNTAX_PROTO2
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for Syntax {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Enum(self.descriptor())
+ }
+}
+
+static file_descriptor_proto_data: &'static [u8] = b"\
+ \n\x1agoogle/protobuf/type.proto\x12\x0fgoogle.protobuf\x1a\x19google/pr\
+ otobuf/any.proto\x1a$google/protobuf/source_context.proto\"\x8d\x02\n\
+ \x04Type\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x12.\n\x06fields\
+ \x18\x02\x20\x03(\x0b2\x16.google.protobuf.FieldR\x06fields\x12\x16\n\
+ \x06oneofs\x18\x03\x20\x03(\tR\x06oneofs\x121\n\x07options\x18\x04\x20\
+ \x03(\x0b2\x17.google.protobuf.OptionR\x07options\x12E\n\x0esource_conte\
+ xt\x18\x05\x20\x01(\x0b2\x1e.google.protobuf.SourceContextR\rsourceConte\
+ xt\x12/\n\x06syntax\x18\x06\x20\x01(\x0e2\x17.google.protobuf.SyntaxR\
+ \x06syntax\"\xb4\x06\n\x05Field\x12/\n\x04kind\x18\x01\x20\x01(\x0e2\x1b\
+ .google.protobuf.Field.KindR\x04kind\x12D\n\x0bcardinality\x18\x02\x20\
+ \x01(\x0e2\".google.protobuf.Field.CardinalityR\x0bcardinality\x12\x16\n\
+ \x06number\x18\x03\x20\x01(\x05R\x06number\x12\x12\n\x04name\x18\x04\x20\
+ \x01(\tR\x04name\x12\x19\n\x08type_url\x18\x06\x20\x01(\tR\x07typeUrl\
+ \x12\x1f\n\x0boneof_index\x18\x07\x20\x01(\x05R\noneofIndex\x12\x16\n\
+ \x06packed\x18\x08\x20\x01(\x08R\x06packed\x121\n\x07options\x18\t\x20\
+ \x03(\x0b2\x17.google.protobuf.OptionR\x07options\x12\x1b\n\tjson_name\
+ \x18\n\x20\x01(\tR\x08jsonName\x12#\n\rdefault_value\x18\x0b\x20\x01(\tR\
+ \x0cdefaultValue\"\xc8\x02\n\x04Kind\x12\x10\n\x0cTYPE_UNKNOWN\x10\0\x12\
+ \x0f\n\x0bTYPE_DOUBLE\x10\x01\x12\x0e\n\nTYPE_FLOAT\x10\x02\x12\x0e\n\nT\
+ YPE_INT64\x10\x03\x12\x0f\n\x0bTYPE_UINT64\x10\x04\x12\x0e\n\nTYPE_INT32\
+ \x10\x05\x12\x10\n\x0cTYPE_FIXED64\x10\x06\x12\x10\n\x0cTYPE_FIXED32\x10\
+ \x07\x12\r\n\tTYPE_BOOL\x10\x08\x12\x0f\n\x0bTYPE_STRING\x10\t\x12\x0e\n\
+ \nTYPE_GROUP\x10\n\x12\x10\n\x0cTYPE_MESSAGE\x10\x0b\x12\x0e\n\nTYPE_BYT\
+ ES\x10\x0c\x12\x0f\n\x0bTYPE_UINT32\x10\r\x12\r\n\tTYPE_ENUM\x10\x0e\x12\
+ \x11\n\rTYPE_SFIXED32\x10\x0f\x12\x11\n\rTYPE_SFIXED64\x10\x10\x12\x0f\n\
+ \x0bTYPE_SINT32\x10\x11\x12\x0f\n\x0bTYPE_SINT64\x10\x12\"t\n\x0bCardina\
+ lity\x12\x17\n\x13CARDINALITY_UNKNOWN\x10\0\x12\x18\n\x14CARDINALITY_OPT\
+ IONAL\x10\x01\x12\x18\n\x14CARDINALITY_REQUIRED\x10\x02\x12\x18\n\x14CAR\
+ DINALITY_REPEATED\x10\x03\"\xff\x01\n\x04Enum\x12\x12\n\x04name\x18\x01\
+ \x20\x01(\tR\x04name\x128\n\tenumvalue\x18\x02\x20\x03(\x0b2\x1a.google.\
+ protobuf.EnumValueR\tenumvalue\x121\n\x07options\x18\x03\x20\x03(\x0b2\
+ \x17.google.protobuf.OptionR\x07options\x12E\n\x0esource_context\x18\x04\
+ \x20\x01(\x0b2\x1e.google.protobuf.SourceContextR\rsourceContext\x12/\n\
+ \x06syntax\x18\x05\x20\x01(\x0e2\x17.google.protobuf.SyntaxR\x06syntax\"\
+ j\n\tEnumValue\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x12\x16\n\
+ \x06number\x18\x02\x20\x01(\x05R\x06number\x121\n\x07options\x18\x03\x20\
+ \x03(\x0b2\x17.google.protobuf.OptionR\x07options\"H\n\x06Option\x12\x12\
+ \n\x04name\x18\x01\x20\x01(\tR\x04name\x12*\n\x05value\x18\x02\x20\x01(\
+ \x0b2\x14.google.protobuf.AnyR\x05value*.\n\x06Syntax\x12\x11\n\rSYNTAX_\
+ PROTO2\x10\0\x12\x11\n\rSYNTAX_PROTO3\x10\x01BL\n\x13com.google.protobuf\
+ B\tTypeProtoP\x01\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.\
+ WellKnownTypesJ\x9a5\n\x07\x12\x05\x1e\0\xb3\x01\x01\n\xcc\x0c\n\x01\x0c\
+ \x12\x03\x1e\0\x122\xc1\x0c\x20Protocol\x20Buffers\x20-\x20Google's\x20d\
+ ata\x20interchange\x20format\n\x20Copyright\x202008\x20Google\x20Inc.\
+ \x20\x20All\x20rights\x20reserved.\n\x20https://developers.google.com/pr\
+ otocol-buffers/\n\n\x20Redistribution\x20and\x20use\x20in\x20source\x20a\
+ nd\x20binary\x20forms,\x20with\x20or\x20without\n\x20modification,\x20ar\
+ e\x20permitted\x20provided\x20that\x20the\x20following\x20conditions\x20\
+ are\n\x20met:\n\n\x20\x20\x20\x20\x20*\x20Redistributions\x20of\x20sourc\
+ e\x20code\x20must\x20retain\x20the\x20above\x20copyright\n\x20notice,\
+ \x20this\x20list\x20of\x20conditions\x20and\x20the\x20following\x20discl\
+ aimer.\n\x20\x20\x20\x20\x20*\x20Redistributions\x20in\x20binary\x20form\
+ \x20must\x20reproduce\x20the\x20above\n\x20copyright\x20notice,\x20this\
+ \x20list\x20of\x20conditions\x20and\x20the\x20following\x20disclaimer\n\
+ \x20in\x20the\x20documentation\x20and/or\x20other\x20materials\x20provid\
+ ed\x20with\x20the\n\x20distribution.\n\x20\x20\x20\x20\x20*\x20Neither\
+ \x20the\x20name\x20of\x20Google\x20Inc.\x20nor\x20the\x20names\x20of\x20\
+ its\n\x20contributors\x20may\x20be\x20used\x20to\x20endorse\x20or\x20pro\
+ mote\x20products\x20derived\x20from\n\x20this\x20software\x20without\x20\
+ specific\x20prior\x20written\x20permission.\n\n\x20THIS\x20SOFTWARE\x20I\
+ S\x20PROVIDED\x20BY\x20THE\x20COPYRIGHT\x20HOLDERS\x20AND\x20CONTRIBUTOR\
+ S\n\x20\"AS\x20IS\"\x20AND\x20ANY\x20EXPRESS\x20OR\x20IMPLIED\x20WARRANT\
+ IES,\x20INCLUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\x20THE\x20IMPLIED\
+ \x20WARRANTIES\x20OF\x20MERCHANTABILITY\x20AND\x20FITNESS\x20FOR\n\x20A\
+ \x20PARTICULAR\x20PURPOSE\x20ARE\x20DISCLAIMED.\x20IN\x20NO\x20EVENT\x20\
+ SHALL\x20THE\x20COPYRIGHT\n\x20OWNER\x20OR\x20CONTRIBUTORS\x20BE\x20LIAB\
+ LE\x20FOR\x20ANY\x20DIRECT,\x20INDIRECT,\x20INCIDENTAL,\n\x20SPECIAL,\
+ \x20EXEMPLARY,\x20OR\x20CONSEQUENTIAL\x20DAMAGES\x20(INCLUDING,\x20BUT\
+ \x20NOT\n\x20LIMITED\x20TO,\x20PROCUREMENT\x20OF\x20SUBSTITUTE\x20GOODS\
+ \x20OR\x20SERVICES;\x20LOSS\x20OF\x20USE,\n\x20DATA,\x20OR\x20PROFITS;\
+ \x20OR\x20BUSINESS\x20INTERRUPTION)\x20HOWEVER\x20CAUSED\x20AND\x20ON\
+ \x20ANY\n\x20THEORY\x20OF\x20LIABILITY,\x20WHETHER\x20IN\x20CONTRACT,\
+ \x20STRICT\x20LIABILITY,\x20OR\x20TORT\n\x20(INCLUDING\x20NEGLIGENCE\x20\
+ OR\x20OTHERWISE)\x20ARISING\x20IN\x20ANY\x20WAY\x20OUT\x20OF\x20THE\x20U\
+ SE\n\x20OF\x20THIS\x20SOFTWARE,\x20EVEN\x20IF\x20ADVISED\x20OF\x20THE\
+ \x20POSSIBILITY\x20OF\x20SUCH\x20DAMAGE.\n\n\x08\n\x01\x02\x12\x03\x20\0\
+ \x18\n\t\n\x02\x03\0\x12\x03\"\0#\n\t\n\x02\x03\x01\x12\x03#\0.\n\x08\n\
+ \x01\x08\x12\x03%\0;\n\t\n\x02\x08%\x12\x03%\0;\n\x08\n\x01\x08\x12\x03&\
+ \0\x1f\n\t\n\x02\x08\x1f\x12\x03&\0\x1f\n\x08\n\x01\x08\x12\x03'\0,\n\t\
+ \n\x02\x08\x01\x12\x03'\0,\n\x08\n\x01\x08\x12\x03(\0*\n\t\n\x02\x08\x08\
+ \x12\x03(\0*\n\x08\n\x01\x08\x12\x03)\0\"\n\t\n\x02\x08\n\x12\x03)\0\"\n\
+ \x08\n\x01\x08\x12\x03*\0!\n\t\n\x02\x08$\x12\x03*\0!\n-\n\x02\x04\0\x12\
+ \x04-\0:\x01\x1a!\x20A\x20protocol\x20buffer\x20message\x20type.\n\n\n\n\
+ \x03\x04\0\x01\x12\x03-\x08\x0c\n0\n\x04\x04\0\x02\0\x12\x03/\x02\x12\
+ \x1a#\x20The\x20fully\x20qualified\x20message\x20name.\n\n\x0c\n\x05\x04\
+ \0\x02\0\x05\x12\x03/\x02\x08\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03/\t\r\n\
+ \x0c\n\x05\x04\0\x02\0\x03\x12\x03/\x10\x11\n\"\n\x04\x04\0\x02\x01\x12\
+ \x031\x02\x1c\x1a\x15\x20The\x20list\x20of\x20fields.\n\n\x0c\n\x05\x04\
+ \0\x02\x01\x04\x12\x031\x02\n\n\x0c\n\x05\x04\0\x02\x01\x06\x12\x031\x0b\
+ \x10\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x031\x11\x17\n\x0c\n\x05\x04\0\
+ \x02\x01\x03\x12\x031\x1a\x1b\nO\n\x04\x04\0\x02\x02\x12\x033\x02\x1d\
+ \x1aB\x20The\x20list\x20of\x20types\x20appearing\x20in\x20`oneof`\x20def\
+ initions\x20in\x20this\x20type.\n\n\x0c\n\x05\x04\0\x02\x02\x04\x12\x033\
+ \x02\n\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x033\x0b\x11\n\x0c\n\x05\x04\0\
+ \x02\x02\x01\x12\x033\x12\x18\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x033\x1b\
+ \x1c\n+\n\x04\x04\0\x02\x03\x12\x035\x02\x1e\x1a\x1e\x20The\x20protocol\
+ \x20buffer\x20options.\n\n\x0c\n\x05\x04\0\x02\x03\x04\x12\x035\x02\n\n\
+ \x0c\n\x05\x04\0\x02\x03\x06\x12\x035\x0b\x11\n\x0c\n\x05\x04\0\x02\x03\
+ \x01\x12\x035\x12\x19\n\x0c\n\x05\x04\0\x02\x03\x03\x12\x035\x1c\x1d\n\"\
+ \n\x04\x04\0\x02\x04\x12\x037\x02#\x1a\x15\x20The\x20source\x20context.\
+ \n\n\x0c\n\x05\x04\0\x02\x04\x06\x12\x037\x02\x0f\n\x0c\n\x05\x04\0\x02\
+ \x04\x01\x12\x037\x10\x1e\n\x0c\n\x05\x04\0\x02\x04\x03\x12\x037!\"\n!\n\
+ \x04\x04\0\x02\x05\x12\x039\x02\x14\x1a\x14\x20The\x20source\x20syntax.\
+ \n\n\x0c\n\x05\x04\0\x02\x05\x06\x12\x039\x02\x08\n\x0c\n\x05\x04\0\x02\
+ \x05\x01\x12\x039\t\x0f\n\x0c\n\x05\x04\0\x02\x05\x03\x12\x039\x12\x13\n\
+ 0\n\x02\x04\x01\x12\x05=\0\x8a\x01\x01\x1a#\x20A\x20single\x20field\x20o\
+ f\x20a\x20message\x20type.\n\n\n\n\x03\x04\x01\x01\x12\x03=\x08\r\n\"\n\
+ \x04\x04\x01\x04\0\x12\x04?\x02f\x03\x1a\x14\x20Basic\x20field\x20types.\
+ \n\n\x0c\n\x05\x04\x01\x04\0\x01\x12\x03?\x07\x0b\n$\n\x06\x04\x01\x04\0\
+ \x02\0\x12\x03A\x04\x1c\x1a\x15\x20Field\x20type\x20unknown.\n\n\x0e\n\
+ \x07\x04\x01\x04\0\x02\0\x01\x12\x03A\x04\x10\n\x0e\n\x07\x04\x01\x04\0\
+ \x02\0\x02\x12\x03A\x1a\x1b\n#\n\x06\x04\x01\x04\0\x02\x01\x12\x03C\x04\
+ \x1c\x1a\x14\x20Field\x20type\x20double.\n\n\x0e\n\x07\x04\x01\x04\0\x02\
+ \x01\x01\x12\x03C\x04\x0f\n\x0e\n\x07\x04\x01\x04\0\x02\x01\x02\x12\x03C\
+ \x1a\x1b\n\"\n\x06\x04\x01\x04\0\x02\x02\x12\x03E\x04\x1c\x1a\x13\x20Fie\
+ ld\x20type\x20float.\n\n\x0e\n\x07\x04\x01\x04\0\x02\x02\x01\x12\x03E\
+ \x04\x0e\n\x0e\n\x07\x04\x01\x04\0\x02\x02\x02\x12\x03E\x1a\x1b\n\"\n\
+ \x06\x04\x01\x04\0\x02\x03\x12\x03G\x04\x1c\x1a\x13\x20Field\x20type\x20\
+ int64.\n\n\x0e\n\x07\x04\x01\x04\0\x02\x03\x01\x12\x03G\x04\x0e\n\x0e\n\
+ \x07\x04\x01\x04\0\x02\x03\x02\x12\x03G\x1a\x1b\n#\n\x06\x04\x01\x04\0\
+ \x02\x04\x12\x03I\x04\x1c\x1a\x14\x20Field\x20type\x20uint64.\n\n\x0e\n\
+ \x07\x04\x01\x04\0\x02\x04\x01\x12\x03I\x04\x0f\n\x0e\n\x07\x04\x01\x04\
+ \0\x02\x04\x02\x12\x03I\x1a\x1b\n\"\n\x06\x04\x01\x04\0\x02\x05\x12\x03K\
+ \x04\x1c\x1a\x13\x20Field\x20type\x20int32.\n\n\x0e\n\x07\x04\x01\x04\0\
+ \x02\x05\x01\x12\x03K\x04\x0e\n\x0e\n\x07\x04\x01\x04\0\x02\x05\x02\x12\
+ \x03K\x1a\x1b\n$\n\x06\x04\x01\x04\0\x02\x06\x12\x03M\x04\x1c\x1a\x15\
+ \x20Field\x20type\x20fixed64.\n\n\x0e\n\x07\x04\x01\x04\0\x02\x06\x01\
+ \x12\x03M\x04\x10\n\x0e\n\x07\x04\x01\x04\0\x02\x06\x02\x12\x03M\x1a\x1b\
+ \n$\n\x06\x04\x01\x04\0\x02\x07\x12\x03O\x04\x1c\x1a\x15\x20Field\x20typ\
+ e\x20fixed32.\n\n\x0e\n\x07\x04\x01\x04\0\x02\x07\x01\x12\x03O\x04\x10\n\
+ \x0e\n\x07\x04\x01\x04\0\x02\x07\x02\x12\x03O\x1a\x1b\n!\n\x06\x04\x01\
+ \x04\0\x02\x08\x12\x03Q\x04\x1c\x1a\x12\x20Field\x20type\x20bool.\n\n\
+ \x0e\n\x07\x04\x01\x04\0\x02\x08\x01\x12\x03Q\x04\r\n\x0e\n\x07\x04\x01\
+ \x04\0\x02\x08\x02\x12\x03Q\x1a\x1b\n#\n\x06\x04\x01\x04\0\x02\t\x12\x03\
+ S\x04\x1c\x1a\x14\x20Field\x20type\x20string.\n\n\x0e\n\x07\x04\x01\x04\
+ \0\x02\t\x01\x12\x03S\x04\x0f\n\x0e\n\x07\x04\x01\x04\0\x02\t\x02\x12\
+ \x03S\x1a\x1b\nF\n\x06\x04\x01\x04\0\x02\n\x12\x03U\x04\x1d\x1a7\x20Fiel\
+ d\x20type\x20group.\x20Proto2\x20syntax\x20only,\x20and\x20deprecated.\n\
+ \n\x0e\n\x07\x04\x01\x04\0\x02\n\x01\x12\x03U\x04\x0e\n\x0e\n\x07\x04\
+ \x01\x04\0\x02\n\x02\x12\x03U\x1a\x1c\n$\n\x06\x04\x01\x04\0\x02\x0b\x12\
+ \x03W\x04\x1d\x1a\x15\x20Field\x20type\x20message.\n\n\x0e\n\x07\x04\x01\
+ \x04\0\x02\x0b\x01\x12\x03W\x04\x10\n\x0e\n\x07\x04\x01\x04\0\x02\x0b\
+ \x02\x12\x03W\x1a\x1c\n\"\n\x06\x04\x01\x04\0\x02\x0c\x12\x03Y\x04\x1d\
+ \x1a\x13\x20Field\x20type\x20bytes.\n\n\x0e\n\x07\x04\x01\x04\0\x02\x0c\
+ \x01\x12\x03Y\x04\x0e\n\x0e\n\x07\x04\x01\x04\0\x02\x0c\x02\x12\x03Y\x1a\
+ \x1c\n#\n\x06\x04\x01\x04\0\x02\r\x12\x03[\x04\x1d\x1a\x14\x20Field\x20t\
+ ype\x20uint32.\n\n\x0e\n\x07\x04\x01\x04\0\x02\r\x01\x12\x03[\x04\x0f\n\
+ \x0e\n\x07\x04\x01\x04\0\x02\r\x02\x12\x03[\x1a\x1c\n!\n\x06\x04\x01\x04\
+ \0\x02\x0e\x12\x03]\x04\x1d\x1a\x12\x20Field\x20type\x20enum.\n\n\x0e\n\
+ \x07\x04\x01\x04\0\x02\x0e\x01\x12\x03]\x04\r\n\x0e\n\x07\x04\x01\x04\0\
+ \x02\x0e\x02\x12\x03]\x1a\x1c\n%\n\x06\x04\x01\x04\0\x02\x0f\x12\x03_\
+ \x04\x1d\x1a\x16\x20Field\x20type\x20sfixed32.\n\n\x0e\n\x07\x04\x01\x04\
+ \0\x02\x0f\x01\x12\x03_\x04\x11\n\x0e\n\x07\x04\x01\x04\0\x02\x0f\x02\
+ \x12\x03_\x1a\x1c\n%\n\x06\x04\x01\x04\0\x02\x10\x12\x03a\x04\x1d\x1a\
+ \x16\x20Field\x20type\x20sfixed64.\n\n\x0e\n\x07\x04\x01\x04\0\x02\x10\
+ \x01\x12\x03a\x04\x11\n\x0e\n\x07\x04\x01\x04\0\x02\x10\x02\x12\x03a\x1a\
+ \x1c\n#\n\x06\x04\x01\x04\0\x02\x11\x12\x03c\x04\x1d\x1a\x14\x20Field\
+ \x20type\x20sint32.\n\n\x0e\n\x07\x04\x01\x04\0\x02\x11\x01\x12\x03c\x04\
+ \x0f\n\x0e\n\x07\x04\x01\x04\0\x02\x11\x02\x12\x03c\x1a\x1c\n#\n\x06\x04\
+ \x01\x04\0\x02\x12\x12\x03e\x04\x1d\x1a\x14\x20Field\x20type\x20sint64.\
+ \n\n\x0e\n\x07\x04\x01\x04\0\x02\x12\x01\x12\x03e\x04\x0f\n\x0e\n\x07\
+ \x04\x01\x04\0\x02\x12\x02\x12\x03e\x1a\x1c\nC\n\x04\x04\x01\x04\x01\x12\
+ \x04i\x02r\x03\x1a5\x20Whether\x20a\x20field\x20is\x20optional,\x20requi\
+ red,\x20or\x20repeated.\n\n\x0c\n\x05\x04\x01\x04\x01\x01\x12\x03i\x07\
+ \x12\n5\n\x06\x04\x01\x04\x01\x02\0\x12\x03k\x04\x1c\x1a&\x20For\x20fiel\
+ ds\x20with\x20unknown\x20cardinality.\n\n\x0e\n\x07\x04\x01\x04\x01\x02\
+ \0\x01\x12\x03k\x04\x17\n\x0e\n\x07\x04\x01\x04\x01\x02\0\x02\x12\x03k\
+ \x1a\x1b\n%\n\x06\x04\x01\x04\x01\x02\x01\x12\x03m\x04\x1d\x1a\x16\x20Fo\
+ r\x20optional\x20fields.\n\n\x0e\n\x07\x04\x01\x04\x01\x02\x01\x01\x12\
+ \x03m\x04\x18\n\x0e\n\x07\x04\x01\x04\x01\x02\x01\x02\x12\x03m\x1b\x1c\n\
+ 9\n\x06\x04\x01\x04\x01\x02\x02\x12\x03o\x04\x1d\x1a*\x20For\x20required\
+ \x20fields.\x20Proto2\x20syntax\x20only.\n\n\x0e\n\x07\x04\x01\x04\x01\
+ \x02\x02\x01\x12\x03o\x04\x18\n\x0e\n\x07\x04\x01\x04\x01\x02\x02\x02\
+ \x12\x03o\x1b\x1c\n%\n\x06\x04\x01\x04\x01\x02\x03\x12\x03q\x04\x1d\x1a\
+ \x16\x20For\x20repeated\x20fields.\n\n\x0e\n\x07\x04\x01\x04\x01\x02\x03\
+ \x01\x12\x03q\x04\x18\n\x0e\n\x07\x04\x01\x04\x01\x02\x03\x02\x12\x03q\
+ \x1b\x1c\n\x1e\n\x04\x04\x01\x02\0\x12\x03u\x02\x10\x1a\x11\x20The\x20fi\
+ eld\x20type.\n\n\x0c\n\x05\x04\x01\x02\0\x06\x12\x03u\x02\x06\n\x0c\n\
+ \x05\x04\x01\x02\0\x01\x12\x03u\x07\x0b\n\x0c\n\x05\x04\x01\x02\0\x03\
+ \x12\x03u\x0e\x0f\n%\n\x04\x04\x01\x02\x01\x12\x03w\x02\x1e\x1a\x18\x20T\
+ he\x20field\x20cardinality.\n\n\x0c\n\x05\x04\x01\x02\x01\x06\x12\x03w\
+ \x02\r\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03w\x0e\x19\n\x0c\n\x05\x04\
+ \x01\x02\x01\x03\x12\x03w\x1c\x1d\n\x20\n\x04\x04\x01\x02\x02\x12\x03y\
+ \x02\x13\x1a\x13\x20The\x20field\x20number.\n\n\x0c\n\x05\x04\x01\x02\
+ \x02\x05\x12\x03y\x02\x07\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03y\x08\
+ \x0e\n\x0c\n\x05\x04\x01\x02\x02\x03\x12\x03y\x11\x12\n\x1e\n\x04\x04\
+ \x01\x02\x03\x12\x03{\x02\x12\x1a\x11\x20The\x20field\x20name.\n\n\x0c\n\
+ \x05\x04\x01\x02\x03\x05\x12\x03{\x02\x08\n\x0c\n\x05\x04\x01\x02\x03\
+ \x01\x12\x03{\t\r\n\x0c\n\x05\x04\x01\x02\x03\x03\x12\x03{\x10\x11\n\x96\
+ \x01\n\x04\x04\x01\x02\x04\x12\x03~\x02\x16\x1a\x88\x01\x20The\x20field\
+ \x20type\x20URL,\x20without\x20the\x20scheme,\x20for\x20message\x20or\
+ \x20enumeration\n\x20types.\x20Example:\x20`\"type.googleapis.com/google\
+ .protobuf.Timestamp\"`.\n\n\x0c\n\x05\x04\x01\x02\x04\x05\x12\x03~\x02\
+ \x08\n\x0c\n\x05\x04\x01\x02\x04\x01\x12\x03~\t\x11\n\x0c\n\x05\x04\x01\
+ \x02\x04\x03\x12\x03~\x14\x15\n\xa5\x01\n\x04\x04\x01\x02\x05\x12\x04\
+ \x81\x01\x02\x18\x1a\x96\x01\x20The\x20index\x20of\x20the\x20field\x20ty\
+ pe\x20in\x20`Type.oneofs`,\x20for\x20message\x20or\x20enumeration\n\x20t\
+ ypes.\x20The\x20first\x20type\x20has\x20index\x201;\x20zero\x20means\x20\
+ the\x20type\x20is\x20not\x20in\x20the\x20list.\n\n\r\n\x05\x04\x01\x02\
+ \x05\x05\x12\x04\x81\x01\x02\x07\n\r\n\x05\x04\x01\x02\x05\x01\x12\x04\
+ \x81\x01\x08\x13\n\r\n\x05\x04\x01\x02\x05\x03\x12\x04\x81\x01\x16\x17\n\
+ F\n\x04\x04\x01\x02\x06\x12\x04\x83\x01\x02\x12\x1a8\x20Whether\x20to\
+ \x20use\x20alternative\x20packed\x20wire\x20representation.\n\n\r\n\x05\
+ \x04\x01\x02\x06\x05\x12\x04\x83\x01\x02\x06\n\r\n\x05\x04\x01\x02\x06\
+ \x01\x12\x04\x83\x01\x07\r\n\r\n\x05\x04\x01\x02\x06\x03\x12\x04\x83\x01\
+ \x10\x11\n,\n\x04\x04\x01\x02\x07\x12\x04\x85\x01\x02\x1e\x1a\x1e\x20The\
+ \x20protocol\x20buffer\x20options.\n\n\r\n\x05\x04\x01\x02\x07\x04\x12\
+ \x04\x85\x01\x02\n\n\r\n\x05\x04\x01\x02\x07\x06\x12\x04\x85\x01\x0b\x11\
+ \n\r\n\x05\x04\x01\x02\x07\x01\x12\x04\x85\x01\x12\x19\n\r\n\x05\x04\x01\
+ \x02\x07\x03\x12\x04\x85\x01\x1c\x1d\n$\n\x04\x04\x01\x02\x08\x12\x04\
+ \x87\x01\x02\x18\x1a\x16\x20The\x20field\x20JSON\x20name.\n\n\r\n\x05\
+ \x04\x01\x02\x08\x05\x12\x04\x87\x01\x02\x08\n\r\n\x05\x04\x01\x02\x08\
+ \x01\x12\x04\x87\x01\t\x12\n\r\n\x05\x04\x01\x02\x08\x03\x12\x04\x87\x01\
+ \x15\x17\nX\n\x04\x04\x01\x02\t\x12\x04\x89\x01\x02\x1c\x1aJ\x20The\x20s\
+ tring\x20value\x20of\x20the\x20default\x20value\x20of\x20this\x20field.\
+ \x20Proto2\x20syntax\x20only.\n\n\r\n\x05\x04\x01\x02\t\x05\x12\x04\x89\
+ \x01\x02\x08\n\r\n\x05\x04\x01\x02\t\x01\x12\x04\x89\x01\t\x16\n\r\n\x05\
+ \x04\x01\x02\t\x03\x12\x04\x89\x01\x19\x1b\n%\n\x02\x04\x02\x12\x06\x8d\
+ \x01\0\x98\x01\x01\x1a\x17\x20Enum\x20type\x20definition.\n\n\x0b\n\x03\
+ \x04\x02\x01\x12\x04\x8d\x01\x08\x0c\n\x1f\n\x04\x04\x02\x02\0\x12\x04\
+ \x8f\x01\x02\x12\x1a\x11\x20Enum\x20type\x20name.\n\n\r\n\x05\x04\x02\
+ \x02\0\x05\x12\x04\x8f\x01\x02\x08\n\r\n\x05\x04\x02\x02\0\x01\x12\x04\
+ \x8f\x01\t\r\n\r\n\x05\x04\x02\x02\0\x03\x12\x04\x8f\x01\x10\x11\n'\n\
+ \x04\x04\x02\x02\x01\x12\x04\x91\x01\x02#\x1a\x19\x20Enum\x20value\x20de\
+ finitions.\n\n\r\n\x05\x04\x02\x02\x01\x04\x12\x04\x91\x01\x02\n\n\r\n\
+ \x05\x04\x02\x02\x01\x06\x12\x04\x91\x01\x0b\x14\n\r\n\x05\x04\x02\x02\
+ \x01\x01\x12\x04\x91\x01\x15\x1e\n\r\n\x05\x04\x02\x02\x01\x03\x12\x04\
+ \x91\x01!\"\n(\n\x04\x04\x02\x02\x02\x12\x04\x93\x01\x02\x1e\x1a\x1a\x20\
+ Protocol\x20buffer\x20options.\n\n\r\n\x05\x04\x02\x02\x02\x04\x12\x04\
+ \x93\x01\x02\n\n\r\n\x05\x04\x02\x02\x02\x06\x12\x04\x93\x01\x0b\x11\n\r\
+ \n\x05\x04\x02\x02\x02\x01\x12\x04\x93\x01\x12\x19\n\r\n\x05\x04\x02\x02\
+ \x02\x03\x12\x04\x93\x01\x1c\x1d\n#\n\x04\x04\x02\x02\x03\x12\x04\x95\
+ \x01\x02#\x1a\x15\x20The\x20source\x20context.\n\n\r\n\x05\x04\x02\x02\
+ \x03\x06\x12\x04\x95\x01\x02\x0f\n\r\n\x05\x04\x02\x02\x03\x01\x12\x04\
+ \x95\x01\x10\x1e\n\r\n\x05\x04\x02\x02\x03\x03\x12\x04\x95\x01!\"\n\"\n\
+ \x04\x04\x02\x02\x04\x12\x04\x97\x01\x02\x14\x1a\x14\x20The\x20source\
+ \x20syntax.\n\n\r\n\x05\x04\x02\x02\x04\x06\x12\x04\x97\x01\x02\x08\n\r\
+ \n\x05\x04\x02\x02\x04\x01\x12\x04\x97\x01\t\x0f\n\r\n\x05\x04\x02\x02\
+ \x04\x03\x12\x04\x97\x01\x12\x13\n&\n\x02\x04\x03\x12\x06\x9b\x01\0\xa2\
+ \x01\x01\x1a\x18\x20Enum\x20value\x20definition.\n\n\x0b\n\x03\x04\x03\
+ \x01\x12\x04\x9b\x01\x08\x11\n\x20\n\x04\x04\x03\x02\0\x12\x04\x9d\x01\
+ \x02\x12\x1a\x12\x20Enum\x20value\x20name.\n\n\r\n\x05\x04\x03\x02\0\x05\
+ \x12\x04\x9d\x01\x02\x08\n\r\n\x05\x04\x03\x02\0\x01\x12\x04\x9d\x01\t\r\
+ \n\r\n\x05\x04\x03\x02\0\x03\x12\x04\x9d\x01\x10\x11\n\"\n\x04\x04\x03\
+ \x02\x01\x12\x04\x9f\x01\x02\x13\x1a\x14\x20Enum\x20value\x20number.\n\n\
+ \r\n\x05\x04\x03\x02\x01\x05\x12\x04\x9f\x01\x02\x07\n\r\n\x05\x04\x03\
+ \x02\x01\x01\x12\x04\x9f\x01\x08\x0e\n\r\n\x05\x04\x03\x02\x01\x03\x12\
+ \x04\x9f\x01\x11\x12\n(\n\x04\x04\x03\x02\x02\x12\x04\xa1\x01\x02\x1e\
+ \x1a\x1a\x20Protocol\x20buffer\x20options.\n\n\r\n\x05\x04\x03\x02\x02\
+ \x04\x12\x04\xa1\x01\x02\n\n\r\n\x05\x04\x03\x02\x02\x06\x12\x04\xa1\x01\
+ \x0b\x11\n\r\n\x05\x04\x03\x02\x02\x01\x12\x04\xa1\x01\x12\x19\n\r\n\x05\
+ \x04\x03\x02\x02\x03\x12\x04\xa1\x01\x1c\x1d\ng\n\x02\x04\x04\x12\x06\
+ \xa6\x01\0\xab\x01\x01\x1aY\x20A\x20protocol\x20buffer\x20option,\x20whi\
+ ch\x20can\x20be\x20attached\x20to\x20a\x20message,\x20field,\n\x20enumer\
+ ation,\x20etc.\n\n\x0b\n\x03\x04\x04\x01\x12\x04\xa6\x01\x08\x0e\nA\n\
+ \x04\x04\x04\x02\0\x12\x04\xa8\x01\x02\x12\x1a3\x20The\x20option's\x20na\
+ me.\x20For\x20example,\x20`\"java_package\"`.\n\n\r\n\x05\x04\x04\x02\0\
+ \x05\x12\x04\xa8\x01\x02\x08\n\r\n\x05\x04\x04\x02\0\x01\x12\x04\xa8\x01\
+ \t\r\n\r\n\x05\x04\x04\x02\0\x03\x12\x04\xa8\x01\x10\x11\nI\n\x04\x04\
+ \x04\x02\x01\x12\x04\xaa\x01\x02\x10\x1a;\x20The\x20option's\x20value.\
+ \x20For\x20example,\x20`\"com.google.protobuf\"`.\n\n\r\n\x05\x04\x04\
+ \x02\x01\x06\x12\x04\xaa\x01\x02\x05\n\r\n\x05\x04\x04\x02\x01\x01\x12\
+ \x04\xaa\x01\x06\x0b\n\r\n\x05\x04\x04\x02\x01\x03\x12\x04\xaa\x01\x0e\
+ \x0f\nI\n\x02\x05\0\x12\x06\xae\x01\0\xb3\x01\x01\x1a;\x20The\x20syntax\
+ \x20in\x20which\x20a\x20protocol\x20buffer\x20element\x20is\x20defined.\
+ \n\n\x0b\n\x03\x05\0\x01\x12\x04\xae\x01\x05\x0b\n\x20\n\x04\x05\0\x02\0\
+ \x12\x04\xb0\x01\x02\x14\x1a\x12\x20Syntax\x20`proto2`.\n\n\r\n\x05\x05\
+ \0\x02\0\x01\x12\x04\xb0\x01\x02\x0f\n\r\n\x05\x05\0\x02\0\x02\x12\x04\
+ \xb0\x01\x12\x13\n\x20\n\x04\x05\0\x02\x01\x12\x04\xb2\x01\x02\x14\x1a\
+ \x12\x20Syntax\x20`proto3`.\n\n\r\n\x05\x05\0\x02\x01\x01\x12\x04\xb2\
+ \x01\x02\x0f\n\r\n\x05\x05\0\x02\x01\x02\x12\x04\xb2\x01\x12\x13b\x06pro\
+ to3\
+";
+
+static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+
+fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
+ ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
+}
+
+pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
+ unsafe {
+ file_descriptor_proto_lazy.get(|| {
+ parse_descriptor_proto()
+ })
+ }
+}
diff --git a/src/well_known_types/wrappers.rs b/src/well_known_types/wrappers.rs
new file mode 100644
index 0000000..35015fd
--- /dev/null
+++ b/src/well_known_types/wrappers.rs
@@ -0,0 +1,1597 @@
+// This file is generated by rust-protobuf 2.14.0-pre. Do not edit
+// @generated
+
+// https://github.com/rust-lang/rust-clippy/issues/702
+#![allow(unknown_lints)]
+#![allow(clippy::all)]
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
+#![allow(box_pointers)]
+#![allow(dead_code)]
+#![allow(missing_docs)]
+#![allow(non_camel_case_types)]
+#![allow(non_snake_case)]
+#![allow(non_upper_case_globals)]
+#![allow(trivial_casts)]
+#![allow(unsafe_code)]
+#![allow(unused_imports)]
+#![allow(unused_results)]
+//! Generated file from `google/protobuf/wrappers.proto`
+
+use protobuf::Message as Message_imported_for_functions;
+use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct DoubleValue {
+ // message fields
+ pub value: f64,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a DoubleValue {
+ fn default() -> &'a DoubleValue {
+ <DoubleValue as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl DoubleValue {
+ pub fn new() -> DoubleValue {
+ ::std::default::Default::default()
+ }
+
+ // double value = 1;
+
+
+ pub fn get_value(&self) -> f64 {
+ self.value
+ }
+ pub fn clear_value(&mut self) {
+ self.value = 0.;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_value(&mut self, v: f64) {
+ self.value = v;
+ }
+}
+
+impl ::protobuf::Message for DoubleValue {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ if wire_type != ::protobuf::wire_format::WireTypeFixed64 {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_double()?;
+ self.value = tmp;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if self.value != 0. {
+ my_size += 9;
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if self.value != 0. {
+ os.write_double(1, self.value)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> DoubleValue {
+ DoubleValue::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeDouble>(
+ "value",
+ |m: &DoubleValue| { &m.value },
+ |m: &mut DoubleValue| { &mut m.value },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<DoubleValue>(
+ "DoubleValue",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static DoubleValue {
+ static mut instance: ::protobuf::lazy::Lazy<DoubleValue> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(DoubleValue::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for DoubleValue {
+ fn clear(&mut self) {
+ self.value = 0.;
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for DoubleValue {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for DoubleValue {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct FloatValue {
+ // message fields
+ pub value: f32,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a FloatValue {
+ fn default() -> &'a FloatValue {
+ <FloatValue as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl FloatValue {
+ pub fn new() -> FloatValue {
+ ::std::default::Default::default()
+ }
+
+ // float value = 1;
+
+
+ pub fn get_value(&self) -> f32 {
+ self.value
+ }
+ pub fn clear_value(&mut self) {
+ self.value = 0.;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_value(&mut self, v: f32) {
+ self.value = v;
+ }
+}
+
+impl ::protobuf::Message for FloatValue {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ if wire_type != ::protobuf::wire_format::WireTypeFixed32 {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_float()?;
+ self.value = tmp;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if self.value != 0. {
+ my_size += 5;
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if self.value != 0. {
+ os.write_float(1, self.value)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> FloatValue {
+ FloatValue::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeFloat>(
+ "value",
+ |m: &FloatValue| { &m.value },
+ |m: &mut FloatValue| { &mut m.value },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<FloatValue>(
+ "FloatValue",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static FloatValue {
+ static mut instance: ::protobuf::lazy::Lazy<FloatValue> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(FloatValue::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for FloatValue {
+ fn clear(&mut self) {
+ self.value = 0.;
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for FloatValue {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for FloatValue {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct Int64Value {
+ // message fields
+ pub value: i64,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a Int64Value {
+ fn default() -> &'a Int64Value {
+ <Int64Value as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl Int64Value {
+ pub fn new() -> Int64Value {
+ ::std::default::Default::default()
+ }
+
+ // int64 value = 1;
+
+
+ pub fn get_value(&self) -> i64 {
+ self.value
+ }
+ pub fn clear_value(&mut self) {
+ self.value = 0;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_value(&mut self, v: i64) {
+ self.value = v;
+ }
+}
+
+impl ::protobuf::Message for Int64Value {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_int64()?;
+ self.value = tmp;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if self.value != 0 {
+ my_size += ::protobuf::rt::value_size(1, self.value, ::protobuf::wire_format::WireTypeVarint);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if self.value != 0 {
+ os.write_int64(1, self.value)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> Int64Value {
+ Int64Value::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>(
+ "value",
+ |m: &Int64Value| { &m.value },
+ |m: &mut Int64Value| { &mut m.value },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<Int64Value>(
+ "Int64Value",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static Int64Value {
+ static mut instance: ::protobuf::lazy::Lazy<Int64Value> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(Int64Value::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for Int64Value {
+ fn clear(&mut self) {
+ self.value = 0;
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for Int64Value {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for Int64Value {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct UInt64Value {
+ // message fields
+ pub value: u64,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a UInt64Value {
+ fn default() -> &'a UInt64Value {
+ <UInt64Value as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl UInt64Value {
+ pub fn new() -> UInt64Value {
+ ::std::default::Default::default()
+ }
+
+ // uint64 value = 1;
+
+
+ pub fn get_value(&self) -> u64 {
+ self.value
+ }
+ pub fn clear_value(&mut self) {
+ self.value = 0;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_value(&mut self, v: u64) {
+ self.value = v;
+ }
+}
+
+impl ::protobuf::Message for UInt64Value {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_uint64()?;
+ self.value = tmp;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if self.value != 0 {
+ my_size += ::protobuf::rt::value_size(1, self.value, ::protobuf::wire_format::WireTypeVarint);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if self.value != 0 {
+ os.write_uint64(1, self.value)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> UInt64Value {
+ UInt64Value::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>(
+ "value",
+ |m: &UInt64Value| { &m.value },
+ |m: &mut UInt64Value| { &mut m.value },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<UInt64Value>(
+ "UInt64Value",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static UInt64Value {
+ static mut instance: ::protobuf::lazy::Lazy<UInt64Value> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(UInt64Value::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for UInt64Value {
+ fn clear(&mut self) {
+ self.value = 0;
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for UInt64Value {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for UInt64Value {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct Int32Value {
+ // message fields
+ pub value: i32,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a Int32Value {
+ fn default() -> &'a Int32Value {
+ <Int32Value as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl Int32Value {
+ pub fn new() -> Int32Value {
+ ::std::default::Default::default()
+ }
+
+ // int32 value = 1;
+
+
+ pub fn get_value(&self) -> i32 {
+ self.value
+ }
+ pub fn clear_value(&mut self) {
+ self.value = 0;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_value(&mut self, v: i32) {
+ self.value = v;
+ }
+}
+
+impl ::protobuf::Message for Int32Value {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_int32()?;
+ self.value = tmp;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if self.value != 0 {
+ my_size += ::protobuf::rt::value_size(1, self.value, ::protobuf::wire_format::WireTypeVarint);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if self.value != 0 {
+ os.write_int32(1, self.value)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> Int32Value {
+ Int32Value::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
+ "value",
+ |m: &Int32Value| { &m.value },
+ |m: &mut Int32Value| { &mut m.value },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<Int32Value>(
+ "Int32Value",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static Int32Value {
+ static mut instance: ::protobuf::lazy::Lazy<Int32Value> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(Int32Value::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for Int32Value {
+ fn clear(&mut self) {
+ self.value = 0;
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for Int32Value {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for Int32Value {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct UInt32Value {
+ // message fields
+ pub value: u32,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a UInt32Value {
+ fn default() -> &'a UInt32Value {
+ <UInt32Value as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl UInt32Value {
+ pub fn new() -> UInt32Value {
+ ::std::default::Default::default()
+ }
+
+ // uint32 value = 1;
+
+
+ pub fn get_value(&self) -> u32 {
+ self.value
+ }
+ pub fn clear_value(&mut self) {
+ self.value = 0;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_value(&mut self, v: u32) {
+ self.value = v;
+ }
+}
+
+impl ::protobuf::Message for UInt32Value {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_uint32()?;
+ self.value = tmp;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if self.value != 0 {
+ my_size += ::protobuf::rt::value_size(1, self.value, ::protobuf::wire_format::WireTypeVarint);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if self.value != 0 {
+ os.write_uint32(1, self.value)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> UInt32Value {
+ UInt32Value::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>(
+ "value",
+ |m: &UInt32Value| { &m.value },
+ |m: &mut UInt32Value| { &mut m.value },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<UInt32Value>(
+ "UInt32Value",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static UInt32Value {
+ static mut instance: ::protobuf::lazy::Lazy<UInt32Value> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(UInt32Value::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for UInt32Value {
+ fn clear(&mut self) {
+ self.value = 0;
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for UInt32Value {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for UInt32Value {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct BoolValue {
+ // message fields
+ pub value: bool,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a BoolValue {
+ fn default() -> &'a BoolValue {
+ <BoolValue as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl BoolValue {
+ pub fn new() -> BoolValue {
+ ::std::default::Default::default()
+ }
+
+ // bool value = 1;
+
+
+ pub fn get_value(&self) -> bool {
+ self.value
+ }
+ pub fn clear_value(&mut self) {
+ self.value = false;
+ }
+
+ // Param is passed by value, moved
+ pub fn set_value(&mut self, v: bool) {
+ self.value = v;
+ }
+}
+
+impl ::protobuf::Message for BoolValue {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ if wire_type != ::protobuf::wire_format::WireTypeVarint {
+ return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+ }
+ let tmp = is.read_bool()?;
+ self.value = tmp;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if self.value != false {
+ my_size += 2;
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if self.value != false {
+ os.write_bool(1, self.value)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> BoolValue {
+ BoolValue::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>(
+ "value",
+ |m: &BoolValue| { &m.value },
+ |m: &mut BoolValue| { &mut m.value },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<BoolValue>(
+ "BoolValue",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static BoolValue {
+ static mut instance: ::protobuf::lazy::Lazy<BoolValue> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(BoolValue::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for BoolValue {
+ fn clear(&mut self) {
+ self.value = false;
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for BoolValue {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for BoolValue {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct StringValue {
+ // message fields
+ pub value: ::std::string::String,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a StringValue {
+ fn default() -> &'a StringValue {
+ <StringValue as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl StringValue {
+ pub fn new() -> StringValue {
+ ::std::default::Default::default()
+ }
+
+ // string value = 1;
+
+
+ pub fn get_value(&self) -> &str {
+ &self.value
+ }
+ pub fn clear_value(&mut self) {
+ self.value.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_value(&mut self, v: ::std::string::String) {
+ self.value = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_value(&mut self) -> &mut ::std::string::String {
+ &mut self.value
+ }
+
+ // Take field
+ pub fn take_value(&mut self) -> ::std::string::String {
+ ::std::mem::replace(&mut self.value, ::std::string::String::new())
+ }
+}
+
+impl ::protobuf::Message for StringValue {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.value)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if !self.value.is_empty() {
+ my_size += ::protobuf::rt::string_size(1, &self.value);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if !self.value.is_empty() {
+ os.write_string(1, &self.value)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> StringValue {
+ StringValue::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
+ "value",
+ |m: &StringValue| { &m.value },
+ |m: &mut StringValue| { &mut m.value },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<StringValue>(
+ "StringValue",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static StringValue {
+ static mut instance: ::protobuf::lazy::Lazy<StringValue> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(StringValue::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for StringValue {
+ fn clear(&mut self) {
+ self.value.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for StringValue {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for StringValue {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+#[derive(PartialEq,Clone,Default)]
+#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))]
+pub struct BytesValue {
+ // message fields
+ pub value: ::std::vec::Vec<u8>,
+ // special fields
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub unknown_fields: ::protobuf::UnknownFields,
+ #[cfg_attr(feature = "with-serde", serde(skip))]
+ pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a BytesValue {
+ fn default() -> &'a BytesValue {
+ <BytesValue as ::protobuf::Message>::default_instance()
+ }
+}
+
+impl BytesValue {
+ pub fn new() -> BytesValue {
+ ::std::default::Default::default()
+ }
+
+ // bytes value = 1;
+
+
+ pub fn get_value(&self) -> &[u8] {
+ &self.value
+ }
+ pub fn clear_value(&mut self) {
+ self.value.clear();
+ }
+
+ // Param is passed by value, moved
+ pub fn set_value(&mut self, v: ::std::vec::Vec<u8>) {
+ self.value = v;
+ }
+
+ // Mutable pointer to the field.
+ // If field is not initialized, it is initialized with default value first.
+ pub fn mut_value(&mut self) -> &mut ::std::vec::Vec<u8> {
+ &mut self.value
+ }
+
+ // Take field
+ pub fn take_value(&mut self) -> ::std::vec::Vec<u8> {
+ ::std::mem::replace(&mut self.value, ::std::vec::Vec::new())
+ }
+}
+
+impl ::protobuf::Message for BytesValue {
+ fn is_initialized(&self) -> bool {
+ true
+ }
+
+ fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ while !is.eof()? {
+ let (field_number, wire_type) = is.read_tag_unpack()?;
+ match field_number {
+ 1 => {
+ ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?;
+ },
+ _ => {
+ ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+ },
+ };
+ }
+ ::std::result::Result::Ok(())
+ }
+
+ // Compute sizes of nested messages
+ #[allow(unused_variables)]
+ fn compute_size(&self) -> u32 {
+ let mut my_size = 0;
+ if !self.value.is_empty() {
+ my_size += ::protobuf::rt::bytes_size(1, &self.value);
+ }
+ my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+ self.cached_size.set(my_size);
+ my_size
+ }
+
+ fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+ if !self.value.is_empty() {
+ os.write_bytes(1, &self.value)?;
+ }
+ os.write_unknown_fields(self.get_unknown_fields())?;
+ ::std::result::Result::Ok(())
+ }
+
+ fn get_cached_size(&self) -> u32 {
+ self.cached_size.get()
+ }
+
+ fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+ &self.unknown_fields
+ }
+
+ fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+ &mut self.unknown_fields
+ }
+
+ fn as_any(&self) -> &dyn (::std::any::Any) {
+ self as &dyn (::std::any::Any)
+ }
+ fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+ self as &mut dyn (::std::any::Any)
+ }
+ fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+ self
+ }
+
+ fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+ Self::descriptor_static()
+ }
+
+ fn new() -> BytesValue {
+ BytesValue::new()
+ }
+
+ fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+ static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ descriptor.get(|| {
+ let mut fields = ::std::vec::Vec::new();
+ fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
+ "value",
+ |m: &BytesValue| { &m.value },
+ |m: &mut BytesValue| { &mut m.value },
+ ));
+ ::protobuf::reflect::MessageDescriptor::new_pb_name::<BytesValue>(
+ "BytesValue",
+ fields,
+ file_descriptor_proto()
+ )
+ })
+ }
+ }
+
+ fn default_instance() -> &'static BytesValue {
+ static mut instance: ::protobuf::lazy::Lazy<BytesValue> = ::protobuf::lazy::Lazy::INIT;
+ unsafe {
+ instance.get(BytesValue::new)
+ }
+ }
+}
+
+impl ::protobuf::Clear for BytesValue {
+ fn clear(&mut self) {
+ self.value.clear();
+ self.unknown_fields.clear();
+ }
+}
+
+impl ::std::fmt::Debug for BytesValue {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ ::protobuf::text_format::fmt(self, f)
+ }
+}
+
+impl ::protobuf::reflect::ProtobufValue for BytesValue {
+ fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+ ::protobuf::reflect::ReflectValueRef::Message(self)
+ }
+}
+
+static file_descriptor_proto_data: &'static [u8] = b"\
+ \n\x1egoogle/protobuf/wrappers.proto\x12\x0fgoogle.protobuf\"#\n\x0bDoub\
+ leValue\x12\x14\n\x05value\x18\x01\x20\x01(\x01R\x05value\"\"\n\nFloatVa\
+ lue\x12\x14\n\x05value\x18\x01\x20\x01(\x02R\x05value\"\"\n\nInt64Value\
+ \x12\x14\n\x05value\x18\x01\x20\x01(\x03R\x05value\"#\n\x0bUInt64Value\
+ \x12\x14\n\x05value\x18\x01\x20\x01(\x04R\x05value\"\"\n\nInt32Value\x12\
+ \x14\n\x05value\x18\x01\x20\x01(\x05R\x05value\"#\n\x0bUInt32Value\x12\
+ \x14\n\x05value\x18\x01\x20\x01(\rR\x05value\"!\n\tBoolValue\x12\x14\n\
+ \x05value\x18\x01\x20\x01(\x08R\x05value\"#\n\x0bStringValue\x12\x14\n\
+ \x05value\x18\x01\x20\x01(\tR\x05value\"\"\n\nBytesValue\x12\x14\n\x05va\
+ lue\x18\x01\x20\x01(\x0cR\x05valueB|\n\x13com.google.protobufB\rWrappers\
+ ProtoP\x01Z*github.com/golang/protobuf/ptypes/wrappers\xf8\x01\x01\xa2\
+ \x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesJ\xae\x1d\n\x06\x12\
+ \x04#\0u\x01\n\xc3\x0e\n\x01\x0c\x12\x03#\0\x122\xc1\x0c\x20Protocol\x20\
+ Buffers\x20-\x20Google's\x20data\x20interchange\x20format\n\x20Copyright\
+ \x202008\x20Google\x20Inc.\x20\x20All\x20rights\x20reserved.\n\x20https:\
+ //developers.google.com/protocol-buffers/\n\n\x20Redistribution\x20and\
+ \x20use\x20in\x20source\x20and\x20binary\x20forms,\x20with\x20or\x20with\
+ out\n\x20modification,\x20are\x20permitted\x20provided\x20that\x20the\
+ \x20following\x20conditions\x20are\n\x20met:\n\n\x20\x20\x20\x20\x20*\
+ \x20Redistributions\x20of\x20source\x20code\x20must\x20retain\x20the\x20\
+ above\x20copyright\n\x20notice,\x20this\x20list\x20of\x20conditions\x20a\
+ nd\x20the\x20following\x20disclaimer.\n\x20\x20\x20\x20\x20*\x20Redistri\
+ butions\x20in\x20binary\x20form\x20must\x20reproduce\x20the\x20above\n\
+ \x20copyright\x20notice,\x20this\x20list\x20of\x20conditions\x20and\x20t\
+ he\x20following\x20disclaimer\n\x20in\x20the\x20documentation\x20and/or\
+ \x20other\x20materials\x20provided\x20with\x20the\n\x20distribution.\n\
+ \x20\x20\x20\x20\x20*\x20Neither\x20the\x20name\x20of\x20Google\x20Inc.\
+ \x20nor\x20the\x20names\x20of\x20its\n\x20contributors\x20may\x20be\x20u\
+ sed\x20to\x20endorse\x20or\x20promote\x20products\x20derived\x20from\n\
+ \x20this\x20software\x20without\x20specific\x20prior\x20written\x20permi\
+ ssion.\n\n\x20THIS\x20SOFTWARE\x20IS\x20PROVIDED\x20BY\x20THE\x20COPYRIG\
+ HT\x20HOLDERS\x20AND\x20CONTRIBUTORS\n\x20\"AS\x20IS\"\x20AND\x20ANY\x20\
+ EXPRESS\x20OR\x20IMPLIED\x20WARRANTIES,\x20INCLUDING,\x20BUT\x20NOT\n\
+ \x20LIMITED\x20TO,\x20THE\x20IMPLIED\x20WARRANTIES\x20OF\x20MERCHANTABIL\
+ ITY\x20AND\x20FITNESS\x20FOR\n\x20A\x20PARTICULAR\x20PURPOSE\x20ARE\x20D\
+ ISCLAIMED.\x20IN\x20NO\x20EVENT\x20SHALL\x20THE\x20COPYRIGHT\n\x20OWNER\
+ \x20OR\x20CONTRIBUTORS\x20BE\x20LIABLE\x20FOR\x20ANY\x20DIRECT,\x20INDIR\
+ ECT,\x20INCIDENTAL,\n\x20SPECIAL,\x20EXEMPLARY,\x20OR\x20CONSEQUENTIAL\
+ \x20DAMAGES\x20(INCLUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\x20PROCUREM\
+ ENT\x20OF\x20SUBSTITUTE\x20GOODS\x20OR\x20SERVICES;\x20LOSS\x20OF\x20USE\
+ ,\n\x20DATA,\x20OR\x20PROFITS;\x20OR\x20BUSINESS\x20INTERRUPTION)\x20HOW\
+ EVER\x20CAUSED\x20AND\x20ON\x20ANY\n\x20THEORY\x20OF\x20LIABILITY,\x20WH\
+ ETHER\x20IN\x20CONTRACT,\x20STRICT\x20LIABILITY,\x20OR\x20TORT\n\x20(INC\
+ LUDING\x20NEGLIGENCE\x20OR\x20OTHERWISE)\x20ARISING\x20IN\x20ANY\x20WAY\
+ \x20OUT\x20OF\x20THE\x20USE\n\x20OF\x20THIS\x20SOFTWARE,\x20EVEN\x20IF\
+ \x20ADVISED\x20OF\x20THE\x20POSSIBILITY\x20OF\x20SUCH\x20DAMAGE.\n2\xf4\
+ \x01\x20Wrappers\x20for\x20primitive\x20(non-message)\x20types.\x20These\
+ \x20types\x20are\x20useful\n\x20for\x20embedding\x20primitives\x20in\x20\
+ the\x20`google.protobuf.Any`\x20type\x20and\x20for\x20places\n\x20where\
+ \x20we\x20need\x20to\x20distinguish\x20between\x20the\x20absence\x20of\
+ \x20a\x20primitive\n\x20typed\x20field\x20and\x20its\x20default\x20value\
+ .\n\n\x08\n\x01\x02\x12\x03%\0\x18\n\x08\n\x01\x08\x12\x03'\0;\n\t\n\x02\
+ \x08%\x12\x03'\0;\n\x08\n\x01\x08\x12\x03(\0\x1f\n\t\n\x02\x08\x1f\x12\
+ \x03(\0\x1f\n\x08\n\x01\x08\x12\x03)\0A\n\t\n\x02\x08\x0b\x12\x03)\0A\n\
+ \x08\n\x01\x08\x12\x03*\0,\n\t\n\x02\x08\x01\x12\x03*\0,\n\x08\n\x01\x08\
+ \x12\x03+\0.\n\t\n\x02\x08\x08\x12\x03+\0.\n\x08\n\x01\x08\x12\x03,\0\"\
+ \n\t\n\x02\x08\n\x12\x03,\0\"\n\x08\n\x01\x08\x12\x03-\0!\n\t\n\x02\x08$\
+ \x12\x03-\0!\ng\n\x02\x04\0\x12\x042\05\x01\x1a[\x20Wrapper\x20message\
+ \x20for\x20`double`.\n\n\x20The\x20JSON\x20representation\x20for\x20`Dou\
+ bleValue`\x20is\x20JSON\x20number.\n\n\n\n\x03\x04\0\x01\x12\x032\x08\
+ \x13\n\x20\n\x04\x04\0\x02\0\x12\x034\x02\x13\x1a\x13\x20The\x20double\
+ \x20value.\n\n\x0c\n\x05\x04\0\x02\0\x05\x12\x034\x02\x08\n\x0c\n\x05\
+ \x04\0\x02\0\x01\x12\x034\t\x0e\n\x0c\n\x05\x04\0\x02\0\x03\x12\x034\x11\
+ \x12\ne\n\x02\x04\x01\x12\x04:\0=\x01\x1aY\x20Wrapper\x20message\x20for\
+ \x20`float`.\n\n\x20The\x20JSON\x20representation\x20for\x20`FloatValue`\
+ \x20is\x20JSON\x20number.\n\n\n\n\x03\x04\x01\x01\x12\x03:\x08\x12\n\x1f\
+ \n\x04\x04\x01\x02\0\x12\x03<\x02\x12\x1a\x12\x20The\x20float\x20value.\
+ \n\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03<\x02\x07\n\x0c\n\x05\x04\x01\
+ \x02\0\x01\x12\x03<\x08\r\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03<\x10\x11\
+ \ne\n\x02\x04\x02\x12\x04B\0E\x01\x1aY\x20Wrapper\x20message\x20for\x20`\
+ int64`.\n\n\x20The\x20JSON\x20representation\x20for\x20`Int64Value`\x20i\
+ s\x20JSON\x20string.\n\n\n\n\x03\x04\x02\x01\x12\x03B\x08\x12\n\x1f\n\
+ \x04\x04\x02\x02\0\x12\x03D\x02\x12\x1a\x12\x20The\x20int64\x20value.\n\
+ \n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03D\x02\x07\n\x0c\n\x05\x04\x02\x02\
+ \0\x01\x12\x03D\x08\r\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03D\x10\x11\ng\
+ \n\x02\x04\x03\x12\x04J\0M\x01\x1a[\x20Wrapper\x20message\x20for\x20`uin\
+ t64`.\n\n\x20The\x20JSON\x20representation\x20for\x20`UInt64Value`\x20is\
+ \x20JSON\x20string.\n\n\n\n\x03\x04\x03\x01\x12\x03J\x08\x13\n\x20\n\x04\
+ \x04\x03\x02\0\x12\x03L\x02\x13\x1a\x13\x20The\x20uint64\x20value.\n\n\
+ \x0c\n\x05\x04\x03\x02\0\x05\x12\x03L\x02\x08\n\x0c\n\x05\x04\x03\x02\0\
+ \x01\x12\x03L\t\x0e\n\x0c\n\x05\x04\x03\x02\0\x03\x12\x03L\x11\x12\ne\n\
+ \x02\x04\x04\x12\x04R\0U\x01\x1aY\x20Wrapper\x20message\x20for\x20`int32\
+ `.\n\n\x20The\x20JSON\x20representation\x20for\x20`Int32Value`\x20is\x20\
+ JSON\x20number.\n\n\n\n\x03\x04\x04\x01\x12\x03R\x08\x12\n\x1f\n\x04\x04\
+ \x04\x02\0\x12\x03T\x02\x12\x1a\x12\x20The\x20int32\x20value.\n\n\x0c\n\
+ \x05\x04\x04\x02\0\x05\x12\x03T\x02\x07\n\x0c\n\x05\x04\x04\x02\0\x01\
+ \x12\x03T\x08\r\n\x0c\n\x05\x04\x04\x02\0\x03\x12\x03T\x10\x11\ng\n\x02\
+ \x04\x05\x12\x04Z\0]\x01\x1a[\x20Wrapper\x20message\x20for\x20`uint32`.\
+ \n\n\x20The\x20JSON\x20representation\x20for\x20`UInt32Value`\x20is\x20J\
+ SON\x20number.\n\n\n\n\x03\x04\x05\x01\x12\x03Z\x08\x13\n\x20\n\x04\x04\
+ \x05\x02\0\x12\x03\\\x02\x13\x1a\x13\x20The\x20uint32\x20value.\n\n\x0c\
+ \n\x05\x04\x05\x02\0\x05\x12\x03\\\x02\x08\n\x0c\n\x05\x04\x05\x02\0\x01\
+ \x12\x03\\\t\x0e\n\x0c\n\x05\x04\x05\x02\0\x03\x12\x03\\\x11\x12\no\n\
+ \x02\x04\x06\x12\x04b\0e\x01\x1ac\x20Wrapper\x20message\x20for\x20`bool`\
+ .\n\n\x20The\x20JSON\x20representation\x20for\x20`BoolValue`\x20is\x20JS\
+ ON\x20`true`\x20and\x20`false`.\n\n\n\n\x03\x04\x06\x01\x12\x03b\x08\x11\
+ \n\x1e\n\x04\x04\x06\x02\0\x12\x03d\x02\x11\x1a\x11\x20The\x20bool\x20va\
+ lue.\n\n\x0c\n\x05\x04\x06\x02\0\x05\x12\x03d\x02\x06\n\x0c\n\x05\x04\
+ \x06\x02\0\x01\x12\x03d\x07\x0c\n\x0c\n\x05\x04\x06\x02\0\x03\x12\x03d\
+ \x0f\x10\ng\n\x02\x04\x07\x12\x04j\0m\x01\x1a[\x20Wrapper\x20message\x20\
+ for\x20`string`.\n\n\x20The\x20JSON\x20representation\x20for\x20`StringV\
+ alue`\x20is\x20JSON\x20string.\n\n\n\n\x03\x04\x07\x01\x12\x03j\x08\x13\
+ \n\x20\n\x04\x04\x07\x02\0\x12\x03l\x02\x13\x1a\x13\x20The\x20string\x20\
+ value.\n\n\x0c\n\x05\x04\x07\x02\0\x05\x12\x03l\x02\x08\n\x0c\n\x05\x04\
+ \x07\x02\0\x01\x12\x03l\t\x0e\n\x0c\n\x05\x04\x07\x02\0\x03\x12\x03l\x11\
+ \x12\ne\n\x02\x04\x08\x12\x04r\0u\x01\x1aY\x20Wrapper\x20message\x20for\
+ \x20`bytes`.\n\n\x20The\x20JSON\x20representation\x20for\x20`BytesValue`\
+ \x20is\x20JSON\x20string.\n\n\n\n\x03\x04\x08\x01\x12\x03r\x08\x12\n\x1f\
+ \n\x04\x04\x08\x02\0\x12\x03t\x02\x12\x1a\x12\x20The\x20bytes\x20value.\
+ \n\n\x0c\n\x05\x04\x08\x02\0\x05\x12\x03t\x02\x07\n\x0c\n\x05\x04\x08\
+ \x02\0\x01\x12\x03t\x08\r\n\x0c\n\x05\x04\x08\x02\0\x03\x12\x03t\x10\x11\
+ b\x06proto3\
+";
+
+static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
+
+fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
+ ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
+}
+
+pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
+ unsafe {
+ file_descriptor_proto_lazy.get(|| {
+ parse_descriptor_proto()
+ })
+ }
+}
diff --git a/src/zigzag.rs b/src/zigzag.rs
new file mode 100644
index 0000000..4c7d27d
--- /dev/null
+++ b/src/zigzag.rs
@@ -0,0 +1,50 @@
+// ZigZag endoging used for efficient transfer of signed integers
+// https://developers.google.com/protocol-buffers/docs/encoding#types
+
+pub fn decode_zig_zag_32(n: u32) -> i32 {
+ ((n >> 1) as i32) ^ (-((n & 1) as i32))
+}
+
+pub fn decode_zig_zag_64(n: u64) -> i64 {
+ ((n >> 1) as i64) ^ (-((n & 1) as i64))
+}
+
+pub fn encode_zig_zag_32(n: i32) -> u32 {
+ ((n << 1) ^ (n >> 31)) as u32
+}
+
+pub fn encode_zig_zag_64(n: i64) -> u64 {
+ ((n << 1) ^ (n >> 63)) as u64
+}
+
+#[cfg(test)]
+mod test {
+
+ use super::decode_zig_zag_32;
+ use super::decode_zig_zag_64;
+ use super::encode_zig_zag_32;
+ use super::encode_zig_zag_64;
+
+ #[test]
+ fn test_zig_zag() {
+ fn test_zig_zag_pair_64(decoded: i64, encoded: u64) {
+ assert_eq!(decoded, decode_zig_zag_64(encoded));
+ assert_eq!(encoded, encode_zig_zag_64(decoded));
+ }
+
+ fn test_zig_zag_pair(decoded: i32, encoded: u32) {
+ assert_eq!(decoded, decode_zig_zag_32(encoded));
+ assert_eq!(encoded, encode_zig_zag_32(decoded));
+ test_zig_zag_pair_64(decoded as i64, encoded as u64);
+ }
+
+ test_zig_zag_pair(0, 0);
+ test_zig_zag_pair(-1, 1);
+ test_zig_zag_pair(1, 2);
+ test_zig_zag_pair(-2, 3);
+ test_zig_zag_pair(2147483647, 4294967294);
+ test_zig_zag_pair(-2147483648, 4294967295);
+ test_zig_zag_pair_64(9223372036854775807, 18446744073709551614);
+ test_zig_zag_pair_64(-9223372036854775808, 18446744073709551615);
+ }
+}