protobuf-2.25.2/.cargo_vcs_info.json0000644000000001120000000000100127560ustar { "git": { "sha1": "cfd5aff1024bd0dd51aba785d80186319ff28d4a" } } protobuf-2.25.2/Cargo.toml0000644000000023020000000000100107570ustar # 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 are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2018" name = "protobuf" version = "2.25.2" authors = ["Stepan Koltsov "] 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 = "1.0" optional = true [dependencies.serde] version = "1.0" features = ["derive"] optional = true [dependencies.serde_derive] version = "1.0" optional = true [features] with-bytes = ["bytes"] with-serde = ["serde", "serde_derive"] protobuf-2.25.2/Cargo.toml.orig000064400000000000000000000013630072674642500144760ustar 00000000000000[package] name = "protobuf" version = "2.25.2" authors = ["Stepan Koltsov "] edition = "2018" 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 = "1.0", optional = true } serde = { version = "1.0", features = ["derive"], optional = true } serde_derive = { version = "1.0", optional = true } [package.metadata.docs.rs] all-features = true protobuf-2.25.2/LICENSE.txt000064400000000000000000000020410072674642500134240ustar 00000000000000Copyright (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.protobuf-2.25.2/README.md000064400000000000000000000002420072674642500130610ustar 00000000000000## 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`. protobuf-2.25.2/benches/coded_input_stream.rs000064400000000000000000000051460072674642500174370ustar 00000000000000// `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::CodedInputStream; use self::test::Bencher; fn make_bytes(len: usize) -> Vec { 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); }) } protobuf-2.25.2/benches/coded_output_stream.rs000064400000000000000000000020240072674642500176300ustar 00000000000000// `cargo test --benches` and `#[feature(test)]` work only in nightly #![cfg(rustc_nightly)] #![feature(test)] extern crate protobuf; extern crate test; use self::test::Bencher; use protobuf::CodedOutputStream; #[inline] fn buffer_write_byte(os: &mut 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 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 = 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 = CodedOutputStream::new(&mut v); buffer_write_bytes(&mut os); } v }); } protobuf-2.25.2/build.rs000064400000000000000000000041510072674642500132520ustar 00000000000000use std::env; use std::fs::File; use std::io::Read; use std::io::Write; use std::path::Path; use std::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(); } protobuf-2.25.2/regenerate.sh000075500000000000000000000030110072674642500142570ustar 00000000000000#!/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 \ -I../protoc-bin-vendored/include \ ../protoc-bin-vendored/include/google/protobuf/*.proto \ ../protoc-bin-vendored/include/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: protobuf-2.25.2/src/any.rs000064400000000000000000000065000072674642500135310ustar 00000000000000use 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(message: &MyMessage) -> ProtobufResult<()> { /// let message: &MyMessage = message; /// let any = Any::pack(message)?; /// assert!(any.is::()); /// # Ok(()) /// # } /// ``` pub fn pack(message: &M) -> ProtobufResult { 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::pack_with_type_url_prefix(message, "type.googleapis.com") } fn pack_with_type_url_prefix( message: &dyn Message, type_url_prefix: &str, ) -> ProtobufResult { 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(&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(&self) -> ProtobufResult> { if !self.is::() { 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>> { 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)) } } protobuf-2.25.2/src/buf_read_iter.rs000064400000000000000000000366650072674642500155530ustar 00000000000000use 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::buf::UninitSlice; #[cfg(feature = "bytes")] use bytes::BufMut; #[cfg(feature = "bytes")] use bytes::Bytes; #[cfg(feature = "bytes")] use bytes::BytesMut; use crate::coded_input_stream::READ_RAW_BYTES_MAX_ALLOC; use crate::error::WireError; use crate::ProtobufError; use crate::ProtobufResult; // 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 dyn BufRead), Read(BufReader<&'a mut dyn 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 { 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 { 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 { 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, max: usize) -> ProtobufResult { 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) -> 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 { 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::uninit_slice_as_mut_slice(&mut r.chunk_mut()[..len]); self.read_exact(buf)?; r.advance_mut(len); } Ok(r.freeze()) } } } #[cfg(feature = "bytes")] unsafe fn uninit_slice_as_mut_slice(slice: &mut UninitSlice) -> &mut [u8] { use std::slice; slice::from_raw_parts_mut(slice.as_mut_ptr(), slice.len()) } /// Returns 0 when EOF or limit reached. pub fn read(&mut self, buf: &mut [u8]) -> ProtobufResult { self.fill_buf()?; let rem = &self.buf[self.pos_within_buf..self.limit_within_buf]; let len = cmp::min(rem.len(), buf.len()); 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 { 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 { 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")); } } protobuf-2.25.2/src/cached_size.rs000064400000000000000000000015450072674642500152070ustar 00000000000000use 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 for CachedSize { fn eq(&self, _other: &CachedSize) -> bool { true } } impl Eq for CachedSize {} protobuf-2.25.2/src/chars.rs000064400000000000000000000043370072674642500140500ustar 00000000000000#![cfg(feature = "bytes")] use std::fmt; use std::ops::Deref; use std::str; use bytes::Bytes; use crate::clear::Clear; /// Thin wrapper around `Bytes` which guarantees that bytes are valid UTF-8 string. /// Should be API-compatible to `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 { 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 for Chars { fn from(src: String) -> Chars { Chars(Bytes::from(src)) } } impl Into for Chars { fn into(self) -> String { // This is safe because `Chars` is guaranteed to store a valid UTF-8 string unsafe { String::from_utf8_unchecked(self.0.as_ref().to_owned()) } } } impl Default for Chars { fn default() -> Self { Chars::new() } } impl Deref for Chars { type Target = str; fn deref(&self) -> &str { // This is safe because `Chars` is guaranteed to store a valid UTF-8 string 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)); } } protobuf-2.25.2/src/clear.rs000064400000000000000000000010660072674642500140320ustar 00000000000000#[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 Clear for Option { fn clear(&mut self) { self.take(); } } impl Clear for String { fn clear(&mut self) { String::clear(self); } } impl Clear for Vec { fn clear(&mut self) { Vec::clear(self); } } #[cfg(feature = "bytes")] impl Clear for Bytes { fn clear(&mut self) { Bytes::clear(self); } } protobuf-2.25.2/src/coded_input_stream.rs000064400000000000000000000732130072674642500166170ustar 00000000000000#![doc(hidden)] //! `CodedInputStream` and `CodedOutputStream` implementations use std::io; use std::io::BufRead; use std::io::Read; use std::mem; use std::slice; #[cfg(feature = "bytes")] use crate::chars::Chars; #[cfg(feature = "bytes")] use bytes::Bytes; use crate::buf_read_iter::BufReadIter; use crate::enums::ProtobufEnum; use crate::error::ProtobufError; use crate::error::ProtobufResult; use crate::error::WireError; use crate::message::Message; use crate::unknown::UnknownValue; use crate::wire_format; use crate::zigzag::decode_zig_zag_32; use crate::zigzag::decode_zig_zag_64; /// 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; /// 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 dyn 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 dyn 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 { self.source.read_exact_bytes(count) } /// Read one byte #[inline(always)] pub fn read_raw_byte(&mut self) -> ProtobufResult { self.source.read_byte() } /// Push new limit, return previous limit. pub fn push_limit(&mut self, limit: u64) -> ProtobufResult { 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 { 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 { 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 { '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 { self.read_raw_varint64().map(|v| v as u32) } /// Read little-endian 32-bit integer pub fn read_raw_little_endian32(&mut self) -> ProtobufResult { 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::()) }; self.read(bytes)?; Ok(r.to_le()) } /// Read little-endian 64-bit integer pub fn read_raw_little_endian64(&mut self) -> ProtobufResult { 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::()) }; self.read(bytes)?; Ok(r.to_le()) } /// Read tag #[inline] pub fn read_tag(&mut self) -> ProtobufResult { 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 { let bits = self.read_raw_little_endian64()?; unsafe { Ok(mem::transmute::(bits)) } } /// Read `float` pub fn read_float(&mut self) -> ProtobufResult { let bits = self.read_raw_little_endian32()?; unsafe { Ok(mem::transmute::(bits)) } } /// Read `int64` pub fn read_int64(&mut self) -> ProtobufResult { self.read_raw_varint64().map(|v| v as i64) } /// Read `int32` pub fn read_int32(&mut self) -> ProtobufResult { self.read_raw_varint32().map(|v| v as i32) } /// Read `uint64` pub fn read_uint64(&mut self) -> ProtobufResult { self.read_raw_varint64() } /// Read `uint32` pub fn read_uint32(&mut self) -> ProtobufResult { self.read_raw_varint32() } /// Read `sint64` pub fn read_sint64(&mut self) -> ProtobufResult { self.read_uint64().map(decode_zig_zag_64) } /// Read `sint32` pub fn read_sint32(&mut self) -> ProtobufResult { self.read_uint32().map(decode_zig_zag_32) } /// Read `fixed64` pub fn read_fixed64(&mut self) -> ProtobufResult { self.read_raw_little_endian64() } /// Read `fixed32` pub fn read_fixed32(&mut self) -> ProtobufResult { self.read_raw_little_endian32() } /// Read `sfixed64` pub fn read_sfixed64(&mut self) -> ProtobufResult { self.read_raw_little_endian64().map(|v| v as i64) } /// Read `sfixed32` pub fn read_sfixed32(&mut self) -> ProtobufResult { self.read_raw_little_endian32().map(|v| v as i32) } /// Read `bool` pub fn read_bool(&mut self) -> ProtobufResult { self.read_raw_varint32().map(|v| v != 0) } /// Read `enum` as `ProtobufEnum` pub fn read_enum(&mut self) -> ProtobufResult { 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, ) -> 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) -> 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) -> 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) -> 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, ) -> 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, ) -> 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, ) -> 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, ) -> 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, ) -> 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, ) -> 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, ) -> 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, ) -> 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) -> 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( &mut self, target: &mut Vec, ) -> 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 { 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) -> 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> { 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> { 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 { 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 { 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) -> 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 { 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)), }; *target = s; Ok(()) } /// Read message, do not check if message is initialized pub fn merge_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(&mut self) -> ProtobufResult { 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 { 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) } } /// Helper internal utility, should not be used directly #[doc(hidden)] pub trait WithCodedInputStream { fn with_coded_input_stream(self, cb: F) -> ProtobufResult where F: FnOnce(&mut CodedInputStream) -> ProtobufResult; } impl<'a> WithCodedInputStream for &'a mut (dyn Read + 'a) { fn with_coded_input_stream(self, cb: F) -> ProtobufResult where F: FnOnce(&mut CodedInputStream) -> ProtobufResult, { let mut is = CodedInputStream::new(self); let r = cb(&mut is)?; is.check_eof()?; Ok(r) } } impl<'a> WithCodedInputStream for &'a mut (dyn BufRead + 'a) { fn with_coded_input_stream(self, cb: F) -> ProtobufResult where F: FnOnce(&mut CodedInputStream) -> ProtobufResult, { 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(self, cb: F) -> ProtobufResult where F: FnOnce(&mut CodedInputStream) -> ProtobufResult, { 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(self, cb: F) -> ProtobufResult where F: FnOnce(&mut CodedInputStream) -> ProtobufResult, { let mut is = CodedInputStream::from_carllerche_bytes(self); let r = cb(&mut is)?; is.check_eof()?; Ok(r) } } #[cfg(test)] mod test { use std::fmt::Debug; use std::io; use std::io::BufRead; use std::io::Read; use crate::error::ProtobufError; use crate::error::ProtobufResult; use crate::hex::decode_hex; use super::CodedInputStream; use super::READ_RAW_BYTES_MAX_ALLOC; fn test_read_partial(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(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(hex: &str, v: V, mut callback: F) where F: FnMut(&mut CodedInputStream) -> ProtobufResult, 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")); } } protobuf-2.25.2/src/coded_output_stream.rs000064400000000000000000000535770072674642500170330ustar 00000000000000use crate::misc::remaining_capacity_as_slice_mut; use crate::misc::remove_lifetime_mut; use crate::varint; use crate::wire_format; use crate::zigzag::encode_zig_zag_32; use crate::zigzag::encode_zig_zag_64; use crate::Message; use crate::ProtobufEnum; use crate::ProtobufError; use crate::ProtobufResult; use crate::UnknownFields; use crate::UnknownValueRef; use std::io; use std::io::Write; use std::mem; /// 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; #[doc(hidden)] pub trait WithCodedOutputStream { fn with_coded_output_stream(self, cb: F) -> ProtobufResult where F: FnOnce(&mut CodedOutputStream) -> ProtobufResult; } impl<'a> WithCodedOutputStream for &'a mut (dyn Write + 'a) { fn with_coded_output_stream(self, cb: F) -> ProtobufResult where F: FnOnce(&mut CodedOutputStream) -> ProtobufResult, { let mut os = CodedOutputStream::new(self); let r = cb(&mut os)?; os.flush()?; Ok(r) } } impl<'a> WithCodedOutputStream for &'a mut Vec { fn with_coded_output_stream(mut self, cb: F) -> ProtobufResult where F: FnOnce(&mut CodedOutputStream) -> ProtobufResult, { 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(cb: F) -> ProtobufResult> where F: FnOnce(&mut CodedOutputStream) -> ProtobufResult<()>, { let mut v = Vec::new(); v.with_coded_output_stream(cb)?; Ok(v) } enum OutputTarget<'a> { Write(&'a mut dyn Write, Vec), Vec(&'a mut Vec), 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 dyn 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`. /// /// Caller should call `flush` at the end to guarantee vec contains /// all written data. pub fn vec(vec: &'a mut Vec) -> 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 => { return Err(ProtobufError::IoError(io::Error::new( io::ErrorKind::Other, "given slice is too small to serialize the message", ))); } } 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() { 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::(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::(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(&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(&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(&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(&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 { 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 crate::coded_output_stream::CodedOutputStream; use crate::hex::decode_hex; use crate::hex::encode_hex; use crate::wire_format; use crate::ProtobufResult; use std::io::Write; use std::iter; fn test_write(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 { 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 = iter::repeat("01 02 03 04") .take(2048) .collect::>() .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 { 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); } } } protobuf-2.25.2/src/compiler_plugin.rs000064400000000000000000000025570072674642500161420ustar 00000000000000// TODO: move into separate crate #![doc(hidden)] use crate::descriptor::FileDescriptorProto; use crate::plugin::*; use crate::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, } pub fn plugin_main(gen: F) where F: Fn(&[FileDescriptorProto], &[String]) -> Vec, { plugin_main_2(|r| gen(r.file_descriptors, r.files_to_generate)) } pub fn plugin_main_2(gen: F) where F: Fn(&GenRequest) -> Vec, { let req = CodeGeneratorRequest::parse_from_reader(&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(); } protobuf-2.25.2/src/descriptor.rs000064400000000000000000015245120072674642500151310ustar 00000000000000// This file is generated by rust-protobuf 2.22.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![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(unused_imports)] #![allow(unused_results)] //! Generated file from `google/protobuf/descriptor.proto` #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct FileDescriptorSet { // message fields pub file: crate::RepeatedField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a FileDescriptorSet { fn default() -> &'a FileDescriptorSet { ::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: crate::RepeatedField) { self.file = v; } // Mutable pointer to the field. pub fn mut_file(&mut self) -> &mut crate::RepeatedField { &mut self.file } // Take field pub fn take_file(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.file, crate::RepeatedField::new()) } } impl crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.file)?; }, _ => { crate::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 + crate::rt::compute_raw_varint32_size(len) + len; }; my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { for v in &self.file { os.write_tag(1, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> FileDescriptorSet { FileDescriptorSet::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "file", |m: &FileDescriptorSet| { &m.file }, |m: &mut FileDescriptorSet| { &mut m.file }, )); crate::reflect::MessageDescriptor::new_pb_name::( "FileDescriptorSet", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static FileDescriptorSet { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(FileDescriptorSet::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for FileDescriptorSet { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct FileDescriptorProto { // message fields name: crate::SingularField<::std::string::String>, package: crate::SingularField<::std::string::String>, pub dependency: crate::RepeatedField<::std::string::String>, pub public_dependency: ::std::vec::Vec, pub weak_dependency: ::std::vec::Vec, pub message_type: crate::RepeatedField, pub enum_type: crate::RepeatedField, pub service: crate::RepeatedField, pub extension: crate::RepeatedField, pub options: crate::SingularPtrField, pub source_code_info: crate::SingularPtrField, syntax: crate::SingularField<::std::string::String>, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a FileDescriptorProto { fn default() -> &'a FileDescriptorProto { ::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 = crate::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 = crate::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: crate::RepeatedField<::std::string::String>) { self.dependency = v; } // Mutable pointer to the field. pub fn mut_dependency(&mut self) -> &mut crate::RepeatedField<::std::string::String> { &mut self.dependency } // Take field pub fn take_dependency(&mut self) -> crate::RepeatedField<::std::string::String> { ::std::mem::replace(&mut self.dependency, crate::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) { self.public_dependency = v; } // Mutable pointer to the field. pub fn mut_public_dependency(&mut self) -> &mut ::std::vec::Vec { &mut self.public_dependency } // Take field pub fn take_public_dependency(&mut self) -> ::std::vec::Vec { ::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) { self.weak_dependency = v; } // Mutable pointer to the field. pub fn mut_weak_dependency(&mut self) -> &mut ::std::vec::Vec { &mut self.weak_dependency } // Take field pub fn take_weak_dependency(&mut self) -> ::std::vec::Vec { ::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: crate::RepeatedField) { self.message_type = v; } // Mutable pointer to the field. pub fn mut_message_type(&mut self) -> &mut crate::RepeatedField { &mut self.message_type } // Take field pub fn take_message_type(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.message_type, crate::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: crate::RepeatedField) { self.enum_type = v; } // Mutable pointer to the field. pub fn mut_enum_type(&mut self) -> &mut crate::RepeatedField { &mut self.enum_type } // Take field pub fn take_enum_type(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.enum_type, crate::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: crate::RepeatedField) { self.service = v; } // Mutable pointer to the field. pub fn mut_service(&mut self) -> &mut crate::RepeatedField { &mut self.service } // Take field pub fn take_service(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.service, crate::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: crate::RepeatedField) { self.extension = v; } // Mutable pointer to the field. pub fn mut_extension(&mut self) -> &mut crate::RepeatedField { &mut self.extension } // Take field pub fn take_extension(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.extension, crate::RepeatedField::new()) } // optional .google.protobuf.FileOptions options = 8; pub fn get_options(&self) -> &FileOptions { self.options.as_ref().unwrap_or_else(|| ::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 = crate::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(|| ::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 = crate::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 = crate::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 crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.name)?; }, 2 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.package)?; }, 3 => { crate::rt::read_repeated_string_into(wire_type, is, &mut self.dependency)?; }, 10 => { crate::rt::read_repeated_int32_into(wire_type, is, &mut self.public_dependency)?; }, 11 => { crate::rt::read_repeated_int32_into(wire_type, is, &mut self.weak_dependency)?; }, 4 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.message_type)?; }, 5 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.enum_type)?; }, 6 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.service)?; }, 7 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.extension)?; }, 8 => { crate::rt::read_singular_message_into(wire_type, is, &mut self.options)?; }, 9 => { crate::rt::read_singular_message_into(wire_type, is, &mut self.source_code_info)?; }, 12 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.syntax)?; }, _ => { crate::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 += crate::rt::string_size(1, &v); } if let Some(ref v) = self.package.as_ref() { my_size += crate::rt::string_size(2, &v); } for value in &self.dependency { my_size += crate::rt::string_size(3, &value); }; for value in &self.public_dependency { my_size += crate::rt::value_size(10, *value, crate::wire_format::WireTypeVarint); }; for value in &self.weak_dependency { my_size += crate::rt::value_size(11, *value, crate::wire_format::WireTypeVarint); }; for value in &self.message_type { let len = value.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }; for value in &self.enum_type { let len = value.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }; for value in &self.service { let len = value.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }; for value in &self.extension { let len = value.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }; if let Some(ref v) = self.options.as_ref() { let len = v.compute_size(); my_size += 1 + crate::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 + crate::rt::compute_raw_varint32_size(len) + len; } if let Some(ref v) = self.syntax.as_ref() { my_size += crate::rt::string_size(12, &v); } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::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, crate::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, crate::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, crate::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, crate::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, crate::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, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> FileDescriptorProto { FileDescriptorProto::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "name", |m: &FileDescriptorProto| { &m.name }, |m: &mut FileDescriptorProto| { &mut m.name }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "package", |m: &FileDescriptorProto| { &m.package }, |m: &mut FileDescriptorProto| { &mut m.package }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeString>( "dependency", |m: &FileDescriptorProto| { &m.dependency }, |m: &mut FileDescriptorProto| { &mut m.dependency }, )); fields.push(crate::reflect::accessor::make_vec_accessor::<_, crate::types::ProtobufTypeInt32>( "public_dependency", |m: &FileDescriptorProto| { &m.public_dependency }, |m: &mut FileDescriptorProto| { &mut m.public_dependency }, )); fields.push(crate::reflect::accessor::make_vec_accessor::<_, crate::types::ProtobufTypeInt32>( "weak_dependency", |m: &FileDescriptorProto| { &m.weak_dependency }, |m: &mut FileDescriptorProto| { &mut m.weak_dependency }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "message_type", |m: &FileDescriptorProto| { &m.message_type }, |m: &mut FileDescriptorProto| { &mut m.message_type }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "enum_type", |m: &FileDescriptorProto| { &m.enum_type }, |m: &mut FileDescriptorProto| { &mut m.enum_type }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "service", |m: &FileDescriptorProto| { &m.service }, |m: &mut FileDescriptorProto| { &mut m.service }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "extension", |m: &FileDescriptorProto| { &m.extension }, |m: &mut FileDescriptorProto| { &mut m.extension }, )); fields.push(crate::reflect::accessor::make_singular_ptr_field_accessor::<_, crate::types::ProtobufTypeMessage>( "options", |m: &FileDescriptorProto| { &m.options }, |m: &mut FileDescriptorProto| { &mut m.options }, )); fields.push(crate::reflect::accessor::make_singular_ptr_field_accessor::<_, crate::types::ProtobufTypeMessage>( "source_code_info", |m: &FileDescriptorProto| { &m.source_code_info }, |m: &mut FileDescriptorProto| { &mut m.source_code_info }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "syntax", |m: &FileDescriptorProto| { &m.syntax }, |m: &mut FileDescriptorProto| { &mut m.syntax }, )); crate::reflect::MessageDescriptor::new_pb_name::( "FileDescriptorProto", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static FileDescriptorProto { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(FileDescriptorProto::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for FileDescriptorProto { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct DescriptorProto { // message fields name: crate::SingularField<::std::string::String>, pub field: crate::RepeatedField, pub extension: crate::RepeatedField, pub nested_type: crate::RepeatedField, pub enum_type: crate::RepeatedField, pub extension_range: crate::RepeatedField, pub oneof_decl: crate::RepeatedField, pub options: crate::SingularPtrField, pub reserved_range: crate::RepeatedField, pub reserved_name: crate::RepeatedField<::std::string::String>, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a DescriptorProto { fn default() -> &'a DescriptorProto { ::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 = crate::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: crate::RepeatedField) { self.field = v; } // Mutable pointer to the field. pub fn mut_field(&mut self) -> &mut crate::RepeatedField { &mut self.field } // Take field pub fn take_field(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.field, crate::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: crate::RepeatedField) { self.extension = v; } // Mutable pointer to the field. pub fn mut_extension(&mut self) -> &mut crate::RepeatedField { &mut self.extension } // Take field pub fn take_extension(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.extension, crate::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: crate::RepeatedField) { self.nested_type = v; } // Mutable pointer to the field. pub fn mut_nested_type(&mut self) -> &mut crate::RepeatedField { &mut self.nested_type } // Take field pub fn take_nested_type(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.nested_type, crate::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: crate::RepeatedField) { self.enum_type = v; } // Mutable pointer to the field. pub fn mut_enum_type(&mut self) -> &mut crate::RepeatedField { &mut self.enum_type } // Take field pub fn take_enum_type(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.enum_type, crate::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: crate::RepeatedField) { self.extension_range = v; } // Mutable pointer to the field. pub fn mut_extension_range(&mut self) -> &mut crate::RepeatedField { &mut self.extension_range } // Take field pub fn take_extension_range(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.extension_range, crate::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: crate::RepeatedField) { self.oneof_decl = v; } // Mutable pointer to the field. pub fn mut_oneof_decl(&mut self) -> &mut crate::RepeatedField { &mut self.oneof_decl } // Take field pub fn take_oneof_decl(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.oneof_decl, crate::RepeatedField::new()) } // optional .google.protobuf.MessageOptions options = 7; pub fn get_options(&self) -> &MessageOptions { self.options.as_ref().unwrap_or_else(|| ::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 = crate::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: crate::RepeatedField) { self.reserved_range = v; } // Mutable pointer to the field. pub fn mut_reserved_range(&mut self) -> &mut crate::RepeatedField { &mut self.reserved_range } // Take field pub fn take_reserved_range(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.reserved_range, crate::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: crate::RepeatedField<::std::string::String>) { self.reserved_name = v; } // Mutable pointer to the field. pub fn mut_reserved_name(&mut self) -> &mut crate::RepeatedField<::std::string::String> { &mut self.reserved_name } // Take field pub fn take_reserved_name(&mut self) -> crate::RepeatedField<::std::string::String> { ::std::mem::replace(&mut self.reserved_name, crate::RepeatedField::new()) } } impl crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.name)?; }, 2 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.field)?; }, 6 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.extension)?; }, 3 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.nested_type)?; }, 4 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.enum_type)?; }, 5 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.extension_range)?; }, 8 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.oneof_decl)?; }, 7 => { crate::rt::read_singular_message_into(wire_type, is, &mut self.options)?; }, 9 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.reserved_range)?; }, 10 => { crate::rt::read_repeated_string_into(wire_type, is, &mut self.reserved_name)?; }, _ => { crate::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 += crate::rt::string_size(1, &v); } for value in &self.field { let len = value.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }; for value in &self.extension { let len = value.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }; for value in &self.nested_type { let len = value.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }; for value in &self.enum_type { let len = value.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }; for value in &self.extension_range { let len = value.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }; for value in &self.oneof_decl { let len = value.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }; if let Some(ref v) = self.options.as_ref() { let len = v.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; } for value in &self.reserved_range { let len = value.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }; for value in &self.reserved_name { my_size += crate::rt::string_size(10, &value); }; my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { if let Some(ref v) = self.name.as_ref() { os.write_string(1, &v)?; } for v in &self.field { os.write_tag(2, crate::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, crate::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, crate::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, crate::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, crate::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, crate::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, crate::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, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> DescriptorProto { DescriptorProto::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "name", |m: &DescriptorProto| { &m.name }, |m: &mut DescriptorProto| { &mut m.name }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "field", |m: &DescriptorProto| { &m.field }, |m: &mut DescriptorProto| { &mut m.field }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "extension", |m: &DescriptorProto| { &m.extension }, |m: &mut DescriptorProto| { &mut m.extension }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "nested_type", |m: &DescriptorProto| { &m.nested_type }, |m: &mut DescriptorProto| { &mut m.nested_type }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "enum_type", |m: &DescriptorProto| { &m.enum_type }, |m: &mut DescriptorProto| { &mut m.enum_type }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "extension_range", |m: &DescriptorProto| { &m.extension_range }, |m: &mut DescriptorProto| { &mut m.extension_range }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "oneof_decl", |m: &DescriptorProto| { &m.oneof_decl }, |m: &mut DescriptorProto| { &mut m.oneof_decl }, )); fields.push(crate::reflect::accessor::make_singular_ptr_field_accessor::<_, crate::types::ProtobufTypeMessage>( "options", |m: &DescriptorProto| { &m.options }, |m: &mut DescriptorProto| { &mut m.options }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "reserved_range", |m: &DescriptorProto| { &m.reserved_range }, |m: &mut DescriptorProto| { &mut m.reserved_range }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeString>( "reserved_name", |m: &DescriptorProto| { &m.reserved_name }, |m: &mut DescriptorProto| { &mut m.reserved_name }, )); crate::reflect::MessageDescriptor::new_pb_name::( "DescriptorProto", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static DescriptorProto { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(DescriptorProto::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for DescriptorProto { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct DescriptorProto_ExtensionRange { // message fields start: ::std::option::Option, end: ::std::option::Option, pub options: crate::SingularPtrField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a DescriptorProto_ExtensionRange { fn default() -> &'a DescriptorProto_ExtensionRange { ::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); } // optional .google.protobuf.ExtensionRangeOptions options = 3; pub fn get_options(&self) -> &ExtensionRangeOptions { self.options.as_ref().unwrap_or_else(|| ::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: ExtensionRangeOptions) { self.options = crate::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 ExtensionRangeOptions { if self.options.is_none() { self.options.set_default(); } self.options.as_mut().unwrap() } // Take field pub fn take_options(&mut self) -> ExtensionRangeOptions { self.options.take().unwrap_or_else(|| ExtensionRangeOptions::new()) } } impl crate::Message for DescriptorProto_ExtensionRange { fn is_initialized(&self) -> bool { for v in &self.options { if !v.is_initialized() { return false; } }; true } fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int32()?; self.start = ::std::option::Option::Some(tmp); }, 2 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int32()?; self.end = ::std::option::Option::Some(tmp); }, 3 => { crate::rt::read_singular_message_into(wire_type, is, &mut self.options)?; }, _ => { crate::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 += crate::rt::value_size(1, v, crate::wire_format::WireTypeVarint); } if let Some(v) = self.end { my_size += crate::rt::value_size(2, v, crate::wire_format::WireTypeVarint); } if let Some(ref v) = self.options.as_ref() { let len = v.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { if let Some(v) = self.start { os.write_int32(1, v)?; } if let Some(v) = self.end { os.write_int32(2, v)?; } if let Some(ref v) = self.options.as_ref() { os.write_tag(3, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> DescriptorProto_ExtensionRange { DescriptorProto_ExtensionRange::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeInt32>( "start", |m: &DescriptorProto_ExtensionRange| { &m.start }, |m: &mut DescriptorProto_ExtensionRange| { &mut m.start }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeInt32>( "end", |m: &DescriptorProto_ExtensionRange| { &m.end }, |m: &mut DescriptorProto_ExtensionRange| { &mut m.end }, )); fields.push(crate::reflect::accessor::make_singular_ptr_field_accessor::<_, crate::types::ProtobufTypeMessage>( "options", |m: &DescriptorProto_ExtensionRange| { &m.options }, |m: &mut DescriptorProto_ExtensionRange| { &mut m.options }, )); crate::reflect::MessageDescriptor::new_pb_name::( "DescriptorProto.ExtensionRange", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static DescriptorProto_ExtensionRange { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(DescriptorProto_ExtensionRange::new) } } impl crate::Clear for DescriptorProto_ExtensionRange { fn clear(&mut self) { self.start = ::std::option::Option::None; self.end = ::std::option::Option::None; self.options.clear(); self.unknown_fields.clear(); } } impl ::std::fmt::Debug for DescriptorProto_ExtensionRange { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for DescriptorProto_ExtensionRange { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct DescriptorProto_ReservedRange { // message fields start: ::std::option::Option, end: ::std::option::Option, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a DescriptorProto_ReservedRange { fn default() -> &'a DescriptorProto_ReservedRange { ::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 crate::Message for DescriptorProto_ReservedRange { fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int32()?; self.start = ::std::option::Option::Some(tmp); }, 2 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int32()?; self.end = ::std::option::Option::Some(tmp); }, _ => { crate::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 += crate::rt::value_size(1, v, crate::wire_format::WireTypeVarint); } if let Some(v) = self.end { my_size += crate::rt::value_size(2, v, crate::wire_format::WireTypeVarint); } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> DescriptorProto_ReservedRange { DescriptorProto_ReservedRange::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeInt32>( "start", |m: &DescriptorProto_ReservedRange| { &m.start }, |m: &mut DescriptorProto_ReservedRange| { &mut m.start }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeInt32>( "end", |m: &DescriptorProto_ReservedRange| { &m.end }, |m: &mut DescriptorProto_ReservedRange| { &mut m.end }, )); crate::reflect::MessageDescriptor::new_pb_name::( "DescriptorProto.ReservedRange", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static DescriptorProto_ReservedRange { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(DescriptorProto_ReservedRange::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for DescriptorProto_ReservedRange { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct ExtensionRangeOptions { // message fields pub uninterpreted_option: crate::RepeatedField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a ExtensionRangeOptions { fn default() -> &'a ExtensionRangeOptions { ::default_instance() } } impl ExtensionRangeOptions { pub fn new() -> ExtensionRangeOptions { ::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: crate::RepeatedField) { self.uninterpreted_option = v; } // Mutable pointer to the field. pub fn mut_uninterpreted_option(&mut self) -> &mut crate::RepeatedField { &mut self.uninterpreted_option } // Take field pub fn take_uninterpreted_option(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.uninterpreted_option, crate::RepeatedField::new()) } } impl crate::Message for ExtensionRangeOptions { 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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 999 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.uninterpreted_option)?; }, _ => { crate::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 + crate::rt::compute_raw_varint32_size(len) + len; }; my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { for v in &self.uninterpreted_option { os.write_tag(999, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> ExtensionRangeOptions { ExtensionRangeOptions::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "uninterpreted_option", |m: &ExtensionRangeOptions| { &m.uninterpreted_option }, |m: &mut ExtensionRangeOptions| { &mut m.uninterpreted_option }, )); crate::reflect::MessageDescriptor::new_pb_name::( "ExtensionRangeOptions", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static ExtensionRangeOptions { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(ExtensionRangeOptions::new) } } impl crate::Clear for ExtensionRangeOptions { fn clear(&mut self) { self.uninterpreted_option.clear(); self.unknown_fields.clear(); } } impl ::std::fmt::Debug for ExtensionRangeOptions { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for ExtensionRangeOptions { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct FieldDescriptorProto { // message fields name: crate::SingularField<::std::string::String>, number: ::std::option::Option, label: ::std::option::Option, field_type: ::std::option::Option, type_name: crate::SingularField<::std::string::String>, extendee: crate::SingularField<::std::string::String>, default_value: crate::SingularField<::std::string::String>, oneof_index: ::std::option::Option, json_name: crate::SingularField<::std::string::String>, pub options: crate::SingularPtrField, proto3_optional: ::std::option::Option, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a FieldDescriptorProto { fn default() -> &'a FieldDescriptorProto { ::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 = crate::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 = crate::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 = crate::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 = crate::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 = crate::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(|| ::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 = crate::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()) } // optional bool proto3_optional = 17; pub fn get_proto3_optional(&self) -> bool { self.proto3_optional.unwrap_or(false) } pub fn clear_proto3_optional(&mut self) { self.proto3_optional = ::std::option::Option::None; } pub fn has_proto3_optional(&self) -> bool { self.proto3_optional.is_some() } // Param is passed by value, moved pub fn set_proto3_optional(&mut self, v: bool) { self.proto3_optional = ::std::option::Option::Some(v); } } impl crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.name)?; }, 3 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int32()?; self.number = ::std::option::Option::Some(tmp); }, 4 => { crate::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.label, 4, &mut self.unknown_fields)? }, 5 => { crate::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.field_type, 5, &mut self.unknown_fields)? }, 6 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.type_name)?; }, 2 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.extendee)?; }, 7 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.default_value)?; }, 9 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int32()?; self.oneof_index = ::std::option::Option::Some(tmp); }, 10 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.json_name)?; }, 8 => { crate::rt::read_singular_message_into(wire_type, is, &mut self.options)?; }, 17 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.proto3_optional = ::std::option::Option::Some(tmp); }, _ => { crate::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 += crate::rt::string_size(1, &v); } if let Some(v) = self.number { my_size += crate::rt::value_size(3, v, crate::wire_format::WireTypeVarint); } if let Some(v) = self.label { my_size += crate::rt::enum_size(4, v); } if let Some(v) = self.field_type { my_size += crate::rt::enum_size(5, v); } if let Some(ref v) = self.type_name.as_ref() { my_size += crate::rt::string_size(6, &v); } if let Some(ref v) = self.extendee.as_ref() { my_size += crate::rt::string_size(2, &v); } if let Some(ref v) = self.default_value.as_ref() { my_size += crate::rt::string_size(7, &v); } if let Some(v) = self.oneof_index { my_size += crate::rt::value_size(9, v, crate::wire_format::WireTypeVarint); } if let Some(ref v) = self.json_name.as_ref() { my_size += crate::rt::string_size(10, &v); } if let Some(ref v) = self.options.as_ref() { let len = v.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; } if let Some(v) = self.proto3_optional { my_size += 3; } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::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, crate::ProtobufEnum::value(&v))?; } if let Some(v) = self.field_type { os.write_enum(5, crate::ProtobufEnum::value(&v))?; } 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, crate::wire_format::WireTypeLengthDelimited)?; os.write_raw_varint32(v.get_cached_size())?; v.write_to_with_cached_sizes(os)?; } if let Some(v) = self.proto3_optional { os.write_bool(17, 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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> FieldDescriptorProto { FieldDescriptorProto::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "name", |m: &FieldDescriptorProto| { &m.name }, |m: &mut FieldDescriptorProto| { &mut m.name }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeInt32>( "number", |m: &FieldDescriptorProto| { &m.number }, |m: &mut FieldDescriptorProto| { &mut m.number }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeEnum>( "label", |m: &FieldDescriptorProto| { &m.label }, |m: &mut FieldDescriptorProto| { &mut m.label }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeEnum>( "type", |m: &FieldDescriptorProto| { &m.field_type }, |m: &mut FieldDescriptorProto| { &mut m.field_type }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "type_name", |m: &FieldDescriptorProto| { &m.type_name }, |m: &mut FieldDescriptorProto| { &mut m.type_name }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "extendee", |m: &FieldDescriptorProto| { &m.extendee }, |m: &mut FieldDescriptorProto| { &mut m.extendee }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "default_value", |m: &FieldDescriptorProto| { &m.default_value }, |m: &mut FieldDescriptorProto| { &mut m.default_value }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeInt32>( "oneof_index", |m: &FieldDescriptorProto| { &m.oneof_index }, |m: &mut FieldDescriptorProto| { &mut m.oneof_index }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "json_name", |m: &FieldDescriptorProto| { &m.json_name }, |m: &mut FieldDescriptorProto| { &mut m.json_name }, )); fields.push(crate::reflect::accessor::make_singular_ptr_field_accessor::<_, crate::types::ProtobufTypeMessage>( "options", |m: &FieldDescriptorProto| { &m.options }, |m: &mut FieldDescriptorProto| { &mut m.options }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "proto3_optional", |m: &FieldDescriptorProto| { &m.proto3_optional }, |m: &mut FieldDescriptorProto| { &mut m.proto3_optional }, )); crate::reflect::MessageDescriptor::new_pb_name::( "FieldDescriptorProto", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static FieldDescriptorProto { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(FieldDescriptorProto::new) } } impl crate::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.proto3_optional = ::std::option::Option::None; self.unknown_fields.clear(); } } impl ::std::fmt::Debug for FieldDescriptorProto { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for FieldDescriptorProto { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(Clone,PartialEq,Eq,Debug,Hash)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::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 crate::ProtobufEnum for FieldDescriptorProto_Type { fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { 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 crate::reflect::EnumDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { crate::reflect::EnumDescriptor::new_pb_name::("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 crate::reflect::ProtobufValue for FieldDescriptorProto_Type { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Enum(crate::ProtobufEnum::descriptor(self)) } } #[derive(Clone,PartialEq,Eq,Debug,Hash)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub enum FieldDescriptorProto_Label { LABEL_OPTIONAL = 1, LABEL_REQUIRED = 2, LABEL_REPEATED = 3, } impl crate::ProtobufEnum for FieldDescriptorProto_Label { fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { 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 crate::reflect::EnumDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { crate::reflect::EnumDescriptor::new_pb_name::("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 crate::reflect::ProtobufValue for FieldDescriptorProto_Label { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Enum(crate::ProtobufEnum::descriptor(self)) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct OneofDescriptorProto { // message fields name: crate::SingularField<::std::string::String>, pub options: crate::SingularPtrField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a OneofDescriptorProto { fn default() -> &'a OneofDescriptorProto { ::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 = crate::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(|| ::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 = crate::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 crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.name)?; }, 2 => { crate::rt::read_singular_message_into(wire_type, is, &mut self.options)?; }, _ => { crate::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 += crate::rt::string_size(1, &v); } if let Some(ref v) = self.options.as_ref() { let len = v.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::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, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> OneofDescriptorProto { OneofDescriptorProto::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "name", |m: &OneofDescriptorProto| { &m.name }, |m: &mut OneofDescriptorProto| { &mut m.name }, )); fields.push(crate::reflect::accessor::make_singular_ptr_field_accessor::<_, crate::types::ProtobufTypeMessage>( "options", |m: &OneofDescriptorProto| { &m.options }, |m: &mut OneofDescriptorProto| { &mut m.options }, )); crate::reflect::MessageDescriptor::new_pb_name::( "OneofDescriptorProto", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static OneofDescriptorProto { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(OneofDescriptorProto::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for OneofDescriptorProto { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct EnumDescriptorProto { // message fields name: crate::SingularField<::std::string::String>, pub value: crate::RepeatedField, pub options: crate::SingularPtrField, pub reserved_range: crate::RepeatedField, pub reserved_name: crate::RepeatedField<::std::string::String>, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a EnumDescriptorProto { fn default() -> &'a EnumDescriptorProto { ::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 = crate::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: crate::RepeatedField) { self.value = v; } // Mutable pointer to the field. pub fn mut_value(&mut self) -> &mut crate::RepeatedField { &mut self.value } // Take field pub fn take_value(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.value, crate::RepeatedField::new()) } // optional .google.protobuf.EnumOptions options = 3; pub fn get_options(&self) -> &EnumOptions { self.options.as_ref().unwrap_or_else(|| ::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 = crate::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()) } // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; pub fn get_reserved_range(&self) -> &[EnumDescriptorProto_EnumReservedRange] { &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: crate::RepeatedField) { self.reserved_range = v; } // Mutable pointer to the field. pub fn mut_reserved_range(&mut self) -> &mut crate::RepeatedField { &mut self.reserved_range } // Take field pub fn take_reserved_range(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.reserved_range, crate::RepeatedField::new()) } // repeated string reserved_name = 5; 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: crate::RepeatedField<::std::string::String>) { self.reserved_name = v; } // Mutable pointer to the field. pub fn mut_reserved_name(&mut self) -> &mut crate::RepeatedField<::std::string::String> { &mut self.reserved_name } // Take field pub fn take_reserved_name(&mut self) -> crate::RepeatedField<::std::string::String> { ::std::mem::replace(&mut self.reserved_name, crate::RepeatedField::new()) } } impl crate::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; } }; for v in &self.reserved_range { if !v.is_initialized() { return false; } }; true } fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.name)?; }, 2 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.value)?; }, 3 => { crate::rt::read_singular_message_into(wire_type, is, &mut self.options)?; }, 4 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.reserved_range)?; }, 5 => { crate::rt::read_repeated_string_into(wire_type, is, &mut self.reserved_name)?; }, _ => { crate::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 += crate::rt::string_size(1, &v); } for value in &self.value { let len = value.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }; if let Some(ref v) = self.options.as_ref() { let len = v.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; } for value in &self.reserved_range { let len = value.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }; for value in &self.reserved_name { my_size += crate::rt::string_size(5, &value); }; my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { if let Some(ref v) = self.name.as_ref() { os.write_string(1, &v)?; } for v in &self.value { os.write_tag(2, crate::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, crate::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(4, crate::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(5, &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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> EnumDescriptorProto { EnumDescriptorProto::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "name", |m: &EnumDescriptorProto| { &m.name }, |m: &mut EnumDescriptorProto| { &mut m.name }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "value", |m: &EnumDescriptorProto| { &m.value }, |m: &mut EnumDescriptorProto| { &mut m.value }, )); fields.push(crate::reflect::accessor::make_singular_ptr_field_accessor::<_, crate::types::ProtobufTypeMessage>( "options", |m: &EnumDescriptorProto| { &m.options }, |m: &mut EnumDescriptorProto| { &mut m.options }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "reserved_range", |m: &EnumDescriptorProto| { &m.reserved_range }, |m: &mut EnumDescriptorProto| { &mut m.reserved_range }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeString>( "reserved_name", |m: &EnumDescriptorProto| { &m.reserved_name }, |m: &mut EnumDescriptorProto| { &mut m.reserved_name }, )); crate::reflect::MessageDescriptor::new_pb_name::( "EnumDescriptorProto", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static EnumDescriptorProto { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(EnumDescriptorProto::new) } } impl crate::Clear for EnumDescriptorProto { fn clear(&mut self) { self.name.clear(); self.value.clear(); self.options.clear(); self.reserved_range.clear(); self.reserved_name.clear(); self.unknown_fields.clear(); } } impl ::std::fmt::Debug for EnumDescriptorProto { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for EnumDescriptorProto { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct EnumDescriptorProto_EnumReservedRange { // message fields start: ::std::option::Option, end: ::std::option::Option, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a EnumDescriptorProto_EnumReservedRange { fn default() -> &'a EnumDescriptorProto_EnumReservedRange { ::default_instance() } } impl EnumDescriptorProto_EnumReservedRange { pub fn new() -> EnumDescriptorProto_EnumReservedRange { ::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 crate::Message for EnumDescriptorProto_EnumReservedRange { fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int32()?; self.start = ::std::option::Option::Some(tmp); }, 2 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int32()?; self.end = ::std::option::Option::Some(tmp); }, _ => { crate::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 += crate::rt::value_size(1, v, crate::wire_format::WireTypeVarint); } if let Some(v) = self.end { my_size += crate::rt::value_size(2, v, crate::wire_format::WireTypeVarint); } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> EnumDescriptorProto_EnumReservedRange { EnumDescriptorProto_EnumReservedRange::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeInt32>( "start", |m: &EnumDescriptorProto_EnumReservedRange| { &m.start }, |m: &mut EnumDescriptorProto_EnumReservedRange| { &mut m.start }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeInt32>( "end", |m: &EnumDescriptorProto_EnumReservedRange| { &m.end }, |m: &mut EnumDescriptorProto_EnumReservedRange| { &mut m.end }, )); crate::reflect::MessageDescriptor::new_pb_name::( "EnumDescriptorProto.EnumReservedRange", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static EnumDescriptorProto_EnumReservedRange { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(EnumDescriptorProto_EnumReservedRange::new) } } impl crate::Clear for EnumDescriptorProto_EnumReservedRange { 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 EnumDescriptorProto_EnumReservedRange { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for EnumDescriptorProto_EnumReservedRange { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct EnumValueDescriptorProto { // message fields name: crate::SingularField<::std::string::String>, number: ::std::option::Option, pub options: crate::SingularPtrField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a EnumValueDescriptorProto { fn default() -> &'a EnumValueDescriptorProto { ::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 = crate::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(|| ::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 = crate::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 crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.name)?; }, 2 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int32()?; self.number = ::std::option::Option::Some(tmp); }, 3 => { crate::rt::read_singular_message_into(wire_type, is, &mut self.options)?; }, _ => { crate::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 += crate::rt::string_size(1, &v); } if let Some(v) = self.number { my_size += crate::rt::value_size(2, v, crate::wire_format::WireTypeVarint); } if let Some(ref v) = self.options.as_ref() { let len = v.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::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, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> EnumValueDescriptorProto { EnumValueDescriptorProto::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "name", |m: &EnumValueDescriptorProto| { &m.name }, |m: &mut EnumValueDescriptorProto| { &mut m.name }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeInt32>( "number", |m: &EnumValueDescriptorProto| { &m.number }, |m: &mut EnumValueDescriptorProto| { &mut m.number }, )); fields.push(crate::reflect::accessor::make_singular_ptr_field_accessor::<_, crate::types::ProtobufTypeMessage>( "options", |m: &EnumValueDescriptorProto| { &m.options }, |m: &mut EnumValueDescriptorProto| { &mut m.options }, )); crate::reflect::MessageDescriptor::new_pb_name::( "EnumValueDescriptorProto", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static EnumValueDescriptorProto { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(EnumValueDescriptorProto::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for EnumValueDescriptorProto { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct ServiceDescriptorProto { // message fields name: crate::SingularField<::std::string::String>, pub method: crate::RepeatedField, pub options: crate::SingularPtrField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a ServiceDescriptorProto { fn default() -> &'a ServiceDescriptorProto { ::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 = crate::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: crate::RepeatedField) { self.method = v; } // Mutable pointer to the field. pub fn mut_method(&mut self) -> &mut crate::RepeatedField { &mut self.method } // Take field pub fn take_method(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.method, crate::RepeatedField::new()) } // optional .google.protobuf.ServiceOptions options = 3; pub fn get_options(&self) -> &ServiceOptions { self.options.as_ref().unwrap_or_else(|| ::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 = crate::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 crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.name)?; }, 2 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.method)?; }, 3 => { crate::rt::read_singular_message_into(wire_type, is, &mut self.options)?; }, _ => { crate::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 += crate::rt::string_size(1, &v); } for value in &self.method { let len = value.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }; if let Some(ref v) = self.options.as_ref() { let len = v.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { if let Some(ref v) = self.name.as_ref() { os.write_string(1, &v)?; } for v in &self.method { os.write_tag(2, crate::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, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> ServiceDescriptorProto { ServiceDescriptorProto::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "name", |m: &ServiceDescriptorProto| { &m.name }, |m: &mut ServiceDescriptorProto| { &mut m.name }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "method", |m: &ServiceDescriptorProto| { &m.method }, |m: &mut ServiceDescriptorProto| { &mut m.method }, )); fields.push(crate::reflect::accessor::make_singular_ptr_field_accessor::<_, crate::types::ProtobufTypeMessage>( "options", |m: &ServiceDescriptorProto| { &m.options }, |m: &mut ServiceDescriptorProto| { &mut m.options }, )); crate::reflect::MessageDescriptor::new_pb_name::( "ServiceDescriptorProto", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static ServiceDescriptorProto { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(ServiceDescriptorProto::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for ServiceDescriptorProto { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct MethodDescriptorProto { // message fields name: crate::SingularField<::std::string::String>, input_type: crate::SingularField<::std::string::String>, output_type: crate::SingularField<::std::string::String>, pub options: crate::SingularPtrField, client_streaming: ::std::option::Option, server_streaming: ::std::option::Option, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a MethodDescriptorProto { fn default() -> &'a MethodDescriptorProto { ::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 = crate::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 = crate::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 = crate::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(|| ::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 = crate::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 crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.name)?; }, 2 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.input_type)?; }, 3 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.output_type)?; }, 4 => { crate::rt::read_singular_message_into(wire_type, is, &mut self.options)?; }, 5 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.client_streaming = ::std::option::Option::Some(tmp); }, 6 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.server_streaming = ::std::option::Option::Some(tmp); }, _ => { crate::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 += crate::rt::string_size(1, &v); } if let Some(ref v) = self.input_type.as_ref() { my_size += crate::rt::string_size(2, &v); } if let Some(ref v) = self.output_type.as_ref() { my_size += crate::rt::string_size(3, &v); } if let Some(ref v) = self.options.as_ref() { let len = v.compute_size(); my_size += 1 + crate::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 += crate::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 crate::CodedOutputStream<'_>) -> crate::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, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> MethodDescriptorProto { MethodDescriptorProto::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "name", |m: &MethodDescriptorProto| { &m.name }, |m: &mut MethodDescriptorProto| { &mut m.name }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "input_type", |m: &MethodDescriptorProto| { &m.input_type }, |m: &mut MethodDescriptorProto| { &mut m.input_type }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "output_type", |m: &MethodDescriptorProto| { &m.output_type }, |m: &mut MethodDescriptorProto| { &mut m.output_type }, )); fields.push(crate::reflect::accessor::make_singular_ptr_field_accessor::<_, crate::types::ProtobufTypeMessage>( "options", |m: &MethodDescriptorProto| { &m.options }, |m: &mut MethodDescriptorProto| { &mut m.options }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "client_streaming", |m: &MethodDescriptorProto| { &m.client_streaming }, |m: &mut MethodDescriptorProto| { &mut m.client_streaming }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "server_streaming", |m: &MethodDescriptorProto| { &m.server_streaming }, |m: &mut MethodDescriptorProto| { &mut m.server_streaming }, )); crate::reflect::MessageDescriptor::new_pb_name::( "MethodDescriptorProto", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static MethodDescriptorProto { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(MethodDescriptorProto::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for MethodDescriptorProto { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct FileOptions { // message fields java_package: crate::SingularField<::std::string::String>, java_outer_classname: crate::SingularField<::std::string::String>, java_multiple_files: ::std::option::Option, java_generate_equals_and_hash: ::std::option::Option, java_string_check_utf8: ::std::option::Option, optimize_for: ::std::option::Option, go_package: crate::SingularField<::std::string::String>, cc_generic_services: ::std::option::Option, java_generic_services: ::std::option::Option, py_generic_services: ::std::option::Option, php_generic_services: ::std::option::Option, deprecated: ::std::option::Option, cc_enable_arenas: ::std::option::Option, objc_class_prefix: crate::SingularField<::std::string::String>, csharp_namespace: crate::SingularField<::std::string::String>, swift_prefix: crate::SingularField<::std::string::String>, php_class_prefix: crate::SingularField<::std::string::String>, php_namespace: crate::SingularField<::std::string::String>, php_metadata_namespace: crate::SingularField<::std::string::String>, ruby_package: crate::SingularField<::std::string::String>, pub uninterpreted_option: crate::RepeatedField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a FileOptions { fn default() -> &'a FileOptions { ::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 = crate::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 = crate::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 = crate::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 php_generic_services = 42; pub fn get_php_generic_services(&self) -> bool { self.php_generic_services.unwrap_or(false) } pub fn clear_php_generic_services(&mut self) { self.php_generic_services = ::std::option::Option::None; } pub fn has_php_generic_services(&self) -> bool { self.php_generic_services.is_some() } // Param is passed by value, moved pub fn set_php_generic_services(&mut self, v: bool) { self.php_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(true) } 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 = crate::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 = crate::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()) } // optional string swift_prefix = 39; pub fn get_swift_prefix(&self) -> &str { match self.swift_prefix.as_ref() { Some(v) => &v, None => "", } } pub fn clear_swift_prefix(&mut self) { self.swift_prefix.clear(); } pub fn has_swift_prefix(&self) -> bool { self.swift_prefix.is_some() } // Param is passed by value, moved pub fn set_swift_prefix(&mut self, v: ::std::string::String) { self.swift_prefix = crate::SingularField::some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_swift_prefix(&mut self) -> &mut ::std::string::String { if self.swift_prefix.is_none() { self.swift_prefix.set_default(); } self.swift_prefix.as_mut().unwrap() } // Take field pub fn take_swift_prefix(&mut self) -> ::std::string::String { self.swift_prefix.take().unwrap_or_else(|| ::std::string::String::new()) } // optional string php_class_prefix = 40; pub fn get_php_class_prefix(&self) -> &str { match self.php_class_prefix.as_ref() { Some(v) => &v, None => "", } } pub fn clear_php_class_prefix(&mut self) { self.php_class_prefix.clear(); } pub fn has_php_class_prefix(&self) -> bool { self.php_class_prefix.is_some() } // Param is passed by value, moved pub fn set_php_class_prefix(&mut self, v: ::std::string::String) { self.php_class_prefix = crate::SingularField::some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_php_class_prefix(&mut self) -> &mut ::std::string::String { if self.php_class_prefix.is_none() { self.php_class_prefix.set_default(); } self.php_class_prefix.as_mut().unwrap() } // Take field pub fn take_php_class_prefix(&mut self) -> ::std::string::String { self.php_class_prefix.take().unwrap_or_else(|| ::std::string::String::new()) } // optional string php_namespace = 41; pub fn get_php_namespace(&self) -> &str { match self.php_namespace.as_ref() { Some(v) => &v, None => "", } } pub fn clear_php_namespace(&mut self) { self.php_namespace.clear(); } pub fn has_php_namespace(&self) -> bool { self.php_namespace.is_some() } // Param is passed by value, moved pub fn set_php_namespace(&mut self, v: ::std::string::String) { self.php_namespace = crate::SingularField::some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_php_namespace(&mut self) -> &mut ::std::string::String { if self.php_namespace.is_none() { self.php_namespace.set_default(); } self.php_namespace.as_mut().unwrap() } // Take field pub fn take_php_namespace(&mut self) -> ::std::string::String { self.php_namespace.take().unwrap_or_else(|| ::std::string::String::new()) } // optional string php_metadata_namespace = 44; pub fn get_php_metadata_namespace(&self) -> &str { match self.php_metadata_namespace.as_ref() { Some(v) => &v, None => "", } } pub fn clear_php_metadata_namespace(&mut self) { self.php_metadata_namespace.clear(); } pub fn has_php_metadata_namespace(&self) -> bool { self.php_metadata_namespace.is_some() } // Param is passed by value, moved pub fn set_php_metadata_namespace(&mut self, v: ::std::string::String) { self.php_metadata_namespace = crate::SingularField::some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_php_metadata_namespace(&mut self) -> &mut ::std::string::String { if self.php_metadata_namespace.is_none() { self.php_metadata_namespace.set_default(); } self.php_metadata_namespace.as_mut().unwrap() } // Take field pub fn take_php_metadata_namespace(&mut self) -> ::std::string::String { self.php_metadata_namespace.take().unwrap_or_else(|| ::std::string::String::new()) } // optional string ruby_package = 45; pub fn get_ruby_package(&self) -> &str { match self.ruby_package.as_ref() { Some(v) => &v, None => "", } } pub fn clear_ruby_package(&mut self) { self.ruby_package.clear(); } pub fn has_ruby_package(&self) -> bool { self.ruby_package.is_some() } // Param is passed by value, moved pub fn set_ruby_package(&mut self, v: ::std::string::String) { self.ruby_package = crate::SingularField::some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_ruby_package(&mut self) -> &mut ::std::string::String { if self.ruby_package.is_none() { self.ruby_package.set_default(); } self.ruby_package.as_mut().unwrap() } // Take field pub fn take_ruby_package(&mut self) -> ::std::string::String { self.ruby_package.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: crate::RepeatedField) { self.uninterpreted_option = v; } // Mutable pointer to the field. pub fn mut_uninterpreted_option(&mut self) -> &mut crate::RepeatedField { &mut self.uninterpreted_option } // Take field pub fn take_uninterpreted_option(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.uninterpreted_option, crate::RepeatedField::new()) } } impl crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.java_package)?; }, 8 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.java_outer_classname)?; }, 10 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.java_multiple_files = ::std::option::Option::Some(tmp); }, 20 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::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 != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.java_string_check_utf8 = ::std::option::Option::Some(tmp); }, 9 => { crate::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.optimize_for, 9, &mut self.unknown_fields)? }, 11 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.go_package)?; }, 16 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.cc_generic_services = ::std::option::Option::Some(tmp); }, 17 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.java_generic_services = ::std::option::Option::Some(tmp); }, 18 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.py_generic_services = ::std::option::Option::Some(tmp); }, 42 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.php_generic_services = ::std::option::Option::Some(tmp); }, 23 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.deprecated = ::std::option::Option::Some(tmp); }, 31 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.cc_enable_arenas = ::std::option::Option::Some(tmp); }, 36 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.objc_class_prefix)?; }, 37 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.csharp_namespace)?; }, 39 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.swift_prefix)?; }, 40 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.php_class_prefix)?; }, 41 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.php_namespace)?; }, 44 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.php_metadata_namespace)?; }, 45 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.ruby_package)?; }, 999 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.uninterpreted_option)?; }, _ => { crate::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 += crate::rt::string_size(1, &v); } if let Some(ref v) = self.java_outer_classname.as_ref() { my_size += crate::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 += crate::rt::enum_size(9, v); } if let Some(ref v) = self.go_package.as_ref() { my_size += crate::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.php_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 += crate::rt::string_size(36, &v); } if let Some(ref v) = self.csharp_namespace.as_ref() { my_size += crate::rt::string_size(37, &v); } if let Some(ref v) = self.swift_prefix.as_ref() { my_size += crate::rt::string_size(39, &v); } if let Some(ref v) = self.php_class_prefix.as_ref() { my_size += crate::rt::string_size(40, &v); } if let Some(ref v) = self.php_namespace.as_ref() { my_size += crate::rt::string_size(41, &v); } if let Some(ref v) = self.php_metadata_namespace.as_ref() { my_size += crate::rt::string_size(44, &v); } if let Some(ref v) = self.ruby_package.as_ref() { my_size += crate::rt::string_size(45, &v); } for value in &self.uninterpreted_option { let len = value.compute_size(); my_size += 2 + crate::rt::compute_raw_varint32_size(len) + len; }; my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::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, crate::ProtobufEnum::value(&v))?; } 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.php_generic_services { os.write_bool(42, 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)?; } if let Some(ref v) = self.swift_prefix.as_ref() { os.write_string(39, &v)?; } if let Some(ref v) = self.php_class_prefix.as_ref() { os.write_string(40, &v)?; } if let Some(ref v) = self.php_namespace.as_ref() { os.write_string(41, &v)?; } if let Some(ref v) = self.php_metadata_namespace.as_ref() { os.write_string(44, &v)?; } if let Some(ref v) = self.ruby_package.as_ref() { os.write_string(45, &v)?; } for v in &self.uninterpreted_option { os.write_tag(999, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> FileOptions { FileOptions::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "java_package", |m: &FileOptions| { &m.java_package }, |m: &mut FileOptions| { &mut m.java_package }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "java_outer_classname", |m: &FileOptions| { &m.java_outer_classname }, |m: &mut FileOptions| { &mut m.java_outer_classname }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "java_multiple_files", |m: &FileOptions| { &m.java_multiple_files }, |m: &mut FileOptions| { &mut m.java_multiple_files }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::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(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "java_string_check_utf8", |m: &FileOptions| { &m.java_string_check_utf8 }, |m: &mut FileOptions| { &mut m.java_string_check_utf8 }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeEnum>( "optimize_for", |m: &FileOptions| { &m.optimize_for }, |m: &mut FileOptions| { &mut m.optimize_for }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "go_package", |m: &FileOptions| { &m.go_package }, |m: &mut FileOptions| { &mut m.go_package }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "cc_generic_services", |m: &FileOptions| { &m.cc_generic_services }, |m: &mut FileOptions| { &mut m.cc_generic_services }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "java_generic_services", |m: &FileOptions| { &m.java_generic_services }, |m: &mut FileOptions| { &mut m.java_generic_services }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "py_generic_services", |m: &FileOptions| { &m.py_generic_services }, |m: &mut FileOptions| { &mut m.py_generic_services }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "php_generic_services", |m: &FileOptions| { &m.php_generic_services }, |m: &mut FileOptions| { &mut m.php_generic_services }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "deprecated", |m: &FileOptions| { &m.deprecated }, |m: &mut FileOptions| { &mut m.deprecated }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "cc_enable_arenas", |m: &FileOptions| { &m.cc_enable_arenas }, |m: &mut FileOptions| { &mut m.cc_enable_arenas }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "objc_class_prefix", |m: &FileOptions| { &m.objc_class_prefix }, |m: &mut FileOptions| { &mut m.objc_class_prefix }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "csharp_namespace", |m: &FileOptions| { &m.csharp_namespace }, |m: &mut FileOptions| { &mut m.csharp_namespace }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "swift_prefix", |m: &FileOptions| { &m.swift_prefix }, |m: &mut FileOptions| { &mut m.swift_prefix }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "php_class_prefix", |m: &FileOptions| { &m.php_class_prefix }, |m: &mut FileOptions| { &mut m.php_class_prefix }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "php_namespace", |m: &FileOptions| { &m.php_namespace }, |m: &mut FileOptions| { &mut m.php_namespace }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "php_metadata_namespace", |m: &FileOptions| { &m.php_metadata_namespace }, |m: &mut FileOptions| { &mut m.php_metadata_namespace }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "ruby_package", |m: &FileOptions| { &m.ruby_package }, |m: &mut FileOptions| { &mut m.ruby_package }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "uninterpreted_option", |m: &FileOptions| { &m.uninterpreted_option }, |m: &mut FileOptions| { &mut m.uninterpreted_option }, )); crate::reflect::MessageDescriptor::new_pb_name::( "FileOptions", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static FileOptions { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(FileOptions::new) } } impl crate::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.php_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.swift_prefix.clear(); self.php_class_prefix.clear(); self.php_namespace.clear(); self.php_metadata_namespace.clear(); self.ruby_package.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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for FileOptions { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(Clone,PartialEq,Eq,Debug,Hash)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub enum FileOptions_OptimizeMode { SPEED = 1, CODE_SIZE = 2, LITE_RUNTIME = 3, } impl crate::ProtobufEnum for FileOptions_OptimizeMode { fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { 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 crate::reflect::EnumDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { crate::reflect::EnumDescriptor::new_pb_name::("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 crate::reflect::ProtobufValue for FileOptions_OptimizeMode { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Enum(crate::ProtobufEnum::descriptor(self)) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct MessageOptions { // message fields message_set_wire_format: ::std::option::Option, no_standard_descriptor_accessor: ::std::option::Option, deprecated: ::std::option::Option, map_entry: ::std::option::Option, pub uninterpreted_option: crate::RepeatedField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a MessageOptions { fn default() -> &'a MessageOptions { ::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: crate::RepeatedField) { self.uninterpreted_option = v; } // Mutable pointer to the field. pub fn mut_uninterpreted_option(&mut self) -> &mut crate::RepeatedField { &mut self.uninterpreted_option } // Take field pub fn take_uninterpreted_option(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.uninterpreted_option, crate::RepeatedField::new()) } } impl crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::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 != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::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 != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.deprecated = ::std::option::Option::Some(tmp); }, 7 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.map_entry = ::std::option::Option::Some(tmp); }, 999 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.uninterpreted_option)?; }, _ => { crate::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 + crate::rt::compute_raw_varint32_size(len) + len; }; my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::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, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> MessageOptions { MessageOptions::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "message_set_wire_format", |m: &MessageOptions| { &m.message_set_wire_format }, |m: &mut MessageOptions| { &mut m.message_set_wire_format }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "no_standard_descriptor_accessor", |m: &MessageOptions| { &m.no_standard_descriptor_accessor }, |m: &mut MessageOptions| { &mut m.no_standard_descriptor_accessor }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "deprecated", |m: &MessageOptions| { &m.deprecated }, |m: &mut MessageOptions| { &mut m.deprecated }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "map_entry", |m: &MessageOptions| { &m.map_entry }, |m: &mut MessageOptions| { &mut m.map_entry }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "uninterpreted_option", |m: &MessageOptions| { &m.uninterpreted_option }, |m: &mut MessageOptions| { &mut m.uninterpreted_option }, )); crate::reflect::MessageDescriptor::new_pb_name::( "MessageOptions", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static MessageOptions { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(MessageOptions::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for MessageOptions { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct FieldOptions { // message fields ctype: ::std::option::Option, packed: ::std::option::Option, jstype: ::std::option::Option, lazy: ::std::option::Option, deprecated: ::std::option::Option, weak: ::std::option::Option, pub uninterpreted_option: crate::RepeatedField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a FieldOptions { fn default() -> &'a FieldOptions { ::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: crate::RepeatedField) { self.uninterpreted_option = v; } // Mutable pointer to the field. pub fn mut_uninterpreted_option(&mut self) -> &mut crate::RepeatedField { &mut self.uninterpreted_option } // Take field pub fn take_uninterpreted_option(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.uninterpreted_option, crate::RepeatedField::new()) } } impl crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.ctype, 1, &mut self.unknown_fields)? }, 2 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.packed = ::std::option::Option::Some(tmp); }, 6 => { crate::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.jstype, 6, &mut self.unknown_fields)? }, 5 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.lazy = ::std::option::Option::Some(tmp); }, 3 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.deprecated = ::std::option::Option::Some(tmp); }, 10 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.weak = ::std::option::Option::Some(tmp); }, 999 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.uninterpreted_option)?; }, _ => { crate::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 += crate::rt::enum_size(1, v); } if let Some(v) = self.packed { my_size += 2; } if let Some(v) = self.jstype { my_size += crate::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 + crate::rt::compute_raw_varint32_size(len) + len; }; my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { if let Some(v) = self.ctype { os.write_enum(1, crate::ProtobufEnum::value(&v))?; } if let Some(v) = self.packed { os.write_bool(2, v)?; } if let Some(v) = self.jstype { os.write_enum(6, crate::ProtobufEnum::value(&v))?; } 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, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> FieldOptions { FieldOptions::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeEnum>( "ctype", |m: &FieldOptions| { &m.ctype }, |m: &mut FieldOptions| { &mut m.ctype }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "packed", |m: &FieldOptions| { &m.packed }, |m: &mut FieldOptions| { &mut m.packed }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeEnum>( "jstype", |m: &FieldOptions| { &m.jstype }, |m: &mut FieldOptions| { &mut m.jstype }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "lazy", |m: &FieldOptions| { &m.lazy }, |m: &mut FieldOptions| { &mut m.lazy }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "deprecated", |m: &FieldOptions| { &m.deprecated }, |m: &mut FieldOptions| { &mut m.deprecated }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "weak", |m: &FieldOptions| { &m.weak }, |m: &mut FieldOptions| { &mut m.weak }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "uninterpreted_option", |m: &FieldOptions| { &m.uninterpreted_option }, |m: &mut FieldOptions| { &mut m.uninterpreted_option }, )); crate::reflect::MessageDescriptor::new_pb_name::( "FieldOptions", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static FieldOptions { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(FieldOptions::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for FieldOptions { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(Clone,PartialEq,Eq,Debug,Hash)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub enum FieldOptions_CType { STRING = 0, CORD = 1, STRING_PIECE = 2, } impl crate::ProtobufEnum for FieldOptions_CType { fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { 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 crate::reflect::EnumDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { crate::reflect::EnumDescriptor::new_pb_name::("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 crate::reflect::ProtobufValue for FieldOptions_CType { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Enum(crate::ProtobufEnum::descriptor(self)) } } #[derive(Clone,PartialEq,Eq,Debug,Hash)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub enum FieldOptions_JSType { JS_NORMAL = 0, JS_STRING = 1, JS_NUMBER = 2, } impl crate::ProtobufEnum for FieldOptions_JSType { fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { 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 crate::reflect::EnumDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { crate::reflect::EnumDescriptor::new_pb_name::("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 crate::reflect::ProtobufValue for FieldOptions_JSType { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Enum(crate::ProtobufEnum::descriptor(self)) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct OneofOptions { // message fields pub uninterpreted_option: crate::RepeatedField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a OneofOptions { fn default() -> &'a OneofOptions { ::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: crate::RepeatedField) { self.uninterpreted_option = v; } // Mutable pointer to the field. pub fn mut_uninterpreted_option(&mut self) -> &mut crate::RepeatedField { &mut self.uninterpreted_option } // Take field pub fn take_uninterpreted_option(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.uninterpreted_option, crate::RepeatedField::new()) } } impl crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 999 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.uninterpreted_option)?; }, _ => { crate::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 + crate::rt::compute_raw_varint32_size(len) + len; }; my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { for v in &self.uninterpreted_option { os.write_tag(999, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> OneofOptions { OneofOptions::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "uninterpreted_option", |m: &OneofOptions| { &m.uninterpreted_option }, |m: &mut OneofOptions| { &mut m.uninterpreted_option }, )); crate::reflect::MessageDescriptor::new_pb_name::( "OneofOptions", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static OneofOptions { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(OneofOptions::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for OneofOptions { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct EnumOptions { // message fields allow_alias: ::std::option::Option, deprecated: ::std::option::Option, pub uninterpreted_option: crate::RepeatedField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a EnumOptions { fn default() -> &'a EnumOptions { ::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: crate::RepeatedField) { self.uninterpreted_option = v; } // Mutable pointer to the field. pub fn mut_uninterpreted_option(&mut self) -> &mut crate::RepeatedField { &mut self.uninterpreted_option } // Take field pub fn take_uninterpreted_option(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.uninterpreted_option, crate::RepeatedField::new()) } } impl crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 2 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.allow_alias = ::std::option::Option::Some(tmp); }, 3 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.deprecated = ::std::option::Option::Some(tmp); }, 999 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.uninterpreted_option)?; }, _ => { crate::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 + crate::rt::compute_raw_varint32_size(len) + len; }; my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::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, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> EnumOptions { EnumOptions::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "allow_alias", |m: &EnumOptions| { &m.allow_alias }, |m: &mut EnumOptions| { &mut m.allow_alias }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "deprecated", |m: &EnumOptions| { &m.deprecated }, |m: &mut EnumOptions| { &mut m.deprecated }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "uninterpreted_option", |m: &EnumOptions| { &m.uninterpreted_option }, |m: &mut EnumOptions| { &mut m.uninterpreted_option }, )); crate::reflect::MessageDescriptor::new_pb_name::( "EnumOptions", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static EnumOptions { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(EnumOptions::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for EnumOptions { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct EnumValueOptions { // message fields deprecated: ::std::option::Option, pub uninterpreted_option: crate::RepeatedField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a EnumValueOptions { fn default() -> &'a EnumValueOptions { ::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: crate::RepeatedField) { self.uninterpreted_option = v; } // Mutable pointer to the field. pub fn mut_uninterpreted_option(&mut self) -> &mut crate::RepeatedField { &mut self.uninterpreted_option } // Take field pub fn take_uninterpreted_option(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.uninterpreted_option, crate::RepeatedField::new()) } } impl crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.deprecated = ::std::option::Option::Some(tmp); }, 999 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.uninterpreted_option)?; }, _ => { crate::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 + crate::rt::compute_raw_varint32_size(len) + len; }; my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { if let Some(v) = self.deprecated { os.write_bool(1, v)?; } for v in &self.uninterpreted_option { os.write_tag(999, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> EnumValueOptions { EnumValueOptions::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "deprecated", |m: &EnumValueOptions| { &m.deprecated }, |m: &mut EnumValueOptions| { &mut m.deprecated }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "uninterpreted_option", |m: &EnumValueOptions| { &m.uninterpreted_option }, |m: &mut EnumValueOptions| { &mut m.uninterpreted_option }, )); crate::reflect::MessageDescriptor::new_pb_name::( "EnumValueOptions", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static EnumValueOptions { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(EnumValueOptions::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for EnumValueOptions { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct ServiceOptions { // message fields deprecated: ::std::option::Option, pub uninterpreted_option: crate::RepeatedField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a ServiceOptions { fn default() -> &'a ServiceOptions { ::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: crate::RepeatedField) { self.uninterpreted_option = v; } // Mutable pointer to the field. pub fn mut_uninterpreted_option(&mut self) -> &mut crate::RepeatedField { &mut self.uninterpreted_option } // Take field pub fn take_uninterpreted_option(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.uninterpreted_option, crate::RepeatedField::new()) } } impl crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 33 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.deprecated = ::std::option::Option::Some(tmp); }, 999 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.uninterpreted_option)?; }, _ => { crate::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 + crate::rt::compute_raw_varint32_size(len) + len; }; my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { if let Some(v) = self.deprecated { os.write_bool(33, v)?; } for v in &self.uninterpreted_option { os.write_tag(999, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> ServiceOptions { ServiceOptions::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "deprecated", |m: &ServiceOptions| { &m.deprecated }, |m: &mut ServiceOptions| { &mut m.deprecated }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "uninterpreted_option", |m: &ServiceOptions| { &m.uninterpreted_option }, |m: &mut ServiceOptions| { &mut m.uninterpreted_option }, )); crate::reflect::MessageDescriptor::new_pb_name::( "ServiceOptions", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static ServiceOptions { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(ServiceOptions::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for ServiceOptions { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct MethodOptions { // message fields deprecated: ::std::option::Option, idempotency_level: ::std::option::Option, pub uninterpreted_option: crate::RepeatedField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a MethodOptions { fn default() -> &'a MethodOptions { ::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); } // optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34; pub fn get_idempotency_level(&self) -> MethodOptions_IdempotencyLevel { self.idempotency_level.unwrap_or(MethodOptions_IdempotencyLevel::IDEMPOTENCY_UNKNOWN) } pub fn clear_idempotency_level(&mut self) { self.idempotency_level = ::std::option::Option::None; } pub fn has_idempotency_level(&self) -> bool { self.idempotency_level.is_some() } // Param is passed by value, moved pub fn set_idempotency_level(&mut self, v: MethodOptions_IdempotencyLevel) { self.idempotency_level = ::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: crate::RepeatedField) { self.uninterpreted_option = v; } // Mutable pointer to the field. pub fn mut_uninterpreted_option(&mut self) -> &mut crate::RepeatedField { &mut self.uninterpreted_option } // Take field pub fn take_uninterpreted_option(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.uninterpreted_option, crate::RepeatedField::new()) } } impl crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 33 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.deprecated = ::std::option::Option::Some(tmp); }, 34 => { crate::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.idempotency_level, 34, &mut self.unknown_fields)? }, 999 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.uninterpreted_option)?; }, _ => { crate::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; } if let Some(v) = self.idempotency_level { my_size += crate::rt::enum_size(34, v); } for value in &self.uninterpreted_option { let len = value.compute_size(); my_size += 2 + crate::rt::compute_raw_varint32_size(len) + len; }; my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { if let Some(v) = self.deprecated { os.write_bool(33, v)?; } if let Some(v) = self.idempotency_level { os.write_enum(34, crate::ProtobufEnum::value(&v))?; } for v in &self.uninterpreted_option { os.write_tag(999, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> MethodOptions { MethodOptions::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "deprecated", |m: &MethodOptions| { &m.deprecated }, |m: &mut MethodOptions| { &mut m.deprecated }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeEnum>( "idempotency_level", |m: &MethodOptions| { &m.idempotency_level }, |m: &mut MethodOptions| { &mut m.idempotency_level }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "uninterpreted_option", |m: &MethodOptions| { &m.uninterpreted_option }, |m: &mut MethodOptions| { &mut m.uninterpreted_option }, )); crate::reflect::MessageDescriptor::new_pb_name::( "MethodOptions", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static MethodOptions { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(MethodOptions::new) } } impl crate::Clear for MethodOptions { fn clear(&mut self) { self.deprecated = ::std::option::Option::None; self.idempotency_level = ::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for MethodOptions { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(Clone,PartialEq,Eq,Debug,Hash)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub enum MethodOptions_IdempotencyLevel { IDEMPOTENCY_UNKNOWN = 0, NO_SIDE_EFFECTS = 1, IDEMPOTENT = 2, } impl crate::ProtobufEnum for MethodOptions_IdempotencyLevel { fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { match value { 0 => ::std::option::Option::Some(MethodOptions_IdempotencyLevel::IDEMPOTENCY_UNKNOWN), 1 => ::std::option::Option::Some(MethodOptions_IdempotencyLevel::NO_SIDE_EFFECTS), 2 => ::std::option::Option::Some(MethodOptions_IdempotencyLevel::IDEMPOTENT), _ => ::std::option::Option::None } } fn values() -> &'static [Self] { static values: &'static [MethodOptions_IdempotencyLevel] = &[ MethodOptions_IdempotencyLevel::IDEMPOTENCY_UNKNOWN, MethodOptions_IdempotencyLevel::NO_SIDE_EFFECTS, MethodOptions_IdempotencyLevel::IDEMPOTENT, ]; values } fn enum_descriptor_static() -> &'static crate::reflect::EnumDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { crate::reflect::EnumDescriptor::new_pb_name::("MethodOptions.IdempotencyLevel", file_descriptor_proto()) }) } } impl ::std::marker::Copy for MethodOptions_IdempotencyLevel { } impl ::std::default::Default for MethodOptions_IdempotencyLevel { fn default() -> Self { MethodOptions_IdempotencyLevel::IDEMPOTENCY_UNKNOWN } } impl crate::reflect::ProtobufValue for MethodOptions_IdempotencyLevel { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Enum(crate::ProtobufEnum::descriptor(self)) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct UninterpretedOption { // message fields pub name: crate::RepeatedField, identifier_value: crate::SingularField<::std::string::String>, positive_int_value: ::std::option::Option, negative_int_value: ::std::option::Option, double_value: ::std::option::Option, string_value: crate::SingularField<::std::vec::Vec>, aggregate_value: crate::SingularField<::std::string::String>, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a UninterpretedOption { fn default() -> &'a UninterpretedOption { ::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: crate::RepeatedField) { self.name = v; } // Mutable pointer to the field. pub fn mut_name(&mut self) -> &mut crate::RepeatedField { &mut self.name } // Take field pub fn take_name(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.name, crate::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 = crate::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) { self.string_value = crate::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 { 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 { 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 = crate::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 crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 2 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.name)?; }, 3 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.identifier_value)?; }, 4 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_uint64()?; self.positive_int_value = ::std::option::Option::Some(tmp); }, 5 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int64()?; self.negative_int_value = ::std::option::Option::Some(tmp); }, 6 => { if wire_type != crate::wire_format::WireTypeFixed64 { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_double()?; self.double_value = ::std::option::Option::Some(tmp); }, 7 => { crate::rt::read_singular_bytes_into(wire_type, is, &mut self.string_value)?; }, 8 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.aggregate_value)?; }, _ => { crate::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 + crate::rt::compute_raw_varint32_size(len) + len; }; if let Some(ref v) = self.identifier_value.as_ref() { my_size += crate::rt::string_size(3, &v); } if let Some(v) = self.positive_int_value { my_size += crate::rt::value_size(4, v, crate::wire_format::WireTypeVarint); } if let Some(v) = self.negative_int_value { my_size += crate::rt::value_size(5, v, crate::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 += crate::rt::bytes_size(7, &v); } if let Some(ref v) = self.aggregate_value.as_ref() { my_size += crate::rt::string_size(8, &v); } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { for v in &self.name { os.write_tag(2, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> UninterpretedOption { UninterpretedOption::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "name", |m: &UninterpretedOption| { &m.name }, |m: &mut UninterpretedOption| { &mut m.name }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "identifier_value", |m: &UninterpretedOption| { &m.identifier_value }, |m: &mut UninterpretedOption| { &mut m.identifier_value }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeUint64>( "positive_int_value", |m: &UninterpretedOption| { &m.positive_int_value }, |m: &mut UninterpretedOption| { &mut m.positive_int_value }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeInt64>( "negative_int_value", |m: &UninterpretedOption| { &m.negative_int_value }, |m: &mut UninterpretedOption| { &mut m.negative_int_value }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeDouble>( "double_value", |m: &UninterpretedOption| { &m.double_value }, |m: &mut UninterpretedOption| { &mut m.double_value }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeBytes>( "string_value", |m: &UninterpretedOption| { &m.string_value }, |m: &mut UninterpretedOption| { &mut m.string_value }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "aggregate_value", |m: &UninterpretedOption| { &m.aggregate_value }, |m: &mut UninterpretedOption| { &mut m.aggregate_value }, )); crate::reflect::MessageDescriptor::new_pb_name::( "UninterpretedOption", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static UninterpretedOption { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(UninterpretedOption::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for UninterpretedOption { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct UninterpretedOption_NamePart { // message fields name_part: crate::SingularField<::std::string::String>, is_extension: ::std::option::Option, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a UninterpretedOption_NamePart { fn default() -> &'a UninterpretedOption_NamePart { ::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 = crate::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 crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.name_part)?; }, 2 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.is_extension = ::std::option::Option::Some(tmp); }, _ => { crate::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 += crate::rt::string_size(1, &v); } if let Some(v) = self.is_extension { my_size += 2; } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> UninterpretedOption_NamePart { UninterpretedOption_NamePart::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "name_part", |m: &UninterpretedOption_NamePart| { &m.name_part }, |m: &mut UninterpretedOption_NamePart| { &mut m.name_part }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeBool>( "is_extension", |m: &UninterpretedOption_NamePart| { &m.is_extension }, |m: &mut UninterpretedOption_NamePart| { &mut m.is_extension }, )); crate::reflect::MessageDescriptor::new_pb_name::( "UninterpretedOption.NamePart", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static UninterpretedOption_NamePart { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(UninterpretedOption_NamePart::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for UninterpretedOption_NamePart { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct SourceCodeInfo { // message fields pub location: crate::RepeatedField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a SourceCodeInfo { fn default() -> &'a SourceCodeInfo { ::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: crate::RepeatedField) { self.location = v; } // Mutable pointer to the field. pub fn mut_location(&mut self) -> &mut crate::RepeatedField { &mut self.location } // Take field pub fn take_location(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.location, crate::RepeatedField::new()) } } impl crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.location)?; }, _ => { crate::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 + crate::rt::compute_raw_varint32_size(len) + len; }; my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { for v in &self.location { os.write_tag(1, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> SourceCodeInfo { SourceCodeInfo::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "location", |m: &SourceCodeInfo| { &m.location }, |m: &mut SourceCodeInfo| { &mut m.location }, )); crate::reflect::MessageDescriptor::new_pb_name::( "SourceCodeInfo", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static SourceCodeInfo { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(SourceCodeInfo::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for SourceCodeInfo { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct SourceCodeInfo_Location { // message fields pub path: ::std::vec::Vec, pub span: ::std::vec::Vec, leading_comments: crate::SingularField<::std::string::String>, trailing_comments: crate::SingularField<::std::string::String>, pub leading_detached_comments: crate::RepeatedField<::std::string::String>, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a SourceCodeInfo_Location { fn default() -> &'a SourceCodeInfo_Location { ::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) { self.path = v; } // Mutable pointer to the field. pub fn mut_path(&mut self) -> &mut ::std::vec::Vec { &mut self.path } // Take field pub fn take_path(&mut self) -> ::std::vec::Vec { ::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) { self.span = v; } // Mutable pointer to the field. pub fn mut_span(&mut self) -> &mut ::std::vec::Vec { &mut self.span } // Take field pub fn take_span(&mut self) -> ::std::vec::Vec { ::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 = crate::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 = crate::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: crate::RepeatedField<::std::string::String>) { self.leading_detached_comments = v; } // Mutable pointer to the field. pub fn mut_leading_detached_comments(&mut self) -> &mut crate::RepeatedField<::std::string::String> { &mut self.leading_detached_comments } // Take field pub fn take_leading_detached_comments(&mut self) -> crate::RepeatedField<::std::string::String> { ::std::mem::replace(&mut self.leading_detached_comments, crate::RepeatedField::new()) } } impl crate::Message for SourceCodeInfo_Location { fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_repeated_int32_into(wire_type, is, &mut self.path)?; }, 2 => { crate::rt::read_repeated_int32_into(wire_type, is, &mut self.span)?; }, 3 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.leading_comments)?; }, 4 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.trailing_comments)?; }, 6 => { crate::rt::read_repeated_string_into(wire_type, is, &mut self.leading_detached_comments)?; }, _ => { crate::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 += crate::rt::vec_packed_varint_size(1, &self.path); } if !self.span.is_empty() { my_size += crate::rt::vec_packed_varint_size(2, &self.span); } if let Some(ref v) = self.leading_comments.as_ref() { my_size += crate::rt::string_size(3, &v); } if let Some(ref v) = self.trailing_comments.as_ref() { my_size += crate::rt::string_size(4, &v); } for value in &self.leading_detached_comments { my_size += crate::rt::string_size(6, &value); }; my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { if !self.path.is_empty() { os.write_tag(1, crate::wire_format::WireTypeLengthDelimited)?; // TODO: Data size is computed again, it should be cached os.write_raw_varint32(crate::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, crate::wire_format::WireTypeLengthDelimited)?; // TODO: Data size is computed again, it should be cached os.write_raw_varint32(crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> SourceCodeInfo_Location { SourceCodeInfo_Location::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_vec_accessor::<_, crate::types::ProtobufTypeInt32>( "path", |m: &SourceCodeInfo_Location| { &m.path }, |m: &mut SourceCodeInfo_Location| { &mut m.path }, )); fields.push(crate::reflect::accessor::make_vec_accessor::<_, crate::types::ProtobufTypeInt32>( "span", |m: &SourceCodeInfo_Location| { &m.span }, |m: &mut SourceCodeInfo_Location| { &mut m.span }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "leading_comments", |m: &SourceCodeInfo_Location| { &m.leading_comments }, |m: &mut SourceCodeInfo_Location| { &mut m.leading_comments }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "trailing_comments", |m: &SourceCodeInfo_Location| { &m.trailing_comments }, |m: &mut SourceCodeInfo_Location| { &mut m.trailing_comments }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeString>( "leading_detached_comments", |m: &SourceCodeInfo_Location| { &m.leading_detached_comments }, |m: &mut SourceCodeInfo_Location| { &mut m.leading_detached_comments }, )); crate::reflect::MessageDescriptor::new_pb_name::( "SourceCodeInfo.Location", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static SourceCodeInfo_Location { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(SourceCodeInfo_Location::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for SourceCodeInfo_Location { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct GeneratedCodeInfo { // message fields pub annotation: crate::RepeatedField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a GeneratedCodeInfo { fn default() -> &'a GeneratedCodeInfo { ::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: crate::RepeatedField) { self.annotation = v; } // Mutable pointer to the field. pub fn mut_annotation(&mut self) -> &mut crate::RepeatedField { &mut self.annotation } // Take field pub fn take_annotation(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.annotation, crate::RepeatedField::new()) } } impl crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.annotation)?; }, _ => { crate::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 + crate::rt::compute_raw_varint32_size(len) + len; }; my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { for v in &self.annotation { os.write_tag(1, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> GeneratedCodeInfo { GeneratedCodeInfo::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "annotation", |m: &GeneratedCodeInfo| { &m.annotation }, |m: &mut GeneratedCodeInfo| { &mut m.annotation }, )); crate::reflect::MessageDescriptor::new_pb_name::( "GeneratedCodeInfo", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static GeneratedCodeInfo { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(GeneratedCodeInfo::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for GeneratedCodeInfo { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct GeneratedCodeInfo_Annotation { // message fields pub path: ::std::vec::Vec, source_file: crate::SingularField<::std::string::String>, begin: ::std::option::Option, end: ::std::option::Option, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a GeneratedCodeInfo_Annotation { fn default() -> &'a GeneratedCodeInfo_Annotation { ::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) { self.path = v; } // Mutable pointer to the field. pub fn mut_path(&mut self) -> &mut ::std::vec::Vec { &mut self.path } // Take field pub fn take_path(&mut self) -> ::std::vec::Vec { ::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 = crate::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 crate::Message for GeneratedCodeInfo_Annotation { fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_repeated_int32_into(wire_type, is, &mut self.path)?; }, 2 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.source_file)?; }, 3 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int32()?; self.begin = ::std::option::Option::Some(tmp); }, 4 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int32()?; self.end = ::std::option::Option::Some(tmp); }, _ => { crate::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 += crate::rt::vec_packed_varint_size(1, &self.path); } if let Some(ref v) = self.source_file.as_ref() { my_size += crate::rt::string_size(2, &v); } if let Some(v) = self.begin { my_size += crate::rt::value_size(3, v, crate::wire_format::WireTypeVarint); } if let Some(v) = self.end { my_size += crate::rt::value_size(4, v, crate::wire_format::WireTypeVarint); } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { if !self.path.is_empty() { os.write_tag(1, crate::wire_format::WireTypeLengthDelimited)?; // TODO: Data size is computed again, it should be cached os.write_raw_varint32(crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> GeneratedCodeInfo_Annotation { GeneratedCodeInfo_Annotation::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_vec_accessor::<_, crate::types::ProtobufTypeInt32>( "path", |m: &GeneratedCodeInfo_Annotation| { &m.path }, |m: &mut GeneratedCodeInfo_Annotation| { &mut m.path }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "source_file", |m: &GeneratedCodeInfo_Annotation| { &m.source_file }, |m: &mut GeneratedCodeInfo_Annotation| { &mut m.source_file }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeInt32>( "begin", |m: &GeneratedCodeInfo_Annotation| { &m.begin }, |m: &mut GeneratedCodeInfo_Annotation| { &mut m.begin }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeInt32>( "end", |m: &GeneratedCodeInfo_Annotation| { &m.end }, |m: &mut GeneratedCodeInfo_Annotation| { &mut m.end }, )); crate::reflect::MessageDescriptor::new_pb_name::( "GeneratedCodeInfo.Annotation", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static GeneratedCodeInfo_Annotation { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(GeneratedCodeInfo_Annotation::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for GeneratedCodeInfo_Annotation { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::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\"\xb9\x06\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\x1az\n\x0e\ ExtensionRange\x12\x14\n\x05start\x18\x01\x20\x01(\x05R\x05start\x12\x10\ \n\x03end\x18\x02\x20\x01(\x05R\x03end\x12@\n\x07options\x18\x03\x20\x01\ (\x0b2&.google.protobuf.ExtensionRangeOptionsR\x07options\x1a7\n\rReserv\ edRange\x12\x14\n\x05start\x18\x01\x20\x01(\x05R\x05start\x12\x10\n\x03e\ nd\x18\x02\x20\x01(\x05R\x03end\"|\n\x15ExtensionRangeOptions\x12X\n\x14\ uninterpreted_option\x18\xe7\x07\x20\x03(\x0b2$.google.protobuf.Uninterp\ retedOptionR\x13uninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\ \x02\"\xc1\x06\n\x14FieldDescriptorProto\x12\x12\n\x04name\x18\x01\x20\ \x01(\tR\x04name\x12\x16\n\x06number\x18\x03\x20\x01(\x05R\x06number\x12\ A\n\x05label\x18\x04\x20\x01(\x0e2+.google.protobuf.FieldDescriptorProto\ .LabelR\x05label\x12>\n\x04type\x18\x05\x20\x01(\x0e2*.google.protobuf.F\ ieldDescriptorProto.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\x0b\ oneof_index\x18\t\x20\x01(\x05R\noneofIndex\x12\x1b\n\tjson_name\x18\n\ \x20\x01(\tR\x08jsonName\x127\n\x07options\x18\x08\x20\x01(\x0b2\x1d.goo\ gle.protobuf.FieldOptionsR\x07options\x12'\n\x0fproto3_optional\x18\x11\ \x20\x01(\x08R\x0eproto3Optional\"\xb6\x02\n\x04Type\x12\x0f\n\x0bTYPE_D\ OUBLE\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_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_BYTES\x10\x0c\ \x12\x0f\n\x0bTYPE_UINT32\x10\r\x12\r\n\tTYPE_ENUM\x10\x0e\x12\x11\n\rTY\ PE_SFIXED32\x10\x0f\x12\x11\n\rTYPE_SFIXED64\x10\x10\x12\x0f\n\x0bTYPE_S\ INT32\x10\x11\x12\x0f\n\x0bTYPE_SINT64\x10\x12\"C\n\x05Label\x12\x12\n\ \x0eLABEL_OPTIONAL\x10\x01\x12\x12\n\x0eLABEL_REQUIRED\x10\x02\x12\x12\n\ \x0eLABEL_REPEATED\x10\x03\"c\n\x14OneofDescriptorProto\x12\x12\n\x04nam\ e\x18\x01\x20\x01(\tR\x04name\x127\n\x07options\x18\x02\x20\x01(\x0b2\ \x1d.google.protobuf.OneofOptionsR\x07options\"\xe3\x02\n\x13EnumDescrip\ torProto\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x12?\n\x05value\ \x18\x02\x20\x03(\x0b2).google.protobuf.EnumValueDescriptorProtoR\x05val\ ue\x126\n\x07options\x18\x03\x20\x01(\x0b2\x1c.google.protobuf.EnumOptio\ nsR\x07options\x12]\n\x0ereserved_range\x18\x04\x20\x03(\x0b26.google.pr\ otobuf.EnumDescriptorProto.EnumReservedRangeR\rreservedRange\x12#\n\rres\ erved_name\x18\x05\x20\x03(\tR\x0creservedName\x1a;\n\x11EnumReservedRan\ ge\x12\x14\n\x05start\x18\x01\x20\x01(\x05R\x05start\x12\x10\n\x03end\ \x18\x02\x20\x01(\x05R\x03end\"\x83\x01\n\x18EnumValueDescriptorProto\ \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\"\x91\t\n\x0bFileOptions\x12!\n\x0cjava_packag\ e\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_generate_\ equals_and_hash\x18\x14\x20\x01(\x08R\x19javaGenerateEqualsAndHashB\x02\ \x18\x01\x12:\n\x16java_string_check_utf8\x18\x1b\x20\x01(\x08:\x05false\ R\x13javaStringCheckUtf8\x12S\n\x0coptimize_for\x18\t\x20\x01(\x0e2).goo\ gle.protobuf.FileOptions.OptimizeMode:\x05SPEEDR\x0boptimizeFor\x12\x1d\ \n\ngo_package\x18\x0b\x20\x01(\tR\tgoPackage\x125\n\x13cc_generic_servi\ ces\x18\x10\x20\x01(\x08:\x05falseR\x11ccGenericServices\x129\n\x15java_\ generic_services\x18\x11\x20\x01(\x08:\x05falseR\x13javaGenericServices\ \x125\n\x13py_generic_services\x18\x12\x20\x01(\x08:\x05falseR\x11pyGene\ ricServices\x127\n\x14php_generic_services\x18*\x20\x01(\x08:\x05falseR\ \x12phpGenericServices\x12%\n\ndeprecated\x18\x17\x20\x01(\x08:\x05false\ R\ndeprecated\x12.\n\x10cc_enable_arenas\x18\x1f\x20\x01(\x08:\x04trueR\ \x0eccEnableArenas\x12*\n\x11objc_class_prefix\x18$\x20\x01(\tR\x0fobjcC\ lassPrefix\x12)\n\x10csharp_namespace\x18%\x20\x01(\tR\x0fcsharpNamespac\ e\x12!\n\x0cswift_prefix\x18'\x20\x01(\tR\x0bswiftPrefix\x12(\n\x10php_c\ lass_prefix\x18(\x20\x01(\tR\x0ephpClassPrefix\x12#\n\rphp_namespace\x18\ )\x20\x01(\tR\x0cphpNamespace\x124\n\x16php_metadata_namespace\x18,\x20\ \x01(\tR\x14phpMetadataNamespace\x12!\n\x0cruby_package\x18-\x20\x01(\tR\ \x0brubyPackage\x12X\n\x14uninterpreted_option\x18\xe7\x07\x20\x03(\x0b2\ $.google.protobuf.UninterpretedOptionR\x13uninterpretedOption\":\n\x0cOp\ timizeMode\x12\t\n\x05SPEED\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\x02J\x04\x08\ &\x10'\"\xd1\x02\n\x0eMessageOptions\x12<\n\x17message_set_wire_format\ \x18\x01\x20\x01(\x08:\x05falseR\x14messageSetWireFormat\x12L\n\x1fno_st\ andard_descriptor_accessor\x18\x02\x20\x01(\x08:\x05falseR\x1cnoStandard\ DescriptorAccessor\x12%\n\ndeprecated\x18\x03\x20\x01(\x08:\x05falseR\nd\ eprecated\x12\x1b\n\tmap_entry\x18\x07\x20\x01(\x08R\x08mapEntry\x12X\n\ \x14uninterpreted_option\x18\xe7\x07\x20\x03(\x0b2$.google.protobuf.Unin\ terpretedOptionR\x13uninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\ \x80\x02J\x04\x08\x08\x10\tJ\x04\x08\t\x10\n\"\xe2\x03\n\x0cFieldOptions\ \x12A\n\x05ctype\x18\x01\x20\x01(\x0e2#.google.protobuf.FieldOptions.CTy\ pe:\x06STRINGR\x05ctype\x12\x16\n\x06packed\x18\x02\x20\x01(\x08R\x06pac\ ked\x12G\n\x06jstype\x18\x06\x20\x01(\x0e2$.google.protobuf.FieldOptions\ .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\x02J\x04\x08\x04\ \x10\x05\"s\n\x0cOneofOptions\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\"\xc0\x01\n\x0bEnumOptions\ \x12\x1f\n\x0ballow_alias\x18\x02\x20\x01(\x08R\nallowAlias\x12%\n\ndepr\ ecated\x18\x03\x20\x01(\x08:\x05falseR\ndeprecated\x12X\n\x14uninterpret\ ed_option\x18\xe7\x07\x20\x03(\x0b2$.google.protobuf.UninterpretedOption\ R\x13uninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02J\x04\x08\ \x05\x10\x06\"\x9e\x01\n\x10EnumValueOptions\x12%\n\ndeprecated\x18\x01\ \x20\x01(\x08:\x05falseR\ndeprecated\x12X\n\x14uninterpreted_option\x18\ \xe7\x07\x20\x03(\x0b2$.google.protobuf.UninterpretedOptionR\x13uninterp\ retedOption*\t\x08\xe8\x07\x10\x80\x80\x80\x80\x02\"\x9c\x01\n\x0eServic\ eOptions\x12%\n\ndeprecated\x18!\x20\x01(\x08:\x05falseR\ndeprecated\x12\ X\n\x14uninterpreted_option\x18\xe7\x07\x20\x03(\x0b2$.google.protobuf.U\ ninterpretedOptionR\x13uninterpretedOption*\t\x08\xe8\x07\x10\x80\x80\ \x80\x80\x02\"\xe0\x02\n\rMethodOptions\x12%\n\ndeprecated\x18!\x20\x01(\ \x08:\x05falseR\ndeprecated\x12q\n\x11idempotency_level\x18\"\x20\x01(\ \x0e2/.google.protobuf.MethodOptions.IdempotencyLevel:\x13IDEMPOTENCY_UN\ KNOWNR\x10idempotencyLevel\x12X\n\x14uninterpreted_option\x18\xe7\x07\ \x20\x03(\x0b2$.google.protobuf.UninterpretedOptionR\x13uninterpretedOpt\ ion\"P\n\x10IdempotencyLevel\x12\x17\n\x13IDEMPOTENCY_UNKNOWN\x10\0\x12\ \x13\n\x0fNO_SIDE_EFFECTS\x10\x01\x12\x0e\n\nIDEMPOTENT\x10\x02*\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.Na\ mePartR\x04name\x12)\n\x10identifier_value\x18\x03\x20\x01(\tR\x0fidenti\ fierValue\x12,\n\x12positive_int_value\x18\x04\x20\x01(\x04R\x10positive\ IntValue\x12,\n\x12negative_int_value\x18\x05\x20\x01(\x03R\x10negativeI\ ntValue\x12!\n\x0cdouble_value\x18\x06\x20\x01(\x01R\x0bdoubleValue\x12!\ \n\x0cstring_value\x18\x07\x20\x01(\x0cR\x0bstringValue\x12'\n\x0faggreg\ ate_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.Loc\ ationR\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(\t\ R\x0fleadingComments\x12+\n\x11trailing_comments\x18\x04\x20\x01(\tR\x10\ trailingComments\x12:\n\x19leading_detached_comments\x18\x06\x20\x03(\tR\ \x17leadingDetachedComments\"\xd1\x01\n\x11GeneratedCodeInfo\x12M\n\nann\ otation\x18\x01\x20\x03(\x0b2-.google.protobuf.GeneratedCodeInfo.Annotat\ ionR\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\x03endB~\n\x13com.google.protobufB\x10Desc\ riptorProtosH\x01Z-google.golang.org/protobuf/types/descriptorpb\xf8\x01\ \x01\xa2\x02\x03GPB\xaa\x02\x1aGoogle.Protobuf.ReflectionJ\xbc\xc8\x02\n\ \x07\x12\x05'\0\x8c\x07\x01\n\xaa\x0f\n\x01\x0c\x12\x03'\0\x122\xc1\x0c\ \x20Protocol\x20Buffers\x20-\x20Google's\x20data\x20interchange\x20forma\ t\n\x20Copyright\x202008\x20Google\x20Inc.\x20\x20All\x20rights\x20reser\ ved.\n\x20https://developers.google.com/protocol-buffers/\n\n\x20Redistr\ ibution\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.\n2\xdb\x02\x20Author:\x20kenton@google.com\x20(Kenton\x20Varda)\n\ \x20\x20Based\x20on\x20original\x20Protocol\x20Buffers\x20design\x20by\n\ \x20\x20Sanjay\x20Ghemawat,\x20Jeff\x20Dean,\x20and\x20others.\n\n\x20Th\ e\x20messages\x20in\x20this\x20file\x20describe\x20the\x20definitions\ \x20found\x20in\x20.proto\x20files.\n\x20A\x20valid\x20.proto\x20file\ \x20can\x20be\x20translated\x20directly\x20to\x20a\x20FileDescriptorProt\ o\n\x20without\x20any\x20other\x20information\x20(e.g.\x20without\x20rea\ ding\x20its\x20imports).\n\n\x08\n\x01\x02\x12\x03)\0\x18\n\x08\n\x01\ \x08\x12\x03+\0D\n\t\n\x02\x08\x0b\x12\x03+\0D\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\x030\0\x1f\n\t\n\x02\x08\x1f\x12\x030\0\x1f\n\x08\n\x01\x08\x12\ \x034\0\x1c\n\x7f\n\x02\x08\t\x12\x034\0\x1c\x1at\x20descriptor.proto\ \x20must\x20be\x20optimized\x20for\x20speed\x20because\x20reflection-bas\ ed\n\x20algorithms\x20don't\x20work\x20during\x20bootstrapping.\n\nj\n\ \x02\x04\0\x12\x048\0:\x01\x1a^\x20The\x20protocol\x20compiler\x20can\ \x20output\x20a\x20FileDescriptorSet\x20containing\x20the\x20.proto\n\ \x20files\x20it\x20parses.\n\n\n\n\x03\x04\0\x01\x12\x038\x08\x19\n\x0b\ \n\x04\x04\0\x02\0\x12\x039\x02(\n\x0c\n\x05\x04\0\x02\0\x04\x12\x039\ \x02\n\n\x0c\n\x05\x04\0\x02\0\x06\x12\x039\x0b\x1e\n\x0c\n\x05\x04\0\ \x02\0\x01\x12\x039\x1f#\n\x0c\n\x05\x04\0\x02\0\x03\x12\x039&'\n/\n\x02\ \x04\x01\x12\x04=\0Z\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\x03B\x02!\x1a'\x20Names\x20of\x20files\x20im\ ported\x20by\x20this\x20file.\n\n\x0c\n\x05\x04\x01\x02\x02\x04\x12\x03B\ \x02\n\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03B\x0b\x11\n\x0c\n\x05\x04\ \x01\x02\x02\x01\x12\x03B\x12\x1c\n\x0c\n\x05\x04\x01\x02\x02\x03\x12\ \x03B\x1f\x20\nQ\n\x04\x04\x01\x02\x03\x12\x03D\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\x03D\x02\n\n\x0c\n\ \x05\x04\x01\x02\x03\x05\x12\x03D\x0b\x10\n\x0c\n\x05\x04\x01\x02\x03\ \x01\x12\x03D\x11\"\n\x0c\n\x05\x04\x01\x02\x03\x03\x12\x03D%'\nz\n\x04\ \x04\x01\x02\x04\x12\x03G\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\x03G\x02\n\n\x0c\n\x05\x04\x01\x02\x04\x05\x12\x03G\ \x0b\x10\n\x0c\n\x05\x04\x01\x02\x04\x01\x12\x03G\x11\x20\n\x0c\n\x05\ \x04\x01\x02\x04\x03\x12\x03G#%\n6\n\x04\x04\x01\x02\x05\x12\x03J\x02,\ \x1a)\x20All\x20top-level\x20definitions\x20in\x20this\x20file.\n\n\x0c\ \n\x05\x04\x01\x02\x05\x04\x12\x03J\x02\n\n\x0c\n\x05\x04\x01\x02\x05\ \x06\x12\x03J\x0b\x1a\n\x0c\n\x05\x04\x01\x02\x05\x01\x12\x03J\x1b'\n\ \x0c\n\x05\x04\x01\x02\x05\x03\x12\x03J*+\n\x0b\n\x04\x04\x01\x02\x06\ \x12\x03K\x02-\n\x0c\n\x05\x04\x01\x02\x06\x04\x12\x03K\x02\n\n\x0c\n\ \x05\x04\x01\x02\x06\x06\x12\x03K\x0b\x1e\n\x0c\n\x05\x04\x01\x02\x06\ \x01\x12\x03K\x1f(\n\x0c\n\x05\x04\x01\x02\x06\x03\x12\x03K+,\n\x0b\n\ \x04\x04\x01\x02\x07\x12\x03L\x02.\n\x0c\n\x05\x04\x01\x02\x07\x04\x12\ \x03L\x02\n\n\x0c\n\x05\x04\x01\x02\x07\x06\x12\x03L\x0b!\n\x0c\n\x05\ \x04\x01\x02\x07\x01\x12\x03L\")\n\x0c\n\x05\x04\x01\x02\x07\x03\x12\x03\ L,-\n\x0b\n\x04\x04\x01\x02\x08\x12\x03M\x02.\n\x0c\n\x05\x04\x01\x02\ \x08\x04\x12\x03M\x02\n\n\x0c\n\x05\x04\x01\x02\x08\x06\x12\x03M\x0b\x1f\ \n\x0c\n\x05\x04\x01\x02\x08\x01\x12\x03M\x20)\n\x0c\n\x05\x04\x01\x02\ \x08\x03\x12\x03M,-\n\x0b\n\x04\x04\x01\x02\t\x12\x03O\x02#\n\x0c\n\x05\ \x04\x01\x02\t\x04\x12\x03O\x02\n\n\x0c\n\x05\x04\x01\x02\t\x06\x12\x03O\ \x0b\x16\n\x0c\n\x05\x04\x01\x02\t\x01\x12\x03O\x17\x1e\n\x0c\n\x05\x04\ \x01\x02\t\x03\x12\x03O!\"\n\xf4\x01\n\x04\x04\x01\x02\n\x12\x03U\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\x03U\x02\n\n\x0c\n\x05\x04\x01\x02\n\x06\x12\x03U\ \x0b\x19\n\x0c\n\x05\x04\x01\x02\n\x01\x12\x03U\x1a*\n\x0c\n\x05\x04\x01\ \x02\n\x03\x12\x03U-.\n]\n\x04\x04\x01\x02\x0b\x12\x03Y\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\x03Y\x02\n\n\x0c\n\x05\x04\x01\x02\x0b\x05\x12\x03Y\x0b\ \x11\n\x0c\n\x05\x04\x01\x02\x0b\x01\x12\x03Y\x12\x18\n\x0c\n\x05\x04\ \x01\x02\x0b\x03\x12\x03Y\x1b\x1d\n'\n\x02\x04\x02\x12\x04]\0}\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\x03a\x02.\n\x0c\n\x05\x04\x02\x02\x02\x04\x12\x03a\x02\n\n\x0c\n\ \x05\x04\x02\x02\x02\x06\x12\x03a\x0b\x1f\n\x0c\n\x05\x04\x02\x02\x02\ \x01\x12\x03a\x20)\n\x0c\n\x05\x04\x02\x02\x02\x03\x12\x03a,-\n\x0b\n\ \x04\x04\x02\x02\x03\x12\x03c\x02+\n\x0c\n\x05\x04\x02\x02\x03\x04\x12\ \x03c\x02\n\n\x0c\n\x05\x04\x02\x02\x03\x06\x12\x03c\x0b\x1a\n\x0c\n\x05\ \x04\x02\x02\x03\x01\x12\x03c\x1b&\n\x0c\n\x05\x04\x02\x02\x03\x03\x12\ \x03c)*\n\x0b\n\x04\x04\x02\x02\x04\x12\x03d\x02-\n\x0c\n\x05\x04\x02\ \x02\x04\x04\x12\x03d\x02\n\n\x0c\n\x05\x04\x02\x02\x04\x06\x12\x03d\x0b\ \x1e\n\x0c\n\x05\x04\x02\x02\x04\x01\x12\x03d\x1f(\n\x0c\n\x05\x04\x02\ \x02\x04\x03\x12\x03d+,\n\x0c\n\x04\x04\x02\x03\0\x12\x04f\x02k\x03\n\ \x0c\n\x05\x04\x02\x03\0\x01\x12\x03f\n\x18\n\x1b\n\x06\x04\x02\x03\0\ \x02\0\x12\x03g\x04\x1d\"\x0c\x20Inclusive.\n\n\x0e\n\x07\x04\x02\x03\0\ \x02\0\x04\x12\x03g\x04\x0c\n\x0e\n\x07\x04\x02\x03\0\x02\0\x05\x12\x03g\ \r\x12\n\x0e\n\x07\x04\x02\x03\0\x02\0\x01\x12\x03g\x13\x18\n\x0e\n\x07\ \x04\x02\x03\0\x02\0\x03\x12\x03g\x1b\x1c\n\x1b\n\x06\x04\x02\x03\0\x02\ \x01\x12\x03h\x04\x1b\"\x0c\x20Exclusive.\n\n\x0e\n\x07\x04\x02\x03\0\ \x02\x01\x04\x12\x03h\x04\x0c\n\x0e\n\x07\x04\x02\x03\0\x02\x01\x05\x12\ \x03h\r\x12\n\x0e\n\x07\x04\x02\x03\0\x02\x01\x01\x12\x03h\x13\x16\n\x0e\ \n\x07\x04\x02\x03\0\x02\x01\x03\x12\x03h\x19\x1a\n\r\n\x06\x04\x02\x03\ \0\x02\x02\x12\x03j\x04/\n\x0e\n\x07\x04\x02\x03\0\x02\x02\x04\x12\x03j\ \x04\x0c\n\x0e\n\x07\x04\x02\x03\0\x02\x02\x06\x12\x03j\r\"\n\x0e\n\x07\ \x04\x02\x03\0\x02\x02\x01\x12\x03j#*\n\x0e\n\x07\x04\x02\x03\0\x02\x02\ \x03\x12\x03j-.\n\x0b\n\x04\x04\x02\x02\x05\x12\x03l\x02.\n\x0c\n\x05\ \x04\x02\x02\x05\x04\x12\x03l\x02\n\n\x0c\n\x05\x04\x02\x02\x05\x06\x12\ \x03l\x0b\x19\n\x0c\n\x05\x04\x02\x02\x05\x01\x12\x03l\x1a)\n\x0c\n\x05\ \x04\x02\x02\x05\x03\x12\x03l,-\n\x0b\n\x04\x04\x02\x02\x06\x12\x03n\x02\ /\n\x0c\n\x05\x04\x02\x02\x06\x04\x12\x03n\x02\n\n\x0c\n\x05\x04\x02\x02\ \x06\x06\x12\x03n\x0b\x1f\n\x0c\n\x05\x04\x02\x02\x06\x01\x12\x03n\x20*\ \n\x0c\n\x05\x04\x02\x02\x06\x03\x12\x03n-.\n\x0b\n\x04\x04\x02\x02\x07\ \x12\x03p\x02&\n\x0c\n\x05\x04\x02\x02\x07\x04\x12\x03p\x02\n\n\x0c\n\ \x05\x04\x02\x02\x07\x06\x12\x03p\x0b\x19\n\x0c\n\x05\x04\x02\x02\x07\ \x01\x12\x03p\x1a!\n\x0c\n\x05\x04\x02\x02\x07\x03\x12\x03p$%\n\xaa\x01\ \n\x04\x04\x02\x03\x01\x12\x04u\x02x\x03\x1a\x9b\x01\x20Range\x20of\x20r\ eserved\x20tag\x20numbers.\x20Reserved\x20tag\x20numbers\x20may\x20not\ \x20be\x20used\x20by\n\x20fields\x20or\x20extension\x20ranges\x20in\x20t\ he\x20same\x20message.\x20Reserved\x20ranges\x20may\n\x20not\x20overlap.\ \n\n\x0c\n\x05\x04\x02\x03\x01\x01\x12\x03u\n\x17\n\x1b\n\x06\x04\x02\ \x03\x01\x02\0\x12\x03v\x04\x1d\"\x0c\x20Inclusive.\n\n\x0e\n\x07\x04\ \x02\x03\x01\x02\0\x04\x12\x03v\x04\x0c\n\x0e\n\x07\x04\x02\x03\x01\x02\ \0\x05\x12\x03v\r\x12\n\x0e\n\x07\x04\x02\x03\x01\x02\0\x01\x12\x03v\x13\ \x18\n\x0e\n\x07\x04\x02\x03\x01\x02\0\x03\x12\x03v\x1b\x1c\n\x1b\n\x06\ \x04\x02\x03\x01\x02\x01\x12\x03w\x04\x1b\"\x0c\x20Exclusive.\n\n\x0e\n\ \x07\x04\x02\x03\x01\x02\x01\x04\x12\x03w\x04\x0c\n\x0e\n\x07\x04\x02\ \x03\x01\x02\x01\x05\x12\x03w\r\x12\n\x0e\n\x07\x04\x02\x03\x01\x02\x01\ \x01\x12\x03w\x13\x16\n\x0e\n\x07\x04\x02\x03\x01\x02\x01\x03\x12\x03w\ \x19\x1a\n\x0b\n\x04\x04\x02\x02\x08\x12\x03y\x02,\n\x0c\n\x05\x04\x02\ \x02\x08\x04\x12\x03y\x02\n\n\x0c\n\x05\x04\x02\x02\x08\x06\x12\x03y\x0b\ \x18\n\x0c\n\x05\x04\x02\x02\x08\x01\x12\x03y\x19'\n\x0c\n\x05\x04\x02\ \x02\x08\x03\x12\x03y*+\n\x82\x01\n\x04\x04\x02\x02\t\x12\x03|\x02%\x1au\ \x20Reserved\x20field\x20names,\x20which\x20may\x20not\x20be\x20used\x20\ by\x20fields\x20in\x20the\x20same\x20message.\n\x20A\x20given\x20name\ \x20may\x20only\x20be\x20reserved\x20once.\n\n\x0c\n\x05\x04\x02\x02\t\ \x04\x12\x03|\x02\n\n\x0c\n\x05\x04\x02\x02\t\x05\x12\x03|\x0b\x11\n\x0c\ \n\x05\x04\x02\x02\t\x01\x12\x03|\x12\x1f\n\x0c\n\x05\x04\x02\x02\t\x03\ \x12\x03|\"$\n\x0b\n\x02\x04\x03\x12\x05\x7f\0\x86\x01\x01\n\n\n\x03\x04\ \x03\x01\x12\x03\x7f\x08\x1d\nO\n\x04\x04\x03\x02\0\x12\x04\x81\x01\x02:\ \x1aA\x20The\x20parser\x20stores\x20options\x20it\x20doesn't\x20recogniz\ e\x20here.\x20See\x20above.\n\n\r\n\x05\x04\x03\x02\0\x04\x12\x04\x81\ \x01\x02\n\n\r\n\x05\x04\x03\x02\0\x06\x12\x04\x81\x01\x0b\x1e\n\r\n\x05\ \x04\x03\x02\0\x01\x12\x04\x81\x01\x1f3\n\r\n\x05\x04\x03\x02\0\x03\x12\ \x04\x81\x0169\nZ\n\x03\x04\x03\x05\x12\x04\x85\x01\x02\x19\x1aM\x20Clie\ nts\x20can\x20define\x20custom\x20options\x20in\x20extensions\x20of\x20t\ his\x20message.\x20See\x20above.\n\n\x0c\n\x04\x04\x03\x05\0\x12\x04\x85\ \x01\r\x18\n\r\n\x05\x04\x03\x05\0\x01\x12\x04\x85\x01\r\x11\n\r\n\x05\ \x04\x03\x05\0\x02\x12\x04\x85\x01\x15\x18\n3\n\x02\x04\x04\x12\x06\x89\ \x01\0\xee\x01\x01\x1a%\x20Describes\x20a\x20field\x20within\x20a\x20mes\ sage.\n\n\x0b\n\x03\x04\x04\x01\x12\x04\x89\x01\x08\x1c\n\x0e\n\x04\x04\ \x04\x04\0\x12\x06\x8a\x01\x02\xa9\x01\x03\n\r\n\x05\x04\x04\x04\0\x01\ \x12\x04\x8a\x01\x07\x0b\nS\n\x06\x04\x04\x04\0\x02\0\x12\x04\x8d\x01\ \x04\x14\x1aC\x200\x20is\x20reserved\x20for\x20errors.\n\x20Order\x20is\ \x20weird\x20for\x20historical\x20reasons.\n\n\x0f\n\x07\x04\x04\x04\0\ \x02\0\x01\x12\x04\x8d\x01\x04\x0f\n\x0f\n\x07\x04\x04\x04\0\x02\0\x02\ \x12\x04\x8d\x01\x12\x13\n\x0e\n\x06\x04\x04\x04\0\x02\x01\x12\x04\x8e\ \x01\x04\x13\n\x0f\n\x07\x04\x04\x04\0\x02\x01\x01\x12\x04\x8e\x01\x04\ \x0e\n\x0f\n\x07\x04\x04\x04\0\x02\x01\x02\x12\x04\x8e\x01\x11\x12\nw\n\ \x06\x04\x04\x04\0\x02\x02\x12\x04\x91\x01\x04\x13\x1ag\x20Not\x20ZigZag\ \x20encoded.\x20\x20Negative\x20numbers\x20take\x2010\x20bytes.\x20\x20U\ se\x20TYPE_SINT64\x20if\n\x20negative\x20values\x20are\x20likely.\n\n\ \x0f\n\x07\x04\x04\x04\0\x02\x02\x01\x12\x04\x91\x01\x04\x0e\n\x0f\n\x07\ \x04\x04\x04\0\x02\x02\x02\x12\x04\x91\x01\x11\x12\n\x0e\n\x06\x04\x04\ \x04\0\x02\x03\x12\x04\x92\x01\x04\x14\n\x0f\n\x07\x04\x04\x04\0\x02\x03\ \x01\x12\x04\x92\x01\x04\x0f\n\x0f\n\x07\x04\x04\x04\0\x02\x03\x02\x12\ \x04\x92\x01\x12\x13\nw\n\x06\x04\x04\x04\0\x02\x04\x12\x04\x95\x01\x04\ \x13\x1ag\x20Not\x20ZigZag\x20encoded.\x20\x20Negative\x20numbers\x20tak\ e\x2010\x20bytes.\x20\x20Use\x20TYPE_SINT32\x20if\n\x20negative\x20value\ s\x20are\x20likely.\n\n\x0f\n\x07\x04\x04\x04\0\x02\x04\x01\x12\x04\x95\ \x01\x04\x0e\n\x0f\n\x07\x04\x04\x04\0\x02\x04\x02\x12\x04\x95\x01\x11\ \x12\n\x0e\n\x06\x04\x04\x04\0\x02\x05\x12\x04\x96\x01\x04\x15\n\x0f\n\ \x07\x04\x04\x04\0\x02\x05\x01\x12\x04\x96\x01\x04\x10\n\x0f\n\x07\x04\ \x04\x04\0\x02\x05\x02\x12\x04\x96\x01\x13\x14\n\x0e\n\x06\x04\x04\x04\0\ \x02\x06\x12\x04\x97\x01\x04\x15\n\x0f\n\x07\x04\x04\x04\0\x02\x06\x01\ \x12\x04\x97\x01\x04\x10\n\x0f\n\x07\x04\x04\x04\0\x02\x06\x02\x12\x04\ \x97\x01\x13\x14\n\x0e\n\x06\x04\x04\x04\0\x02\x07\x12\x04\x98\x01\x04\ \x12\n\x0f\n\x07\x04\x04\x04\0\x02\x07\x01\x12\x04\x98\x01\x04\r\n\x0f\n\ \x07\x04\x04\x04\0\x02\x07\x02\x12\x04\x98\x01\x10\x11\n\x0e\n\x06\x04\ \x04\x04\0\x02\x08\x12\x04\x99\x01\x04\x14\n\x0f\n\x07\x04\x04\x04\0\x02\ \x08\x01\x12\x04\x99\x01\x04\x0f\n\x0f\n\x07\x04\x04\x04\0\x02\x08\x02\ \x12\x04\x99\x01\x12\x13\n\xe2\x01\n\x06\x04\x04\x04\0\x02\t\x12\x04\x9e\ \x01\x04\x14\x1a\xd1\x01\x20Tag-delimited\x20aggregate.\n\x20Group\x20ty\ pe\x20is\x20deprecated\x20and\x20not\x20supported\x20in\x20proto3.\x20Ho\ wever,\x20Proto3\n\x20implementations\x20should\x20still\x20be\x20able\ \x20to\x20parse\x20the\x20group\x20wire\x20format\x20and\n\x20treat\x20g\ roup\x20fields\x20as\x20unknown\x20fields.\n\n\x0f\n\x07\x04\x04\x04\0\ \x02\t\x01\x12\x04\x9e\x01\x04\x0e\n\x0f\n\x07\x04\x04\x04\0\x02\t\x02\ \x12\x04\x9e\x01\x11\x13\n-\n\x06\x04\x04\x04\0\x02\n\x12\x04\x9f\x01\ \x04\x16\"\x1d\x20Length-delimited\x20aggregate.\n\n\x0f\n\x07\x04\x04\ \x04\0\x02\n\x01\x12\x04\x9f\x01\x04\x10\n\x0f\n\x07\x04\x04\x04\0\x02\n\ \x02\x12\x04\x9f\x01\x13\x15\n#\n\x06\x04\x04\x04\0\x02\x0b\x12\x04\xa2\ \x01\x04\x14\x1a\x13\x20New\x20in\x20version\x202.\n\n\x0f\n\x07\x04\x04\ \x04\0\x02\x0b\x01\x12\x04\xa2\x01\x04\x0e\n\x0f\n\x07\x04\x04\x04\0\x02\ \x0b\x02\x12\x04\xa2\x01\x11\x13\n\x0e\n\x06\x04\x04\x04\0\x02\x0c\x12\ \x04\xa3\x01\x04\x15\n\x0f\n\x07\x04\x04\x04\0\x02\x0c\x01\x12\x04\xa3\ \x01\x04\x0f\n\x0f\n\x07\x04\x04\x04\0\x02\x0c\x02\x12\x04\xa3\x01\x12\ \x14\n\x0e\n\x06\x04\x04\x04\0\x02\r\x12\x04\xa4\x01\x04\x13\n\x0f\n\x07\ \x04\x04\x04\0\x02\r\x01\x12\x04\xa4\x01\x04\r\n\x0f\n\x07\x04\x04\x04\0\ \x02\r\x02\x12\x04\xa4\x01\x10\x12\n\x0e\n\x06\x04\x04\x04\0\x02\x0e\x12\ \x04\xa5\x01\x04\x17\n\x0f\n\x07\x04\x04\x04\0\x02\x0e\x01\x12\x04\xa5\ \x01\x04\x11\n\x0f\n\x07\x04\x04\x04\0\x02\x0e\x02\x12\x04\xa5\x01\x14\ \x16\n\x0e\n\x06\x04\x04\x04\0\x02\x0f\x12\x04\xa6\x01\x04\x17\n\x0f\n\ \x07\x04\x04\x04\0\x02\x0f\x01\x12\x04\xa6\x01\x04\x11\n\x0f\n\x07\x04\ \x04\x04\0\x02\x0f\x02\x12\x04\xa6\x01\x14\x16\n'\n\x06\x04\x04\x04\0\ \x02\x10\x12\x04\xa7\x01\x04\x15\"\x17\x20Uses\x20ZigZag\x20encoding.\n\ \n\x0f\n\x07\x04\x04\x04\0\x02\x10\x01\x12\x04\xa7\x01\x04\x0f\n\x0f\n\ \x07\x04\x04\x04\0\x02\x10\x02\x12\x04\xa7\x01\x12\x14\n'\n\x06\x04\x04\ \x04\0\x02\x11\x12\x04\xa8\x01\x04\x15\"\x17\x20Uses\x20ZigZag\x20encodi\ ng.\n\n\x0f\n\x07\x04\x04\x04\0\x02\x11\x01\x12\x04\xa8\x01\x04\x0f\n\ \x0f\n\x07\x04\x04\x04\0\x02\x11\x02\x12\x04\xa8\x01\x12\x14\n\x0e\n\x04\ \x04\x04\x04\x01\x12\x06\xab\x01\x02\xb0\x01\x03\n\r\n\x05\x04\x04\x04\ \x01\x01\x12\x04\xab\x01\x07\x0c\n*\n\x06\x04\x04\x04\x01\x02\0\x12\x04\ \xad\x01\x04\x17\x1a\x1a\x200\x20is\x20reserved\x20for\x20errors\n\n\x0f\ \n\x07\x04\x04\x04\x01\x02\0\x01\x12\x04\xad\x01\x04\x12\n\x0f\n\x07\x04\ \x04\x04\x01\x02\0\x02\x12\x04\xad\x01\x15\x16\n\x0e\n\x06\x04\x04\x04\ \x01\x02\x01\x12\x04\xae\x01\x04\x17\n\x0f\n\x07\x04\x04\x04\x01\x02\x01\ \x01\x12\x04\xae\x01\x04\x12\n\x0f\n\x07\x04\x04\x04\x01\x02\x01\x02\x12\ \x04\xae\x01\x15\x16\n\x0e\n\x06\x04\x04\x04\x01\x02\x02\x12\x04\xaf\x01\ \x04\x17\n\x0f\n\x07\x04\x04\x04\x01\x02\x02\x01\x12\x04\xaf\x01\x04\x12\ \n\x0f\n\x07\x04\x04\x04\x01\x02\x02\x02\x12\x04\xaf\x01\x15\x16\n\x0c\n\ \x04\x04\x04\x02\0\x12\x04\xb2\x01\x02\x1b\n\r\n\x05\x04\x04\x02\0\x04\ \x12\x04\xb2\x01\x02\n\n\r\n\x05\x04\x04\x02\0\x05\x12\x04\xb2\x01\x0b\ \x11\n\r\n\x05\x04\x04\x02\0\x01\x12\x04\xb2\x01\x12\x16\n\r\n\x05\x04\ \x04\x02\0\x03\x12\x04\xb2\x01\x19\x1a\n\x0c\n\x04\x04\x04\x02\x01\x12\ \x04\xb3\x01\x02\x1c\n\r\n\x05\x04\x04\x02\x01\x04\x12\x04\xb3\x01\x02\n\ \n\r\n\x05\x04\x04\x02\x01\x05\x12\x04\xb3\x01\x0b\x10\n\r\n\x05\x04\x04\ \x02\x01\x01\x12\x04\xb3\x01\x11\x17\n\r\n\x05\x04\x04\x02\x01\x03\x12\ \x04\xb3\x01\x1a\x1b\n\x0c\n\x04\x04\x04\x02\x02\x12\x04\xb4\x01\x02\x1b\ \n\r\n\x05\x04\x04\x02\x02\x04\x12\x04\xb4\x01\x02\n\n\r\n\x05\x04\x04\ \x02\x02\x06\x12\x04\xb4\x01\x0b\x10\n\r\n\x05\x04\x04\x02\x02\x01\x12\ \x04\xb4\x01\x11\x16\n\r\n\x05\x04\x04\x02\x02\x03\x12\x04\xb4\x01\x19\ \x1a\n\x9c\x01\n\x04\x04\x04\x02\x03\x12\x04\xb8\x01\x02\x19\x1a\x8d\x01\ \x20If\x20type_name\x20is\x20set,\x20this\x20need\x20not\x20be\x20set.\ \x20\x20If\x20both\x20this\x20and\x20type_name\n\x20are\x20set,\x20this\ \x20must\x20be\x20one\x20of\x20TYPE_ENUM,\x20TYPE_MESSAGE\x20or\x20TYPE_\ GROUP.\n\n\r\n\x05\x04\x04\x02\x03\x04\x12\x04\xb8\x01\x02\n\n\r\n\x05\ \x04\x04\x02\x03\x06\x12\x04\xb8\x01\x0b\x0f\n\r\n\x05\x04\x04\x02\x03\ \x01\x12\x04\xb8\x01\x10\x14\n\r\n\x05\x04\x04\x02\x03\x03\x12\x04\xb8\ \x01\x17\x18\n\xb7\x02\n\x04\x04\x04\x02\x04\x12\x04\xbf\x01\x02\x20\x1a\ \xa8\x02\x20For\x20message\x20and\x20enum\x20types,\x20this\x20is\x20the\ \x20name\x20of\x20the\x20type.\x20\x20If\x20the\x20name\n\x20starts\x20w\ ith\x20a\x20'.',\x20it\x20is\x20fully-qualified.\x20\x20Otherwise,\x20C+\ +-like\x20scoping\n\x20rules\x20are\x20used\x20to\x20find\x20the\x20type\ \x20(i.e.\x20first\x20the\x20nested\x20types\x20within\x20this\n\x20mess\ age\x20are\x20searched,\x20then\x20within\x20the\x20parent,\x20on\x20up\ \x20to\x20the\x20root\n\x20namespace).\n\n\r\n\x05\x04\x04\x02\x04\x04\ \x12\x04\xbf\x01\x02\n\n\r\n\x05\x04\x04\x02\x04\x05\x12\x04\xbf\x01\x0b\ \x11\n\r\n\x05\x04\x04\x02\x04\x01\x12\x04\xbf\x01\x12\x1b\n\r\n\x05\x04\ \x04\x02\x04\x03\x12\x04\xbf\x01\x1e\x1f\n~\n\x04\x04\x04\x02\x05\x12\ \x04\xc3\x01\x02\x1f\x1ap\x20For\x20extensions,\x20this\x20is\x20the\x20\ name\x20of\x20the\x20type\x20being\x20extended.\x20\x20It\x20is\n\x20res\ olved\x20in\x20the\x20same\x20manner\x20as\x20type_name.\n\n\r\n\x05\x04\ \x04\x02\x05\x04\x12\x04\xc3\x01\x02\n\n\r\n\x05\x04\x04\x02\x05\x05\x12\ \x04\xc3\x01\x0b\x11\n\r\n\x05\x04\x04\x02\x05\x01\x12\x04\xc3\x01\x12\ \x1a\n\r\n\x05\x04\x04\x02\x05\x03\x12\x04\xc3\x01\x1d\x1e\n\xb1\x02\n\ \x04\x04\x04\x02\x06\x12\x04\xca\x01\x02$\x1a\xa2\x02\x20For\x20numeric\ \x20types,\x20contains\x20the\x20original\x20text\x20representation\x20o\ f\x20the\x20value.\n\x20For\x20booleans,\x20\"true\"\x20or\x20\"false\".\ \n\x20For\x20strings,\x20contains\x20the\x20default\x20text\x20contents\ \x20(not\x20escaped\x20in\x20any\x20way).\n\x20For\x20bytes,\x20contains\ \x20the\x20C\x20escaped\x20value.\x20\x20All\x20bytes\x20>=\x20128\x20ar\ e\x20escaped.\n\x20TODO(kenton):\x20\x20Base-64\x20encode?\n\n\r\n\x05\ \x04\x04\x02\x06\x04\x12\x04\xca\x01\x02\n\n\r\n\x05\x04\x04\x02\x06\x05\ \x12\x04\xca\x01\x0b\x11\n\r\n\x05\x04\x04\x02\x06\x01\x12\x04\xca\x01\ \x12\x1f\n\r\n\x05\x04\x04\x02\x06\x03\x12\x04\xca\x01\"#\n\x84\x01\n\ \x04\x04\x04\x02\x07\x12\x04\xce\x01\x02!\x1av\x20If\x20set,\x20gives\ \x20the\x20index\x20of\x20a\x20oneof\x20in\x20the\x20containing\x20type'\ s\x20oneof_decl\n\x20list.\x20\x20This\x20field\x20is\x20a\x20member\x20\ of\x20that\x20oneof.\n\n\r\n\x05\x04\x04\x02\x07\x04\x12\x04\xce\x01\x02\ \n\n\r\n\x05\x04\x04\x02\x07\x05\x12\x04\xce\x01\x0b\x10\n\r\n\x05\x04\ \x04\x02\x07\x01\x12\x04\xce\x01\x11\x1c\n\r\n\x05\x04\x04\x02\x07\x03\ \x12\x04\xce\x01\x1f\x20\n\xfa\x01\n\x04\x04\x04\x02\x08\x12\x04\xd4\x01\ \x02!\x1a\xeb\x01\x20JSON\x20name\x20of\x20this\x20field.\x20The\x20valu\ e\x20is\x20set\x20by\x20protocol\x20compiler.\x20If\x20the\n\x20user\x20\ has\x20set\x20a\x20\"json_name\"\x20option\x20on\x20this\x20field,\x20th\ at\x20option's\x20value\n\x20will\x20be\x20used.\x20Otherwise,\x20it's\ \x20deduced\x20from\x20the\x20field's\x20name\x20by\x20converting\n\x20i\ t\x20to\x20camelCase.\n\n\r\n\x05\x04\x04\x02\x08\x04\x12\x04\xd4\x01\ \x02\n\n\r\n\x05\x04\x04\x02\x08\x05\x12\x04\xd4\x01\x0b\x11\n\r\n\x05\ \x04\x04\x02\x08\x01\x12\x04\xd4\x01\x12\x1b\n\r\n\x05\x04\x04\x02\x08\ \x03\x12\x04\xd4\x01\x1e\x20\n\x0c\n\x04\x04\x04\x02\t\x12\x04\xd6\x01\ \x02$\n\r\n\x05\x04\x04\x02\t\x04\x12\x04\xd6\x01\x02\n\n\r\n\x05\x04\ \x04\x02\t\x06\x12\x04\xd6\x01\x0b\x17\n\r\n\x05\x04\x04\x02\t\x01\x12\ \x04\xd6\x01\x18\x1f\n\r\n\x05\x04\x04\x02\t\x03\x12\x04\xd6\x01\"#\n\ \xb3\t\n\x04\x04\x04\x02\n\x12\x04\xed\x01\x02%\x1a\xa4\t\x20If\x20true,\ \x20this\x20is\x20a\x20proto3\x20\"optional\".\x20When\x20a\x20proto3\ \x20field\x20is\x20optional,\x20it\n\x20tracks\x20presence\x20regardless\ \x20of\x20field\x20type.\n\n\x20When\x20proto3_optional\x20is\x20true,\ \x20this\x20field\x20must\x20be\x20belong\x20to\x20a\x20oneof\x20to\n\ \x20signal\x20to\x20old\x20proto3\x20clients\x20that\x20presence\x20is\ \x20tracked\x20for\x20this\x20field.\x20This\n\x20oneof\x20is\x20known\ \x20as\x20a\x20\"synthetic\"\x20oneof,\x20and\x20this\x20field\x20must\ \x20be\x20its\x20sole\n\x20member\x20(each\x20proto3\x20optional\x20fiel\ d\x20gets\x20its\x20own\x20synthetic\x20oneof).\x20Synthetic\n\x20oneofs\ \x20exist\x20in\x20the\x20descriptor\x20only,\x20and\x20do\x20not\x20gen\ erate\x20any\x20API.\x20Synthetic\n\x20oneofs\x20must\x20be\x20ordered\ \x20after\x20all\x20\"real\"\x20oneofs.\n\n\x20For\x20message\x20fields,\ \x20proto3_optional\x20doesn't\x20create\x20any\x20semantic\x20change,\n\ \x20since\x20non-repeated\x20message\x20fields\x20always\x20track\x20pre\ sence.\x20However\x20it\x20still\n\x20indicates\x20the\x20semantic\x20de\ tail\x20of\x20whether\x20the\x20user\x20wrote\x20\"optional\"\x20or\x20n\ ot.\n\x20This\x20can\x20be\x20useful\x20for\x20round-tripping\x20the\x20\ .proto\x20file.\x20For\x20consistency\x20we\n\x20give\x20message\x20fiel\ ds\x20a\x20synthetic\x20oneof\x20also,\x20even\x20though\x20it\x20is\x20\ not\x20required\n\x20to\x20track\x20presence.\x20This\x20is\x20especiall\ y\x20important\x20because\x20the\x20parser\x20can't\n\x20tell\x20if\x20a\ \x20field\x20is\x20a\x20message\x20or\x20an\x20enum,\x20so\x20it\x20must\ \x20always\x20create\x20a\n\x20synthetic\x20oneof.\n\n\x20Proto2\x20opti\ onal\x20fields\x20do\x20not\x20set\x20this\x20flag,\x20because\x20they\ \x20already\x20indicate\n\x20optional\x20with\x20`LABEL_OPTIONAL`.\n\n\r\ \n\x05\x04\x04\x02\n\x04\x12\x04\xed\x01\x02\n\n\r\n\x05\x04\x04\x02\n\ \x05\x12\x04\xed\x01\x0b\x0f\n\r\n\x05\x04\x04\x02\n\x01\x12\x04\xed\x01\ \x10\x1f\n\r\n\x05\x04\x04\x02\n\x03\x12\x04\xed\x01\"$\n\"\n\x02\x04\ \x05\x12\x06\xf1\x01\0\xf4\x01\x01\x1a\x14\x20Describes\x20a\x20oneof.\n\ \n\x0b\n\x03\x04\x05\x01\x12\x04\xf1\x01\x08\x1c\n\x0c\n\x04\x04\x05\x02\ \0\x12\x04\xf2\x01\x02\x1b\n\r\n\x05\x04\x05\x02\0\x04\x12\x04\xf2\x01\ \x02\n\n\r\n\x05\x04\x05\x02\0\x05\x12\x04\xf2\x01\x0b\x11\n\r\n\x05\x04\ \x05\x02\0\x01\x12\x04\xf2\x01\x12\x16\n\r\n\x05\x04\x05\x02\0\x03\x12\ \x04\xf2\x01\x19\x1a\n\x0c\n\x04\x04\x05\x02\x01\x12\x04\xf3\x01\x02$\n\ \r\n\x05\x04\x05\x02\x01\x04\x12\x04\xf3\x01\x02\n\n\r\n\x05\x04\x05\x02\ \x01\x06\x12\x04\xf3\x01\x0b\x17\n\r\n\x05\x04\x05\x02\x01\x01\x12\x04\ \xf3\x01\x18\x1f\n\r\n\x05\x04\x05\x02\x01\x03\x12\x04\xf3\x01\"#\n'\n\ \x02\x04\x06\x12\x06\xf7\x01\0\x91\x02\x01\x1a\x19\x20Describes\x20an\ \x20enum\x20type.\n\n\x0b\n\x03\x04\x06\x01\x12\x04\xf7\x01\x08\x1b\n\ \x0c\n\x04\x04\x06\x02\0\x12\x04\xf8\x01\x02\x1b\n\r\n\x05\x04\x06\x02\0\ \x04\x12\x04\xf8\x01\x02\n\n\r\n\x05\x04\x06\x02\0\x05\x12\x04\xf8\x01\ \x0b\x11\n\r\n\x05\x04\x06\x02\0\x01\x12\x04\xf8\x01\x12\x16\n\r\n\x05\ \x04\x06\x02\0\x03\x12\x04\xf8\x01\x19\x1a\n\x0c\n\x04\x04\x06\x02\x01\ \x12\x04\xfa\x01\x02.\n\r\n\x05\x04\x06\x02\x01\x04\x12\x04\xfa\x01\x02\ \n\n\r\n\x05\x04\x06\x02\x01\x06\x12\x04\xfa\x01\x0b#\n\r\n\x05\x04\x06\ \x02\x01\x01\x12\x04\xfa\x01$)\n\r\n\x05\x04\x06\x02\x01\x03\x12\x04\xfa\ \x01,-\n\x0c\n\x04\x04\x06\x02\x02\x12\x04\xfc\x01\x02#\n\r\n\x05\x04\ \x06\x02\x02\x04\x12\x04\xfc\x01\x02\n\n\r\n\x05\x04\x06\x02\x02\x06\x12\ \x04\xfc\x01\x0b\x16\n\r\n\x05\x04\x06\x02\x02\x01\x12\x04\xfc\x01\x17\ \x1e\n\r\n\x05\x04\x06\x02\x02\x03\x12\x04\xfc\x01!\"\n\xaf\x02\n\x04\ \x04\x06\x03\0\x12\x06\x84\x02\x02\x87\x02\x03\x1a\x9e\x02\x20Range\x20o\ f\x20reserved\x20numeric\x20values.\x20Reserved\x20values\x20may\x20not\ \x20be\x20used\x20by\n\x20entries\x20in\x20the\x20same\x20enum.\x20Reser\ ved\x20ranges\x20may\x20not\x20overlap.\n\n\x20Note\x20that\x20this\x20i\ s\x20distinct\x20from\x20DescriptorProto.ReservedRange\x20in\x20that\x20\ it\n\x20is\x20inclusive\x20such\x20that\x20it\x20can\x20appropriately\ \x20represent\x20the\x20entire\x20int32\n\x20domain.\n\n\r\n\x05\x04\x06\ \x03\0\x01\x12\x04\x84\x02\n\x1b\n\x1c\n\x06\x04\x06\x03\0\x02\0\x12\x04\ \x85\x02\x04\x1d\"\x0c\x20Inclusive.\n\n\x0f\n\x07\x04\x06\x03\0\x02\0\ \x04\x12\x04\x85\x02\x04\x0c\n\x0f\n\x07\x04\x06\x03\0\x02\0\x05\x12\x04\ \x85\x02\r\x12\n\x0f\n\x07\x04\x06\x03\0\x02\0\x01\x12\x04\x85\x02\x13\ \x18\n\x0f\n\x07\x04\x06\x03\0\x02\0\x03\x12\x04\x85\x02\x1b\x1c\n\x1c\n\ \x06\x04\x06\x03\0\x02\x01\x12\x04\x86\x02\x04\x1b\"\x0c\x20Inclusive.\n\ \n\x0f\n\x07\x04\x06\x03\0\x02\x01\x04\x12\x04\x86\x02\x04\x0c\n\x0f\n\ \x07\x04\x06\x03\0\x02\x01\x05\x12\x04\x86\x02\r\x12\n\x0f\n\x07\x04\x06\ \x03\0\x02\x01\x01\x12\x04\x86\x02\x13\x16\n\x0f\n\x07\x04\x06\x03\0\x02\ \x01\x03\x12\x04\x86\x02\x19\x1a\n\xaa\x01\n\x04\x04\x06\x02\x03\x12\x04\ \x8c\x02\x020\x1a\x9b\x01\x20Range\x20of\x20reserved\x20numeric\x20value\ s.\x20Reserved\x20numeric\x20values\x20may\x20not\x20be\x20used\n\x20by\ \x20enum\x20values\x20in\x20the\x20same\x20enum\x20declaration.\x20Reser\ ved\x20ranges\x20may\x20not\n\x20overlap.\n\n\r\n\x05\x04\x06\x02\x03\ \x04\x12\x04\x8c\x02\x02\n\n\r\n\x05\x04\x06\x02\x03\x06\x12\x04\x8c\x02\ \x0b\x1c\n\r\n\x05\x04\x06\x02\x03\x01\x12\x04\x8c\x02\x1d+\n\r\n\x05\ \x04\x06\x02\x03\x03\x12\x04\x8c\x02./\nl\n\x04\x04\x06\x02\x04\x12\x04\ \x90\x02\x02$\x1a^\x20Reserved\x20enum\x20value\x20names,\x20which\x20ma\ y\x20not\x20be\x20reused.\x20A\x20given\x20name\x20may\x20only\n\x20be\ \x20reserved\x20once.\n\n\r\n\x05\x04\x06\x02\x04\x04\x12\x04\x90\x02\ \x02\n\n\r\n\x05\x04\x06\x02\x04\x05\x12\x04\x90\x02\x0b\x11\n\r\n\x05\ \x04\x06\x02\x04\x01\x12\x04\x90\x02\x12\x1f\n\r\n\x05\x04\x06\x02\x04\ \x03\x12\x04\x90\x02\"#\n1\n\x02\x04\x07\x12\x06\x94\x02\0\x99\x02\x01\ \x1a#\x20Describes\x20a\x20value\x20within\x20an\x20enum.\n\n\x0b\n\x03\ \x04\x07\x01\x12\x04\x94\x02\x08\x20\n\x0c\n\x04\x04\x07\x02\0\x12\x04\ \x95\x02\x02\x1b\n\r\n\x05\x04\x07\x02\0\x04\x12\x04\x95\x02\x02\n\n\r\n\ \x05\x04\x07\x02\0\x05\x12\x04\x95\x02\x0b\x11\n\r\n\x05\x04\x07\x02\0\ \x01\x12\x04\x95\x02\x12\x16\n\r\n\x05\x04\x07\x02\0\x03\x12\x04\x95\x02\ \x19\x1a\n\x0c\n\x04\x04\x07\x02\x01\x12\x04\x96\x02\x02\x1c\n\r\n\x05\ \x04\x07\x02\x01\x04\x12\x04\x96\x02\x02\n\n\r\n\x05\x04\x07\x02\x01\x05\ \x12\x04\x96\x02\x0b\x10\n\r\n\x05\x04\x07\x02\x01\x01\x12\x04\x96\x02\ \x11\x17\n\r\n\x05\x04\x07\x02\x01\x03\x12\x04\x96\x02\x1a\x1b\n\x0c\n\ \x04\x04\x07\x02\x02\x12\x04\x98\x02\x02(\n\r\n\x05\x04\x07\x02\x02\x04\ \x12\x04\x98\x02\x02\n\n\r\n\x05\x04\x07\x02\x02\x06\x12\x04\x98\x02\x0b\ \x1b\n\r\n\x05\x04\x07\x02\x02\x01\x12\x04\x98\x02\x1c#\n\r\n\x05\x04\ \x07\x02\x02\x03\x12\x04\x98\x02&'\n$\n\x02\x04\x08\x12\x06\x9c\x02\0\ \xa1\x02\x01\x1a\x16\x20Describes\x20a\x20service.\n\n\x0b\n\x03\x04\x08\ \x01\x12\x04\x9c\x02\x08\x1e\n\x0c\n\x04\x04\x08\x02\0\x12\x04\x9d\x02\ \x02\x1b\n\r\n\x05\x04\x08\x02\0\x04\x12\x04\x9d\x02\x02\n\n\r\n\x05\x04\ \x08\x02\0\x05\x12\x04\x9d\x02\x0b\x11\n\r\n\x05\x04\x08\x02\0\x01\x12\ \x04\x9d\x02\x12\x16\n\r\n\x05\x04\x08\x02\0\x03\x12\x04\x9d\x02\x19\x1a\ \n\x0c\n\x04\x04\x08\x02\x01\x12\x04\x9e\x02\x02,\n\r\n\x05\x04\x08\x02\ \x01\x04\x12\x04\x9e\x02\x02\n\n\r\n\x05\x04\x08\x02\x01\x06\x12\x04\x9e\ \x02\x0b\x20\n\r\n\x05\x04\x08\x02\x01\x01\x12\x04\x9e\x02!'\n\r\n\x05\ \x04\x08\x02\x01\x03\x12\x04\x9e\x02*+\n\x0c\n\x04\x04\x08\x02\x02\x12\ \x04\xa0\x02\x02&\n\r\n\x05\x04\x08\x02\x02\x04\x12\x04\xa0\x02\x02\n\n\ \r\n\x05\x04\x08\x02\x02\x06\x12\x04\xa0\x02\x0b\x19\n\r\n\x05\x04\x08\ \x02\x02\x01\x12\x04\xa0\x02\x1a!\n\r\n\x05\x04\x08\x02\x02\x03\x12\x04\ \xa0\x02$%\n0\n\x02\x04\t\x12\x06\xa4\x02\0\xb2\x02\x01\x1a\"\x20Describ\ es\x20a\x20method\x20of\x20a\x20service.\n\n\x0b\n\x03\x04\t\x01\x12\x04\ \xa4\x02\x08\x1d\n\x0c\n\x04\x04\t\x02\0\x12\x04\xa5\x02\x02\x1b\n\r\n\ \x05\x04\t\x02\0\x04\x12\x04\xa5\x02\x02\n\n\r\n\x05\x04\t\x02\0\x05\x12\ \x04\xa5\x02\x0b\x11\n\r\n\x05\x04\t\x02\0\x01\x12\x04\xa5\x02\x12\x16\n\ \r\n\x05\x04\t\x02\0\x03\x12\x04\xa5\x02\x19\x1a\n\x97\x01\n\x04\x04\t\ \x02\x01\x12\x04\xa9\x02\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\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\x1c\n\r\n\x05\x04\t\x02\x01\x03\ \x12\x04\xa9\x02\x1f\x20\n\x0c\n\x04\x04\t\x02\x02\x12\x04\xaa\x02\x02\"\ \n\r\n\x05\x04\t\x02\x02\x04\x12\x04\xaa\x02\x02\n\n\r\n\x05\x04\t\x02\ \x02\x05\x12\x04\xaa\x02\x0b\x11\n\r\n\x05\x04\t\x02\x02\x01\x12\x04\xaa\ \x02\x12\x1d\n\r\n\x05\x04\t\x02\x02\x03\x12\x04\xaa\x02\x20!\n\x0c\n\ \x04\x04\t\x02\x03\x12\x04\xac\x02\x02%\n\r\n\x05\x04\t\x02\x03\x04\x12\ \x04\xac\x02\x02\n\n\r\n\x05\x04\t\x02\x03\x06\x12\x04\xac\x02\x0b\x18\n\ \r\n\x05\x04\t\x02\x03\x01\x12\x04\xac\x02\x19\x20\n\r\n\x05\x04\t\x02\ \x03\x03\x12\x04\xac\x02#$\nE\n\x04\x04\t\x02\x04\x12\x04\xaf\x02\x027\ \x1a7\x20Identifies\x20if\x20client\x20streams\x20multiple\x20client\x20\ messages\n\n\r\n\x05\x04\t\x02\x04\x04\x12\x04\xaf\x02\x02\n\n\r\n\x05\ \x04\t\x02\x04\x05\x12\x04\xaf\x02\x0b\x0f\n\r\n\x05\x04\t\x02\x04\x01\ \x12\x04\xaf\x02\x10\x20\n\r\n\x05\x04\t\x02\x04\x03\x12\x04\xaf\x02#$\n\ \r\n\x05\x04\t\x02\x04\x08\x12\x04\xaf\x02%6\n\r\n\x05\x04\t\x02\x04\x07\ \x12\x04\xaf\x0205\nE\n\x04\x04\t\x02\x05\x12\x04\xb1\x02\x027\x1a7\x20I\ dentifies\x20if\x20server\x20streams\x20multiple\x20server\x20messages\n\ \n\r\n\x05\x04\t\x02\x05\x04\x12\x04\xb1\x02\x02\n\n\r\n\x05\x04\t\x02\ \x05\x05\x12\x04\xb1\x02\x0b\x0f\n\r\n\x05\x04\t\x02\x05\x01\x12\x04\xb1\ \x02\x10\x20\n\r\n\x05\x04\t\x02\x05\x03\x12\x04\xb1\x02#$\n\r\n\x05\x04\ \t\x02\x05\x08\x12\x04\xb1\x02%6\n\r\n\x05\x04\t\x02\x05\x07\x12\x04\xb1\ \x0205\n\xaf\x0e\n\x02\x04\n\x12\x06\xd5\x02\0\xd0\x03\x012N\x20========\ ===========================================================\n\x20Options\ \n2\xd0\r\x20Each\x20of\x20the\x20definitions\x20above\x20may\x20have\ \x20\"options\"\x20attached.\x20\x20These\x20are\n\x20just\x20annotation\ s\x20which\x20may\x20cause\x20code\x20to\x20be\x20generated\x20slightly\ \x20differently\n\x20or\x20may\x20contain\x20hints\x20for\x20code\x20tha\ t\x20manipulates\x20protocol\x20messages.\n\n\x20Clients\x20may\x20defin\ e\x20custom\x20options\x20as\x20extensions\x20of\x20the\x20*Options\x20m\ essages.\n\x20These\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\x20field\x20in\x20the\x20*Options\n\x20message\x20called\x20\ uninterpreted_option.\x20This\x20field\x20must\x20have\x20the\x20same\ \x20name\n\x20across\x20all\x20*Options\x20messages.\x20We\x20then\x20us\ e\x20this\x20field\x20to\x20populate\x20the\n\x20extensions\x20when\x20w\ e\x20build\x20a\x20descriptor,\x20at\x20which\x20point\x20all\x20protos\ \x20have\x20been\n\x20parsed\x20and\x20so\x20all\x20extensions\x20are\ \x20known.\n\n\x20Extension\x20numbers\x20for\x20custom\x20options\x20ma\ y\x20be\x20chosen\x20as\x20follows:\n\x20*\x20For\x20options\x20which\ \x20will\x20only\x20be\x20used\x20within\x20a\x20single\x20application\ \x20or\n\x20\x20\x20organization,\x20or\x20for\x20experimental\x20option\ s,\x20use\x20field\x20numbers\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\x20\ options.\n\x20*\x20For\x20options\x20which\x20will\x20be\x20published\ \x20and\x20used\x20publicly\x20by\x20multiple\n\x20\x20\x20independent\ \x20entities,\x20e-mail\x20protobuf-global-extension-registry@google.com\ \n\x20\x20\x20to\x20reserve\x20extension\x20numbers.\x20Simply\x20provid\ e\x20your\x20project\x20name\x20(e.g.\n\x20\x20\x20Objective-C\x20plugin\ )\x20and\x20your\x20project\x20website\x20(if\x20available)\x20--\x20the\ re's\x20no\n\x20\x20\x20need\x20to\x20explain\x20how\x20you\x20intend\ \x20to\x20use\x20them.\x20Usually\x20you\x20only\x20need\x20one\n\x20\ \x20\x20extension\x20number.\x20You\x20can\x20declare\x20multiple\x20opt\ ions\x20with\x20only\x20one\x20extension\n\x20\x20\x20number\x20by\x20pu\ tting\x20them\x20in\x20a\x20sub-message.\x20See\x20the\x20Custom\x20Opti\ ons\x20section\x20of\n\x20\x20\x20the\x20docs\x20for\x20examples:\n\x20\ \x20\x20https://developers.google.com/protocol-buffers/docs/proto#option\ s\n\x20\x20\x20If\x20this\x20turns\x20out\x20to\x20be\x20popular,\x20a\ \x20web\x20service\x20will\x20be\x20set\x20up\n\x20\x20\x20to\x20automat\ ically\x20assign\x20option\x20numbers.\n\n\x0b\n\x03\x04\n\x01\x12\x04\ \xd5\x02\x08\x13\n\xf4\x01\n\x04\x04\n\x02\0\x12\x04\xdb\x02\x02#\x1a\ \xe5\x01\x20Sets\x20the\x20Java\x20package\x20where\x20classes\x20genera\ ted\x20from\x20this\x20.proto\x20will\x20be\n\x20placed.\x20\x20By\x20de\ fault,\x20the\x20proto\x20package\x20is\x20used,\x20but\x20this\x20is\ \x20often\n\x20inappropriate\x20because\x20proto\x20packages\x20do\x20no\ t\x20normally\x20start\x20with\x20backwards\n\x20domain\x20names.\n\n\r\ \n\x05\x04\n\x02\0\x04\x12\x04\xdb\x02\x02\n\n\r\n\x05\x04\n\x02\0\x05\ \x12\x04\xdb\x02\x0b\x11\n\r\n\x05\x04\n\x02\0\x01\x12\x04\xdb\x02\x12\ \x1e\n\r\n\x05\x04\n\x02\0\x03\x12\x04\xdb\x02!\"\n\xbf\x02\n\x04\x04\n\ \x02\x01\x12\x04\xe3\x02\x02+\x1a\xb0\x02\x20If\x20set,\x20all\x20the\ \x20classes\x20from\x20the\x20.proto\x20file\x20are\x20wrapped\x20in\x20\ a\x20single\n\x20outer\x20class\x20with\x20the\x20given\x20name.\x20\x20\ This\x20applies\x20to\x20both\x20Proto1\n\x20(equivalent\x20to\x20the\ \x20old\x20\"--one_java_file\"\x20option)\x20and\x20Proto2\x20(where\n\ \x20a\x20.proto\x20always\x20translates\x20to\x20a\x20single\x20class,\ \x20but\x20you\x20may\x20want\x20to\n\x20explicitly\x20choose\x20the\x20\ class\x20name).\n\n\r\n\x05\x04\n\x02\x01\x04\x12\x04\xe3\x02\x02\n\n\r\ \n\x05\x04\n\x02\x01\x05\x12\x04\xe3\x02\x0b\x11\n\r\n\x05\x04\n\x02\x01\ \x01\x12\x04\xe3\x02\x12&\n\r\n\x05\x04\n\x02\x01\x03\x12\x04\xe3\x02)*\ \n\xa3\x03\n\x04\x04\n\x02\x02\x12\x04\xeb\x02\x02;\x1a\x94\x03\x20If\ \x20set\x20true,\x20then\x20the\x20Java\x20code\x20generator\x20will\x20\ generate\x20a\x20separate\x20.java\n\x20file\x20for\x20each\x20top-level\ \x20message,\x20enum,\x20and\x20service\x20defined\x20in\x20the\x20.prot\ o\n\x20file.\x20\x20Thus,\x20these\x20types\x20will\x20*not*\x20be\x20ne\ sted\x20inside\x20the\x20outer\x20class\n\x20named\x20by\x20java_outer_c\ lassname.\x20\x20However,\x20the\x20outer\x20class\x20will\x20still\x20b\ e\n\x20generated\x20to\x20contain\x20the\x20file's\x20getDescriptor()\ \x20method\x20as\x20well\x20as\x20any\n\x20top-level\x20extensions\x20de\ fined\x20in\x20the\x20file.\n\n\r\n\x05\x04\n\x02\x02\x04\x12\x04\xeb\ \x02\x02\n\n\r\n\x05\x04\n\x02\x02\x05\x12\x04\xeb\x02\x0b\x0f\n\r\n\x05\ \x04\n\x02\x02\x01\x12\x04\xeb\x02\x10#\n\r\n\x05\x04\n\x02\x02\x03\x12\ \x04\xeb\x02&(\n\r\n\x05\x04\n\x02\x02\x08\x12\x04\xeb\x02):\n\r\n\x05\ \x04\n\x02\x02\x07\x12\x04\xeb\x0249\n)\n\x04\x04\n\x02\x03\x12\x04\xee\ \x02\x02E\x1a\x1b\x20This\x20option\x20does\x20nothing.\n\n\r\n\x05\x04\ \n\x02\x03\x04\x12\x04\xee\x02\x02\n\n\r\n\x05\x04\n\x02\x03\x05\x12\x04\ \xee\x02\x0b\x0f\n\r\n\x05\x04\n\x02\x03\x01\x12\x04\xee\x02\x10-\n\r\n\ \x05\x04\n\x02\x03\x03\x12\x04\xee\x0202\n\r\n\x05\x04\n\x02\x03\x08\x12\ \x04\xee\x023D\n\x0e\n\x06\x04\n\x02\x03\x08\x03\x12\x04\xee\x024C\n\xe6\ \x02\n\x04\x04\n\x02\x04\x12\x04\xf6\x02\x02>\x1a\xd7\x02\x20If\x20set\ \x20true,\x20then\x20the\x20Java2\x20code\x20generator\x20will\x20genera\ te\x20code\x20that\n\x20throws\x20an\x20exception\x20whenever\x20an\x20a\ ttempt\x20is\x20made\x20to\x20assign\x20a\x20non-UTF-8\n\x20byte\x20sequ\ ence\x20to\x20a\x20string\x20field.\n\x20Message\x20reflection\x20will\ \x20do\x20the\x20same.\n\x20However,\x20an\x20extension\x20field\x20stil\ l\x20accepts\x20non-UTF-8\x20byte\x20sequences.\n\x20This\x20option\x20h\ as\x20no\x20effect\x20on\x20when\x20used\x20with\x20the\x20lite\x20runti\ me.\n\n\r\n\x05\x04\n\x02\x04\x04\x12\x04\xf6\x02\x02\n\n\r\n\x05\x04\n\ \x02\x04\x05\x12\x04\xf6\x02\x0b\x0f\n\r\n\x05\x04\n\x02\x04\x01\x12\x04\ \xf6\x02\x10&\n\r\n\x05\x04\n\x02\x04\x03\x12\x04\xf6\x02)+\n\r\n\x05\ \x04\n\x02\x04\x08\x12\x04\xf6\x02,=\n\r\n\x05\x04\n\x02\x04\x07\x12\x04\ \xf6\x027<\nL\n\x04\x04\n\x04\0\x12\x06\xfa\x02\x02\xff\x02\x03\x1a<\x20\ Generated\x20classes\x20can\x20be\x20optimized\x20for\x20speed\x20or\x20\ code\x20size.\n\n\r\n\x05\x04\n\x04\0\x01\x12\x04\xfa\x02\x07\x13\nD\n\ \x06\x04\n\x04\0\x02\0\x12\x04\xfb\x02\x04\x0e\"4\x20Generate\x20complet\ e\x20code\x20for\x20parsing,\x20serialization,\n\n\x0f\n\x07\x04\n\x04\0\ \x02\0\x01\x12\x04\xfb\x02\x04\t\n\x0f\n\x07\x04\n\x04\0\x02\0\x02\x12\ \x04\xfb\x02\x0c\r\nG\n\x06\x04\n\x04\0\x02\x01\x12\x04\xfd\x02\x04\x12\ \x1a\x06\x20etc.\n\"/\x20Use\x20ReflectionOps\x20to\x20implement\x20thes\ e\x20methods.\n\n\x0f\n\x07\x04\n\x04\0\x02\x01\x01\x12\x04\xfd\x02\x04\ \r\n\x0f\n\x07\x04\n\x04\0\x02\x01\x02\x12\x04\xfd\x02\x10\x11\nG\n\x06\ \x04\n\x04\0\x02\x02\x12\x04\xfe\x02\x04\x15\"7\x20Generate\x20code\x20u\ sing\x20MessageLite\x20and\x20the\x20lite\x20runtime.\n\n\x0f\n\x07\x04\ \n\x04\0\x02\x02\x01\x12\x04\xfe\x02\x04\x10\n\x0f\n\x07\x04\n\x04\0\x02\ \x02\x02\x12\x04\xfe\x02\x13\x14\n\x0c\n\x04\x04\n\x02\x05\x12\x04\x80\ \x03\x02;\n\r\n\x05\x04\n\x02\x05\x04\x12\x04\x80\x03\x02\n\n\r\n\x05\ \x04\n\x02\x05\x06\x12\x04\x80\x03\x0b\x17\n\r\n\x05\x04\n\x02\x05\x01\ \x12\x04\x80\x03\x18$\n\r\n\x05\x04\n\x02\x05\x03\x12\x04\x80\x03'(\n\r\ \n\x05\x04\n\x02\x05\x08\x12\x04\x80\x03):\n\r\n\x05\x04\n\x02\x05\x07\ \x12\x04\x80\x0349\n\xe2\x02\n\x04\x04\n\x02\x06\x12\x04\x87\x03\x02\"\ \x1a\xd3\x02\x20Sets\x20the\x20Go\x20package\x20where\x20structs\x20gene\ rated\x20from\x20this\x20.proto\x20will\x20be\n\x20placed.\x20If\x20omit\ ted,\x20the\x20Go\x20package\x20will\x20be\x20derived\x20from\x20the\x20\ following:\n\x20\x20\x20-\x20The\x20basename\x20of\x20the\x20package\x20\ import\x20path,\x20if\x20provided.\n\x20\x20\x20-\x20Otherwise,\x20the\ \x20package\x20statement\x20in\x20the\x20.proto\x20file,\x20if\x20presen\ t.\n\x20\x20\x20-\x20Otherwise,\x20the\x20basename\x20of\x20the\x20.prot\ o\x20file,\x20without\x20extension.\n\n\r\n\x05\x04\n\x02\x06\x04\x12\ \x04\x87\x03\x02\n\n\r\n\x05\x04\n\x02\x06\x05\x12\x04\x87\x03\x0b\x11\n\ \r\n\x05\x04\n\x02\x06\x01\x12\x04\x87\x03\x12\x1c\n\r\n\x05\x04\n\x02\ \x06\x03\x12\x04\x87\x03\x1f!\n\xd4\x04\n\x04\x04\n\x02\x07\x12\x04\x96\ \x03\x02;\x1a\xc5\x04\x20Should\x20generic\x20services\x20be\x20generate\ d\x20in\x20each\x20language?\x20\x20\"Generic\"\x20services\n\x20are\x20\ not\x20specific\x20to\x20any\x20particular\x20RPC\x20system.\x20\x20They\ \x20are\x20generated\x20by\x20the\n\x20main\x20code\x20generators\x20in\ \x20each\x20language\x20(without\x20additional\x20plugins).\n\x20Generic\ \x20services\x20were\x20the\x20only\x20kind\x20of\x20service\x20generati\ on\x20supported\x20by\n\x20early\x20versions\x20of\x20google.protobuf.\n\ \n\x20Generic\x20services\x20are\x20now\x20considered\x20deprecated\x20i\ n\x20favor\x20of\x20using\x20plugins\n\x20that\x20generate\x20code\x20sp\ ecific\x20to\x20your\x20particular\x20RPC\x20system.\x20\x20Therefore,\n\ \x20these\x20default\x20to\x20false.\x20\x20Old\x20code\x20which\x20depe\ nds\x20on\x20generic\x20services\x20should\n\x20explicitly\x20set\x20the\ m\x20to\x20true.\n\n\r\n\x05\x04\n\x02\x07\x04\x12\x04\x96\x03\x02\n\n\r\ \n\x05\x04\n\x02\x07\x05\x12\x04\x96\x03\x0b\x0f\n\r\n\x05\x04\n\x02\x07\ \x01\x12\x04\x96\x03\x10#\n\r\n\x05\x04\n\x02\x07\x03\x12\x04\x96\x03&(\ \n\r\n\x05\x04\n\x02\x07\x08\x12\x04\x96\x03):\n\r\n\x05\x04\n\x02\x07\ \x07\x12\x04\x96\x0349\n\x0c\n\x04\x04\n\x02\x08\x12\x04\x97\x03\x02=\n\ \r\n\x05\x04\n\x02\x08\x04\x12\x04\x97\x03\x02\n\n\r\n\x05\x04\n\x02\x08\ \x05\x12\x04\x97\x03\x0b\x0f\n\r\n\x05\x04\n\x02\x08\x01\x12\x04\x97\x03\ \x10%\n\r\n\x05\x04\n\x02\x08\x03\x12\x04\x97\x03(*\n\r\n\x05\x04\n\x02\ \x08\x08\x12\x04\x97\x03+<\n\r\n\x05\x04\n\x02\x08\x07\x12\x04\x97\x036;\ \n\x0c\n\x04\x04\n\x02\t\x12\x04\x98\x03\x02;\n\r\n\x05\x04\n\x02\t\x04\ \x12\x04\x98\x03\x02\n\n\r\n\x05\x04\n\x02\t\x05\x12\x04\x98\x03\x0b\x0f\ \n\r\n\x05\x04\n\x02\t\x01\x12\x04\x98\x03\x10#\n\r\n\x05\x04\n\x02\t\ \x03\x12\x04\x98\x03&(\n\r\n\x05\x04\n\x02\t\x08\x12\x04\x98\x03):\n\r\n\ \x05\x04\n\x02\t\x07\x12\x04\x98\x0349\n\x0c\n\x04\x04\n\x02\n\x12\x04\ \x99\x03\x02<\n\r\n\x05\x04\n\x02\n\x04\x12\x04\x99\x03\x02\n\n\r\n\x05\ \x04\n\x02\n\x05\x12\x04\x99\x03\x0b\x0f\n\r\n\x05\x04\n\x02\n\x01\x12\ \x04\x99\x03\x10$\n\r\n\x05\x04\n\x02\n\x03\x12\x04\x99\x03')\n\r\n\x05\ \x04\n\x02\n\x08\x12\x04\x99\x03*;\n\r\n\x05\x04\n\x02\n\x07\x12\x04\x99\ \x035:\n\xf3\x01\n\x04\x04\n\x02\x0b\x12\x04\x9f\x03\x022\x1a\xe4\x01\ \x20Is\x20this\x20file\x20deprecated?\n\x20Depending\x20on\x20the\x20tar\ get\x20platform,\x20this\x20can\x20emit\x20Deprecated\x20annotations\n\ \x20for\x20everything\x20in\x20the\x20file,\x20or\x20it\x20will\x20be\ \x20completely\x20ignored;\x20in\x20the\x20very\n\x20least,\x20this\x20i\ s\x20a\x20formalization\x20for\x20deprecating\x20files.\n\n\r\n\x05\x04\ \n\x02\x0b\x04\x12\x04\x9f\x03\x02\n\n\r\n\x05\x04\n\x02\x0b\x05\x12\x04\ \x9f\x03\x0b\x0f\n\r\n\x05\x04\n\x02\x0b\x01\x12\x04\x9f\x03\x10\x1a\n\r\ \n\x05\x04\n\x02\x0b\x03\x12\x04\x9f\x03\x1d\x1f\n\r\n\x05\x04\n\x02\x0b\ \x08\x12\x04\x9f\x03\x201\n\r\n\x05\x04\n\x02\x0b\x07\x12\x04\x9f\x03+0\ \n\x7f\n\x04\x04\n\x02\x0c\x12\x04\xa3\x03\x027\x1aq\x20Enables\x20the\ \x20use\x20of\x20arenas\x20for\x20the\x20proto\x20messages\x20in\x20this\ \x20file.\x20This\x20applies\n\x20only\x20to\x20generated\x20classes\x20\ for\x20C++.\n\n\r\n\x05\x04\n\x02\x0c\x04\x12\x04\xa3\x03\x02\n\n\r\n\ \x05\x04\n\x02\x0c\x05\x12\x04\xa3\x03\x0b\x0f\n\r\n\x05\x04\n\x02\x0c\ \x01\x12\x04\xa3\x03\x10\x20\n\r\n\x05\x04\n\x02\x0c\x03\x12\x04\xa3\x03\ #%\n\r\n\x05\x04\n\x02\x0c\x08\x12\x04\xa3\x03&6\n\r\n\x05\x04\n\x02\x0c\ \x07\x12\x04\xa3\x0315\n\x92\x01\n\x04\x04\n\x02\r\x12\x04\xa8\x03\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\n\x02\r\x04\x12\x04\xa8\x03\x02\n\n\r\n\x05\x04\n\x02\r\x05\ \x12\x04\xa8\x03\x0b\x11\n\r\n\x05\x04\n\x02\r\x01\x12\x04\xa8\x03\x12#\ \n\r\n\x05\x04\n\x02\r\x03\x12\x04\xa8\x03&(\nI\n\x04\x04\n\x02\x0e\x12\ \x04\xab\x03\x02(\x1a;\x20Namespace\x20for\x20generated\x20classes;\x20d\ efaults\x20to\x20the\x20package.\n\n\r\n\x05\x04\n\x02\x0e\x04\x12\x04\ \xab\x03\x02\n\n\r\n\x05\x04\n\x02\x0e\x05\x12\x04\xab\x03\x0b\x11\n\r\n\ \x05\x04\n\x02\x0e\x01\x12\x04\xab\x03\x12\"\n\r\n\x05\x04\n\x02\x0e\x03\ \x12\x04\xab\x03%'\n\x91\x02\n\x04\x04\n\x02\x0f\x12\x04\xb1\x03\x02$\ \x1a\x82\x02\x20By\x20default\x20Swift\x20generators\x20will\x20take\x20\ the\x20proto\x20package\x20and\x20CamelCase\x20it\n\x20replacing\x20'.'\ \x20with\x20underscore\x20and\x20use\x20that\x20to\x20prefix\x20the\x20t\ ypes/symbols\n\x20defined.\x20When\x20this\x20options\x20is\x20provided,\ \x20they\x20will\x20use\x20this\x20value\x20instead\n\x20to\x20prefix\ \x20the\x20types/symbols\x20defined.\n\n\r\n\x05\x04\n\x02\x0f\x04\x12\ \x04\xb1\x03\x02\n\n\r\n\x05\x04\n\x02\x0f\x05\x12\x04\xb1\x03\x0b\x11\n\ \r\n\x05\x04\n\x02\x0f\x01\x12\x04\xb1\x03\x12\x1e\n\r\n\x05\x04\n\x02\ \x0f\x03\x12\x04\xb1\x03!#\n~\n\x04\x04\n\x02\x10\x12\x04\xb5\x03\x02(\ \x1ap\x20Sets\x20the\x20php\x20class\x20prefix\x20which\x20is\x20prepend\ ed\x20to\x20all\x20php\x20generated\x20classes\n\x20from\x20this\x20.pro\ to.\x20Default\x20is\x20empty.\n\n\r\n\x05\x04\n\x02\x10\x04\x12\x04\xb5\ \x03\x02\n\n\r\n\x05\x04\n\x02\x10\x05\x12\x04\xb5\x03\x0b\x11\n\r\n\x05\ \x04\n\x02\x10\x01\x12\x04\xb5\x03\x12\"\n\r\n\x05\x04\n\x02\x10\x03\x12\ \x04\xb5\x03%'\n\xbe\x01\n\x04\x04\n\x02\x11\x12\x04\xba\x03\x02%\x1a\ \xaf\x01\x20Use\x20this\x20option\x20to\x20change\x20the\x20namespace\ \x20of\x20php\x20generated\x20classes.\x20Default\n\x20is\x20empty.\x20W\ hen\x20this\x20option\x20is\x20empty,\x20the\x20package\x20name\x20will\ \x20be\x20used\x20for\n\x20determining\x20the\x20namespace.\n\n\r\n\x05\ \x04\n\x02\x11\x04\x12\x04\xba\x03\x02\n\n\r\n\x05\x04\n\x02\x11\x05\x12\ \x04\xba\x03\x0b\x11\n\r\n\x05\x04\n\x02\x11\x01\x12\x04\xba\x03\x12\x1f\ \n\r\n\x05\x04\n\x02\x11\x03\x12\x04\xba\x03\"$\n\xca\x01\n\x04\x04\n\ \x02\x12\x12\x04\xbf\x03\x02.\x1a\xbb\x01\x20Use\x20this\x20option\x20to\ \x20change\x20the\x20namespace\x20of\x20php\x20generated\x20metadata\x20\ classes.\n\x20Default\x20is\x20empty.\x20When\x20this\x20option\x20is\ \x20empty,\x20the\x20proto\x20file\x20name\x20will\x20be\n\x20used\x20fo\ r\x20determining\x20the\x20namespace.\n\n\r\n\x05\x04\n\x02\x12\x04\x12\ \x04\xbf\x03\x02\n\n\r\n\x05\x04\n\x02\x12\x05\x12\x04\xbf\x03\x0b\x11\n\ \r\n\x05\x04\n\x02\x12\x01\x12\x04\xbf\x03\x12(\n\r\n\x05\x04\n\x02\x12\ \x03\x12\x04\xbf\x03+-\n\xc2\x01\n\x04\x04\n\x02\x13\x12\x04\xc4\x03\x02\ $\x1a\xb3\x01\x20Use\x20this\x20option\x20to\x20change\x20the\x20package\ \x20of\x20ruby\x20generated\x20classes.\x20Default\n\x20is\x20empty.\x20\ When\x20this\x20option\x20is\x20not\x20set,\x20the\x20package\x20name\ \x20will\x20be\x20used\x20for\n\x20determining\x20the\x20ruby\x20package\ .\n\n\r\n\x05\x04\n\x02\x13\x04\x12\x04\xc4\x03\x02\n\n\r\n\x05\x04\n\ \x02\x13\x05\x12\x04\xc4\x03\x0b\x11\n\r\n\x05\x04\n\x02\x13\x01\x12\x04\ \xc4\x03\x12\x1e\n\r\n\x05\x04\n\x02\x13\x03\x12\x04\xc4\x03!#\n|\n\x04\ \x04\n\x02\x14\x12\x04\xc9\x03\x02:\x1an\x20The\x20parser\x20stores\x20o\ ptions\x20it\x20doesn't\x20recognize\x20here.\n\x20See\x20the\x20documen\ tation\x20for\x20the\x20\"Options\"\x20section\x20above.\n\n\r\n\x05\x04\ \n\x02\x14\x04\x12\x04\xc9\x03\x02\n\n\r\n\x05\x04\n\x02\x14\x06\x12\x04\ \xc9\x03\x0b\x1e\n\r\n\x05\x04\n\x02\x14\x01\x12\x04\xc9\x03\x1f3\n\r\n\ \x05\x04\n\x02\x14\x03\x12\x04\xc9\x0369\n\x87\x01\n\x03\x04\n\x05\x12\ \x04\xcd\x03\x02\x19\x1az\x20Clients\x20can\x20define\x20custom\x20optio\ ns\x20in\x20extensions\x20of\x20this\x20message.\n\x20See\x20the\x20docu\ mentation\x20for\x20the\x20\"Options\"\x20section\x20above.\n\n\x0c\n\ \x04\x04\n\x05\0\x12\x04\xcd\x03\r\x18\n\r\n\x05\x04\n\x05\0\x01\x12\x04\ \xcd\x03\r\x11\n\r\n\x05\x04\n\x05\0\x02\x12\x04\xcd\x03\x15\x18\n\x0b\n\ \x03\x04\n\t\x12\x04\xcf\x03\x02\x0e\n\x0c\n\x04\x04\n\t\0\x12\x04\xcf\ \x03\x0b\r\n\r\n\x05\x04\n\t\0\x01\x12\x04\xcf\x03\x0b\r\n\r\n\x05\x04\n\ \t\0\x02\x12\x04\xcf\x03\x0b\r\n\x0c\n\x02\x04\x0b\x12\x06\xd2\x03\0\x92\ \x04\x01\n\x0b\n\x03\x04\x0b\x01\x12\x04\xd2\x03\x08\x16\n\xd8\x05\n\x04\ \x04\x0b\x02\0\x12\x04\xe5\x03\x02>\x1a\xc9\x05\x20Set\x20true\x20to\x20\ use\x20the\x20old\x20proto1\x20MessageSet\x20wire\x20format\x20for\x20ex\ tensions.\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\x20\ less\n\x20efficient,\x20has\x20fewer\x20features,\x20and\x20is\x20more\ \x20complicated.\n\n\x20The\x20message\x20must\x20be\x20defined\x20exact\ ly\x20as\x20follows:\n\x20\x20\x20message\x20Foo\x20{\n\x20\x20\x20\x20\ \x20option\x20message_set_wire_format\x20=\x20true;\n\x20\x20\x20\x20\ \x20extensions\x204\x20to\x20max;\n\x20\x20\x20}\n\x20Note\x20that\x20th\ e\x20message\x20cannot\x20have\x20any\x20defined\x20fields;\x20MessageSe\ ts\x20only\n\x20have\x20extensions.\n\n\x20All\x20extensions\x20of\x20yo\ ur\x20type\x20must\x20be\x20singular\x20messages;\x20e.g.\x20they\x20can\ not\n\x20be\x20int32s,\x20enums,\x20or\x20repeated\x20messages.\n\n\x20B\ ecause\x20this\x20is\x20an\x20option,\x20the\x20above\x20two\x20restrict\ ions\x20are\x20not\x20enforced\x20by\n\x20the\x20protocol\x20compiler.\n\ \n\r\n\x05\x04\x0b\x02\0\x04\x12\x04\xe5\x03\x02\n\n\r\n\x05\x04\x0b\x02\ \0\x05\x12\x04\xe5\x03\x0b\x0f\n\r\n\x05\x04\x0b\x02\0\x01\x12\x04\xe5\ \x03\x10'\n\r\n\x05\x04\x0b\x02\0\x03\x12\x04\xe5\x03*+\n\r\n\x05\x04\ \x0b\x02\0\x08\x12\x04\xe5\x03,=\n\r\n\x05\x04\x0b\x02\0\x07\x12\x04\xe5\ \x037<\n\xeb\x01\n\x04\x04\x0b\x02\x01\x12\x04\xea\x03\x02F\x1a\xdc\x01\ \x20Disables\x20the\x20generation\x20of\x20the\x20standard\x20\"descript\ or()\"\x20accessor,\x20which\x20can\n\x20conflict\x20with\x20a\x20field\ \x20of\x20the\x20same\x20name.\x20\x20This\x20is\x20meant\x20to\x20make\ \x20migration\n\x20from\x20proto1\x20easier;\x20new\x20code\x20should\ \x20avoid\x20fields\x20named\x20\"descriptor\".\n\n\r\n\x05\x04\x0b\x02\ \x01\x04\x12\x04\xea\x03\x02\n\n\r\n\x05\x04\x0b\x02\x01\x05\x12\x04\xea\ \x03\x0b\x0f\n\r\n\x05\x04\x0b\x02\x01\x01\x12\x04\xea\x03\x10/\n\r\n\ \x05\x04\x0b\x02\x01\x03\x12\x04\xea\x0323\n\r\n\x05\x04\x0b\x02\x01\x08\ \x12\x04\xea\x034E\n\r\n\x05\x04\x0b\x02\x01\x07\x12\x04\xea\x03?D\n\xee\ \x01\n\x04\x04\x0b\x02\x02\x12\x04\xf0\x03\x021\x1a\xdf\x01\x20Is\x20thi\ s\x20message\x20deprecated?\n\x20Depending\x20on\x20the\x20target\x20pla\ tform,\x20this\x20can\x20emit\x20Deprecated\x20annotations\n\x20for\x20t\ he\x20message,\x20or\x20it\x20will\x20be\x20completely\x20ignored;\x20in\ \x20the\x20very\x20least,\n\x20this\x20is\x20a\x20formalization\x20for\ \x20deprecating\x20messages.\n\n\r\n\x05\x04\x0b\x02\x02\x04\x12\x04\xf0\ \x03\x02\n\n\r\n\x05\x04\x0b\x02\x02\x05\x12\x04\xf0\x03\x0b\x0f\n\r\n\ \x05\x04\x0b\x02\x02\x01\x12\x04\xf0\x03\x10\x1a\n\r\n\x05\x04\x0b\x02\ \x02\x03\x12\x04\xf0\x03\x1d\x1e\n\r\n\x05\x04\x0b\x02\x02\x08\x12\x04\ \xf0\x03\x1f0\n\r\n\x05\x04\x0b\x02\x02\x07\x12\x04\xf0\x03*/\n\xa0\x06\ \n\x04\x04\x0b\x02\x03\x12\x04\x87\x04\x02\x1e\x1a\x91\x06\x20Whether\ \x20the\x20message\x20is\x20an\x20automatically\x20generated\x20map\x20e\ ntry\x20type\x20for\x20the\n\x20maps\x20field.\n\n\x20For\x20maps\x20fie\ lds:\n\x20\x20\x20\x20\x20map\x20map_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_field\x20=\x201;\ \n\n\x20Implementations\x20may\x20choose\x20not\x20to\x20generate\x20the\ \x20map_entry=true\x20message,\x20but\n\x20use\x20a\x20native\x20map\x20\ in\x20the\x20target\x20language\x20to\x20hold\x20the\x20keys\x20and\x20v\ alues.\n\x20The\x20reflection\x20APIs\x20in\x20such\x20implementations\ \x20still\x20need\x20to\x20work\x20as\n\x20if\x20the\x20field\x20is\x20a\ \x20repeated\x20message\x20field.\n\n\x20NOTE:\x20Do\x20not\x20set\x20th\ e\x20option\x20in\x20.proto\x20files.\x20Always\x20use\x20the\x20maps\ \x20syntax\n\x20instead.\x20The\x20option\x20should\x20only\x20be\x20imp\ licitly\x20set\x20by\x20the\x20proto\x20compiler\n\x20parser.\n\n\r\n\ \x05\x04\x0b\x02\x03\x04\x12\x04\x87\x04\x02\n\n\r\n\x05\x04\x0b\x02\x03\ \x05\x12\x04\x87\x04\x0b\x0f\n\r\n\x05\x04\x0b\x02\x03\x01\x12\x04\x87\ \x04\x10\x19\n\r\n\x05\x04\x0b\x02\x03\x03\x12\x04\x87\x04\x1c\x1d\n$\n\ \x03\x04\x0b\t\x12\x04\x89\x04\x02\r\"\x17\x20javalite_serializable\n\n\ \x0c\n\x04\x04\x0b\t\0\x12\x04\x89\x04\x0b\x0c\n\r\n\x05\x04\x0b\t\0\x01\ \x12\x04\x89\x04\x0b\x0c\n\r\n\x05\x04\x0b\t\0\x02\x12\x04\x89\x04\x0b\ \x0c\n\x1f\n\x03\x04\x0b\t\x12\x04\x8a\x04\x02\r\"\x12\x20javanano_as_li\ te\n\n\x0c\n\x04\x04\x0b\t\x01\x12\x04\x8a\x04\x0b\x0c\n\r\n\x05\x04\x0b\ \t\x01\x01\x12\x04\x8a\x04\x0b\x0c\n\r\n\x05\x04\x0b\t\x01\x02\x12\x04\ \x8a\x04\x0b\x0c\nO\n\x04\x04\x0b\x02\x04\x12\x04\x8e\x04\x02:\x1aA\x20T\ he\x20parser\x20stores\x20options\x20it\x20doesn't\x20recognize\x20here.\ \x20See\x20above.\n\n\r\n\x05\x04\x0b\x02\x04\x04\x12\x04\x8e\x04\x02\n\ \n\r\n\x05\x04\x0b\x02\x04\x06\x12\x04\x8e\x04\x0b\x1e\n\r\n\x05\x04\x0b\ \x02\x04\x01\x12\x04\x8e\x04\x1f3\n\r\n\x05\x04\x0b\x02\x04\x03\x12\x04\ \x8e\x0469\nZ\n\x03\x04\x0b\x05\x12\x04\x91\x04\x02\x19\x1aM\x20Clients\ \x20can\x20define\x20custom\x20options\x20in\x20extensions\x20of\x20this\ \x20message.\x20See\x20above.\n\n\x0c\n\x04\x04\x0b\x05\0\x12\x04\x91\ \x04\r\x18\n\r\n\x05\x04\x0b\x05\0\x01\x12\x04\x91\x04\r\x11\n\r\n\x05\ \x04\x0b\x05\0\x02\x12\x04\x91\x04\x15\x18\n\x0c\n\x02\x04\x0c\x12\x06\ \x94\x04\0\xef\x04\x01\n\x0b\n\x03\x04\x0c\x01\x12\x04\x94\x04\x08\x14\n\ \xa3\x02\n\x04\x04\x0c\x02\0\x12\x04\x99\x04\x02.\x1a\x94\x02\x20The\x20\ ctype\x20option\x20instructs\x20the\x20C++\x20code\x20generator\x20to\ \x20use\x20a\x20different\n\x20representation\x20of\x20the\x20field\x20t\ han\x20it\x20normally\x20would.\x20\x20See\x20the\x20specific\n\x20optio\ ns\x20below.\x20\x20This\x20option\x20is\x20not\x20yet\x20implemented\ \x20in\x20the\x20open\x20source\n\x20release\x20--\x20sorry,\x20we'll\ \x20try\x20to\x20include\x20it\x20in\x20a\x20future\x20version!\n\n\r\n\ \x05\x04\x0c\x02\0\x04\x12\x04\x99\x04\x02\n\n\r\n\x05\x04\x0c\x02\0\x06\ \x12\x04\x99\x04\x0b\x10\n\r\n\x05\x04\x0c\x02\0\x01\x12\x04\x99\x04\x11\ \x16\n\r\n\x05\x04\x0c\x02\0\x03\x12\x04\x99\x04\x19\x1a\n\r\n\x05\x04\ \x0c\x02\0\x08\x12\x04\x99\x04\x1b-\n\r\n\x05\x04\x0c\x02\0\x07\x12\x04\ \x99\x04&,\n\x0e\n\x04\x04\x0c\x04\0\x12\x06\x9a\x04\x02\xa1\x04\x03\n\r\ \n\x05\x04\x0c\x04\0\x01\x12\x04\x9a\x04\x07\x0c\n\x1f\n\x06\x04\x0c\x04\ \0\x02\0\x12\x04\x9c\x04\x04\x0f\x1a\x0f\x20Default\x20mode.\n\n\x0f\n\ \x07\x04\x0c\x04\0\x02\0\x01\x12\x04\x9c\x04\x04\n\n\x0f\n\x07\x04\x0c\ \x04\0\x02\0\x02\x12\x04\x9c\x04\r\x0e\n\x0e\n\x06\x04\x0c\x04\0\x02\x01\ \x12\x04\x9e\x04\x04\r\n\x0f\n\x07\x04\x0c\x04\0\x02\x01\x01\x12\x04\x9e\ \x04\x04\x08\n\x0f\n\x07\x04\x0c\x04\0\x02\x01\x02\x12\x04\x9e\x04\x0b\ \x0c\n\x0e\n\x06\x04\x0c\x04\0\x02\x02\x12\x04\xa0\x04\x04\x15\n\x0f\n\ \x07\x04\x0c\x04\0\x02\x02\x01\x12\x04\xa0\x04\x04\x10\n\x0f\n\x07\x04\ \x0c\x04\0\x02\x02\x02\x12\x04\xa0\x04\x13\x14\n\xda\x02\n\x04\x04\x0c\ \x02\x01\x12\x04\xa7\x04\x02\x1b\x1a\xcb\x02\x20The\x20packed\x20option\ \x20can\x20be\x20enabled\x20for\x20repeated\x20primitive\x20fields\x20to\ \x20enable\n\x20a\x20more\x20efficient\x20representation\x20on\x20the\ \x20wire.\x20Rather\x20than\x20repeatedly\n\x20writing\x20the\x20tag\x20\ and\x20type\x20for\x20each\x20element,\x20the\x20entire\x20array\x20is\ \x20encoded\x20as\n\x20a\x20single\x20length-delimited\x20blob.\x20In\ \x20proto3,\x20only\x20explicit\x20setting\x20it\x20to\n\x20false\x20wil\ l\x20avoid\x20using\x20packed\x20encoding.\n\n\r\n\x05\x04\x0c\x02\x01\ \x04\x12\x04\xa7\x04\x02\n\n\r\n\x05\x04\x0c\x02\x01\x05\x12\x04\xa7\x04\ \x0b\x0f\n\r\n\x05\x04\x0c\x02\x01\x01\x12\x04\xa7\x04\x10\x16\n\r\n\x05\ \x04\x0c\x02\x01\x03\x12\x04\xa7\x04\x19\x1a\n\x9a\x05\n\x04\x04\x0c\x02\ \x02\x12\x04\xb4\x04\x023\x1a\x8b\x05\x20The\x20jstype\x20option\x20dete\ rmines\x20the\x20JavaScript\x20type\x20used\x20for\x20values\x20of\x20th\ e\n\x20field.\x20\x20The\x20option\x20is\x20permitted\x20only\x20for\x20\ 64\x20bit\x20integral\x20and\x20fixed\x20types\n\x20(int64,\x20uint64,\ \x20sint64,\x20fixed64,\x20sfixed64).\x20\x20A\x20field\x20with\x20jstyp\ e\x20JS_STRING\n\x20is\x20represented\x20as\x20JavaScript\x20string,\x20\ which\x20avoids\x20loss\x20of\x20precision\x20that\n\x20can\x20happen\ \x20when\x20a\x20large\x20value\x20is\x20converted\x20to\x20a\x20floatin\ g\x20point\x20JavaScript.\n\x20Specifying\x20JS_NUMBER\x20for\x20the\x20\ jstype\x20causes\x20the\x20generated\x20JavaScript\x20code\x20to\n\x20us\ e\x20the\x20JavaScript\x20\"number\"\x20type.\x20\x20The\x20behavior\x20\ of\x20the\x20default\x20option\n\x20JS_NORMAL\x20is\x20implementation\ \x20dependent.\n\n\x20This\x20option\x20is\x20an\x20enum\x20to\x20permit\ \x20additional\x20types\x20to\x20be\x20added,\x20e.g.\n\x20goog.math.Int\ eger.\n\n\r\n\x05\x04\x0c\x02\x02\x04\x12\x04\xb4\x04\x02\n\n\r\n\x05\ \x04\x0c\x02\x02\x06\x12\x04\xb4\x04\x0b\x11\n\r\n\x05\x04\x0c\x02\x02\ \x01\x12\x04\xb4\x04\x12\x18\n\r\n\x05\x04\x0c\x02\x02\x03\x12\x04\xb4\ \x04\x1b\x1c\n\r\n\x05\x04\x0c\x02\x02\x08\x12\x04\xb4\x04\x1d2\n\r\n\ \x05\x04\x0c\x02\x02\x07\x12\x04\xb4\x04(1\n\x0e\n\x04\x04\x0c\x04\x01\ \x12\x06\xb5\x04\x02\xbe\x04\x03\n\r\n\x05\x04\x0c\x04\x01\x01\x12\x04\ \xb5\x04\x07\r\n'\n\x06\x04\x0c\x04\x01\x02\0\x12\x04\xb7\x04\x04\x12\ \x1a\x17\x20Use\x20the\x20default\x20type.\n\n\x0f\n\x07\x04\x0c\x04\x01\ \x02\0\x01\x12\x04\xb7\x04\x04\r\n\x0f\n\x07\x04\x0c\x04\x01\x02\0\x02\ \x12\x04\xb7\x04\x10\x11\n)\n\x06\x04\x0c\x04\x01\x02\x01\x12\x04\xba\ \x04\x04\x12\x1a\x19\x20Use\x20JavaScript\x20strings.\n\n\x0f\n\x07\x04\ \x0c\x04\x01\x02\x01\x01\x12\x04\xba\x04\x04\r\n\x0f\n\x07\x04\x0c\x04\ \x01\x02\x01\x02\x12\x04\xba\x04\x10\x11\n)\n\x06\x04\x0c\x04\x01\x02\ \x02\x12\x04\xbd\x04\x04\x12\x1a\x19\x20Use\x20JavaScript\x20numbers.\n\ \n\x0f\n\x07\x04\x0c\x04\x01\x02\x02\x01\x12\x04\xbd\x04\x04\r\n\x0f\n\ \x07\x04\x0c\x04\x01\x02\x02\x02\x12\x04\xbd\x04\x10\x11\n\xef\x0c\n\x04\ \x04\x0c\x02\x03\x12\x04\xdc\x04\x02+\x1a\xe0\x0c\x20Should\x20this\x20f\ ield\x20be\x20parsed\x20lazily?\x20\x20Lazy\x20applies\x20only\x20to\x20\ message-type\n\x20fields.\x20\x20It\x20means\x20that\x20when\x20the\x20o\ uter\x20message\x20is\x20initially\x20parsed,\x20the\n\x20inner\x20messa\ ge's\x20contents\x20will\x20not\x20be\x20parsed\x20but\x20instead\x20sto\ red\x20in\x20encoded\n\x20form.\x20\x20The\x20inner\x20message\x20will\ \x20actually\x20be\x20parsed\x20when\x20it\x20is\x20first\x20accessed.\n\ \n\x20This\x20is\x20only\x20a\x20hint.\x20\x20Implementations\x20are\x20\ free\x20to\x20choose\x20whether\x20to\x20use\n\x20eager\x20or\x20lazy\ \x20parsing\x20regardless\x20of\x20the\x20value\x20of\x20this\x20option.\ \x20\x20However,\n\x20setting\x20this\x20option\x20true\x20suggests\x20t\ hat\x20the\x20protocol\x20author\x20believes\x20that\n\x20using\x20lazy\ \x20parsing\x20on\x20this\x20field\x20is\x20worth\x20the\x20additional\ \x20bookkeeping\n\x20overhead\x20typically\x20needed\x20to\x20implement\ \x20it.\n\n\x20This\x20option\x20does\x20not\x20affect\x20the\x20public\ \x20interface\x20of\x20any\x20generated\x20code;\n\x20all\x20method\x20s\ ignatures\x20remain\x20the\x20same.\x20\x20Furthermore,\x20thread-safety\ \x20of\x20the\n\x20interface\x20is\x20not\x20affected\x20by\x20this\x20o\ ption;\x20const\x20methods\x20remain\x20safe\x20to\n\x20call\x20from\x20\ multiple\x20threads\x20concurrently,\x20while\x20non-const\x20methods\ \x20continue\n\x20to\x20require\x20exclusive\x20access.\n\n\n\x20Note\ \x20that\x20implementations\x20may\x20choose\x20not\x20to\x20check\x20re\ quired\x20fields\x20within\n\x20a\x20lazy\x20sub-message.\x20\x20That\ \x20is,\x20calling\x20IsInitialized()\x20on\x20the\x20outer\x20message\n\ \x20may\x20return\x20true\x20even\x20if\x20the\x20inner\x20message\x20ha\ s\x20missing\x20required\x20fields.\n\x20This\x20is\x20necessary\x20beca\ use\x20otherwise\x20the\x20inner\x20message\x20would\x20have\x20to\x20be\ \n\x20parsed\x20in\x20order\x20to\x20perform\x20the\x20check,\x20defeati\ ng\x20the\x20purpose\x20of\x20lazy\n\x20parsing.\x20\x20An\x20implementa\ tion\x20which\x20chooses\x20not\x20to\x20check\x20required\x20fields\n\ \x20must\x20be\x20consistent\x20about\x20it.\x20\x20That\x20is,\x20for\ \x20any\x20particular\x20sub-message,\x20the\n\x20implementation\x20must\ \x20either\x20*always*\x20check\x20its\x20required\x20fields,\x20or\x20*\ never*\n\x20check\x20its\x20required\x20fields,\x20regardless\x20of\x20w\ hether\x20or\x20not\x20the\x20message\x20has\n\x20been\x20parsed.\n\n\r\ \n\x05\x04\x0c\x02\x03\x04\x12\x04\xdc\x04\x02\n\n\r\n\x05\x04\x0c\x02\ \x03\x05\x12\x04\xdc\x04\x0b\x0f\n\r\n\x05\x04\x0c\x02\x03\x01\x12\x04\ \xdc\x04\x10\x14\n\r\n\x05\x04\x0c\x02\x03\x03\x12\x04\xdc\x04\x17\x18\n\ \r\n\x05\x04\x0c\x02\x03\x08\x12\x04\xdc\x04\x19*\n\r\n\x05\x04\x0c\x02\ \x03\x07\x12\x04\xdc\x04$)\n\xe8\x01\n\x04\x04\x0c\x02\x04\x12\x04\xe2\ \x04\x021\x1a\xd9\x01\x20Is\x20this\x20field\x20deprecated?\n\x20Dependi\ ng\x20on\x20the\x20target\x20platform,\x20this\x20can\x20emit\x20Depreca\ ted\x20annotations\n\x20for\x20accessors,\x20or\x20it\x20will\x20be\x20c\ ompletely\x20ignored;\x20in\x20the\x20very\x20least,\x20this\n\x20is\x20\ a\x20formalization\x20for\x20deprecating\x20fields.\n\n\r\n\x05\x04\x0c\ \x02\x04\x04\x12\x04\xe2\x04\x02\n\n\r\n\x05\x04\x0c\x02\x04\x05\x12\x04\ \xe2\x04\x0b\x0f\n\r\n\x05\x04\x0c\x02\x04\x01\x12\x04\xe2\x04\x10\x1a\n\ \r\n\x05\x04\x0c\x02\x04\x03\x12\x04\xe2\x04\x1d\x1e\n\r\n\x05\x04\x0c\ \x02\x04\x08\x12\x04\xe2\x04\x1f0\n\r\n\x05\x04\x0c\x02\x04\x07\x12\x04\ \xe2\x04*/\n?\n\x04\x04\x0c\x02\x05\x12\x04\xe5\x04\x02,\x1a1\x20For\x20\ Google-internal\x20migration\x20only.\x20Do\x20not\x20use.\n\n\r\n\x05\ \x04\x0c\x02\x05\x04\x12\x04\xe5\x04\x02\n\n\r\n\x05\x04\x0c\x02\x05\x05\ \x12\x04\xe5\x04\x0b\x0f\n\r\n\x05\x04\x0c\x02\x05\x01\x12\x04\xe5\x04\ \x10\x14\n\r\n\x05\x04\x0c\x02\x05\x03\x12\x04\xe5\x04\x17\x19\n\r\n\x05\ \x04\x0c\x02\x05\x08\x12\x04\xe5\x04\x1a+\n\r\n\x05\x04\x0c\x02\x05\x07\ \x12\x04\xe5\x04%*\nO\n\x04\x04\x0c\x02\x06\x12\x04\xe9\x04\x02:\x1aA\ \x20The\x20parser\x20stores\x20options\x20it\x20doesn't\x20recognize\x20\ here.\x20See\x20above.\n\n\r\n\x05\x04\x0c\x02\x06\x04\x12\x04\xe9\x04\ \x02\n\n\r\n\x05\x04\x0c\x02\x06\x06\x12\x04\xe9\x04\x0b\x1e\n\r\n\x05\ \x04\x0c\x02\x06\x01\x12\x04\xe9\x04\x1f3\n\r\n\x05\x04\x0c\x02\x06\x03\ \x12\x04\xe9\x0469\nZ\n\x03\x04\x0c\x05\x12\x04\xec\x04\x02\x19\x1aM\x20\ Clients\x20can\x20define\x20custom\x20options\x20in\x20extensions\x20of\ \x20this\x20message.\x20See\x20above.\n\n\x0c\n\x04\x04\x0c\x05\0\x12\ \x04\xec\x04\r\x18\n\r\n\x05\x04\x0c\x05\0\x01\x12\x04\xec\x04\r\x11\n\r\ \n\x05\x04\x0c\x05\0\x02\x12\x04\xec\x04\x15\x18\n\x1c\n\x03\x04\x0c\t\ \x12\x04\xee\x04\x02\r\"\x0f\x20removed\x20jtype\n\n\x0c\n\x04\x04\x0c\t\ \0\x12\x04\xee\x04\x0b\x0c\n\r\n\x05\x04\x0c\t\0\x01\x12\x04\xee\x04\x0b\ \x0c\n\r\n\x05\x04\x0c\t\0\x02\x12\x04\xee\x04\x0b\x0c\n\x0c\n\x02\x04\r\ \x12\x06\xf1\x04\0\xf7\x04\x01\n\x0b\n\x03\x04\r\x01\x12\x04\xf1\x04\x08\ \x14\nO\n\x04\x04\r\x02\0\x12\x04\xf3\x04\x02:\x1aA\x20The\x20parser\x20\ stores\x20options\x20it\x20doesn't\x20recognize\x20here.\x20See\x20above\ .\n\n\r\n\x05\x04\r\x02\0\x04\x12\x04\xf3\x04\x02\n\n\r\n\x05\x04\r\x02\ \0\x06\x12\x04\xf3\x04\x0b\x1e\n\r\n\x05\x04\r\x02\0\x01\x12\x04\xf3\x04\ \x1f3\n\r\n\x05\x04\r\x02\0\x03\x12\x04\xf3\x0469\nZ\n\x03\x04\r\x05\x12\ \x04\xf6\x04\x02\x19\x1aM\x20Clients\x20can\x20define\x20custom\x20optio\ ns\x20in\x20extensions\x20of\x20this\x20message.\x20See\x20above.\n\n\ \x0c\n\x04\x04\r\x05\0\x12\x04\xf6\x04\r\x18\n\r\n\x05\x04\r\x05\0\x01\ \x12\x04\xf6\x04\r\x11\n\r\n\x05\x04\r\x05\0\x02\x12\x04\xf6\x04\x15\x18\ \n\x0c\n\x02\x04\x0e\x12\x06\xf9\x04\0\x8c\x05\x01\n\x0b\n\x03\x04\x0e\ \x01\x12\x04\xf9\x04\x08\x13\n`\n\x04\x04\x0e\x02\0\x12\x04\xfd\x04\x02\ \x20\x1aR\x20Set\x20this\x20option\x20to\x20true\x20to\x20allow\x20mappi\ ng\x20different\x20tag\x20names\x20to\x20the\x20same\n\x20value.\n\n\r\n\ \x05\x04\x0e\x02\0\x04\x12\x04\xfd\x04\x02\n\n\r\n\x05\x04\x0e\x02\0\x05\ \x12\x04\xfd\x04\x0b\x0f\n\r\n\x05\x04\x0e\x02\0\x01\x12\x04\xfd\x04\x10\ \x1b\n\r\n\x05\x04\x0e\x02\0\x03\x12\x04\xfd\x04\x1e\x1f\n\xe5\x01\n\x04\ \x04\x0e\x02\x01\x12\x04\x83\x05\x021\x1a\xd6\x01\x20Is\x20this\x20enum\ \x20deprecated?\n\x20Depending\x20on\x20the\x20target\x20platform,\x20th\ is\x20can\x20emit\x20Deprecated\x20annotations\n\x20for\x20the\x20enum,\ \x20or\x20it\x20will\x20be\x20completely\x20ignored;\x20in\x20the\x20ver\ y\x20least,\x20this\n\x20is\x20a\x20formalization\x20for\x20deprecating\ \x20enums.\n\n\r\n\x05\x04\x0e\x02\x01\x04\x12\x04\x83\x05\x02\n\n\r\n\ \x05\x04\x0e\x02\x01\x05\x12\x04\x83\x05\x0b\x0f\n\r\n\x05\x04\x0e\x02\ \x01\x01\x12\x04\x83\x05\x10\x1a\n\r\n\x05\x04\x0e\x02\x01\x03\x12\x04\ \x83\x05\x1d\x1e\n\r\n\x05\x04\x0e\x02\x01\x08\x12\x04\x83\x05\x1f0\n\r\ \n\x05\x04\x0e\x02\x01\x07\x12\x04\x83\x05*/\n\x1f\n\x03\x04\x0e\t\x12\ \x04\x85\x05\x02\r\"\x12\x20javanano_as_lite\n\n\x0c\n\x04\x04\x0e\t\0\ \x12\x04\x85\x05\x0b\x0c\n\r\n\x05\x04\x0e\t\0\x01\x12\x04\x85\x05\x0b\ \x0c\n\r\n\x05\x04\x0e\t\0\x02\x12\x04\x85\x05\x0b\x0c\nO\n\x04\x04\x0e\ \x02\x02\x12\x04\x88\x05\x02:\x1aA\x20The\x20parser\x20stores\x20options\ \x20it\x20doesn't\x20recognize\x20here.\x20See\x20above.\n\n\r\n\x05\x04\ \x0e\x02\x02\x04\x12\x04\x88\x05\x02\n\n\r\n\x05\x04\x0e\x02\x02\x06\x12\ \x04\x88\x05\x0b\x1e\n\r\n\x05\x04\x0e\x02\x02\x01\x12\x04\x88\x05\x1f3\ \n\r\n\x05\x04\x0e\x02\x02\x03\x12\x04\x88\x0569\nZ\n\x03\x04\x0e\x05\ \x12\x04\x8b\x05\x02\x19\x1aM\x20Clients\x20can\x20define\x20custom\x20o\ ptions\x20in\x20extensions\x20of\x20this\x20message.\x20See\x20above.\n\ \n\x0c\n\x04\x04\x0e\x05\0\x12\x04\x8b\x05\r\x18\n\r\n\x05\x04\x0e\x05\0\ \x01\x12\x04\x8b\x05\r\x11\n\r\n\x05\x04\x0e\x05\0\x02\x12\x04\x8b\x05\ \x15\x18\n\x0c\n\x02\x04\x0f\x12\x06\x8e\x05\0\x9a\x05\x01\n\x0b\n\x03\ \x04\x0f\x01\x12\x04\x8e\x05\x08\x18\n\xf7\x01\n\x04\x04\x0f\x02\0\x12\ \x04\x93\x05\x021\x1a\xe8\x01\x20Is\x20this\x20enum\x20value\x20deprecat\ ed?\n\x20Depending\x20on\x20the\x20target\x20platform,\x20this\x20can\ \x20emit\x20Deprecated\x20annotations\n\x20for\x20the\x20enum\x20value,\ \x20or\x20it\x20will\x20be\x20completely\x20ignored;\x20in\x20the\x20ver\ y\x20least,\n\x20this\x20is\x20a\x20formalization\x20for\x20deprecating\ \x20enum\x20values.\n\n\r\n\x05\x04\x0f\x02\0\x04\x12\x04\x93\x05\x02\n\ \n\r\n\x05\x04\x0f\x02\0\x05\x12\x04\x93\x05\x0b\x0f\n\r\n\x05\x04\x0f\ \x02\0\x01\x12\x04\x93\x05\x10\x1a\n\r\n\x05\x04\x0f\x02\0\x03\x12\x04\ \x93\x05\x1d\x1e\n\r\n\x05\x04\x0f\x02\0\x08\x12\x04\x93\x05\x1f0\n\r\n\ \x05\x04\x0f\x02\0\x07\x12\x04\x93\x05*/\nO\n\x04\x04\x0f\x02\x01\x12\ \x04\x96\x05\x02:\x1aA\x20The\x20parser\x20stores\x20options\x20it\x20do\ esn't\x20recognize\x20here.\x20See\x20above.\n\n\r\n\x05\x04\x0f\x02\x01\ \x04\x12\x04\x96\x05\x02\n\n\r\n\x05\x04\x0f\x02\x01\x06\x12\x04\x96\x05\ \x0b\x1e\n\r\n\x05\x04\x0f\x02\x01\x01\x12\x04\x96\x05\x1f3\n\r\n\x05\ \x04\x0f\x02\x01\x03\x12\x04\x96\x0569\nZ\n\x03\x04\x0f\x05\x12\x04\x99\ \x05\x02\x19\x1aM\x20Clients\x20can\x20define\x20custom\x20options\x20in\ \x20extensions\x20of\x20this\x20message.\x20See\x20above.\n\n\x0c\n\x04\ \x04\x0f\x05\0\x12\x04\x99\x05\r\x18\n\r\n\x05\x04\x0f\x05\0\x01\x12\x04\ \x99\x05\r\x11\n\r\n\x05\x04\x0f\x05\0\x02\x12\x04\x99\x05\x15\x18\n\x0c\ \n\x02\x04\x10\x12\x06\x9c\x05\0\xae\x05\x01\n\x0b\n\x03\x04\x10\x01\x12\ \x04\x9c\x05\x08\x16\n\xd9\x03\n\x04\x04\x10\x02\0\x12\x04\xa7\x05\x022\ \x1a\xdf\x01\x20Is\x20this\x20service\x20deprecated?\n\x20Depending\x20o\ n\x20the\x20target\x20platform,\x20this\x20can\x20emit\x20Deprecated\x20\ annotations\n\x20for\x20the\x20service,\x20or\x20it\x20will\x20be\x20com\ pletely\x20ignored;\x20in\x20the\x20very\x20least,\n\x20this\x20is\x20a\ \x20formalization\x20for\x20deprecating\x20services.\n2\xe8\x01\x20Note:\ \x20\x20Field\x20numbers\x201\x20through\x2032\x20are\x20reserved\x20for\ \x20Google's\x20internal\x20RPC\n\x20\x20\x20framework.\x20\x20We\x20apo\ logize\x20for\x20hoarding\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\x10\x02\0\x04\x12\x04\xa7\x05\x02\n\n\r\n\x05\x04\x10\x02\0\ \x05\x12\x04\xa7\x05\x0b\x0f\n\r\n\x05\x04\x10\x02\0\x01\x12\x04\xa7\x05\ \x10\x1a\n\r\n\x05\x04\x10\x02\0\x03\x12\x04\xa7\x05\x1d\x1f\n\r\n\x05\ \x04\x10\x02\0\x08\x12\x04\xa7\x05\x201\n\r\n\x05\x04\x10\x02\0\x07\x12\ \x04\xa7\x05+0\nO\n\x04\x04\x10\x02\x01\x12\x04\xaa\x05\x02:\x1aA\x20The\ \x20parser\x20stores\x20options\x20it\x20doesn't\x20recognize\x20here.\ \x20See\x20above.\n\n\r\n\x05\x04\x10\x02\x01\x04\x12\x04\xaa\x05\x02\n\ \n\r\n\x05\x04\x10\x02\x01\x06\x12\x04\xaa\x05\x0b\x1e\n\r\n\x05\x04\x10\ \x02\x01\x01\x12\x04\xaa\x05\x1f3\n\r\n\x05\x04\x10\x02\x01\x03\x12\x04\ \xaa\x0569\nZ\n\x03\x04\x10\x05\x12\x04\xad\x05\x02\x19\x1aM\x20Clients\ \x20can\x20define\x20custom\x20options\x20in\x20extensions\x20of\x20this\ \x20message.\x20See\x20above.\n\n\x0c\n\x04\x04\x10\x05\0\x12\x04\xad\ \x05\r\x18\n\r\n\x05\x04\x10\x05\0\x01\x12\x04\xad\x05\r\x11\n\r\n\x05\ \x04\x10\x05\0\x02\x12\x04\xad\x05\x15\x18\n\x0c\n\x02\x04\x11\x12\x06\ \xb0\x05\0\xcd\x05\x01\n\x0b\n\x03\x04\x11\x01\x12\x04\xb0\x05\x08\x15\n\ \xd6\x03\n\x04\x04\x11\x02\0\x12\x04\xbb\x05\x022\x1a\xdc\x01\x20Is\x20t\ his\x20method\x20deprecated?\n\x20Depending\x20on\x20the\x20target\x20pl\ atform,\x20this\x20can\x20emit\x20Deprecated\x20annotations\n\x20for\x20\ the\x20method,\x20or\x20it\x20will\x20be\x20completely\x20ignored;\x20in\ \x20the\x20very\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\x20hoardin\ g\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\x11\x02\0\ \x04\x12\x04\xbb\x05\x02\n\n\r\n\x05\x04\x11\x02\0\x05\x12\x04\xbb\x05\ \x0b\x0f\n\r\n\x05\x04\x11\x02\0\x01\x12\x04\xbb\x05\x10\x1a\n\r\n\x05\ \x04\x11\x02\0\x03\x12\x04\xbb\x05\x1d\x1f\n\r\n\x05\x04\x11\x02\0\x08\ \x12\x04\xbb\x05\x201\n\r\n\x05\x04\x11\x02\0\x07\x12\x04\xbb\x05+0\n\ \xf0\x01\n\x04\x04\x11\x04\0\x12\x06\xc0\x05\x02\xc4\x05\x03\x1a\xdf\x01\ \x20Is\x20this\x20method\x20side-effect-free\x20(or\x20safe\x20in\x20HTT\ P\x20parlance),\x20or\x20idempotent,\n\x20or\x20neither?\x20HTTP\x20base\ d\x20RPC\x20implementation\x20may\x20choose\x20GET\x20verb\x20for\x20saf\ e\n\x20methods,\x20and\x20PUT\x20verb\x20for\x20idempotent\x20methods\ \x20instead\x20of\x20the\x20default\x20POST.\n\n\r\n\x05\x04\x11\x04\0\ \x01\x12\x04\xc0\x05\x07\x17\n\x0e\n\x06\x04\x11\x04\0\x02\0\x12\x04\xc1\ \x05\x04\x1c\n\x0f\n\x07\x04\x11\x04\0\x02\0\x01\x12\x04\xc1\x05\x04\x17\ \n\x0f\n\x07\x04\x11\x04\0\x02\0\x02\x12\x04\xc1\x05\x1a\x1b\n$\n\x06\ \x04\x11\x04\0\x02\x01\x12\x04\xc2\x05\x04\x18\"\x14\x20implies\x20idemp\ otent\n\n\x0f\n\x07\x04\x11\x04\0\x02\x01\x01\x12\x04\xc2\x05\x04\x13\n\ \x0f\n\x07\x04\x11\x04\0\x02\x01\x02\x12\x04\xc2\x05\x16\x17\n7\n\x06\ \x04\x11\x04\0\x02\x02\x12\x04\xc3\x05\x04\x13\"'\x20idempotent,\x20but\ \x20may\x20have\x20side\x20effects\n\n\x0f\n\x07\x04\x11\x04\0\x02\x02\ \x01\x12\x04\xc3\x05\x04\x0e\n\x0f\n\x07\x04\x11\x04\0\x02\x02\x02\x12\ \x04\xc3\x05\x11\x12\n\x0e\n\x04\x04\x11\x02\x01\x12\x06\xc5\x05\x02\xc6\ \x05&\n\r\n\x05\x04\x11\x02\x01\x04\x12\x04\xc5\x05\x02\n\n\r\n\x05\x04\ \x11\x02\x01\x06\x12\x04\xc5\x05\x0b\x1b\n\r\n\x05\x04\x11\x02\x01\x01\ \x12\x04\xc5\x05\x1c-\n\r\n\x05\x04\x11\x02\x01\x03\x12\x04\xc5\x0502\n\ \r\n\x05\x04\x11\x02\x01\x08\x12\x04\xc6\x05\x06%\n\r\n\x05\x04\x11\x02\ \x01\x07\x12\x04\xc6\x05\x11$\nO\n\x04\x04\x11\x02\x02\x12\x04\xc9\x05\ \x02:\x1aA\x20The\x20parser\x20stores\x20options\x20it\x20doesn't\x20rec\ ognize\x20here.\x20See\x20above.\n\n\r\n\x05\x04\x11\x02\x02\x04\x12\x04\ \xc9\x05\x02\n\n\r\n\x05\x04\x11\x02\x02\x06\x12\x04\xc9\x05\x0b\x1e\n\r\ \n\x05\x04\x11\x02\x02\x01\x12\x04\xc9\x05\x1f3\n\r\n\x05\x04\x11\x02\ \x02\x03\x12\x04\xc9\x0569\nZ\n\x03\x04\x11\x05\x12\x04\xcc\x05\x02\x19\ \x1aM\x20Clients\x20can\x20define\x20custom\x20options\x20in\x20extensio\ ns\x20of\x20this\x20message.\x20See\x20above.\n\n\x0c\n\x04\x04\x11\x05\ \0\x12\x04\xcc\x05\r\x18\n\r\n\x05\x04\x11\x05\0\x01\x12\x04\xcc\x05\r\ \x11\n\r\n\x05\x04\x11\x05\0\x02\x12\x04\xcc\x05\x15\x18\n\x8b\x03\n\x02\ \x04\x12\x12\x06\xd6\x05\0\xea\x05\x01\x1a\xfc\x02\x20A\x20message\x20re\ presenting\x20a\x20option\x20the\x20parser\x20does\x20not\x20recognize.\ \x20This\x20only\n\x20appears\x20in\x20options\x20protos\x20created\x20b\ y\x20the\x20compiler::Parser\x20class.\n\x20DescriptorPool\x20resolves\ \x20these\x20when\x20building\x20Descriptor\x20objects.\x20Therefore,\n\ \x20options\x20protos\x20in\x20descriptor\x20objects\x20(e.g.\x20returne\ d\x20by\x20Descriptor::options(),\n\x20or\x20produced\x20by\x20Descripto\ r::CopyTo())\x20will\x20never\x20have\x20UninterpretedOptions\n\x20in\ \x20them.\n\n\x0b\n\x03\x04\x12\x01\x12\x04\xd6\x05\x08\x1b\n\xcb\x02\n\ \x04\x04\x12\x03\0\x12\x06\xdc\x05\x02\xdf\x05\x03\x1a\xba\x02\x20The\ \x20name\x20of\x20the\x20uninterpreted\x20option.\x20\x20Each\x20string\ \x20represents\x20a\x20segment\x20in\n\x20a\x20dot-separated\x20name.\ \x20\x20is_extension\x20is\x20true\x20iff\x20a\x20segment\x20represents\ \x20an\n\x20extension\x20(denoted\x20with\x20parentheses\x20in\x20option\ s\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\x12\x03\0\x01\x12\x04\xdc\x05\ \n\x12\n\x0e\n\x06\x04\x12\x03\0\x02\0\x12\x04\xdd\x05\x04\"\n\x0f\n\x07\ \x04\x12\x03\0\x02\0\x04\x12\x04\xdd\x05\x04\x0c\n\x0f\n\x07\x04\x12\x03\ \0\x02\0\x05\x12\x04\xdd\x05\r\x13\n\x0f\n\x07\x04\x12\x03\0\x02\0\x01\ \x12\x04\xdd\x05\x14\x1d\n\x0f\n\x07\x04\x12\x03\0\x02\0\x03\x12\x04\xdd\ \x05\x20!\n\x0e\n\x06\x04\x12\x03\0\x02\x01\x12\x04\xde\x05\x04#\n\x0f\n\ \x07\x04\x12\x03\0\x02\x01\x04\x12\x04\xde\x05\x04\x0c\n\x0f\n\x07\x04\ \x12\x03\0\x02\x01\x05\x12\x04\xde\x05\r\x11\n\x0f\n\x07\x04\x12\x03\0\ \x02\x01\x01\x12\x04\xde\x05\x12\x1e\n\x0f\n\x07\x04\x12\x03\0\x02\x01\ \x03\x12\x04\xde\x05!\"\n\x0c\n\x04\x04\x12\x02\0\x12\x04\xe0\x05\x02\ \x1d\n\r\n\x05\x04\x12\x02\0\x04\x12\x04\xe0\x05\x02\n\n\r\n\x05\x04\x12\ \x02\0\x06\x12\x04\xe0\x05\x0b\x13\n\r\n\x05\x04\x12\x02\0\x01\x12\x04\ \xe0\x05\x14\x18\n\r\n\x05\x04\x12\x02\0\x03\x12\x04\xe0\x05\x1b\x1c\n\ \x9c\x01\n\x04\x04\x12\x02\x01\x12\x04\xe4\x05\x02'\x1a\x8d\x01\x20The\ \x20value\x20of\x20the\x20uninterpreted\x20option,\x20in\x20whatever\x20\ type\x20the\x20tokenizer\n\x20identified\x20it\x20as\x20during\x20parsin\ g.\x20Exactly\x20one\x20of\x20these\x20should\x20be\x20set.\n\n\r\n\x05\ \x04\x12\x02\x01\x04\x12\x04\xe4\x05\x02\n\n\r\n\x05\x04\x12\x02\x01\x05\ \x12\x04\xe4\x05\x0b\x11\n\r\n\x05\x04\x12\x02\x01\x01\x12\x04\xe4\x05\ \x12\"\n\r\n\x05\x04\x12\x02\x01\x03\x12\x04\xe4\x05%&\n\x0c\n\x04\x04\ \x12\x02\x02\x12\x04\xe5\x05\x02)\n\r\n\x05\x04\x12\x02\x02\x04\x12\x04\ \xe5\x05\x02\n\n\r\n\x05\x04\x12\x02\x02\x05\x12\x04\xe5\x05\x0b\x11\n\r\ \n\x05\x04\x12\x02\x02\x01\x12\x04\xe5\x05\x12$\n\r\n\x05\x04\x12\x02\ \x02\x03\x12\x04\xe5\x05'(\n\x0c\n\x04\x04\x12\x02\x03\x12\x04\xe6\x05\ \x02(\n\r\n\x05\x04\x12\x02\x03\x04\x12\x04\xe6\x05\x02\n\n\r\n\x05\x04\ \x12\x02\x03\x05\x12\x04\xe6\x05\x0b\x10\n\r\n\x05\x04\x12\x02\x03\x01\ \x12\x04\xe6\x05\x11#\n\r\n\x05\x04\x12\x02\x03\x03\x12\x04\xe6\x05&'\n\ \x0c\n\x04\x04\x12\x02\x04\x12\x04\xe7\x05\x02#\n\r\n\x05\x04\x12\x02\ \x04\x04\x12\x04\xe7\x05\x02\n\n\r\n\x05\x04\x12\x02\x04\x05\x12\x04\xe7\ \x05\x0b\x11\n\r\n\x05\x04\x12\x02\x04\x01\x12\x04\xe7\x05\x12\x1e\n\r\n\ \x05\x04\x12\x02\x04\x03\x12\x04\xe7\x05!\"\n\x0c\n\x04\x04\x12\x02\x05\ \x12\x04\xe8\x05\x02\"\n\r\n\x05\x04\x12\x02\x05\x04\x12\x04\xe8\x05\x02\ \n\n\r\n\x05\x04\x12\x02\x05\x05\x12\x04\xe8\x05\x0b\x10\n\r\n\x05\x04\ \x12\x02\x05\x01\x12\x04\xe8\x05\x11\x1d\n\r\n\x05\x04\x12\x02\x05\x03\ \x12\x04\xe8\x05\x20!\n\x0c\n\x04\x04\x12\x02\x06\x12\x04\xe9\x05\x02&\n\ \r\n\x05\x04\x12\x02\x06\x04\x12\x04\xe9\x05\x02\n\n\r\n\x05\x04\x12\x02\ \x06\x05\x12\x04\xe9\x05\x0b\x11\n\r\n\x05\x04\x12\x02\x06\x01\x12\x04\ \xe9\x05\x12!\n\r\n\x05\x04\x12\x02\x06\x03\x12\x04\xe9\x05$%\n\xda\x01\ \n\x02\x04\x13\x12\x06\xf1\x05\0\xf2\x06\x01\x1aj\x20Encapsulates\x20inf\ ormation\x20about\x20the\x20original\x20source\x20file\x20from\x20which\ \x20a\n\x20FileDescriptorProto\x20was\x20generated.\n2`\x20=============\ ======================================================\n\x20Optional\x20\ source\x20code\x20info\n\n\x0b\n\x03\x04\x13\x01\x12\x04\xf1\x05\x08\x16\ \n\x82\x11\n\x04\x04\x13\x02\0\x12\x04\x9d\x06\x02!\x1a\xf3\x10\x20A\x20\ Location\x20identifies\x20a\x20piece\x20of\x20source\x20code\x20in\x20a\ \x20.proto\x20file\x20which\n\x20corresponds\x20to\x20a\x20particular\ \x20definition.\x20\x20This\x20information\x20is\x20intended\n\x20to\x20\ be\x20useful\x20to\x20IDEs,\x20code\x20indexers,\x20documentation\x20gen\ erators,\x20and\x20similar\n\x20tools.\n\n\x20For\x20example,\x20say\x20\ we\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\x20definition:\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\x20\ represents\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\x20label\x20(opti\ onal).\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,\x20\ 2,\x200,\x201\x20]\x20\x20The\x20name\x20(foo).\n\x20\x20\x20[g,h)\x20\ \x20[\x204,\x200,\x202,\x200,\x203\x20]\x20\x20The\x20number\x20(1).\n\n\ \x20Notes:\n\x20-\x20A\x20location\x20may\x20refer\x20to\x20a\x20repeate\ d\x20field\x20itself\x20(i.e.\x20not\x20to\x20any\n\x20\x20\x20particula\ r\x20index\x20within\x20it).\x20\x20This\x20is\x20used\x20whenever\x20a\ \x20set\x20of\x20elements\x20are\n\x20\x20\x20logically\x20enclosed\x20i\ n\x20a\x20single\x20code\x20segment.\x20\x20For\x20example,\x20an\x20ent\ ire\n\x20\x20\x20extend\x20block\x20(possibly\x20containing\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-\x20Mul\ tiple\x20locations\x20may\x20have\x20the\x20same\x20path.\x20\x20This\ \x20happens\x20when\x20a\x20single\n\x20\x20\x20logical\x20declaration\ \x20is\x20spread\x20out\x20across\x20multiple\x20places.\x20\x20The\x20m\ ost\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\x20which\x20will\ \x20have\x20the\x20same\x20path.\n\x20-\x20A\x20location's\x20span\x20is\ \x20not\x20always\x20a\x20subset\x20of\x20its\x20parent's\x20span.\x20\ \x20For\n\x20\x20\x20example,\x20the\x20\"extendee\"\x20of\x20an\x20exte\ nsion\x20declaration\x20appears\x20at\x20the\n\x20\x20\x20beginning\x20o\ f\x20the\x20\"extend\"\x20block\x20and\x20is\x20shared\x20by\x20all\x20e\ xtensions\x20within\n\x20\x20\x20the\x20block.\n\x20-\x20Just\x20because\ \x20a\x20location's\x20span\x20is\x20a\x20subset\x20of\x20some\x20other\ \x20location's\x20span\n\x20\x20\x20does\x20not\x20mean\x20that\x20it\ \x20is\x20a\x20descendant.\x20\x20For\x20example,\x20a\x20\"group\"\x20d\ efines\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\x20their\ \x20components\x20will\x20overlap.\n\x20-\x20Code\x20which\x20tries\x20t\ o\x20interpret\x20locations\x20should\x20probably\x20be\x20designed\x20t\ o\n\x20\x20\x20ignore\x20those\x20that\x20it\x20doesn't\x20understand,\ \x20as\x20more\x20types\x20of\x20locations\x20could\n\x20\x20\x20be\x20r\ ecorded\x20in\x20the\x20future.\n\n\r\n\x05\x04\x13\x02\0\x04\x12\x04\ \x9d\x06\x02\n\n\r\n\x05\x04\x13\x02\0\x06\x12\x04\x9d\x06\x0b\x13\n\r\n\ \x05\x04\x13\x02\0\x01\x12\x04\x9d\x06\x14\x1c\n\r\n\x05\x04\x13\x02\0\ \x03\x12\x04\x9d\x06\x1f\x20\n\x0e\n\x04\x04\x13\x03\0\x12\x06\x9e\x06\ \x02\xf1\x06\x03\n\r\n\x05\x04\x13\x03\0\x01\x12\x04\x9e\x06\n\x12\n\x83\ \x07\n\x06\x04\x13\x03\0\x02\0\x12\x04\xb6\x06\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\x13\x03\0\x02\0\x04\x12\x04\xb6\x06\x04\x0c\n\x0f\ \n\x07\x04\x13\x03\0\x02\0\x05\x12\x04\xb6\x06\r\x12\n\x0f\n\x07\x04\x13\ \x03\0\x02\0\x01\x12\x04\xb6\x06\x13\x17\n\x0f\n\x07\x04\x13\x03\0\x02\0\ \x03\x12\x04\xb6\x06\x1a\x1b\n\x0f\n\x07\x04\x13\x03\0\x02\0\x08\x12\x04\ \xb6\x06\x1c+\n\x10\n\x08\x04\x13\x03\0\x02\0\x08\x02\x12\x04\xb6\x06\ \x1d*\n\xd2\x02\n\x06\x04\x13\x03\0\x02\x01\x12\x04\xbd\x06\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\x13\x03\0\x02\x01\x04\x12\x04\xbd\x06\x04\x0c\n\x0f\n\x07\x04\ \x13\x03\0\x02\x01\x05\x12\x04\xbd\x06\r\x12\n\x0f\n\x07\x04\x13\x03\0\ \x02\x01\x01\x12\x04\xbd\x06\x13\x17\n\x0f\n\x07\x04\x13\x03\0\x02\x01\ \x03\x12\x04\xbd\x06\x1a\x1b\n\x0f\n\x07\x04\x13\x03\0\x02\x01\x08\x12\ \x04\xbd\x06\x1c+\n\x10\n\x08\x04\x13\x03\0\x02\x01\x08\x02\x12\x04\xbd\ \x06\x1d*\n\xa5\x0c\n\x06\x04\x13\x03\0\x02\x02\x12\x04\xee\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\x13\x03\0\x02\x02\x04\x12\x04\xee\x06\x04\x0c\n\x0f\n\ \x07\x04\x13\x03\0\x02\x02\x05\x12\x04\xee\x06\r\x13\n\x0f\n\x07\x04\x13\ \x03\0\x02\x02\x01\x12\x04\xee\x06\x14$\n\x0f\n\x07\x04\x13\x03\0\x02\ \x02\x03\x12\x04\xee\x06'(\n\x0e\n\x06\x04\x13\x03\0\x02\x03\x12\x04\xef\ \x06\x04*\n\x0f\n\x07\x04\x13\x03\0\x02\x03\x04\x12\x04\xef\x06\x04\x0c\ \n\x0f\n\x07\x04\x13\x03\0\x02\x03\x05\x12\x04\xef\x06\r\x13\n\x0f\n\x07\ \x04\x13\x03\0\x02\x03\x01\x12\x04\xef\x06\x14%\n\x0f\n\x07\x04\x13\x03\ \0\x02\x03\x03\x12\x04\xef\x06()\n\x0e\n\x06\x04\x13\x03\0\x02\x04\x12\ \x04\xf0\x06\x042\n\x0f\n\x07\x04\x13\x03\0\x02\x04\x04\x12\x04\xf0\x06\ \x04\x0c\n\x0f\n\x07\x04\x13\x03\0\x02\x04\x05\x12\x04\xf0\x06\r\x13\n\ \x0f\n\x07\x04\x13\x03\0\x02\x04\x01\x12\x04\xf0\x06\x14-\n\x0f\n\x07\ \x04\x13\x03\0\x02\x04\x03\x12\x04\xf0\x0601\n\xee\x01\n\x02\x04\x14\x12\ \x06\xf7\x06\0\x8c\x07\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\x14\x01\x12\x04\xf7\x06\x08\x19\nx\n\x04\x04\x14\x02\0\ \x12\x04\xfa\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\x14\x02\0\x04\ \x12\x04\xfa\x06\x02\n\n\r\n\x05\x04\x14\x02\0\x06\x12\x04\xfa\x06\x0b\ \x15\n\r\n\x05\x04\x14\x02\0\x01\x12\x04\xfa\x06\x16\x20\n\r\n\x05\x04\ \x14\x02\0\x03\x12\x04\xfa\x06#$\n\x0e\n\x04\x04\x14\x03\0\x12\x06\xfb\ \x06\x02\x8b\x07\x03\n\r\n\x05\x04\x14\x03\0\x01\x12\x04\xfb\x06\n\x14\n\ \x8f\x01\n\x06\x04\x14\x03\0\x02\0\x12\x04\xfe\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\x14\x03\0\x02\0\x04\x12\x04\ \xfe\x06\x04\x0c\n\x0f\n\x07\x04\x14\x03\0\x02\0\x05\x12\x04\xfe\x06\r\ \x12\n\x0f\n\x07\x04\x14\x03\0\x02\0\x01\x12\x04\xfe\x06\x13\x17\n\x0f\n\ \x07\x04\x14\x03\0\x02\0\x03\x12\x04\xfe\x06\x1a\x1b\n\x0f\n\x07\x04\x14\ \x03\0\x02\0\x08\x12\x04\xfe\x06\x1c+\n\x10\n\x08\x04\x14\x03\0\x02\0\ \x08\x02\x12\x04\xfe\x06\x1d*\nO\n\x06\x04\x14\x03\0\x02\x01\x12\x04\x81\ \x07\x04$\x1a?\x20Identifies\x20the\x20filesystem\x20path\x20to\x20the\ \x20original\x20source\x20.proto.\n\n\x0f\n\x07\x04\x14\x03\0\x02\x01\ \x04\x12\x04\x81\x07\x04\x0c\n\x0f\n\x07\x04\x14\x03\0\x02\x01\x05\x12\ \x04\x81\x07\r\x13\n\x0f\n\x07\x04\x14\x03\0\x02\x01\x01\x12\x04\x81\x07\ \x14\x1f\n\x0f\n\x07\x04\x14\x03\0\x02\x01\x03\x12\x04\x81\x07\"#\nw\n\ \x06\x04\x14\x03\0\x02\x02\x12\x04\x85\x07\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\x14\x03\0\x02\x02\x04\x12\x04\x85\x07\x04\x0c\n\x0f\n\x07\ \x04\x14\x03\0\x02\x02\x05\x12\x04\x85\x07\r\x12\n\x0f\n\x07\x04\x14\x03\ \0\x02\x02\x01\x12\x04\x85\x07\x13\x18\n\x0f\n\x07\x04\x14\x03\0\x02\x02\ \x03\x12\x04\x85\x07\x1b\x1c\n\xdb\x01\n\x06\x04\x14\x03\0\x02\x03\x12\ \x04\x8a\x07\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\x14\x03\0\x02\x03\x04\x12\x04\x8a\x07\x04\x0c\n\x0f\n\x07\x04\ \x14\x03\0\x02\x03\x05\x12\x04\x8a\x07\r\x12\n\x0f\n\x07\x04\x14\x03\0\ \x02\x03\x01\x12\x04\x8a\x07\x13\x16\n\x0f\n\x07\x04\x14\x03\0\x02\x03\ \x03\x12\x04\x8a\x07\x19\x1a\ "; static file_descriptor_proto_lazy: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; fn parse_descriptor_proto() -> crate::descriptor::FileDescriptorProto { crate::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() } pub fn file_descriptor_proto() -> &'static crate::descriptor::FileDescriptorProto { file_descriptor_proto_lazy.get(|| { parse_descriptor_proto() }) } protobuf-2.25.2/src/descriptorx.rs000064400000000000000000000411430072674642500153120ustar 00000000000000// Should not be a part of public API #![doc(hidden)] use crate::descriptor::DescriptorProto; use crate::descriptor::EnumDescriptorProto; use crate::descriptor::EnumValueDescriptorProto; use crate::descriptor::FieldDescriptorProto; /// utilities to work with descriptor use crate::descriptor::FileDescriptorProto; use crate::descriptor::OneofDescriptorProto; use crate::rust; use crate::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::(); 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> { 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> { 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> { 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> { 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> { 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> { 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> { 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> { 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> { self.get_message_descriptors() .iter() .map(|m| { let mut nested = self.clone(); nested.path.push(m); nested }) .collect() } fn walk_scopes_impl)>(&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(&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> { self.message .get_field() .iter() .map(|f| FieldWithContext { field: f, message: self.clone(), }) .collect() } pub fn oneofs(&self) -> Vec> { 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> { 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> { 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")); } } protobuf-2.25.2/src/enums.rs000064400000000000000000000016030072674642500140700ustar 00000000000000use crate::reflect::EnumDescriptor; use crate::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; /// 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!(); } } protobuf-2.25.2/src/error.rs000064400000000000000000000122560072674642500141000ustar 00000000000000//! Protobuf error type use std::error::Error; use std::fmt; use std::io; use std::str; use crate::wire_format::WireType; /// `Result` alias for `ProtobufError` pub type ProtobufResult = Result; /// 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<&dyn Error> { match self { &ProtobufError::IoError(ref e) => Some(e), &ProtobufError::Utf8(ref e) => Some(e), &ProtobufError::WireError(..) => None, &ProtobufError::MessageNotInitialized { .. } => None, } } } impl From for ProtobufError { fn from(err: io::Error) -> Self { ProtobufError::IoError(err) } } impl From for ProtobufError { fn from(err: str::Utf8Error) -> Self { ProtobufError::Utf8(err) } } impl From 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)), } } } protobuf-2.25.2/src/ext.rs000064400000000000000000000024620072674642500135450ustar 00000000000000//! 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 crate::message::Message; use crate::types::ProtobufType; /// Optional ext field pub struct ExtFieldOptional { /// Extension field number pub field_number: u32, /// Marker // TODO: hide pub phantom: PhantomData<(M, T)>, } /// Repeated ext field pub struct ExtFieldRepeated { /// Extension field number pub field_number: u32, /// Extension field number // TODO: hide pub phantom: PhantomData<(M, T)>, } impl ExtFieldOptional { /// Get a copy of value from a message. /// /// Extension data is stored in [`UnknownFields`](crate::UnknownFields). pub fn get(&self, m: &M) -> Option { m.get_unknown_fields() .get(self.field_number) .and_then(T::get_from_unknown) } } impl ExtFieldRepeated { /// Get a copy of value from a message (**not implemented**). pub fn get(&self, _m: &M) -> Vec { // TODO unimplemented!() } } protobuf-2.25.2/src/json/json_name.rs000064400000000000000000000007730072674642500156720ustar 00000000000000/// Implementation must match exactly /// `ToJsonName()` function in C++ `descriptor.cc`. pub fn json_name(input: &str) -> String { let mut capitalize_next = false; let mut result = String::with_capacity(input.len()); for c in input.chars() { if c == '_' { capitalize_next = true; } else if capitalize_next { result.extend(c.to_uppercase()); capitalize_next = false; } else { result.push(c); } } result } protobuf-2.25.2/src/json/mod.rs000064400000000000000000000002660072674642500144750ustar 00000000000000//! JSON serialization and deserialization. //! //! (Implemented in master, but not ported to stable branch yet). mod json_name; #[doc(hidden)] pub use self::json_name::json_name; protobuf-2.25.2/src/lazy.rs000064400000000000000000000065510072674642500137270ustar 00000000000000//! Lazily initialized data. //! Used in generated code. // Avoid deprecation warnings when compiling rust-protobuf #![allow(deprecated)] use std::mem; use std::sync; /// Lasily initialized data. #[deprecated( since = "2.16", note = "Please regenerate .rs files from .proto files to use newer APIs" )] pub struct Lazy { #[doc(hidden)] pub lock: sync::Once, #[doc(hidden)] pub ptr: *const T, } impl Lazy { /// 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 = 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(&'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 = 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); } } } protobuf-2.25.2/src/lazy_v2.rs000064400000000000000000000050370072674642500143340ustar 00000000000000//! Lazily initialized data. //! Used in generated code. use std::cell::UnsafeCell; use std::sync; /// Lazily initialized data. pub struct LazyV2 { lock: sync::Once, ptr: UnsafeCell<*const T>, } unsafe impl Sync for LazyV2 {} impl LazyV2 { /// Uninitialized `Lazy` object. pub const INIT: LazyV2 = LazyV2 { lock: sync::Once::new(), ptr: UnsafeCell::new(0 as *const T), }; /// Get lazy field value, initialize it with given function if not yet. pub fn get(&'static self, init: F) -> &'static T where F: FnOnce() -> T, { self.lock.call_once(|| unsafe { *self.ptr.get() = Box::into_raw(Box::new(init())); }); unsafe { &**self.ptr.get() } } } #[cfg(test)] mod test { use super::LazyV2; 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: LazyV2 = LazyV2::INIT; static CALL_COUNT: AtomicIsize = AtomicIsize::new(0); let value = "Hello, world!".to_owned(); for _ in 0..N_ITERS { // Reset mutable state. unsafe { LAZY = LazyV2::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); } } } protobuf-2.25.2/src/lib.rs000064400000000000000000000046610072674642500135160ustar 00000000000000//! Library to read and write protocol buffers data. #![deny(missing_docs)] #![deny(broken_intra_doc_links)] #[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 crate::cached_size::CachedSize; #[cfg(feature = "bytes")] pub use crate::chars::Chars; pub use crate::clear::Clear; pub use crate::coded_input_stream::CodedInputStream; pub use crate::coded_output_stream::CodedOutputStream; pub use crate::enums::ProtobufEnum; pub use crate::error::ProtobufError; pub use crate::error::ProtobufResult; #[allow(deprecated)] pub use crate::message::parse_from_bytes; #[cfg(feature = "bytes")] #[allow(deprecated)] pub use crate::message::parse_from_carllerche_bytes; #[allow(deprecated)] pub use crate::message::parse_from_reader; #[allow(deprecated)] pub use crate::message::parse_length_delimited_from; #[allow(deprecated)] pub use crate::message::parse_length_delimited_from_bytes; #[allow(deprecated)] pub use crate::message::parse_length_delimited_from_reader; pub use crate::message::Message; pub use crate::repeated::RepeatedField; pub use crate::singular::SingularField; pub use crate::singular::SingularPtrField; pub use crate::unknown::UnknownFields; pub use crate::unknown::UnknownFieldsIter; pub use crate::unknown::UnknownValue; pub use crate::unknown::UnknownValueRef; pub use crate::unknown::UnknownValues; pub use crate::unknown::UnknownValuesIter; // generated pub mod descriptor; pub mod plugin; pub mod rustproto; pub mod wire_format; mod clear; mod coded_input_stream; mod coded_output_stream; pub mod compiler_plugin; mod enums; pub mod error; pub mod ext; pub mod json; pub mod lazy; mod lazy_v2; mod message; pub mod reflect; mod repeated; pub mod rt; mod singular; pub mod text_format; pub mod types; pub mod well_known_types; mod well_known_types_util; // used by test #[cfg(test)] #[path = "../../protobuf-test-common/src/hex.rs"] mod hex; // used by rust-grpc pub mod descriptorx; mod cached_size; mod chars; #[doc(hidden)] // used by codegen pub mod rust; mod strx; mod unknown; mod varint; mod zigzag; mod misc; mod buf_read_iter; /// 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!(concat!(env!("OUT_DIR"), "/version.rs")); protobuf-2.25.2/src/message.rs000064400000000000000000000233300072674642500143660ustar 00000000000000use 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 crate::clear::Clear; use crate::coded_input_stream::CodedInputStream; use crate::coded_input_stream::WithCodedInputStream; use crate::coded_output_stream::with_coded_output_stream_to_bytes; use crate::coded_output_stream::CodedOutputStream; use crate::coded_output_stream::WithCodedOutputStream; use crate::error::ProtobufError; use crate::error::ProtobufResult; use crate::reflect::MessageDescriptor; use crate::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<()>; /// Parse message from stream. fn parse_from(is: &mut CodedInputStream) -> ProtobufResult where Self: Sized, { let mut r: Self = Message::new(); r.merge_from(is)?; r.check_initialized()?; Ok(r) } /// 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) -> 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) } /// Parse message from reader. /// Parse stops on EOF or when error encountered. fn parse_from_reader(reader: &mut dyn Read) -> ProtobufResult where Self: Sized, { let mut is = CodedInputStream::new(reader); let r = Message::parse_from(&mut is)?; is.check_eof()?; Ok(r) } /// Parse message from byte array. fn parse_from_bytes(bytes: &[u8]) -> ProtobufResult where Self: Sized, { let mut is = CodedInputStream::from_bytes(bytes); let r = Message::parse_from(&mut is)?; is.check_eof()?; Ok(r) } /// Parse message from `Bytes` object. /// Resulting message may share references to the passed bytes object. #[cfg(feature = "bytes")] fn parse_from_carllerche_bytes(bytes: &Bytes) -> ProtobufResult where Self: Sized, { let mut is = CodedInputStream::from_carllerche_bytes(bytes); let r = Self::parse_from(&mut is)?; is.check_eof()?; Ok(r) } /// 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 dyn 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) -> ProtobufResult<()> { v.with_coded_output_stream(|os| self.write_to(os)) } /// Write the message to bytes vec. fn write_to_bytes(&self) -> ProtobufResult> { 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 dyn 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> { 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::() } /// View self as `Any`. fn as_any(&self) -> &dyn Any; /// View self as mutable `Any`. fn as_any_mut(&mut self) -> &mut dyn Any { panic!() } /// Convert boxed self to boxed `Any`. fn into_any(self: Box) -> Box { panic!() } // Rust does not allow implementation of trait for trait: // impl fmt::Debug for M { // ... // } /// Create an empty message object. /// /// /// ``` /// # use protobuf::Message; /// # fn foo() { /// let m = MyMessage::new(); /// # } /// ``` fn new() -> Self where Self: Sized; /// Get message descriptor for message type. /// /// ``` /// # use protobuf::Message; /// # fn foo() { /// 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() { /// 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 dyn Message) -> &'a M { m.as_any().downcast_ref::().unwrap() } /// Parse message from reader. /// Parse stops on EOF or when error encountered. #[deprecated(since = "2.19", note = "Use Message::parse_from_reader instead")] pub fn parse_from_reader(reader: &mut dyn Read) -> ProtobufResult { M::parse_from_reader(reader) } /// Parse message from byte array. #[deprecated(since = "2.19", note = "Use Message::parse_from_bytes instead")] pub fn parse_from_bytes(bytes: &[u8]) -> ProtobufResult { M::parse_from_bytes(bytes) } /// Parse message from `Bytes` object. /// Resulting message may share references to the passed bytes object. #[cfg(feature = "bytes")] #[deprecated( since = "2.19", note = "Use Message::parse_from_carllerche_bytes instead" )] pub fn parse_from_carllerche_bytes(bytes: &Bytes) -> ProtobufResult { M::parse_from_carllerche_bytes(bytes) } /// 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(is: &mut CodedInputStream) -> ProtobufResult { is.read_message::() } /// 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(r: &mut dyn Read) -> ProtobufResult { // TODO: wrong: we may read length first, and then read exact number of bytes needed r.with_coded_input_stream(|is| is.read_message::()) } /// 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(bytes: &[u8]) -> ProtobufResult { bytes.with_coded_input_stream(|is| is.read_message::()) } protobuf-2.25.2/src/misc.rs000064400000000000000000000016140072674642500136760ustar 00000000000000use std::mem; use std::slice; /// Slice from `vec[vec.len()..vec.capacity()]` pub unsafe fn remaining_capacity_as_slice_mut(vec: &mut Vec) -> &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: &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); } } protobuf-2.25.2/src/plugin.rs000064400000000000000000001713510072674642500142470ustar 00000000000000// This file is generated by rust-protobuf 2.22.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![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(unused_imports)] #![allow(unused_results)] //! Generated file from `google/protobuf/compiler/plugin.proto` #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct Version { // message fields major: ::std::option::Option, minor: ::std::option::Option, patch: ::std::option::Option, suffix: crate::SingularField<::std::string::String>, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a Version { fn default() -> &'a Version { ::default_instance() } } impl Version { pub fn new() -> Version { ::std::default::Default::default() } // optional int32 major = 1; pub fn get_major(&self) -> i32 { self.major.unwrap_or(0) } pub fn clear_major(&mut self) { self.major = ::std::option::Option::None; } pub fn has_major(&self) -> bool { self.major.is_some() } // Param is passed by value, moved pub fn set_major(&mut self, v: i32) { self.major = ::std::option::Option::Some(v); } // optional int32 minor = 2; pub fn get_minor(&self) -> i32 { self.minor.unwrap_or(0) } pub fn clear_minor(&mut self) { self.minor = ::std::option::Option::None; } pub fn has_minor(&self) -> bool { self.minor.is_some() } // Param is passed by value, moved pub fn set_minor(&mut self, v: i32) { self.minor = ::std::option::Option::Some(v); } // optional int32 patch = 3; pub fn get_patch(&self) -> i32 { self.patch.unwrap_or(0) } pub fn clear_patch(&mut self) { self.patch = ::std::option::Option::None; } pub fn has_patch(&self) -> bool { self.patch.is_some() } // Param is passed by value, moved pub fn set_patch(&mut self, v: i32) { self.patch = ::std::option::Option::Some(v); } // optional string suffix = 4; pub fn get_suffix(&self) -> &str { match self.suffix.as_ref() { Some(v) => &v, None => "", } } pub fn clear_suffix(&mut self) { self.suffix.clear(); } pub fn has_suffix(&self) -> bool { self.suffix.is_some() } // Param is passed by value, moved pub fn set_suffix(&mut self, v: ::std::string::String) { self.suffix = crate::SingularField::some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_suffix(&mut self) -> &mut ::std::string::String { if self.suffix.is_none() { self.suffix.set_default(); } self.suffix.as_mut().unwrap() } // Take field pub fn take_suffix(&mut self) -> ::std::string::String { self.suffix.take().unwrap_or_else(|| ::std::string::String::new()) } } impl crate::Message for Version { fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int32()?; self.major = ::std::option::Option::Some(tmp); }, 2 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int32()?; self.minor = ::std::option::Option::Some(tmp); }, 3 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int32()?; self.patch = ::std::option::Option::Some(tmp); }, 4 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.suffix)?; }, _ => { crate::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.major { my_size += crate::rt::value_size(1, v, crate::wire_format::WireTypeVarint); } if let Some(v) = self.minor { my_size += crate::rt::value_size(2, v, crate::wire_format::WireTypeVarint); } if let Some(v) = self.patch { my_size += crate::rt::value_size(3, v, crate::wire_format::WireTypeVarint); } if let Some(ref v) = self.suffix.as_ref() { my_size += crate::rt::string_size(4, &v); } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { if let Some(v) = self.major { os.write_int32(1, v)?; } if let Some(v) = self.minor { os.write_int32(2, v)?; } if let Some(v) = self.patch { os.write_int32(3, v)?; } if let Some(ref v) = self.suffix.as_ref() { os.write_string(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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> Version { Version::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeInt32>( "major", |m: &Version| { &m.major }, |m: &mut Version| { &mut m.major }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeInt32>( "minor", |m: &Version| { &m.minor }, |m: &mut Version| { &mut m.minor }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeInt32>( "patch", |m: &Version| { &m.patch }, |m: &mut Version| { &mut m.patch }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "suffix", |m: &Version| { &m.suffix }, |m: &mut Version| { &mut m.suffix }, )); crate::reflect::MessageDescriptor::new_pb_name::( "Version", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static Version { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(Version::new) } } impl crate::Clear for Version { fn clear(&mut self) { self.major = ::std::option::Option::None; self.minor = ::std::option::Option::None; self.patch = ::std::option::Option::None; self.suffix.clear(); self.unknown_fields.clear(); } } impl ::std::fmt::Debug for Version { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for Version { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct CodeGeneratorRequest { // message fields pub file_to_generate: crate::RepeatedField<::std::string::String>, parameter: crate::SingularField<::std::string::String>, pub proto_file: crate::RepeatedField, pub compiler_version: crate::SingularPtrField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a CodeGeneratorRequest { fn default() -> &'a CodeGeneratorRequest { ::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: crate::RepeatedField<::std::string::String>) { self.file_to_generate = v; } // Mutable pointer to the field. pub fn mut_file_to_generate(&mut self) -> &mut crate::RepeatedField<::std::string::String> { &mut self.file_to_generate } // Take field pub fn take_file_to_generate(&mut self) -> crate::RepeatedField<::std::string::String> { ::std::mem::replace(&mut self.file_to_generate, crate::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 = crate::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) -> &[crate::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: crate::RepeatedField) { self.proto_file = v; } // Mutable pointer to the field. pub fn mut_proto_file(&mut self) -> &mut crate::RepeatedField { &mut self.proto_file } // Take field pub fn take_proto_file(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.proto_file, crate::RepeatedField::new()) } // optional .google.protobuf.compiler.Version compiler_version = 3; pub fn get_compiler_version(&self) -> &Version { self.compiler_version.as_ref().unwrap_or_else(|| ::default_instance()) } pub fn clear_compiler_version(&mut self) { self.compiler_version.clear(); } pub fn has_compiler_version(&self) -> bool { self.compiler_version.is_some() } // Param is passed by value, moved pub fn set_compiler_version(&mut self, v: Version) { self.compiler_version = crate::SingularPtrField::some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_compiler_version(&mut self) -> &mut Version { if self.compiler_version.is_none() { self.compiler_version.set_default(); } self.compiler_version.as_mut().unwrap() } // Take field pub fn take_compiler_version(&mut self) -> Version { self.compiler_version.take().unwrap_or_else(|| Version::new()) } } impl crate::Message for CodeGeneratorRequest { fn is_initialized(&self) -> bool { for v in &self.proto_file { if !v.is_initialized() { return false; } }; for v in &self.compiler_version { if !v.is_initialized() { return false; } }; true } fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_repeated_string_into(wire_type, is, &mut self.file_to_generate)?; }, 2 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.parameter)?; }, 15 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.proto_file)?; }, 3 => { crate::rt::read_singular_message_into(wire_type, is, &mut self.compiler_version)?; }, _ => { crate::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 += crate::rt::string_size(1, &value); }; if let Some(ref v) = self.parameter.as_ref() { my_size += crate::rt::string_size(2, &v); } for value in &self.proto_file { let len = value.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }; if let Some(ref v) = self.compiler_version.as_ref() { let len = v.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::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, crate::wire_format::WireTypeLengthDelimited)?; os.write_raw_varint32(v.get_cached_size())?; v.write_to_with_cached_sizes(os)?; }; if let Some(ref v) = self.compiler_version.as_ref() { os.write_tag(3, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> CodeGeneratorRequest { CodeGeneratorRequest::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeString>( "file_to_generate", |m: &CodeGeneratorRequest| { &m.file_to_generate }, |m: &mut CodeGeneratorRequest| { &mut m.file_to_generate }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "parameter", |m: &CodeGeneratorRequest| { &m.parameter }, |m: &mut CodeGeneratorRequest| { &mut m.parameter }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "proto_file", |m: &CodeGeneratorRequest| { &m.proto_file }, |m: &mut CodeGeneratorRequest| { &mut m.proto_file }, )); fields.push(crate::reflect::accessor::make_singular_ptr_field_accessor::<_, crate::types::ProtobufTypeMessage>( "compiler_version", |m: &CodeGeneratorRequest| { &m.compiler_version }, |m: &mut CodeGeneratorRequest| { &mut m.compiler_version }, )); crate::reflect::MessageDescriptor::new_pb_name::( "CodeGeneratorRequest", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static CodeGeneratorRequest { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(CodeGeneratorRequest::new) } } impl crate::Clear for CodeGeneratorRequest { fn clear(&mut self) { self.file_to_generate.clear(); self.parameter.clear(); self.proto_file.clear(); self.compiler_version.clear(); self.unknown_fields.clear(); } } impl ::std::fmt::Debug for CodeGeneratorRequest { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for CodeGeneratorRequest { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct CodeGeneratorResponse { // message fields error: crate::SingularField<::std::string::String>, supported_features: ::std::option::Option, pub file: crate::RepeatedField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a CodeGeneratorResponse { fn default() -> &'a CodeGeneratorResponse { ::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 = crate::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()) } // optional uint64 supported_features = 2; pub fn get_supported_features(&self) -> u64 { self.supported_features.unwrap_or(0) } pub fn clear_supported_features(&mut self) { self.supported_features = ::std::option::Option::None; } pub fn has_supported_features(&self) -> bool { self.supported_features.is_some() } // Param is passed by value, moved pub fn set_supported_features(&mut self, v: u64) { self.supported_features = ::std::option::Option::Some(v); } // 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: crate::RepeatedField) { self.file = v; } // Mutable pointer to the field. pub fn mut_file(&mut self) -> &mut crate::RepeatedField { &mut self.file } // Take field pub fn take_file(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.file, crate::RepeatedField::new()) } } impl crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.error)?; }, 2 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_uint64()?; self.supported_features = ::std::option::Option::Some(tmp); }, 15 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.file)?; }, _ => { crate::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 += crate::rt::string_size(1, &v); } if let Some(v) = self.supported_features { my_size += crate::rt::value_size(2, v, crate::wire_format::WireTypeVarint); } for value in &self.file { let len = value.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }; my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { if let Some(ref v) = self.error.as_ref() { os.write_string(1, &v)?; } if let Some(v) = self.supported_features { os.write_uint64(2, v)?; } for v in &self.file { os.write_tag(15, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> CodeGeneratorResponse { CodeGeneratorResponse::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "error", |m: &CodeGeneratorResponse| { &m.error }, |m: &mut CodeGeneratorResponse| { &mut m.error }, )); fields.push(crate::reflect::accessor::make_option_accessor::<_, crate::types::ProtobufTypeUint64>( "supported_features", |m: &CodeGeneratorResponse| { &m.supported_features }, |m: &mut CodeGeneratorResponse| { &mut m.supported_features }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "file", |m: &CodeGeneratorResponse| { &m.file }, |m: &mut CodeGeneratorResponse| { &mut m.file }, )); crate::reflect::MessageDescriptor::new_pb_name::( "CodeGeneratorResponse", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static CodeGeneratorResponse { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(CodeGeneratorResponse::new) } } impl crate::Clear for CodeGeneratorResponse { fn clear(&mut self) { self.error.clear(); self.supported_features = ::std::option::Option::None; self.file.clear(); self.unknown_fields.clear(); } } impl ::std::fmt::Debug for CodeGeneratorResponse { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for CodeGeneratorResponse { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct CodeGeneratorResponse_File { // message fields name: crate::SingularField<::std::string::String>, insertion_point: crate::SingularField<::std::string::String>, content: crate::SingularField<::std::string::String>, pub generated_code_info: crate::SingularPtrField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a CodeGeneratorResponse_File { fn default() -> &'a CodeGeneratorResponse_File { ::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 = crate::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 = crate::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 = crate::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()) } // optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16; pub fn get_generated_code_info(&self) -> &crate::descriptor::GeneratedCodeInfo { self.generated_code_info.as_ref().unwrap_or_else(|| ::default_instance()) } pub fn clear_generated_code_info(&mut self) { self.generated_code_info.clear(); } pub fn has_generated_code_info(&self) -> bool { self.generated_code_info.is_some() } // Param is passed by value, moved pub fn set_generated_code_info(&mut self, v: crate::descriptor::GeneratedCodeInfo) { self.generated_code_info = crate::SingularPtrField::some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_generated_code_info(&mut self) -> &mut crate::descriptor::GeneratedCodeInfo { if self.generated_code_info.is_none() { self.generated_code_info.set_default(); } self.generated_code_info.as_mut().unwrap() } // Take field pub fn take_generated_code_info(&mut self) -> crate::descriptor::GeneratedCodeInfo { self.generated_code_info.take().unwrap_or_else(|| crate::descriptor::GeneratedCodeInfo::new()) } } impl crate::Message for CodeGeneratorResponse_File { fn is_initialized(&self) -> bool { for v in &self.generated_code_info { if !v.is_initialized() { return false; } }; true } fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.name)?; }, 2 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.insertion_point)?; }, 15 => { crate::rt::read_singular_string_into(wire_type, is, &mut self.content)?; }, 16 => { crate::rt::read_singular_message_into(wire_type, is, &mut self.generated_code_info)?; }, _ => { crate::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 += crate::rt::string_size(1, &v); } if let Some(ref v) = self.insertion_point.as_ref() { my_size += crate::rt::string_size(2, &v); } if let Some(ref v) = self.content.as_ref() { my_size += crate::rt::string_size(15, &v); } if let Some(ref v) = self.generated_code_info.as_ref() { let len = v.compute_size(); my_size += 2 + crate::rt::compute_raw_varint32_size(len) + len; } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::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)?; } if let Some(ref v) = self.generated_code_info.as_ref() { os.write_tag(16, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> CodeGeneratorResponse_File { CodeGeneratorResponse_File::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "name", |m: &CodeGeneratorResponse_File| { &m.name }, |m: &mut CodeGeneratorResponse_File| { &mut m.name }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "insertion_point", |m: &CodeGeneratorResponse_File| { &m.insertion_point }, |m: &mut CodeGeneratorResponse_File| { &mut m.insertion_point }, )); fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( "content", |m: &CodeGeneratorResponse_File| { &m.content }, |m: &mut CodeGeneratorResponse_File| { &mut m.content }, )); fields.push(crate::reflect::accessor::make_singular_ptr_field_accessor::<_, crate::types::ProtobufTypeMessage>( "generated_code_info", |m: &CodeGeneratorResponse_File| { &m.generated_code_info }, |m: &mut CodeGeneratorResponse_File| { &mut m.generated_code_info }, )); crate::reflect::MessageDescriptor::new_pb_name::( "CodeGeneratorResponse.File", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static CodeGeneratorResponse_File { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(CodeGeneratorResponse_File::new) } } impl crate::Clear for CodeGeneratorResponse_File { fn clear(&mut self) { self.name.clear(); self.insertion_point.clear(); self.content.clear(); self.generated_code_info.clear(); self.unknown_fields.clear(); } } impl ::std::fmt::Debug for CodeGeneratorResponse_File { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for CodeGeneratorResponse_File { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(Clone,PartialEq,Eq,Debug,Hash)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub enum CodeGeneratorResponse_Feature { FEATURE_NONE = 0, FEATURE_PROTO3_OPTIONAL = 1, } impl crate::ProtobufEnum for CodeGeneratorResponse_Feature { fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { match value { 0 => ::std::option::Option::Some(CodeGeneratorResponse_Feature::FEATURE_NONE), 1 => ::std::option::Option::Some(CodeGeneratorResponse_Feature::FEATURE_PROTO3_OPTIONAL), _ => ::std::option::Option::None } } fn values() -> &'static [Self] { static values: &'static [CodeGeneratorResponse_Feature] = &[ CodeGeneratorResponse_Feature::FEATURE_NONE, CodeGeneratorResponse_Feature::FEATURE_PROTO3_OPTIONAL, ]; values } fn enum_descriptor_static() -> &'static crate::reflect::EnumDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { crate::reflect::EnumDescriptor::new_pb_name::("CodeGeneratorResponse.Feature", file_descriptor_proto()) }) } } impl ::std::marker::Copy for CodeGeneratorResponse_Feature { } impl ::std::default::Default for CodeGeneratorResponse_Feature { fn default() -> Self { CodeGeneratorResponse_Feature::FEATURE_NONE } } impl crate::reflect::ProtobufValue for CodeGeneratorResponse_Feature { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Enum(crate::ProtobufEnum::descriptor(self)) } } static file_descriptor_proto_data: &'static [u8] = b"\ \n%google/protobuf/compiler/plugin.proto\x12\x18google.protobuf.compiler\ \x1a\x20google/protobuf/descriptor.proto\"c\n\x07Version\x12\x14\n\x05ma\ jor\x18\x01\x20\x01(\x05R\x05major\x12\x14\n\x05minor\x18\x02\x20\x01(\ \x05R\x05minor\x12\x14\n\x05patch\x18\x03\x20\x01(\x05R\x05patch\x12\x16\ \n\x06suffix\x18\x04\x20\x01(\tR\x06suffix\"\xf1\x01\n\x14CodeGeneratorR\ equest\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\ \x12L\n\x10compiler_version\x18\x03\x20\x01(\x0b2!.google.protobuf.compi\ ler.VersionR\x0fcompilerVersion\"\x94\x03\n\x15CodeGeneratorResponse\x12\ \x14\n\x05error\x18\x01\x20\x01(\tR\x05error\x12-\n\x12supported_feature\ s\x18\x02\x20\x01(\x04R\x11supportedFeatures\x12H\n\x04file\x18\x0f\x20\ \x03(\x0b24.google.protobuf.compiler.CodeGeneratorResponse.FileR\x04file\ \x1a\xb1\x01\n\x04File\x12\x12\n\x04name\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\x07content\x12R\n\x13generated_code_info\ \x18\x10\x20\x01(\x0b2\".google.protobuf.GeneratedCodeInfoR\x11generated\ CodeInfo\"8\n\x07Feature\x12\x10\n\x0cFEATURE_NONE\x10\0\x12\x1b\n\x17FE\ ATURE_PROTO3_OPTIONAL\x10\x01BW\n\x1ccom.google.protobuf.compilerB\x0cPl\ uginProtosZ)google.golang.org/protobuf/types/pluginpbJ\xf9C\n\x07\x12\ \x05.\0\xb6\x01\x01\n\xca\x11\n\x01\x0c\x12\x03.\0\x122\xc1\x0c\x20Proto\ col\x20Buffers\x20-\x20Google's\x20data\x20interchange\x20format\n\x20Co\ pyright\x202008\x20Google\x20Inc.\x20\x20All\x20rights\x20reserved.\n\ \x20https://developers.google.com/protocol-buffers/\n\n\x20Redistributio\ n\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.\n2\xfb\ \x04\x20Author:\x20kenton@google.com\x20(Kenton\x20Varda)\n\n\x20WARNING\ :\x20\x20The\x20plugin\x20interface\x20is\x20currently\x20EXPERIMENTAL\ \x20and\x20is\x20subject\x20to\n\x20\x20\x20change.\n\n\x20protoc\x20(ak\ a\x20the\x20Protocol\x20Compiler)\x20can\x20be\x20extended\x20via\x20plu\ gins.\x20\x20A\x20plugin\x20is\n\x20just\x20a\x20program\x20that\x20read\ s\x20a\x20CodeGeneratorRequest\x20from\x20stdin\x20and\x20writes\x20a\n\ \x20CodeGeneratorResponse\x20to\x20stdout.\n\n\x20Plugins\x20written\x20\ using\x20C++\x20can\x20use\x20google/protobuf/compiler/plugin.h\x20inste\ ad\n\x20of\x20dealing\x20with\x20the\x20raw\x20protocol\x20defined\x20he\ re.\n\n\x20A\x20plugin\x20executable\x20needs\x20only\x20to\x20be\x20pla\ ced\x20somewhere\x20in\x20the\x20path.\x20\x20The\n\x20plugin\x20should\ \x20be\x20named\x20\"protoc-gen-$NAME\",\x20and\x20will\x20then\x20be\ \x20used\x20when\x20the\n\x20flag\x20\"--${NAME}_out\"\x20is\x20passed\ \x20to\x20protoc.\n\n\x08\n\x01\x02\x12\x030\0!\n\x08\n\x01\x08\x12\x031\ \05\n\t\n\x02\x08\x01\x12\x031\05\n\x08\n\x01\x08\x12\x032\0-\n\t\n\x02\ \x08\x08\x12\x032\0-\n\x08\n\x01\x08\x12\x034\0@\n\t\n\x02\x08\x0b\x12\ \x034\0@\n\t\n\x02\x03\0\x12\x036\0*\n6\n\x02\x04\0\x12\x049\0@\x01\x1a*\ \x20The\x20version\x20number\x20of\x20protocol\x20compiler.\n\n\n\n\x03\ \x04\0\x01\x12\x039\x08\x0f\n\x0b\n\x04\x04\0\x02\0\x12\x03:\x02\x1b\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\x10\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03:\x11\x16\n\x0c\n\ \x05\x04\0\x02\0\x03\x12\x03:\x19\x1a\n\x0b\n\x04\x04\0\x02\x01\x12\x03;\ \x02\x1b\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\x10\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03;\x11\ \x16\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03;\x19\x1a\n\x0b\n\x04\x04\0\ \x02\x02\x12\x03<\x02\x1b\n\x0c\n\x05\x04\0\x02\x02\x04\x12\x03<\x02\n\n\ \x0c\n\x05\x04\0\x02\x02\x05\x12\x03<\x0b\x10\n\x0c\n\x05\x04\0\x02\x02\ \x01\x12\x03<\x11\x16\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03<\x19\x1a\n\ \x80\x01\n\x04\x04\0\x02\x03\x12\x03?\x02\x1d\x1as\x20A\x20suffix\x20for\ \x20alpha,\x20beta\x20or\x20rc\x20release,\x20e.g.,\x20\"alpha-1\",\x20\ \"rc2\".\x20It\x20should\n\x20be\x20empty\x20for\x20mainline\x20stable\ \x20releases.\n\n\x0c\n\x05\x04\0\x02\x03\x04\x12\x03?\x02\n\n\x0c\n\x05\ \x04\0\x02\x03\x05\x12\x03?\x0b\x11\n\x0c\n\x05\x04\0\x02\x03\x01\x12\ \x03?\x12\x18\n\x0c\n\x05\x04\0\x02\x03\x03\x12\x03?\x1b\x1c\nO\n\x02\ \x04\x01\x12\x04C\0_\x01\x1aC\x20An\x20encoded\x20CodeGeneratorRequest\ \x20is\x20written\x20to\x20the\x20plugin's\x20stdin.\n\n\n\n\x03\x04\x01\ \x01\x12\x03C\x08\x1c\n\xd1\x01\n\x04\x04\x01\x02\0\x12\x03G\x02'\x1a\ \xc3\x01\x20The\x20.proto\x20files\x20that\x20were\x20explicitly\x20list\ ed\x20on\x20the\x20command-line.\x20\x20The\n\x20code\x20generator\x20sh\ ould\x20generate\x20code\x20only\x20for\x20these\x20files.\x20\x20Each\ \x20file's\n\x20descriptor\x20will\x20be\x20included\x20in\x20proto_file\ ,\x20below.\n\n\x0c\n\x05\x04\x01\x02\0\x04\x12\x03G\x02\n\n\x0c\n\x05\ \x04\x01\x02\0\x05\x12\x03G\x0b\x11\n\x0c\n\x05\x04\x01\x02\0\x01\x12\ \x03G\x12\"\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03G%&\nB\n\x04\x04\x01\ \x02\x01\x12\x03J\x02\x20\x1a5\x20The\x20generator\x20parameter\x20passe\ d\x20on\x20the\x20command-line.\n\n\x0c\n\x05\x04\x01\x02\x01\x04\x12\ \x03J\x02\n\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03J\x0b\x11\n\x0c\n\x05\ \x04\x01\x02\x01\x01\x12\x03J\x12\x1b\n\x0c\n\x05\x04\x01\x02\x01\x03\ \x12\x03J\x1e\x1f\n\x87\x06\n\x04\x04\x01\x02\x02\x12\x03Z\x02/\x1a\xf9\ \x05\x20FileDescriptorProtos\x20for\x20all\x20files\x20in\x20files_to_ge\ nerate\x20and\x20everything\n\x20they\x20import.\x20\x20The\x20files\x20\ will\x20appear\x20in\x20topological\x20order,\x20so\x20each\x20file\n\ \x20appears\x20before\x20any\x20file\x20that\x20imports\x20it.\n\n\x20pr\ otoc\x20guarantees\x20that\x20all\x20proto_files\x20will\x20be\x20writte\ n\x20after\n\x20the\x20fields\x20above,\x20even\x20though\x20this\x20is\ \x20not\x20technically\x20guaranteed\x20by\x20the\n\x20protobuf\x20wire\ \x20format.\x20\x20This\x20theoretically\x20could\x20allow\x20a\x20plugi\ n\x20to\x20stream\n\x20in\x20the\x20FileDescriptorProtos\x20and\x20handl\ e\x20them\x20one\x20by\x20one\x20rather\x20than\x20read\n\x20the\x20enti\ re\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\x20t\ he\x20plugin.\n\n\x20Type\x20names\x20of\x20fields\x20and\x20extensions\ \x20in\x20the\x20FileDescriptorProto\x20are\x20always\n\x20fully\x20qual\ ified.\n\n\x0c\n\x05\x04\x01\x02\x02\x04\x12\x03Z\x02\n\n\x0c\n\x05\x04\ \x01\x02\x02\x06\x12\x03Z\x0b\x1e\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\ \x03Z\x1f)\n\x0c\n\x05\x04\x01\x02\x02\x03\x12\x03Z,.\n7\n\x04\x04\x01\ \x02\x03\x12\x03]\x02(\x1a*\x20The\x20version\x20number\x20of\x20protoco\ l\x20compiler.\n\n\x0c\n\x05\x04\x01\x02\x03\x04\x12\x03]\x02\n\n\x0c\n\ \x05\x04\x01\x02\x03\x06\x12\x03]\x0b\x12\n\x0c\n\x05\x04\x01\x02\x03\ \x01\x12\x03]\x13#\n\x0c\n\x05\x04\x01\x02\x03\x03\x12\x03]&'\nL\n\x02\ \x04\x02\x12\x05b\0\xb6\x01\x01\x1a?\x20The\x20plugin\x20writes\x20an\ \x20encoded\x20CodeGeneratorResponse\x20to\x20stdout.\n\n\n\n\x03\x04\ \x02\x01\x12\x03b\x08\x1d\n\xed\x03\n\x04\x04\x02\x02\0\x12\x03k\x02\x1c\ \x1a\xdf\x03\x20Error\x20message.\x20\x20If\x20non-empty,\x20code\x20gen\ eration\x20failed.\x20\x20The\x20plugin\x20process\n\x20should\x20exit\ \x20with\x20status\x20code\x20zero\x20even\x20if\x20it\x20reports\x20an\ \x20error\x20in\x20this\x20way.\n\n\x20This\x20should\x20be\x20used\x20t\ o\x20indicate\x20errors\x20in\x20.proto\x20files\x20which\x20prevent\x20\ the\n\x20code\x20generator\x20from\x20generating\x20correct\x20code.\x20\ \x20Errors\x20which\x20indicate\x20a\n\x20problem\x20in\x20protoc\x20its\ elf\x20--\x20such\x20as\x20the\x20input\x20CodeGeneratorRequest\x20being\ \n\x20unparseable\x20--\x20should\x20be\x20reported\x20by\x20writing\x20\ a\x20message\x20to\x20stderr\x20and\n\x20exiting\x20with\x20a\x20non-zer\ o\x20status\x20code.\n\n\x0c\n\x05\x04\x02\x02\0\x04\x12\x03k\x02\n\n\ \x0c\n\x05\x04\x02\x02\0\x05\x12\x03k\x0b\x11\n\x0c\n\x05\x04\x02\x02\0\ \x01\x12\x03k\x12\x17\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03k\x1a\x1b\n\ \x89\x01\n\x04\x04\x02\x02\x01\x12\x03o\x02)\x1a|\x20A\x20bitmask\x20of\ \x20supported\x20features\x20that\x20the\x20code\x20generator\x20support\ s.\n\x20This\x20is\x20a\x20bitwise\x20\"or\"\x20of\x20values\x20from\x20\ the\x20Feature\x20enum.\n\n\x0c\n\x05\x04\x02\x02\x01\x04\x12\x03o\x02\n\ \n\x0c\n\x05\x04\x02\x02\x01\x05\x12\x03o\x0b\x11\n\x0c\n\x05\x04\x02\ \x02\x01\x01\x12\x03o\x12$\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\x03o'(\n+\ \n\x04\x04\x02\x04\0\x12\x04r\x02u\x03\x1a\x1d\x20Sync\x20with\x20code_g\ enerator.h.\n\n\x0c\n\x05\x04\x02\x04\0\x01\x12\x03r\x07\x0e\n\r\n\x06\ \x04\x02\x04\0\x02\0\x12\x03s\x04\x15\n\x0e\n\x07\x04\x02\x04\0\x02\0\ \x01\x12\x03s\x04\x10\n\x0e\n\x07\x04\x02\x04\0\x02\0\x02\x12\x03s\x13\ \x14\n\r\n\x06\x04\x02\x04\0\x02\x01\x12\x03t\x04\x20\n\x0e\n\x07\x04\ \x02\x04\0\x02\x01\x01\x12\x03t\x04\x1b\n\x0e\n\x07\x04\x02\x04\0\x02\ \x01\x02\x12\x03t\x1e\x1f\n4\n\x04\x04\x02\x03\0\x12\x05x\x02\xb4\x01\ \x03\x1a%\x20Represents\x20a\x20single\x20generated\x20file.\n\n\x0c\n\ \x05\x04\x02\x03\0\x01\x12\x03x\n\x0e\n\xae\x05\n\x06\x04\x02\x03\0\x02\ \0\x12\x04\x84\x01\x04\x1d\x1a\x9d\x05\x20The\x20file\x20name,\x20relati\ ve\x20to\x20the\x20output\x20directory.\x20\x20The\x20name\x20must\x20no\ t\n\x20contain\x20\".\"\x20or\x20\"..\"\x20components\x20and\x20must\x20\ be\x20relative,\x20not\x20be\x20absolute\x20(so,\n\x20the\x20file\x20can\ not\x20lie\x20outside\x20the\x20output\x20directory).\x20\x20\"/\"\x20mu\ st\x20be\x20used\x20as\n\x20the\x20path\x20separator,\x20not\x20\"\\\".\ \n\n\x20If\x20the\x20name\x20is\x20omitted,\x20the\x20content\x20will\ \x20be\x20appended\x20to\x20the\x20previous\n\x20file.\x20\x20This\x20al\ lows\x20the\x20generator\x20to\x20break\x20large\x20files\x20into\x20sma\ ll\x20chunks,\n\x20and\x20allows\x20the\x20generated\x20text\x20to\x20be\ \x20streamed\x20back\x20to\x20protoc\x20so\x20that\x20large\n\x20files\ \x20need\x20not\x20reside\x20completely\x20in\x20memory\x20at\x20one\x20\ time.\x20\x20Note\x20that\x20as\x20of\n\x20this\x20writing\x20protoc\x20\ does\x20not\x20optimize\x20for\x20this\x20--\x20it\x20will\x20read\x20th\ e\x20entire\n\x20CodeGeneratorResponse\x20before\x20writing\x20files\x20\ to\x20disk.\n\n\x0f\n\x07\x04\x02\x03\0\x02\0\x04\x12\x04\x84\x01\x04\ \x0c\n\x0f\n\x07\x04\x02\x03\0\x02\0\x05\x12\x04\x84\x01\r\x13\n\x0f\n\ \x07\x04\x02\x03\0\x02\0\x01\x12\x04\x84\x01\x14\x18\n\x0f\n\x07\x04\x02\ \x03\0\x02\0\x03\x12\x04\x84\x01\x1b\x1c\n\xae\x10\n\x06\x04\x02\x03\0\ \x02\x01\x12\x04\xab\x01\x04(\x1a\x9d\x10\x20If\x20non-empty,\x20indicat\ es\x20that\x20the\x20named\x20file\x20should\x20already\x20exist,\x20and\ \x20the\n\x20content\x20here\x20is\x20to\x20be\x20inserted\x20into\x20th\ at\x20file\x20at\x20a\x20defined\x20insertion\n\x20point.\x20\x20This\ \x20feature\x20allows\x20a\x20code\x20generator\x20to\x20extend\x20the\ \x20output\n\x20produced\x20by\x20another\x20code\x20generator.\x20\x20T\ he\x20original\x20generator\x20may\x20provide\n\x20insertion\x20points\ \x20by\x20placing\x20special\x20annotations\x20in\x20the\x20file\x20that\ \x20look\n\x20like:\n\x20\x20\x20@@protoc_insertion_point(NAME)\n\x20The\ \x20annotation\x20can\x20have\x20arbitrary\x20text\x20before\x20and\x20a\ fter\x20it\x20on\x20the\x20line,\n\x20which\x20allows\x20it\x20to\x20be\ \x20placed\x20in\x20a\x20comment.\x20\x20NAME\x20should\x20be\x20replace\ d\x20with\n\x20an\x20identifier\x20naming\x20the\x20point\x20--\x20this\ \x20is\x20what\x20other\x20generators\x20will\x20use\n\x20as\x20the\x20i\ nsertion_point.\x20\x20Code\x20inserted\x20at\x20this\x20point\x20will\ \x20be\x20placed\n\x20immediately\x20above\x20the\x20line\x20containing\ \x20the\x20insertion\x20point\x20(thus\x20multiple\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\x20generated\x20code\n\x20coul\ d\x20contain\x20things\x20that\x20look\x20like\x20insertion\x20points\ \x20by\x20accident.\n\n\x20For\x20example,\x20the\x20C++\x20code\x20gene\ rator\x20places\x20the\x20following\x20line\x20in\x20the\n\x20.pb.h\x20f\ iles\x20that\x20it\x20generates:\n\x20\x20\x20//\x20@@protoc_insertion_p\ oint(namespace_scope)\n\x20This\x20line\x20appears\x20within\x20the\x20s\ cope\x20of\x20the\x20file's\x20package\x20namespace,\x20but\n\x20outside\ \x20of\x20any\x20particular\x20class.\x20\x20Another\x20plugin\x20can\ \x20then\x20specify\x20the\n\x20insertion_point\x20\"namespace_scope\"\ \x20to\x20generate\x20additional\x20classes\x20or\n\x20other\x20declarat\ ions\x20that\x20should\x20be\x20placed\x20in\x20this\x20scope.\n\n\x20No\ te\x20that\x20if\x20the\x20line\x20containing\x20the\x20insertion\x20poi\ nt\x20begins\x20with\n\x20whitespace,\x20the\x20same\x20whitespace\x20wi\ ll\x20be\x20added\x20to\x20every\x20line\x20of\x20the\n\x20inserted\x20t\ ext.\x20\x20This\x20is\x20useful\x20for\x20languages\x20like\x20Python,\ \x20where\n\x20indentation\x20matters.\x20\x20In\x20these\x20languages,\ \x20the\x20insertion\x20point\x20comment\n\x20should\x20be\x20indented\ \x20the\x20same\x20amount\x20as\x20any\x20inserted\x20code\x20will\x20ne\ ed\x20to\x20be\n\x20in\x20order\x20to\x20work\x20correctly\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\x20a\x20single\x20invo\ cation\x20of\x20protoc.\n\x20Code\x20generators\x20are\x20executed\x20in\ \x20the\x20order\x20in\x20which\x20they\x20appear\x20on\x20the\n\x20comm\ and\x20line.\n\n\x20If\x20|insertion_point|\x20is\x20present,\x20|name|\ \x20must\x20also\x20be\x20present.\n\n\x0f\n\x07\x04\x02\x03\0\x02\x01\ \x04\x12\x04\xab\x01\x04\x0c\n\x0f\n\x07\x04\x02\x03\0\x02\x01\x05\x12\ \x04\xab\x01\r\x13\n\x0f\n\x07\x04\x02\x03\0\x02\x01\x01\x12\x04\xab\x01\ \x14#\n\x0f\n\x07\x04\x02\x03\0\x02\x01\x03\x12\x04\xab\x01&'\n$\n\x06\ \x04\x02\x03\0\x02\x02\x12\x04\xae\x01\x04!\x1a\x14\x20The\x20file\x20co\ ntents.\n\n\x0f\n\x07\x04\x02\x03\0\x02\x02\x04\x12\x04\xae\x01\x04\x0c\ \n\x0f\n\x07\x04\x02\x03\0\x02\x02\x05\x12\x04\xae\x01\r\x13\n\x0f\n\x07\ \x04\x02\x03\0\x02\x02\x01\x12\x04\xae\x01\x14\x1b\n\x0f\n\x07\x04\x02\ \x03\0\x02\x02\x03\x12\x04\xae\x01\x1e\x20\n\xe1\x01\n\x06\x04\x02\x03\0\ \x02\x03\x12\x04\xb3\x01\x048\x1a\xd0\x01\x20Information\x20describing\ \x20the\x20file\x20content\x20being\x20inserted.\x20If\x20an\x20insertio\ n\n\x20point\x20is\x20used,\x20this\x20information\x20will\x20be\x20appr\ opriately\x20offset\x20and\x20inserted\n\x20into\x20the\x20code\x20gener\ ation\x20metadata\x20for\x20the\x20generated\x20files.\n\n\x0f\n\x07\x04\ \x02\x03\0\x02\x03\x04\x12\x04\xb3\x01\x04\x0c\n\x0f\n\x07\x04\x02\x03\0\ \x02\x03\x06\x12\x04\xb3\x01\r\x1e\n\x0f\n\x07\x04\x02\x03\0\x02\x03\x01\ \x12\x04\xb3\x01\x1f2\n\x0f\n\x07\x04\x02\x03\0\x02\x03\x03\x12\x04\xb3\ \x0157\n\x0c\n\x04\x04\x02\x02\x02\x12\x04\xb5\x01\x02\x1a\n\r\n\x05\x04\ \x02\x02\x02\x04\x12\x04\xb5\x01\x02\n\n\r\n\x05\x04\x02\x02\x02\x06\x12\ \x04\xb5\x01\x0b\x0f\n\r\n\x05\x04\x02\x02\x02\x01\x12\x04\xb5\x01\x10\ \x14\n\r\n\x05\x04\x02\x02\x02\x03\x12\x04\xb5\x01\x17\x19\ "; static file_descriptor_proto_lazy: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; fn parse_descriptor_proto() -> crate::descriptor::FileDescriptorProto { crate::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() } pub fn file_descriptor_proto() -> &'static crate::descriptor::FileDescriptorProto { file_descriptor_proto_lazy.get(|| { parse_descriptor_proto() }) } protobuf-2.25.2/src/reflect/acc/mod.rs000064400000000000000000000013650072674642500156770ustar 00000000000000#![doc(hidden)] use crate::reflect::acc::v1::FieldAccessorFunctions; use crate::reflect::acc::v1::FieldAccessorImpl; use crate::reflect::acc::v1::FieldAccessorTrait; use crate::Message; pub(crate) mod v1; pub(crate) enum Accessor { V1(Box), } /// Accessor object is constructed in generated code. /// Should not be used directly. pub struct FieldAccessor { pub(crate) name: &'static str, pub(crate) accessor: Accessor, } impl FieldAccessor { pub(crate) fn new_v1( name: &'static str, fns: FieldAccessorFunctions, ) -> FieldAccessor { FieldAccessor { name, accessor: Accessor::V1(Box::new(FieldAccessorImpl { fns })), } } } protobuf-2.25.2/src/reflect/acc/v1.rs000064400000000000000000000601400072674642500154420ustar 00000000000000#![doc(hidden)] //! Version 1 reflection accessors. use std::collections::HashMap; use std::fmt; use std::hash::Hash; use crate::enums::ProtobufEnum; use crate::message::message_down_cast; use crate::message::Message; use crate::reflect::EnumValueDescriptor; use crate::reflect::ProtobufValue; use crate::reflect::ReflectFieldRef; use crate::reflect::ReflectValueRef; use crate::types::*; use crate::reflect::map::ReflectMap; use crate::reflect::optional::ReflectOptional; use crate::reflect::repeated::ReflectRepeated; use crate::reflect::repeated::ReflectRepeatedEnum; use crate::reflect::repeated::ReflectRepeatedMessage; use crate::reflect::rt::FieldAccessor; use crate::repeated::RepeatedField; use crate::singular::SingularField; use crate::singular::SingularPtrField; /// this trait should not be used directly, use `FieldDescriptor` instead pub trait FieldAccessorTrait: Sync + 'static { fn has_field_generic(&self, m: &dyn Message) -> bool; fn len_field_generic(&self, m: &dyn Message) -> usize; // TODO: should it return default value or panic on unset field? fn get_message_generic<'a>(&self, m: &'a dyn Message) -> &'a dyn Message; fn get_enum_generic(&self, m: &dyn Message) -> &'static EnumValueDescriptor; fn get_str_generic<'a>(&self, m: &'a dyn Message) -> &'a str; fn get_bytes_generic<'a>(&self, m: &'a dyn Message) -> &'a [u8]; fn get_u32_generic(&self, m: &dyn Message) -> u32; fn get_u64_generic(&self, m: &dyn Message) -> u64; fn get_i32_generic(&self, m: &dyn Message) -> i32; fn get_i64_generic(&self, m: &dyn Message) -> i64; fn get_bool_generic(&self, m: &dyn Message) -> bool; fn get_f32_generic(&self, m: &dyn Message) -> f32; fn get_f64_generic(&self, m: &dyn Message) -> f64; fn get_reflect<'a>(&self, m: &'a dyn Message) -> ReflectFieldRef<'a>; } pub(crate) trait GetSingularMessage: Sync { fn get_message<'a>(&self, m: &'a M) -> &'a dyn Message; } struct GetSingularMessageImpl { get: for<'a> fn(&'a M) -> &'a N, } impl GetSingularMessage for GetSingularMessageImpl { fn get_message<'a>(&self, m: &'a M) -> &'a dyn Message { (self.get)(m) } } pub(crate) trait GetSingularEnum: Sync { fn get_enum(&self, m: &M) -> &'static EnumValueDescriptor; } struct GetSingularEnumImpl { get: fn(&M) -> E, } impl GetSingularEnum for GetSingularEnumImpl { fn get_enum(&self, m: &M) -> &'static EnumValueDescriptor { (self.get)(m).descriptor() } } trait GetRepeatedMessage: Sync { fn len_field(&self, m: &M) -> usize; fn get_message_item<'a>(&self, m: &'a M, index: usize) -> &'a dyn Message; fn reflect_repeated_message<'a>(&self, m: &'a M) -> Box + 'a>; } trait GetRepeatedEnum: Sync { 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 + 'a>; } pub(crate) trait GetSetCopyFns: Sync { fn get_field<'a>(&self, m: &'a M) -> ReflectValueRef<'a>; } struct GetSetCopyFnsImpl { get: fn(&M) -> V, _set: fn(&mut M, V), } impl GetSetCopyFns for GetSetCopyFnsImpl { fn get_field<'a>(&self, m: &'a M) -> ReflectValueRef<'a> { (&(self.get)(m) as &dyn ProtobufValue).as_ref_copy() } } pub(crate) enum SingularGetSet { Copy(Box>), String(for<'a> fn(&'a M) -> &'a str, fn(&mut M, String)), Bytes(for<'a> fn(&'a M) -> &'a [u8], fn(&mut M, Vec)), Enum(Box + 'static>), Message(Box + 'static>), } impl SingularGetSet { 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)), } } } pub(crate) trait FieldAccessor2: Sync 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 where M: Message + 'static, { get_field: for<'a> fn(&'a M) -> &'a L, mut_field: for<'a> fn(&'a mut M) -> &'a mut L, } pub(crate) enum FieldAccessorFunctions { // up to 1.0.24 optional or required SingularHasGetSet { has: fn(&M) -> bool, get_set: SingularGetSet, }, // protobuf 3 simple field Simple(Box>), // optional, required or message Optional(Box>), // repeated Repeated(Box>), // protobuf 3 map Map(Box>), } impl fmt::Debug for FieldAccessorFunctions { 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(..)"), } } } pub(crate) struct FieldAccessorImpl { pub(crate) fns: FieldAccessorFunctions, } impl FieldAccessorImpl { fn get_value_option<'a>(&self, m: &'a M) -> Option> { 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 FieldAccessorTrait for FieldAccessorImpl { fn has_field_generic(&self, m: &dyn 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: &dyn 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 dyn Message) -> &'a dyn 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: &dyn Message) -> &'static EnumValueDescriptor { match self.fns { FieldAccessorFunctions::SingularHasGetSet { get_set: SingularGetSet::Enum(ref get), .. } => get.get_enum(message_down_cast(m)), FieldAccessorFunctions::Optional(ref t) => { match t .get_field(message_down_cast(m)) .to_option() .expect("field unset") .as_ref() { ReflectValueRef::Enum(e) => e, _ => panic!("not an enum"), } } FieldAccessorFunctions::Simple(ref t) => { match t.get_field(message_down_cast(m)).as_ref() { ReflectValueRef::Enum(e) => e, _ => panic!("not an enum"), } } ref fns => panic!("unknown accessor type: {:?}", fns), } } fn get_str_generic<'a>(&self, m: &'a dyn 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 dyn 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: &dyn 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: &dyn 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: &dyn 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: &dyn 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_bool_generic(&self, m: &dyn 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_f32_generic(&self, m: &dyn 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: &dyn 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_reflect<'a>(&self, m: &'a dyn 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(_: &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( name: &'static str, has: fn(&M) -> bool, get: fn(&M) -> u32, ) -> FieldAccessor { FieldAccessor::new_v1( name, FieldAccessorFunctions::SingularHasGetSet { has, get_set: SingularGetSet::Copy(Box::new(GetSetCopyFnsImpl { get, _set: set_panic, })), }, ) } pub fn make_singular_i32_accessor( name: &'static str, has: fn(&M) -> bool, get: fn(&M) -> i32, ) -> FieldAccessor { FieldAccessor::new_v1( name, FieldAccessorFunctions::SingularHasGetSet { has, get_set: SingularGetSet::Copy(Box::new(GetSetCopyFnsImpl { get, _set: set_panic, })), }, ) } pub fn make_singular_u64_accessor( name: &'static str, has: fn(&M) -> bool, get: fn(&M) -> u64, ) -> FieldAccessor { FieldAccessor::new_v1( name, FieldAccessorFunctions::SingularHasGetSet { has, get_set: SingularGetSet::Copy(Box::new(GetSetCopyFnsImpl { get, _set: set_panic, })), }, ) } pub fn make_singular_i64_accessor( name: &'static str, has: fn(&M) -> bool, get: fn(&M) -> i64, ) -> FieldAccessor { FieldAccessor::new_v1( name, FieldAccessorFunctions::SingularHasGetSet { has, get_set: SingularGetSet::Copy(Box::new(GetSetCopyFnsImpl { get, _set: set_panic, })), }, ) } pub fn make_singular_f32_accessor( name: &'static str, has: fn(&M) -> bool, get: fn(&M) -> f32, ) -> FieldAccessor { FieldAccessor::new_v1( name, FieldAccessorFunctions::SingularHasGetSet { has, get_set: SingularGetSet::Copy(Box::new(GetSetCopyFnsImpl { get, _set: set_panic, })), }, ) } pub fn make_singular_f64_accessor( name: &'static str, has: fn(&M) -> bool, get: fn(&M) -> f64, ) -> FieldAccessor { FieldAccessor::new_v1( name, FieldAccessorFunctions::SingularHasGetSet { has, get_set: SingularGetSet::Copy(Box::new(GetSetCopyFnsImpl { get, _set: set_panic, })), }, ) } pub fn make_singular_bool_accessor( name: &'static str, has: fn(&M) -> bool, get: fn(&M) -> bool, ) -> FieldAccessor { FieldAccessor::new_v1( name, FieldAccessorFunctions::SingularHasGetSet { has, get_set: SingularGetSet::Copy(Box::new(GetSetCopyFnsImpl { get, _set: set_panic, })), }, ) } pub fn make_singular_enum_accessor( name: &'static str, has: fn(&M) -> bool, get: fn(&M) -> E, ) -> FieldAccessor { FieldAccessor::new_v1( name, FieldAccessorFunctions::SingularHasGetSet { has, get_set: SingularGetSet::Enum(Box::new(GetSingularEnumImpl { get })), }, ) } pub fn make_singular_string_accessor( name: &'static str, has: fn(&M) -> bool, get: for<'a> fn(&'a M) -> &'a str, ) -> FieldAccessor { FieldAccessor::new_v1( name, FieldAccessorFunctions::SingularHasGetSet { has, get_set: SingularGetSet::String(get, set_panic), }, ) } pub fn make_singular_bytes_accessor( name: &'static str, has: fn(&M) -> bool, get: for<'a> fn(&'a M) -> &'a [u8], ) -> FieldAccessor { FieldAccessor::new_v1( name, FieldAccessorFunctions::SingularHasGetSet { has, get_set: SingularGetSet::Bytes(get, set_panic), }, ) } pub fn make_singular_message_accessor( name: &'static str, has: fn(&M) -> bool, get: for<'a> fn(&'a M) -> &'a F, ) -> FieldAccessor { FieldAccessor::new_v1( name, FieldAccessorFunctions::SingularHasGetSet { has, get_set: SingularGetSet::Message(Box::new(GetSingularMessageImpl { get })), }, ) } // repeated impl FieldAccessor2 for MessageGetMut> where M: Message + 'static, V: ProtobufValue + 'static, { fn get_field<'a>(&self, m: &'a M) -> &'a dyn ReflectRepeated { (self.get_field)(m) as &dyn ReflectRepeated } fn mut_field<'a>(&self, m: &'a mut M) -> &'a mut dyn ReflectRepeated { (self.mut_field)(m) as &mut dyn ReflectRepeated } } pub fn make_vec_accessor( name: &'static str, get_vec: for<'a> fn(&'a M) -> &'a Vec, mut_vec: for<'a> fn(&'a mut M) -> &'a mut Vec, ) -> FieldAccessor where M: Message + 'static, V: ProtobufType + 'static, { FieldAccessor::new_v1( name, FieldAccessorFunctions::Repeated(Box::new(MessageGetMut::> { get_field: get_vec, mut_field: mut_vec, })), ) } impl FieldAccessor2 for MessageGetMut> where M: Message + 'static, V: ProtobufValue + 'static, { fn get_field<'a>(&self, m: &'a M) -> &'a dyn ReflectRepeated { (self.get_field)(m) as &dyn ReflectRepeated } fn mut_field<'a>(&self, m: &'a mut M) -> &'a mut dyn ReflectRepeated { (self.mut_field)(m) as &mut dyn ReflectRepeated } } pub fn make_repeated_field_accessor( name: &'static str, get_vec: for<'a> fn(&'a M) -> &'a RepeatedField, mut_vec: for<'a> fn(&'a mut M) -> &'a mut RepeatedField, ) -> FieldAccessor where M: Message + 'static, V: ProtobufType + 'static, { FieldAccessor::new_v1( name, FieldAccessorFunctions::Repeated(Box::new(MessageGetMut::> { get_field: get_vec, mut_field: mut_vec, })), ) } impl FieldAccessor2 for MessageGetMut> where M: Message + 'static, V: ProtobufValue + Clone + 'static, { fn get_field<'a>(&self, m: &'a M) -> &'a dyn ReflectOptional { (self.get_field)(m) as &dyn ReflectOptional } fn mut_field<'a>(&self, m: &'a mut M) -> &'a mut dyn ReflectOptional { (self.mut_field)(m) as &mut dyn ReflectOptional } } pub fn make_option_accessor( name: &'static str, get_field: for<'a> fn(&'a M) -> &'a Option, mut_field: for<'a> fn(&'a mut M) -> &'a mut Option, ) -> FieldAccessor where M: Message + 'static, V: ProtobufType + 'static, { FieldAccessor::new_v1( name, FieldAccessorFunctions::Optional(Box::new(MessageGetMut::> { get_field, mut_field, })), ) } impl FieldAccessor2 for MessageGetMut> where M: Message + 'static, V: ProtobufValue + Clone + 'static, { fn get_field<'a>(&self, m: &'a M) -> &'a dyn ReflectOptional { (self.get_field)(m) as &dyn ReflectOptional } fn mut_field<'a>(&self, m: &'a mut M) -> &'a mut dyn ReflectOptional { (self.mut_field)(m) as &mut dyn ReflectOptional } } pub fn make_singular_field_accessor( name: &'static str, get_field: for<'a> fn(&'a M) -> &'a SingularField, mut_field: for<'a> fn(&'a mut M) -> &'a mut SingularField, ) -> FieldAccessor where M: Message + 'static, V: ProtobufType + 'static, { FieldAccessor::new_v1( name, FieldAccessorFunctions::Optional(Box::new(MessageGetMut::> { get_field, mut_field, })), ) } impl FieldAccessor2 for MessageGetMut> where M: Message + 'static, V: ProtobufValue + Clone + 'static, { fn get_field<'a>(&self, m: &'a M) -> &'a dyn ReflectOptional { (self.get_field)(m) as &dyn ReflectOptional } fn mut_field<'a>(&self, m: &'a mut M) -> &'a mut dyn ReflectOptional { (self.mut_field)(m) as &mut dyn ReflectOptional } } pub fn make_singular_ptr_field_accessor( name: &'static str, get_field: for<'a> fn(&'a M) -> &'a SingularPtrField, mut_field: for<'a> fn(&'a mut M) -> &'a mut SingularPtrField, ) -> FieldAccessor where M: Message + 'static, V: ProtobufType + 'static, { FieldAccessor::new_v1( name, FieldAccessorFunctions::Optional(Box::new( MessageGetMut::> { get_field, mut_field, }, )), ) } impl FieldAccessor2 for MessageGetMut where M: Message + 'static, V: ProtobufValue + Clone + 'static, { fn get_field<'a>(&self, m: &'a M) -> &'a dyn ProtobufValue { (self.get_field)(m) as &dyn ProtobufValue } fn mut_field<'a>(&self, m: &'a mut M) -> &'a mut dyn ProtobufValue { (self.mut_field)(m) as &mut dyn ProtobufValue } } pub fn make_simple_field_accessor( 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, ) -> FieldAccessor where M: Message + 'static, V: ProtobufType + 'static, { FieldAccessor::new_v1( name, FieldAccessorFunctions::Simple(Box::new(MessageGetMut:: { get_field, mut_field, })), ) } impl FieldAccessor2 for MessageGetMut> where M: Message + 'static, K: ProtobufValue + 'static, V: ProtobufValue + 'static, K: Hash + Eq, { fn get_field<'a>(&self, m: &'a M) -> &'a dyn ReflectMap { (self.get_field)(m) as &dyn ReflectMap } fn mut_field<'a>(&self, m: &'a mut M) -> &'a mut dyn ReflectMap { (self.mut_field)(m) as &mut dyn ReflectMap } } pub fn make_map_accessor( name: &'static str, get_field: for<'a> fn(&'a M) -> &'a HashMap, mut_field: for<'a> fn(&'a mut M) -> &'a mut HashMap, ) -> FieldAccessor where M: Message + 'static, K: ProtobufType + 'static, V: ProtobufType + 'static, ::Value: Hash + Eq, { FieldAccessor::new_v1( name, FieldAccessorFunctions::Map(Box::new(MessageGetMut::> { get_field, mut_field, })), ) } protobuf-2.25.2/src/reflect/accessor/mod.rs000064400000000000000000000022150072674642500167460ustar 00000000000000#![doc(hidden)] pub use crate::reflect::acc::v1::make_map_accessor; pub use crate::reflect::acc::v1::make_option_accessor; pub use crate::reflect::acc::v1::make_repeated_field_accessor; pub use crate::reflect::acc::v1::make_simple_field_accessor; pub use crate::reflect::acc::v1::make_singular_bool_accessor; pub use crate::reflect::acc::v1::make_singular_bytes_accessor; pub use crate::reflect::acc::v1::make_singular_enum_accessor; pub use crate::reflect::acc::v1::make_singular_f32_accessor; pub use crate::reflect::acc::v1::make_singular_f64_accessor; pub use crate::reflect::acc::v1::make_singular_field_accessor; pub use crate::reflect::acc::v1::make_singular_i32_accessor; pub use crate::reflect::acc::v1::make_singular_i64_accessor; pub use crate::reflect::acc::v1::make_singular_message_accessor; pub use crate::reflect::acc::v1::make_singular_ptr_field_accessor; pub use crate::reflect::acc::v1::make_singular_string_accessor; pub use crate::reflect::acc::v1::make_singular_u32_accessor; pub use crate::reflect::acc::v1::make_singular_u64_accessor; pub use crate::reflect::acc::v1::make_vec_accessor; pub use crate::reflect::acc::v1::FieldAccessorTrait; protobuf-2.25.2/src/reflect/enums.rs000064400000000000000000000100000072674642500155030ustar 00000000000000use crate::descriptor::EnumDescriptorProto; use crate::descriptor::EnumValueDescriptorProto; use crate::descriptor::FileDescriptorProto; use crate::descriptorx::find_enum_by_rust_name; use crate::reflect::find_message_or_enum::find_message_or_enum; use crate::reflect::find_message_or_enum::MessageOrEnum; use crate::ProtobufEnum; use std::collections::HashMap; /// 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, index_by_name: HashMap, index_by_number: HashMap, } 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() -> &'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( 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] } } protobuf-2.25.2/src/reflect/field.rs000064400000000000000000000154670072674642500154650ustar 00000000000000use crate::descriptor::FieldDescriptorProto; use crate::descriptor::FieldDescriptorProto_Label; use crate::json::json_name; use crate::message::Message; use crate::reflect::acc::Accessor; use crate::reflect::acc::FieldAccessor; use crate::reflect::map::ReflectMap; use crate::reflect::repeated::ReflectRepeated; use crate::reflect::EnumValueDescriptor; use crate::reflect::ReflectValueRef; /// 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>), /// Repeated field Repeated(&'a dyn ReflectRepeated), /// Map field Map(&'a dyn ReflectMap), } /// Field descriptor. /// /// Can be used for runtime reflection. pub struct FieldDescriptor { proto: &'static FieldDescriptorProto, accessor: FieldAccessor, json_name: String, } impl FieldDescriptor { pub(crate) fn new( accessor: FieldAccessor, proto: &'static FieldDescriptorProto, ) -> FieldDescriptor { assert_eq!(proto.get_name(), accessor.name); let json_name = if !proto.get_json_name().is_empty() { proto.get_json_name().to_string() } else { json_name(proto.get_name()) }; FieldDescriptor { proto, accessor, // probably could be lazy-init json_name, } } /// 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() } /// JSON field name. /// /// Can be different from `.proto` field name. /// /// See [JSON mapping][json] for details. /// /// [json]: https://developers.google.com/protocol-buffers/docs/proto3#json pub fn json_name(&self) -> &str { &self.json_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: &dyn Message) -> bool { match &self.accessor.accessor { Accessor::V1(a) => a.has_field_generic(m), } } /// Return length of repeated field. /// /// For singular 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 { match &self.accessor.accessor { Accessor::V1(a) => a.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 { match &self.accessor.accessor { Accessor::V1(a) => a.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 { match &self.accessor.accessor { Accessor::V1(a) => a.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 { match &self.accessor.accessor { Accessor::V1(a) => a.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] { match &self.accessor.accessor { Accessor::V1(a) => a.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 { match &self.accessor.accessor { Accessor::V1(a) => a.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 { match &self.accessor.accessor { Accessor::V1(a) => a.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 { match &self.accessor.accessor { Accessor::V1(a) => a.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 { match &self.accessor.accessor { Accessor::V1(a) => a.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 { match &self.accessor.accessor { Accessor::V1(a) => a.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 { match &self.accessor.accessor { Accessor::V1(a) => a.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 { match &self.accessor.accessor { Accessor::V1(a) => a.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> { match &self.accessor.accessor { Accessor::V1(a) => a.get_reflect(m), } } } protobuf-2.25.2/src/reflect/find_message_or_enum.rs000064400000000000000000000036110072674642500205360ustar 00000000000000use 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) } protobuf-2.25.2/src/reflect/map.rs000064400000000000000000000034030072674642500151420ustar 00000000000000use 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 ReflectMap for HashMap { 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 dyn ProtobufValue, &'a dyn 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 dyn ProtobufValue, &'a dyn ProtobufValue)> { match self.iter.next() { Some((k, v)) => Some((k as &dyn ProtobufValue, v as &dyn ProtobufValue)), None => None, } } } pub struct ReflectMapIter<'a> { imp: Box + 'a>, } impl<'a> Iterator for ReflectMapIter<'a> { type Item = (&'a dyn ProtobufValue, &'a dyn ProtobufValue); fn next(&mut self) -> Option<(&'a dyn ProtobufValue, &'a dyn ProtobufValue)> { self.imp.next() } } impl<'a> IntoIterator for &'a dyn ReflectMap { type IntoIter = ReflectMapIter<'a>; type Item = (&'a dyn ProtobufValue, &'a dyn ProtobufValue); fn into_iter(self) -> Self::IntoIter { self.reflect_iter() } } protobuf-2.25.2/src/reflect/message.rs000064400000000000000000000223270072674642500160170ustar 00000000000000use crate::descriptor::DescriptorProto; use crate::descriptor::FileDescriptorProto; use crate::descriptorx::find_message_by_rust_name; use crate::reflect::acc::FieldAccessor; use crate::reflect::find_message_or_enum::find_message_or_enum; use crate::reflect::find_message_or_enum::MessageOrEnum; use crate::reflect::FieldDescriptor; use crate::Message; use std::collections::HashMap; use std::marker; trait MessageFactory: Send + Sync + 'static { fn new_instance(&self) -> Box; } struct MessageFactoryImpl(marker::PhantomData); impl MessageFactory for MessageFactoryImpl where M: 'static + Message + Default + Clone + PartialEq, { fn new_instance(&self) -> Box { 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, index_by_name: HashMap, index_by_name_or_json_name: HashMap, index_by_number: HashMap, } 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() -> &'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, 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_name_or_json_name = HashMap::new(); let mut index_by_number = HashMap::new(); 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()); let fields: Vec<_> = fields .into_iter() .map(|f| { let proto = *field_proto_by_name.get(&f.name).unwrap(); FieldDescriptor::new(f, proto) }) .collect(); for (i, f) in fields.iter().enumerate() { assert!(index_by_number .insert(f.proto().get_number() as u32, i) .is_none()); assert!(index_by_name .insert(f.proto().get_name().to_owned(), i) .is_none()); assert!(index_by_name_or_json_name .insert(f.proto().get_name().to_owned(), i) .is_none()); let json_name = f.json_name().to_owned(); if json_name != f.proto().get_name() { assert!(index_by_name_or_json_name.insert(json_name, i).is_none()); } } MessageDescriptor { full_name, proto: proto.message, factory, fields, index_by_name, index_by_name_or_json_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, 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_name_or_json_name = HashMap::new(); let mut index_by_number = HashMap::new(); let full_name = MessageDescriptor::compute_full_name( file_descriptor_proto.get_package(), &path_to_package, &proto, ); let fields: Vec<_> = fields .into_iter() .map(|f| { let proto = *field_proto_by_name.get(&f.name).unwrap(); FieldDescriptor::new(f, proto) }) .collect(); for (i, f) in fields.iter().enumerate() { assert!(index_by_number .insert(f.proto().get_number() as u32, i) .is_none()); assert!(index_by_name .insert(f.proto().get_name().to_owned(), i) .is_none()); assert!(index_by_name_or_json_name .insert(f.proto().get_name().to_owned(), i) .is_none()); let json_name = f.json_name().to_owned(); if json_name != f.proto().get_name() { assert!(index_by_name_or_json_name.insert(json_name, i).is_none()); } } MessageDescriptor { full_name, proto, factory, fields, index_by_name, index_by_name_or_json_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( rust_name: &'static str, fields: Vec, file: &'static FileDescriptorProto, ) -> MessageDescriptor { let factory = &MessageFactoryImpl(marker::PhantomData::); 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( protobuf_name_to_package: &'static str, fields: Vec, file_descriptor_proto: &'static FileDescriptorProto, ) -> MessageDescriptor { let factory = &MessageFactoryImpl(marker::PhantomData::); 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 { self.factory.new_instance() } /// Message name as given in `.proto` file 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 message field by protobuf field name /// /// Note: protobuf field name might be different for Rust field name. pub fn get_field_by_name<'a>(&'a self, name: &str) -> Option<&'a FieldDescriptor> { let &index = self.index_by_name.get(name)?; Some(&self.fields[index]) } /// Find message field by field name or field JSON name pub fn get_field_by_name_or_json_name<'a>(&'a self, name: &str) -> Option<&'a FieldDescriptor> { let &index = self.index_by_name_or_json_name.get(name)?; Some(&self.fields[index]) } /// Find message field by field name pub fn get_field_by_number(&self, number: u32) -> Option<&FieldDescriptor> { let &index = self.index_by_number.get(&number)?; Some(&self.fields[index]) } /// Find field by name // TODO: deprecate 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 // TODO: deprecate pub fn field_by_number<'a>(&'a self, number: u32) -> &'a FieldDescriptor { let &index = self.index_by_number.get(&number).unwrap(); &self.fields[index] } } protobuf-2.25.2/src/reflect/mod.rs000064400000000000000000000012060072674642500151430ustar 00000000000000//! Reflection implementation for protobuf types. use crate::message::Message; mod acc; 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 mod rt; 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; protobuf-2.25.2/src/reflect/optional.rs000064400000000000000000000027360072674642500162220ustar 00000000000000use std::mem; use super::value::ProtobufValue; use crate::singular::*; pub trait ReflectOptional: 'static { fn to_option(&self) -> Option<&dyn ProtobufValue>; fn set_value(&mut self, value: &dyn ProtobufValue); } impl ReflectOptional for Option { fn to_option(&self) -> Option<&dyn ProtobufValue> { self.as_ref().map(|v| v as &dyn ProtobufValue) } fn set_value(&mut self, value: &dyn ProtobufValue) { match value.as_any().downcast_ref::() { Some(v) => mem::replace(self, Some(v.clone())), None => panic!(), }; } } impl ReflectOptional for SingularField { fn to_option(&self) -> Option<&dyn ProtobufValue> { self.as_ref().map(|v| v as &dyn ProtobufValue) } fn set_value(&mut self, value: &dyn ProtobufValue) { match value.as_any().downcast_ref::() { Some(v) => mem::replace(self, SingularField::some(v.clone())), None => panic!(), }; } } impl ReflectOptional for SingularPtrField { fn to_option(&self) -> Option<&dyn ProtobufValue> { self.as_ref().map(|v| v as &dyn ProtobufValue) } fn set_value(&mut self, value: &dyn ProtobufValue) { match value.as_any().downcast_ref::() { Some(v) => mem::replace(self, SingularPtrField::some(v.clone())), None => panic!(), }; } } protobuf-2.25.2/src/reflect/repeated.rs000064400000000000000000000127230072674642500161630ustar 00000000000000use std::slice; use super::value::ProtobufValue; use super::value::ReflectValueRef; use crate::repeated::RepeatedField; pub trait ReflectRepeated: 'static { fn reflect_iter(&self) -> ReflectRepeatedIter; fn len(&self) -> usize; fn get(&self, index: usize) -> &dyn ProtobufValue; } impl ReflectRepeated for Vec { 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) -> &dyn ProtobufValue { &self[index] } } // useless impl 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) -> &dyn ProtobufValue { &self[index] } } impl ReflectRepeated for RepeatedField { 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) -> &dyn ProtobufValue { &self[index] } } trait ReflectRepeatedIterTrait<'a> { fn next(&mut self) -> Option<&'a dyn 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 dyn ProtobufValue> { self.iter.next().map(|v| v as &dyn ProtobufValue) } } pub struct ReflectRepeatedIter<'a> { imp: Box + 'a>, } impl<'a> Iterator for ReflectRepeatedIter<'a> { type Item = &'a dyn ProtobufValue; fn next(&mut self) -> Option { self.imp.next() } } impl<'a> IntoIterator for &'a dyn ReflectRepeated { type IntoIter = ReflectRepeatedIter<'a>; type Item = &'a dyn 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 dyn 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]), Enum(Box + 'a>), Message(Box + '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 { 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, } } } protobuf-2.25.2/src/reflect/rt/mod.rs000064400000000000000000000002160072674642500155700ustar 00000000000000//! This module contains functions references for reflection in generated code. #![doc(hidden)] pub use crate::reflect::acc::FieldAccessor; protobuf-2.25.2/src/reflect/value.rs000064400000000000000000000106020072674642500155000ustar 00000000000000use std::any::Any; #[cfg(feature = "bytes")] use crate::chars::Chars; #[cfg(feature = "bytes")] use bytes::Bytes; 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) -> &dyn 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 { 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 ProtobufValue for E { fn as_ref(&self) -> ProtobufValueRef { ProtobufValueRef::Enum(self.descriptor()) } } impl 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, } } } protobuf-2.25.2/src/repeated.rs000064400000000000000000000322130072674642500145330ustar 00000000000000#[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 crate::clear::Clear; /// Wrapper around vector to avoid deallocations on clear. pub struct RepeatedField { vec: Vec, len: usize, } impl RepeatedField { /// 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 Clear for RepeatedField { #[inline] fn clear(&mut self) { self.len = 0; } } impl Default for RepeatedField { #[inline] fn default() -> RepeatedField { RepeatedField { vec: Vec::new(), len: 0, } } } impl RepeatedField { /// Create new empty container. #[inline] pub fn new() -> RepeatedField { Default::default() } /// Create a contained with data from given vec. #[inline] pub fn from_vec(vec: Vec) -> RepeatedField { let len = vec.len(); RepeatedField { vec: vec, len: len } } /// Convert data into vec. #[inline] pub fn into_vec(self) -> Vec { 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 { 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) } /// Retains only the elements specified by the predicate. /// /// In other words, remove all elements `e` such that `f(&e)` returns `false`. /// This method operates in place, visiting each element exactly once in the /// original order, and preserves the order of the retained elements. /// /// # Examples /// /// ``` /// # use protobuf::RepeatedField; /// /// let mut vec = RepeatedField::from(vec![1, 2, 3, 4]); /// vec.retain(|&x| x % 2 == 0); /// assert_eq!(vec, RepeatedField::from(vec![2, 4])); /// ``` pub fn retain(&mut self, f: F) where F: FnMut(&T) -> bool, { // suboptimal self.vec.truncate(self.len); self.vec.retain(f); self.len = self.vec.len(); } /// 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 { 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(&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 RepeatedField { /// 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 From> for RepeatedField { #[inline] fn from(values: Vec) -> RepeatedField { RepeatedField::from_vec(values) } } impl<'a, T: Clone> From<&'a [T]> for RepeatedField { #[inline] fn from(values: &'a [T]) -> RepeatedField { RepeatedField::from_slice(values) } } impl Into> for RepeatedField { #[inline] fn into(self) -> Vec { self.into_vec() } } impl RepeatedField { /// Copy slice data to `RepeatedField` #[inline] pub fn from_slice(values: &[T]) -> RepeatedField { RepeatedField::from_vec(values.to_vec()) } /// Copy slice data to `RepeatedField` #[inline] pub fn from_ref>(values: X) -> RepeatedField { RepeatedField::from_slice(values.as_ref()) } /// Copy this data into new vec. #[inline] pub fn to_vec(&self) -> Vec { self.as_ref().to_vec() } } impl Clone for RepeatedField { #[inline] fn clone(&self) -> RepeatedField { RepeatedField { vec: self.to_vec(), len: self.len(), } } } impl FromIterator for RepeatedField { #[inline] fn from_iter>(iter: I) -> RepeatedField { RepeatedField::from_vec(FromIterator::from_iter(iter)) } } impl<'a, T> IntoIterator for &'a RepeatedField { type Item = &'a T; type IntoIter = slice::Iter<'a, T>; fn into_iter(self) -> slice::Iter<'a, T> { self.iter() } } impl<'a, T> IntoIterator for &'a mut RepeatedField { type Item = &'a mut T; type IntoIter = slice::IterMut<'a, T>; fn into_iter(self) -> slice::IterMut<'a, T> { self.iter_mut() } } impl<'a, T> IntoIterator for RepeatedField { type Item = T; type IntoIter = vec::IntoIter; fn into_iter(self) -> vec::IntoIter { self.into_iter() } } impl PartialEq for RepeatedField { #[inline] fn eq(&self, other: &RepeatedField) -> bool { self.as_ref() == other.as_ref() } } impl Eq for RepeatedField {} impl PartialEq<[T]> for RepeatedField { fn eq(&self, other: &[T]) -> bool { self.as_slice() == other } } impl PartialEq> for [T] { fn eq(&self, other: &RepeatedField) -> bool { self == other.as_slice() } } impl RepeatedField { /// True iff this container contains given element. #[inline] pub fn contains(&self, value: &T) -> bool { self.as_ref().contains(value) } } impl Hash for RepeatedField { fn hash(&self, state: &mut H) { self.as_ref().hash(state); } } impl AsRef<[T]> for RepeatedField { #[inline] fn as_ref<'a>(&'a self) -> &'a [T] { &self.vec[..self.len] } } impl Borrow<[T]> for RepeatedField { #[inline] fn borrow(&self) -> &[T] { &self.vec[..self.len] } } impl Deref for RepeatedField { type Target = [T]; #[inline] fn deref(&self) -> &[T] { &self.vec[..self.len] } } impl DerefMut for RepeatedField { #[inline] fn deref_mut(&mut self) -> &mut [T] { &mut self.vec[..self.len] } } impl Index for RepeatedField { type Output = T; #[inline] fn index<'a>(&'a self, index: usize) -> &'a T { &self.as_ref()[index] } } impl IndexMut for RepeatedField { #[inline] fn index_mut<'a>(&'a mut self, index: usize) -> &'a mut T { &mut self.as_mut_slice()[index] } } impl Extend for RepeatedField { fn extend>(&mut self, iter: I) { self.vec.truncate(self.len); self.vec.extend(iter); self.len = self.vec.len(); } } impl<'a, T: Copy + 'a> Extend<&'a T> for RepeatedField { fn extend>(&mut self, iter: I) { self.vec.truncate(self.len); self.vec.extend(iter); self.len = self.vec.len(); } } impl fmt::Debug for RepeatedField { #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.as_ref().fmt(f) } } #[cfg(feature = "with-serde")] impl serde::Serialize for RepeatedField { fn serialize( &self, serializer: S, ) -> Result<::Ok, ::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 { fn deserialize(deserializer: D) -> Result>::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()); } #[test] fn extend_values() { let mut r = RepeatedField::new(); r.push(10); r.push(20); r.clear(); // self-check assert_eq!(2, r.vec.len()); r.extend(vec![30, 40]); assert_eq!(&[30, 40][..], &r); } #[test] fn extend_copy() { let mut r = RepeatedField::new(); r.push(10); r.push(20); r.clear(); // self-check assert_eq!(2, r.vec.len()); r.extend(&[30, 40]); assert_eq!(&[30, 40][..], &r); } } protobuf-2.25.2/src/rt.rs000064400000000000000000000651550072674642500134020ustar 00000000000000//! 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 crate::chars::Chars; #[cfg(feature = "bytes")] use bytes::Bytes; use crate::coded_input_stream::CodedInputStream; use crate::coded_output_stream::CodedOutputStream; use crate::enums::ProtobufEnum; use crate::error::ProtobufError; use crate::error::ProtobufResult; use crate::error::WireError; use crate::message::*; use crate::repeated::RepeatedField; use crate::singular::SingularField; use crate::singular::SingularPtrField; use crate::types::*; use crate::zigzag::*; pub use crate::lazy_v2::LazyV2; use crate::unknown::UnknownFields; use crate::wire_format; use crate::wire_format::WireType; /// 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 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(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(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(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(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(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(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, WireType::WireTypeFixed64) .value() .len_varint() } fn value_size_no_tag(value: T, wt: WireType) -> u32 { match wt { WireType::WireTypeFixed64 => 8, WireType::WireTypeFixed32 => 4, WireType::WireTypeVarint => value.len_varint(), _ => panic!(), } } /// Integer value size when encoded as specified wire type. pub fn value_size(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(value: T) -> u32 { value.len_varint_zigzag() } /// Length of value when encoding with zigzag encoding with tag pub fn value_varint_zigzag_size(field_number: u32, value: T) -> u32 { tag_size(field_number) + value_varint_zigzag_size_no_tag(value) } fn enum_size_no_tag(value: E) -> u32 { value.value().len_varint() } /// Size of encoded enum field value. pub fn enum_size(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, ) -> ProtobufResult<()> { match wire_type { WireType::WireTypeLengthDelimited => is.read_repeated_packed_int32_into(target), WireType::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, ) -> ProtobufResult<()> { match wire_type { WireType::WireTypeLengthDelimited => is.read_repeated_packed_int64_into(target), WireType::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, ) -> ProtobufResult<()> { match wire_type { WireType::WireTypeLengthDelimited => is.read_repeated_packed_uint32_into(target), WireType::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, ) -> ProtobufResult<()> { match wire_type { WireType::WireTypeLengthDelimited => is.read_repeated_packed_uint64_into(target), WireType::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, ) -> ProtobufResult<()> { match wire_type { WireType::WireTypeLengthDelimited => is.read_repeated_packed_sint32_into(target), WireType::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, ) -> ProtobufResult<()> { match wire_type { WireType::WireTypeLengthDelimited => is.read_repeated_packed_sint64_into(target), WireType::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, ) -> ProtobufResult<()> { match wire_type { WireType::WireTypeLengthDelimited => is.read_repeated_packed_fixed32_into(target), WireType::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, ) -> ProtobufResult<()> { match wire_type { WireType::WireTypeLengthDelimited => is.read_repeated_packed_fixed64_into(target), WireType::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, ) -> ProtobufResult<()> { match wire_type { WireType::WireTypeLengthDelimited => is.read_repeated_packed_sfixed32_into(target), WireType::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, ) -> ProtobufResult<()> { match wire_type { WireType::WireTypeLengthDelimited => is.read_repeated_packed_sfixed64_into(target), WireType::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, ) -> ProtobufResult<()> { match wire_type { WireType::WireTypeLengthDelimited => is.read_repeated_packed_double_into(target), WireType::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, ) -> ProtobufResult<()> { match wire_type { WireType::WireTypeLengthDelimited => is.read_repeated_packed_float_into(target), WireType::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, ) -> ProtobufResult<()> { match wire_type { WireType::WireTypeLengthDelimited => is.read_repeated_packed_bool_into(target), WireType::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( wire_type: WireType, is: &mut CodedInputStream, target: &mut Vec, ) -> ProtobufResult<()> { match wire_type { WireType::WireTypeLengthDelimited => is.read_repeated_packed_enum_into(target), WireType::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( 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( is: &mut CodedInputStream, target: &mut Vec, 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( wire_type: WireType, is: &mut CodedInputStream, target: &mut Vec, field_number: u32, unknown_fields: &mut UnknownFields, ) -> ProtobufResult<()> { match wire_type { WireType::WireTypeLengthDelimited => read_repeated_packed_enum_with_unknown_fields_into( is, target, field_number, unknown_fields, ), WireType::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( 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( wire_type: WireType, is: &mut CodedInputStream, target: &mut Option, 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, ) -> ProtobufResult<()> { match wire_type { WireType::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, ) -> ProtobufResult<()> { match wire_type { WireType::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, ) -> ProtobufResult<()> { match wire_type { WireType::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, ) -> ProtobufResult<()> { match wire_type { WireType::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 { WireType::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 { WireType::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>, ) -> ProtobufResult<()> { match wire_type { WireType::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, ) -> ProtobufResult<()> { match wire_type { WireType::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>, ) -> ProtobufResult<()> { match wire_type { WireType::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, ) -> ProtobufResult<()> { match wire_type { WireType::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, ) -> ProtobufResult<()> { match wire_type { WireType::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 { WireType::WireTypeLengthDelimited => { *target = is.read_carllerche_bytes()?; Ok(()) } _ => Err(unexpected_wire_type(wire_type)), } } /// Read repeated `message` field. pub fn read_repeated_message_into( wire_type: WireType, is: &mut CodedInputStream, target: &mut RepeatedField, ) -> ProtobufResult<()> { match wire_type { WireType::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( wire_type: WireType, is: &mut CodedInputStream, target: &mut SingularPtrField, ) -> ProtobufResult<()> { match wire_type { WireType::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(field_number: u32, map: &HashMap) -> 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( field_number: u32, map: &HashMap, 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( wire_type: WireType, is: &mut CodedInputStream, target: &mut HashMap, ) -> 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(()) } protobuf-2.25.2/src/rust.rs000064400000000000000000000045530072674642500137450ustar 00000000000000#[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") ); } } protobuf-2.25.2/src/rustproto.rs000064400000000000000000000341110072674642500150220ustar 00000000000000// This file is generated by rust-protobuf 2.22.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![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(unused_imports)] #![allow(unused_results)] //! Generated file from `rustproto.proto` /// Extension fields pub mod exts { pub const expose_oneof_all: crate::ext::ExtFieldOptional = crate::ext::ExtFieldOptional { field_number: 17001, phantom: ::std::marker::PhantomData }; pub const expose_fields_all: crate::ext::ExtFieldOptional = crate::ext::ExtFieldOptional { field_number: 17003, phantom: ::std::marker::PhantomData }; pub const generate_accessors_all: crate::ext::ExtFieldOptional = crate::ext::ExtFieldOptional { field_number: 17004, phantom: ::std::marker::PhantomData }; pub const carllerche_bytes_for_bytes_all: crate::ext::ExtFieldOptional = crate::ext::ExtFieldOptional { field_number: 17011, phantom: ::std::marker::PhantomData }; pub const carllerche_bytes_for_string_all: crate::ext::ExtFieldOptional = crate::ext::ExtFieldOptional { field_number: 17012, phantom: ::std::marker::PhantomData }; pub const serde_derive_all: crate::ext::ExtFieldOptional = crate::ext::ExtFieldOptional { field_number: 17030, phantom: ::std::marker::PhantomData }; pub const serde_derive_cfg_all: crate::ext::ExtFieldOptional = crate::ext::ExtFieldOptional { field_number: 17031, phantom: ::std::marker::PhantomData }; pub const lite_runtime_all: crate::ext::ExtFieldOptional = crate::ext::ExtFieldOptional { field_number: 17035, phantom: ::std::marker::PhantomData }; pub const expose_oneof: crate::ext::ExtFieldOptional = crate::ext::ExtFieldOptional { field_number: 17001, phantom: ::std::marker::PhantomData }; pub const expose_fields: crate::ext::ExtFieldOptional = crate::ext::ExtFieldOptional { field_number: 17003, phantom: ::std::marker::PhantomData }; pub const generate_accessors: crate::ext::ExtFieldOptional = crate::ext::ExtFieldOptional { field_number: 17004, phantom: ::std::marker::PhantomData }; pub const carllerche_bytes_for_bytes: crate::ext::ExtFieldOptional = crate::ext::ExtFieldOptional { field_number: 17011, phantom: ::std::marker::PhantomData }; pub const carllerche_bytes_for_string: crate::ext::ExtFieldOptional = crate::ext::ExtFieldOptional { field_number: 17012, phantom: ::std::marker::PhantomData }; pub const serde_derive: crate::ext::ExtFieldOptional = crate::ext::ExtFieldOptional { field_number: 17030, phantom: ::std::marker::PhantomData }; pub const serde_derive_cfg: crate::ext::ExtFieldOptional = crate::ext::ExtFieldOptional { field_number: 17031, phantom: ::std::marker::PhantomData }; pub const expose_fields_field: crate::ext::ExtFieldOptional = crate::ext::ExtFieldOptional { field_number: 17003, phantom: ::std::marker::PhantomData }; pub const generate_accessors_field: crate::ext::ExtFieldOptional = crate::ext::ExtFieldOptional { field_number: 17004, phantom: ::std::marker::PhantomData }; pub const carllerche_bytes_for_bytes_field: crate::ext::ExtFieldOptional = crate::ext::ExtFieldOptional { field_number: 17011, phantom: ::std::marker::PhantomData }; pub const carllerche_bytes_for_string_field: crate::ext::ExtFieldOptional = crate::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 file_descriptor_proto_lazy: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; fn parse_descriptor_proto() -> crate::descriptor::FileDescriptorProto { crate::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() } pub fn file_descriptor_proto() -> &'static crate::descriptor::FileDescriptorProto { file_descriptor_proto_lazy.get(|| { parse_descriptor_proto() }) } protobuf-2.25.2/src/singular.rs000064400000000000000000000333270072674642500145750ustar 00000000000000#[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 crate::clear::Clear; /// Like `Option`, but keeps the actual element on `clear`. pub struct SingularField { value: T, set: bool, } /// Like `Option>`, but keeps the actual element on `clear`. pub struct SingularPtrField { value: Option>, set: bool, } impl SingularField { /// Construct this object from given value. #[inline] pub fn some(value: T) -> SingularField { 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 { 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(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(self, f: F) -> SingularPtrField 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 SingularField { /// Construct a `SingularField` with no data. #[inline] pub fn none() -> SingularField { SingularField { value: Default::default(), set: false, } } /// Construct `SingularField` from `Option`. #[inline] pub fn from_option(option: Option) -> SingularField { match option { Some(x) => SingularField::some(x), None => SingularField::none(), } } /// Return data as option, clear this object. #[inline] pub fn take(&mut self) -> Option { if self.set { self.set = false; Some(mem::replace(&mut self.value, Default::default())) } else { None } } } impl SingularPtrField { /// Construct `SingularPtrField` from given object. #[inline] pub fn some(value: T) -> SingularPtrField { SingularPtrField { value: Some(Box::new(value)), set: true, } } /// Construct an empty `SingularPtrField`. #[inline] pub fn none() -> SingularPtrField { SingularPtrField { value: None, set: false, } } /// Construct `SingularPtrField` from optional. #[inline] pub fn from_option(option: Option) -> SingularPtrField { 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`. #[inline] pub fn into_option(self) -> Option { 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(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(self, f: F) -> SingularPtrField 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 { 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 SingularField { /// 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 SingularPtrField { /// 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 Default for SingularField { #[inline] fn default() -> SingularField { SingularField::none() } } impl Default for SingularPtrField { #[inline] fn default() -> SingularPtrField { SingularPtrField::none() } } impl From> for SingularField { fn from(o: Option) -> Self { SingularField::from_option(o) } } impl From> for SingularPtrField { fn from(o: Option) -> Self { SingularPtrField::from_option(o) } } impl Clone for SingularField { #[inline] fn clone(&self) -> SingularField { if self.set { SingularField::some(self.value.clone()) } else { SingularField::none() } } } impl Clone for SingularPtrField { #[inline] fn clone(&self) -> SingularPtrField { if self.set { SingularPtrField::some(self.as_ref().unwrap().clone()) } else { SingularPtrField::none() } } } impl fmt::Debug for SingularField { #[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 fmt::Debug for SingularPtrField { #[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 PartialEq for SingularField { #[inline] fn eq(&self, other: &SingularField) -> bool { self.as_ref() == other.as_ref() } } impl Eq for SingularField {} impl PartialEq for SingularPtrField { #[inline] fn eq(&self, other: &SingularPtrField) -> bool { self.as_ref() == other.as_ref() } } impl Eq for SingularPtrField {} impl Hash for SingularField { fn hash(&self, state: &mut H) { self.as_ref().hash(state); } } impl Hash for SingularPtrField { fn hash(&self, state: &mut H) { self.as_ref().hash(state); } } impl<'a, T> IntoIterator for &'a SingularField { 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 { 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 serde::Serialize for SingularPtrField { fn serialize( &self, serializer: S, ) -> Result<::Ok, ::Error> where S: serde::Serializer, { self.as_ref().serialize(serializer) } } #[cfg(feature = "with-serde")] impl serde::Serialize for SingularField { fn serialize( &self, serializer: S, ) -> Result<::Ok, ::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 { fn deserialize(deserializer: D) -> Result>::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 { fn deserialize(deserializer: D) -> Result>::Error> where D: serde::Deserializer<'de>, { Option::deserialize(deserializer).map(SingularField::from_option) } } #[cfg(test)] mod test { use super::SingularField; use crate::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); } } protobuf-2.25.2/src/strx.rs000064400000000000000000000013730072674642500137450ustar 00000000000000pub 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")); } } protobuf-2.25.2/src/text_format/lexer/float.rs000064400000000000000000000025610072674642500175250ustar 00000000000000use std::f64; #[derive(Debug)] pub enum ProtobufFloatParseError { EmptyString, CannotParseFloat, } pub type ProtobufFloatParseResult = Result; pub const PROTOBUF_NAN: &str = "nan"; pub const PROTOBUF_INF: &str = "inf"; /// Format float as in protobuf `.proto` files pub fn format_protobuf_float(f: f64) -> String { if f.is_nan() { PROTOBUF_NAN.to_owned() } else if f.is_infinite() { if f > 0.0 { format!("{}", PROTOBUF_INF) } else { format!("-{}", PROTOBUF_INF) } } else { // TODO: make sure doesn't lose precision format!("{}", f) } } /// Parse float from `.proto` format pub fn parse_protobuf_float(s: &str) -> ProtobufFloatParseResult { if s.is_empty() { return Err(ProtobufFloatParseError::EmptyString); } if s == PROTOBUF_NAN { return Ok(f64::NAN); } if s == PROTOBUF_INF || s == format!("+{}", PROTOBUF_INF) { return Ok(f64::INFINITY); } if s == format!("-{}", PROTOBUF_INF) { return Ok(f64::NEG_INFINITY); } match s.parse() { Ok(f) => Ok(f), Err(_) => Err(ProtobufFloatParseError::CannotParseFloat), } } #[cfg(test)] mod test { use super::*; #[test] fn test_format_protobuf_float() { assert_eq!("10", format_protobuf_float(10.0)); } } protobuf-2.25.2/src/text_format/lexer/json_number_lit.rs000064400000000000000000000003630072674642500216070ustar 00000000000000use std::fmt; #[derive(Clone, Debug, Eq, PartialEq)] pub struct JsonNumberLit(pub(crate) String); impl fmt::Display for JsonNumberLit { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(&self.0, f) } } protobuf-2.25.2/src/text_format/lexer/lexer_impl.rs000064400000000000000000000530300072674642500205550ustar 00000000000000use std::char; use std::convert::TryFrom; use std::f64; use std::fmt; use std::num::ParseFloatError; use std::num::ParseIntError; use super::float; use super::loc::Loc; use super::loc::FIRST_COL; use super::str_lit::StrLit; use super::str_lit::StrLitDecodeError; use super::token::Token; use super::token::TokenWithLocation; use super::ParserLanguage; use crate::text_format::lexer::JsonNumberLit; #[derive(Debug)] pub enum LexerError { IncorrectInput, // TODO: something better than this UnexpectedEof, ExpectChar(char), ParseIntError, ParseFloatError, IncorrectFloatLit, // TODO: how it is different from ParseFloatError? IncorrectJsonEscape, IncorrectJsonNumber, IncorrectUnicodeChar, ExpectHexDigit, ExpectOctDigit, ExpectDecDigit, StrLitDecodeError(StrLitDecodeError), ExpectedIdent, } impl fmt::Display for LexerError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { LexerError::IncorrectInput => write!(f, "Incorrect input"), LexerError::UnexpectedEof => write!(f, "Unexpected EOF"), LexerError::ExpectChar(c) => write!(f, "Expecting char: {}", c), LexerError::ParseIntError => write!(f, "Parse int error"), LexerError::ParseFloatError => write!(f, "Parse float error"), LexerError::IncorrectFloatLit => write!(f, "Incorrect float literal"), LexerError::IncorrectJsonEscape => write!(f, "Incorrect JSON escape"), LexerError::IncorrectJsonNumber => write!(f, "Incorrect JSON number"), LexerError::IncorrectUnicodeChar => write!(f, "Incorrect Unicode char"), LexerError::ExpectHexDigit => write!(f, "Expecting hex digit"), LexerError::ExpectOctDigit => write!(f, "Expecting oct digit"), LexerError::ExpectDecDigit => write!(f, "Expecting dec digit"), LexerError::StrLitDecodeError(e) => write!(f, "{}", e), LexerError::ExpectedIdent => write!(f, "Expecting identifier"), } } } impl std::error::Error for LexerError {} pub type LexerResult = Result; impl From for LexerError { fn from(e: StrLitDecodeError) -> Self { LexerError::StrLitDecodeError(e) } } impl From for LexerError { fn from(_: ParseIntError) -> Self { LexerError::ParseIntError } } impl From for LexerError { fn from(_: ParseFloatError) -> Self { LexerError::ParseFloatError } } impl From for LexerError { fn from(_: float::ProtobufFloatParseError) -> Self { LexerError::IncorrectFloatLit } } #[derive(Copy, Clone)] pub struct Lexer<'a> { language: ParserLanguage, input: &'a str, pos: usize, pub loc: Loc, } fn is_letter(c: char) -> bool { c.is_alphabetic() || c == '_' } impl<'a> Lexer<'a> { pub fn new(input: &'a str, language: ParserLanguage) -> Lexer<'a> { Lexer { language, input, pos: 0, loc: Loc::start(), } } /// No more chars pub fn eof(&self) -> bool { self.pos == self.input.len() } /// Remaining chars fn rem_chars(&self) -> &'a str { &self.input[self.pos..] } pub fn lookahead_char_is bool>(&self, p: P) -> bool { self.lookahead_char().map_or(false, p) } fn lookahead_char_is_in(&self, alphabet: &str) -> bool { self.lookahead_char_is(|c| alphabet.contains(c)) } fn next_char_opt(&mut self) -> Option { let rem = self.rem_chars(); if rem.is_empty() { None } else { let mut char_indices = rem.char_indices(); let (_, c) = char_indices.next().unwrap(); let c_len = char_indices.next().map(|(len, _)| len).unwrap_or(rem.len()); self.pos += c_len; if c == '\n' { self.loc.line += 1; self.loc.col = FIRST_COL; } else { self.loc.col += 1; } Some(c) } } fn next_char(&mut self) -> LexerResult { self.next_char_opt().ok_or(LexerError::UnexpectedEof) } /// Skip whitespaces fn skip_whitespaces(&mut self) { self.take_while(|c| c.is_whitespace()); } fn skip_c_comment(&mut self) -> LexerResult<()> { if self.skip_if_lookahead_is_str("/*") { let end = "*/"; match self.rem_chars().find(end) { None => Err(LexerError::UnexpectedEof), Some(len) => { let new_pos = self.pos + len + end.len(); self.skip_to_pos(new_pos); Ok(()) } } } else { Ok(()) } } fn skip_cpp_comment(&mut self) { if self.skip_if_lookahead_is_str("//") { loop { match self.next_char_opt() { Some('\n') | None => break, _ => {} } } } } fn skip_sh_comment(&mut self) { if self.skip_if_lookahead_is_str("#") { loop { match self.next_char_opt() { Some('\n') | None => break, _ => {} } } } } fn skip_comment(&mut self) -> LexerResult<()> { match self.language { ParserLanguage::Proto => { self.skip_c_comment()?; self.skip_cpp_comment(); } ParserLanguage::TextFormat => { self.skip_sh_comment(); } ParserLanguage::Json => {} } Ok(()) } pub fn skip_ws(&mut self) -> LexerResult<()> { loop { let pos = self.pos; self.skip_whitespaces(); self.skip_comment()?; if pos == self.pos { // Did not advance return Ok(()); } } } pub fn take_while(&mut self, f: F) -> &'a str where F: Fn(char) -> bool, { let start = self.pos; while self.lookahead_char().map(&f) == Some(true) { self.next_char_opt().unwrap(); } let end = self.pos; &self.input[start..end] } fn lookahead_char(&self) -> Option { self.clone().next_char_opt() } fn lookahead_is_str(&self, s: &str) -> bool { self.rem_chars().starts_with(s) } fn skip_if_lookahead_is_str(&mut self, s: &str) -> bool { if self.lookahead_is_str(s) { let new_pos = self.pos + s.len(); self.skip_to_pos(new_pos); true } else { false } } fn next_char_if

(&mut self, p: P) -> Option where P: FnOnce(char) -> bool, { let mut clone = self.clone(); match clone.next_char_opt() { Some(c) if p(c) => { *self = clone; Some(c) } _ => None, } } pub fn next_char_if_eq(&mut self, expect: char) -> bool { self.next_char_if(|c| c == expect) != None } fn next_char_if_in(&mut self, alphabet: &str) -> Option { for c in alphabet.chars() { if self.next_char_if_eq(c) { return Some(c); } } None } fn next_char_expect_eq(&mut self, expect: char) -> LexerResult<()> { if self.next_char_if_eq(expect) { Ok(()) } else { Err(LexerError::ExpectChar(expect)) } } fn next_char_expect

(&mut self, expect: P, err: LexerError) -> LexerResult where P: FnOnce(char) -> bool, { self.next_char_if(expect).ok_or(err) } // str functions /// properly update line and column fn skip_to_pos(&mut self, new_pos: usize) -> &'a str { assert!(new_pos >= self.pos); assert!(new_pos <= self.input.len()); let pos = self.pos; while self.pos != new_pos { self.next_char_opt().unwrap(); } &self.input[pos..new_pos] } // Protobuf grammar // char functions // letter = "A" … "Z" | "a" … "z" // https://github.com/google/protobuf/issues/4565 fn next_letter_opt(&mut self) -> Option { self.next_char_if(is_letter) } // capitalLetter = "A" … "Z" fn _next_capital_letter_opt(&mut self) -> Option { self.next_char_if(|c| c >= 'A' && c <= 'Z') } fn next_ident_part(&mut self) -> Option { self.next_char_if(|c| c.is_ascii_alphanumeric() || c == '_') } // Identifiers // ident = letter { letter | decimalDigit | "_" } fn next_ident_opt(&mut self) -> LexerResult> { if let Some(c) = self.next_letter_opt() { let mut ident = String::new(); ident.push(c); while let Some(c) = self.next_ident_part() { ident.push(c); } Ok(Some(ident)) } else { Ok(None) } } // Integer literals // hexLit = "0" ( "x" | "X" ) hexDigit { hexDigit } fn next_hex_lit_opt(&mut self) -> LexerResult> { Ok( if self.skip_if_lookahead_is_str("0x") || self.skip_if_lookahead_is_str("0X") { let s = self.take_while(|c| c.is_ascii_hexdigit()); Some(u64::from_str_radix(s, 16)? as u64) } else { None }, ) } // decimalLit = ( "1" … "9" ) { decimalDigit } // octalLit = "0" { octalDigit } fn next_decimal_octal_lit_opt(&mut self) -> LexerResult> { // do not advance on number parse error let mut clone = self.clone(); let pos = clone.pos; Ok(if clone.next_char_if(|c| c.is_ascii_digit()) != None { clone.take_while(|c| c.is_ascii_digit()); let value = clone.input[pos..clone.pos].parse()?; *self = clone; Some(value) } else { None }) } // hexDigit = "0" … "9" | "A" … "F" | "a" … "f" fn next_hex_digit(&mut self) -> LexerResult { let mut clone = self.clone(); let r = match clone.next_char()? { c if c >= '0' && c <= '9' => c as u32 - b'0' as u32, c if c >= 'A' && c <= 'F' => c as u32 - b'A' as u32 + 10, c if c >= 'a' && c <= 'f' => c as u32 - b'a' as u32 + 10, _ => return Err(LexerError::ExpectHexDigit), }; *self = clone; Ok(r) } // octalDigit = "0" … "7" fn next_octal_digit(&mut self) -> LexerResult { self.next_char_expect(|c| c >= '0' && c <= '9', LexerError::ExpectOctDigit) .map(|c| c as u32 - '0' as u32) } // decimalDigit = "0" … "9" fn next_decimal_digit(&mut self) -> LexerResult { self.next_char_expect(|c| c >= '0' && c <= '9', LexerError::ExpectDecDigit) .map(|c| c as u32 - '0' as u32) } // decimals = decimalDigit { decimalDigit } fn next_decimal_digits(&mut self) -> LexerResult<()> { self.next_decimal_digit()?; self.take_while(|c| c >= '0' && c <= '9'); Ok(()) } // intLit = decimalLit | octalLit | hexLit pub fn next_int_lit_opt(&mut self) -> LexerResult> { assert_ne!(ParserLanguage::Json, self.language); self.skip_ws()?; if let Some(i) = self.next_hex_lit_opt()? { return Ok(Some(i)); } if let Some(i) = self.next_decimal_octal_lit_opt()? { return Ok(Some(i)); } Ok(None) } // Floating-point literals // exponent = ( "e" | "E" ) [ "+" | "-" ] decimals fn next_exponent_opt(&mut self) -> LexerResult> { if self.next_char_if_in("eE") != None { self.next_char_if_in("+-"); self.next_decimal_digits()?; Ok(Some(())) } else { Ok(None) } } // floatLit = ( decimals "." [ decimals ] [ exponent ] | decimals exponent | "."decimals [ exponent ] ) | "inf" | "nan" fn next_float_lit(&mut self) -> LexerResult<()> { assert_ne!(ParserLanguage::Json, self.language); // "inf" and "nan" are handled as part of ident if self.next_char_if_eq('.') { self.next_decimal_digits()?; self.next_exponent_opt()?; } else { self.next_decimal_digits()?; if self.next_char_if_eq('.') { self.next_decimal_digits()?; self.next_exponent_opt()?; } else { if self.next_exponent_opt()? == None { return Err(LexerError::IncorrectFloatLit); } } } Ok(()) } // String literals // charValue = hexEscape | octEscape | charEscape | /[^\0\n\\]/ // hexEscape = '\' ( "x" | "X" ) hexDigit hexDigit // https://github.com/google/protobuf/issues/4560 // octEscape = '\' octalDigit octalDigit octalDigit // charEscape = '\' ( "a" | "b" | "f" | "n" | "r" | "t" | "v" | '\' | "'" | '"' ) // quote = "'" | '"' pub fn next_byte_value(&mut self) -> LexerResult { match self.next_char()? { '\\' => { match self.next_char()? { '\'' => Ok(b'\''), '"' => Ok(b'"'), '\\' => Ok(b'\\'), 'a' => Ok(b'\x07'), 'b' => Ok(b'\x08'), 'f' => Ok(b'\x0c'), 'n' => Ok(b'\n'), 'r' => Ok(b'\r'), 't' => Ok(b'\t'), 'v' => Ok(b'\x0b'), 'x' => { let d1 = self.next_hex_digit()? as u8; let d2 = self.next_hex_digit()? as u8; Ok(((d1 << 4) | d2) as u8) } d if d >= '0' && d <= '7' => { let mut r = d as u8 - b'0'; for _ in 0..2 { match self.next_octal_digit() { Err(_) => break, Ok(d) => r = (r << 3) + d as u8, } } Ok(r) } // https://github.com/google/protobuf/issues/4562 // TODO: overflow c => Ok(c as u8), } } '\n' | '\0' => Err(LexerError::IncorrectInput), // TODO: check overflow c => Ok(c as u8), } } fn char_try_from(i: u32) -> LexerResult { char::try_from(i).map_err(|_| LexerError::IncorrectUnicodeChar) } pub fn next_json_char_value(&mut self) -> LexerResult { match self.next_char()? { '\\' => match self.next_char()? { '"' => Ok('"'), '\'' => Ok('\''), '\\' => Ok('\\'), '/' => Ok('/'), 'b' => Ok('\x08'), 'f' => Ok('\x0c'), 'n' => Ok('\n'), 'r' => Ok('\r'), 't' => Ok('\t'), 'u' => { let mut v = 0; for _ in 0..4 { let digit = self.next_hex_digit()?; v = v * 16 + digit; } Self::char_try_from(v) } _ => Err(LexerError::IncorrectJsonEscape), }, c => Ok(c), } } // https://github.com/google/protobuf/issues/4564 // strLit = ( "'" { charValue } "'" ) | ( '"' { charValue } '"' ) fn next_str_lit_raw(&mut self) -> LexerResult { let mut raw = String::new(); let mut first = true; loop { if !first { self.skip_ws()?; } let start = self.pos; let q = match self.next_char_if_in("'\"") { Some(q) => q, None if !first => break, None => return Err(LexerError::IncorrectInput), }; first = false; while self.lookahead_char() != Some(q) { self.next_byte_value()?; } self.next_char_expect_eq(q)?; raw.push_str(&self.input[start + 1..self.pos - 1]); } Ok(raw) } fn next_str_lit_raw_opt(&mut self) -> LexerResult> { if self.lookahead_char_is_in("'\"") { Ok(Some(self.next_str_lit_raw()?)) } else { Ok(None) } } /// Parse next token as JSON number fn next_json_number_opt(&mut self) -> LexerResult> { assert_eq!(ParserLanguage::Json, self.language); fn is_digit(c: char) -> bool { c >= '0' && c <= '9' } fn is_digit_1_9(c: char) -> bool { c >= '1' && c <= '9' } if !self.lookahead_char_is_in("-0123456789") { return Ok(None); } let mut s = String::new(); if self.next_char_if_eq('-') { s.push('-'); } if self.next_char_if_eq('0') { s.push('0'); } else { s.push(self.next_char_expect(is_digit_1_9, LexerError::IncorrectJsonNumber)?); while let Some(c) = self.next_char_if(is_digit) { s.push(c); } } if self.next_char_if_eq('.') { s.push('.'); s.push(self.next_char_expect(is_digit, LexerError::IncorrectJsonNumber)?); while let Some(c) = self.next_char_if(is_digit) { s.push(c); } } if let Some(c) = self.next_char_if_in("eE") { s.push(c); if let Some(c) = self.next_char_if_in("+-") { s.push(c); } s.push(self.next_char_expect(is_digit, LexerError::IncorrectJsonNumber)?); while let Some(c) = self.next_char_if(is_digit) { s.push(c); } } Ok(Some(JsonNumberLit(s))) } fn next_token_inner(&mut self) -> LexerResult { if self.language == ParserLanguage::Json { if let Some(v) = self.next_json_number_opt()? { return Ok(Token::JsonNumber(v)); } } if let Some(ident) = self.next_ident_opt()? { let token = if self.language != ParserLanguage::Json && ident == float::PROTOBUF_NAN { Token::FloatLit(f64::NAN) } else if self.language != ParserLanguage::Json && ident == float::PROTOBUF_INF { Token::FloatLit(f64::INFINITY) } else { Token::Ident(ident.to_owned()) }; return Ok(token); } if self.language != ParserLanguage::Json { let mut clone = self.clone(); let pos = clone.pos; if let Ok(_) = clone.next_float_lit() { let f = float::parse_protobuf_float(&self.input[pos..clone.pos])?; *self = clone; return Ok(Token::FloatLit(f)); } if let Some(lit) = self.next_int_lit_opt()? { return Ok(Token::IntLit(lit)); } } if let Some(escaped) = self.next_str_lit_raw_opt()? { return Ok(Token::StrLit(StrLit { escaped })); } // This branch must be after str lit if let Some(c) = self.next_char_if(|c| c.is_ascii_punctuation()) { return Ok(Token::Symbol(c)); } if let Some(ident) = self.next_ident_opt()? { return Ok(Token::Ident(ident)); } Err(LexerError::IncorrectInput) } pub fn next_token(&mut self) -> LexerResult> { self.skip_ws()?; let loc = self.loc; Ok(if self.eof() { None } else { let token = self.next_token_inner()?; // Skip whitespace here to update location // to the beginning of the next token self.skip_ws()?; Some(TokenWithLocation { token, loc }) }) } } #[cfg(test)] mod test { use super::*; fn lex(input: &str, parse_what: P) -> R where P: FnOnce(&mut Lexer) -> LexerResult, { let mut lexer = Lexer::new(input, ParserLanguage::Proto); let r = parse_what(&mut lexer).expect(&format!("lexer failed at {}", lexer.loc)); assert!(lexer.eof(), "check eof failed at {}", lexer.loc); r } fn lex_opt(input: &str, parse_what: P) -> R where P: FnOnce(&mut Lexer) -> LexerResult>, { let mut lexer = Lexer::new(input, ParserLanguage::Proto); let o = parse_what(&mut lexer).expect(&format!("lexer failed at {}", lexer.loc)); let r = o.expect(&format!("lexer returned none at {}", lexer.loc)); assert!(lexer.eof(), "check eof failed at {}", lexer.loc); r } #[test] fn test_lexer_int_lit() { let msg = r#"10"#; let mess = lex_opt(msg, |p| p.next_int_lit_opt()); assert_eq!(10, mess); } #[test] fn test_lexer_float_lit() { let msg = r#"12.3"#; let mess = lex(msg, |p| p.next_token_inner()); assert_eq!(Token::FloatLit(12.3), mess); } #[test] fn test_lexer_float_lit_leading_zeros_in_exp() { let msg = r#"1e00009"#; let mess = lex(msg, |p| p.next_token_inner()); assert_eq!(Token::FloatLit(1_000_000_000.0), mess); } } protobuf-2.25.2/src/text_format/lexer/loc.rs000064400000000000000000000010120072674642500171630ustar 00000000000000use std::fmt; pub const FIRST_LINE: u32 = 1; pub const FIRST_COL: u32 = 1; /// Location in file #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] pub struct Loc { /// 1-based pub line: u32, /// 1-based pub col: u32, } impl fmt::Display for Loc { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}:{}", self.line, self.col) } } impl Loc { pub fn start() -> Loc { Loc { line: FIRST_LINE, col: FIRST_COL, } } } protobuf-2.25.2/src/text_format/lexer/mod.rs000064400000000000000000000010620072674642500171720ustar 00000000000000//! Implementation of lexer for both protobuf parser and for text format parser. pub mod float; mod json_number_lit; mod lexer_impl; mod loc; mod num_lit; mod parser_language; mod str_lit; mod token; pub use self::json_number_lit::JsonNumberLit; pub use self::lexer_impl::Lexer; pub use self::lexer_impl::LexerError; pub use self::loc::Loc; pub use self::num_lit::NumLit; pub use self::parser_language::ParserLanguage; pub use self::str_lit::StrLit; pub use self::str_lit::StrLitDecodeError; pub use self::token::Token; pub use self::token::TokenWithLocation; protobuf-2.25.2/src/text_format/lexer/num_lit.rs000064400000000000000000000001070072674642500200610ustar 00000000000000#[derive(Copy, Clone)] pub enum NumLit { U64(u64), F64(f64), } protobuf-2.25.2/src/text_format/lexer/parser_language.rs000064400000000000000000000003570072674642500215600ustar 00000000000000/// We use the same lexer/tokenizer for all parsers for simplicity #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum ParserLanguage { // `.proto` files Proto, // Protobuf text format TextFormat, // JSON Json, } protobuf-2.25.2/src/text_format/lexer/str_lit.rs000064400000000000000000000041170072674642500200770ustar 00000000000000use super::lexer_impl::Lexer; use super::lexer_impl::LexerError; use crate::text_format::lexer::ParserLanguage; use std::fmt; use std::string::FromUtf8Error; #[derive(Debug)] pub enum StrLitDecodeError { FromUtf8Error(FromUtf8Error), // TODO: be more specific OtherError, } impl fmt::Display for StrLitDecodeError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { StrLitDecodeError::FromUtf8Error(e) => write!(f, "{}", e), StrLitDecodeError::OtherError => write!(f, "String literal decode error"), } } } impl std::error::Error for StrLitDecodeError {} impl From for StrLitDecodeError { fn from(_: LexerError) -> Self { StrLitDecodeError::OtherError } } impl From for StrLitDecodeError { fn from(e: FromUtf8Error) -> Self { StrLitDecodeError::FromUtf8Error(e) } } pub type StrLitDecodeResult = Result; /// String literal, both `string` and `bytes`. #[derive(Clone, Eq, PartialEq, Debug)] pub struct StrLit { pub escaped: String, } impl StrLit { /// May fail if not valid UTF8 pub fn decode_utf8(&self) -> StrLitDecodeResult { let mut lexer = Lexer::new(&self.escaped, ParserLanguage::Json); let mut r = Vec::new(); while !lexer.eof() { r.push(lexer.next_byte_value()?); } Ok(String::from_utf8(r)?) } pub fn decode_bytes(&self) -> StrLitDecodeResult> { let mut lexer = Lexer::new(&self.escaped, ParserLanguage::Json); let mut r = Vec::new(); while !lexer.eof() { r.push(lexer.next_byte_value()?); } Ok(r) } pub fn quoted(&self) -> String { format!("\"{}\"", self.escaped) } } #[cfg(test)] mod test { use crate::text_format::lexer::StrLit; #[test] fn decode_utf8() { assert_eq!( "\u{1234}".to_owned(), StrLit { escaped: "\\341\\210\\264".to_owned() } .decode_utf8() .unwrap() ) } } protobuf-2.25.2/src/text_format/lexer/token.rs000064400000000000000000000023530072674642500175370ustar 00000000000000use super::lexer_impl::LexerError; use super::lexer_impl::LexerResult; use super::loc::Loc; use super::num_lit::NumLit; use super::str_lit::StrLit; use crate::text_format::lexer::JsonNumberLit; #[derive(Clone, Debug, PartialEq)] pub enum Token { Ident(String), Symbol(char), // Protobuf tokenizer has separate tokens for int and float. // Tokens do not include sign. IntLit(u64), FloatLit(f64), JsonNumber(JsonNumberLit), // including quotes StrLit(StrLit), } impl Token { /// Back to original pub fn format(&self) -> String { match self { &Token::Ident(ref s) => s.clone(), &Token::Symbol(c) => c.to_string(), &Token::IntLit(ref i) => i.to_string(), &Token::StrLit(ref s) => s.quoted(), &Token::FloatLit(ref f) => f.to_string(), &Token::JsonNumber(ref f) => f.to_string(), } } pub fn to_num_lit(&self) -> LexerResult { match self { &Token::IntLit(i) => Ok(NumLit::U64(i)), &Token::FloatLit(f) => Ok(NumLit::F64(f)), _ => Err(LexerError::IncorrectInput), } } } #[derive(Clone)] pub struct TokenWithLocation { pub token: Token, pub loc: Loc, } protobuf-2.25.2/src/text_format/mod.rs000064400000000000000000000210110072674642500160470ustar 00000000000000//! 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 crate::message::Message; use crate::reflect::ReflectFieldRef; use crate::reflect::ReflectValueRef; use std; use std::fmt; use std::fmt::Write; mod print; // Used by text format parser and by pure-rust codegen parsed // this it is public but hidden module. // https://github.com/rust-lang/rust/issues/44663 #[doc(hidden)] pub mod lexer; use self::print::print_str_to; #[doc(hidden)] pub use self::print::quote_bytes_to; #[doc(hidden)] pub use self::print::quote_escape_bytes; use crate::text_format::print::quote_escape_bytes_to; #[doc(hidden)] pub fn unescape_string(string: &str) -> Vec { 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 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: &dyn 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: &dyn Message, buf: &mut String) { print_to_internal(m, buf, false, 0) } fn print_to_string_internal(m: &dyn 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: &dyn Message) -> String { print_to_string_internal(m, false) } /// Text-format to `fmt::Formatter`. pub fn fmt(m: &dyn 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")[..]); } } protobuf-2.25.2/src/text_format/print.rs000064400000000000000000000021120072674642500164250ustar 00000000000000#[doc(hidden)] pub 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("\\\""), 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); } } } } pub(crate) 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 } pub(crate) fn print_str_to(s: &str, buf: &mut String) { // TODO: keep printable Unicode quote_escape_bytes_to(s.as_bytes(), buf); } protobuf-2.25.2/src/types.rs000064400000000000000000000415340072674642500141140ustar 00000000000000//! Implementations of `ProtobufType` for all types. use std::marker; use std::mem; #[cfg(feature = "bytes")] use crate::chars::Chars; #[cfg(feature = "bytes")] use bytes::Bytes; use crate::coded_input_stream::CodedInputStream; use crate::coded_output_stream::CodedOutputStream; use crate::enums::ProtobufEnum; use crate::error::ProtobufResult; use crate::message::Message; use crate::reflect::ProtobufValue; use crate::rt; use crate::unknown::UnknownValues; use crate::wire_format::WireType; use crate::zigzag::decode_zig_zag_32; use crate::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; /// Compute wire size fn compute_size(value: &Self::Value) -> u32; /// Get value from `UnknownValues` fn get_from_unknown(unknown_values: &UnknownValues) -> Option; /// 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(marker::PhantomData); /// `message` pub struct ProtobufTypeMessage(marker::PhantomData); impl ProtobufType for ProtobufTypeFloat { type Value = f32; fn wire_type() -> WireType { WireType::WireTypeFixed32 } fn read(is: &mut CodedInputStream) -> ProtobufResult { is.read_float() } fn compute_size(_value: &f32) -> u32 { 4 } fn get_from_unknown(unknown_values: &UnknownValues) -> Option { unknown_values .fixed32 .iter() .rev() .next() .map(|&bits| unsafe { mem::transmute::(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 { is.read_double() } fn get_from_unknown(unknown_values: &UnknownValues) -> Option { unknown_values .fixed64 .iter() .rev() .next() .map(|&bits| unsafe { mem::transmute::(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 { 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 { 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 { is.read_int64() } fn get_from_unknown(unknown_values: &UnknownValues) -> Option { 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 { is.read_uint32() } fn get_from_unknown(unknown_values: &UnknownValues) -> Option { 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 { is.read_uint64() } fn get_from_unknown(unknown_values: &UnknownValues) -> Option { 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 { is.read_sint32() } fn get_from_unknown(unknown_values: &UnknownValues) -> Option { 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 { is.read_sint64() } fn get_from_unknown(unknown_values: &UnknownValues) -> Option { 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 { is.read_fixed32() } fn get_from_unknown(unknown_values: &UnknownValues) -> Option { 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 { is.read_fixed64() } fn get_from_unknown(unknown_values: &UnknownValues) -> Option { 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 { is.read_sfixed32() } fn get_from_unknown(unknown_values: &UnknownValues) -> Option { 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 { is.read_sfixed64() } fn get_from_unknown(unknown_values: &UnknownValues) -> Option { 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 { is.read_bool() } fn get_from_unknown(unknown: &UnknownValues) -> Option { 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 { is.read_string() } fn get_from_unknown(unknown_values: &UnknownValues) -> Option { // 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; fn wire_type() -> WireType { WireType::WireTypeLengthDelimited } fn read(is: &mut CodedInputStream) -> ProtobufResult> { is.read_bytes() } fn get_from_unknown(unknown_values: &UnknownValues) -> Option> { unknown_values.length_delimited.iter().cloned().rev().next() } fn compute_size(value: &Vec) -> u32 { value.len() as u32 } fn write_with_cached_size( field_number: u32, value: &Vec, 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 { is.read_carllerche_bytes() } fn get_from_unknown(unknown_values: &UnknownValues) -> Option { 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 { is.read_carllerche_chars() } fn get_from_unknown(unknown_values: &UnknownValues) -> Option { 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 ProtobufType for ProtobufTypeEnum { type Value = E; fn wire_type() -> WireType { WireType::WireTypeVarint } fn read(is: &mut CodedInputStream) -> ProtobufResult { is.read_enum() } fn get_from_unknown(unknown_values: &UnknownValues) -> Option { // 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 ProtobufType for ProtobufTypeMessage { type Value = M; fn wire_type() -> WireType { WireType::WireTypeLengthDelimited } fn read(is: &mut CodedInputStream) -> ProtobufResult { is.read_message() } fn get_from_unknown(unknown_values: &UnknownValues) -> Option { // TODO: do not panic unknown_values .length_delimited .iter() .rev() .next() .map(|bytes| M::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(()) } } protobuf-2.25.2/src/unknown.rs000064400000000000000000000262170072674642500144500ustar 00000000000000use crate::clear::Clear; use crate::wire_format; use crate::zigzag::encode_zig_zag_32; use crate::zigzag::encode_zig_zag_64; use std::collections::hash_map; use std::collections::hash_map::DefaultHasher; use std::collections::HashMap; use std::default::Default; use std::hash::BuildHasherDefault; use std::hash::Hash; use std::hash::Hasher; use std::slice; /// 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), } 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, /// 64-bit unknowns pub fixed64: Vec, /// Varint unknowns pub varint: Vec, /// Length-delimited unknowns pub length_delimited: Vec>, } 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>, } impl<'o> Iterator for UnknownValuesIter<'o> { type Item = UnknownValueRef<'o>; fn next(&mut self) -> Option> { 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. // // We use "default hasher" to make iteration order deterministic. // Which is used to make codegen output deterministic in presence of unknown fields // (e. g. file options are represented as unknown fields). // Using default hasher is suboptimal, because it makes unknown fields less safe. // Note, Google Protobuf C++ simply uses linear map (which can exploitable the same way), // and Google Protobuf Java uses tree map to store unknown fields // (which is more expensive than hashmap). // TODO: hide pub fields: Option>>>, } /// 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(&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) { 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); } /// Remove unknown field by number pub fn remove(&mut self, field_number: u32) { if let Some(fields) = &mut self.fields { fields.remove(&field_number); } } /// 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>, } 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)); } #[test] fn unknown_fields_iteration_order_deterministic() { let mut u_1 = UnknownFields::new(); let mut u_2 = UnknownFields::new(); for u in &mut [&mut u_1, &mut u_2] { u.add_fixed32(10, 20); u.add_varint(30, 40); u.add_fixed64(50, 60); u.add_length_delimited(70, Vec::new()); u.add_varint(80, 90); u.add_fixed32(11, 22); u.add_fixed64(33, 44); } let items_1: Vec<_> = u_1.iter().collect(); let items_2: Vec<_> = u_2.iter().collect(); assert_eq!(items_1, items_2); } } protobuf-2.25.2/src/varint.rs000064400000000000000000000016030072674642500142440ustar 00000000000000/// 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 } } protobuf-2.25.2/src/well_known_types/any.rs000064400000000000000000000422070072674642500171400ustar 00000000000000// This file is generated by rust-protobuf 2.22.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![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(unused_imports)] #![allow(unused_results)] //! Generated file from `google/protobuf/any.proto` #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct Any { // message fields pub type_url: ::std::string::String, pub value: ::std::vec::Vec, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a Any { fn default() -> &'a Any { ::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) { 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 { &mut self.value } // Take field pub fn take_value(&mut self) -> ::std::vec::Vec { ::std::mem::replace(&mut self.value, ::std::vec::Vec::new()) } } impl crate::Message for Any { fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_singular_proto3_string_into(wire_type, is, &mut self.type_url)?; }, 2 => { crate::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?; }, _ => { crate::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 += crate::rt::string_size(1, &self.type_url); } if !self.value.is_empty() { my_size += crate::rt::bytes_size(2, &self.value); } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> Any { Any::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_simple_field_accessor::<_, crate::types::ProtobufTypeString>( "type_url", |m: &Any| { &m.type_url }, |m: &mut Any| { &mut m.type_url }, )); fields.push(crate::reflect::accessor::make_simple_field_accessor::<_, crate::types::ProtobufTypeBytes>( "value", |m: &Any| { &m.value }, |m: &mut Any| { &mut m.value }, )); crate::reflect::MessageDescriptor::new_pb_name::( "Any", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static Any { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(Any::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for Any { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::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\x05valueBv\n\x13com.google.protobufB\x08AnyProtoP\x01\ Z,google.golang.org/protobuf/types/known/anypb\xa2\x02\x03GPB\xaa\x02\ \x1eGoogle.Protobuf.WellKnownTypesJ\xf9*\n\x07\x12\x05\x1e\0\x9d\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\x20200\ 8\x20Google\x20Inc.\x20\x20All\x20rights\x20reserved.\n\x20https://devel\ opers.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#\0C\n\t\n\x02\x08\x0b\x12\x03#\0C\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\xfd\x10\n\x02\x04\0\x12\x05|\0\x9d\x01\x01\x1a\xef\x10\ \x20`Any`\x20contains\x20an\x20arbitrary\x20serialized\x20protocol\x20bu\ ffer\x20message\x20along\x20with\x20a\n\x20URL\x20that\x20describes\x20t\ he\x20type\x20of\x20the\x20serialized\x20message.\n\n\x20Protobuf\x20lib\ rary\x20provides\x20support\x20to\x20pack/unpack\x20Any\x20values\x20in\ \x20the\x20form\n\x20of\x20utility\x20functions\x20or\x20additional\x20g\ enerated\x20methods\x20of\x20the\x20Any\x20type.\n\n\x20Example\x201:\ \x20Pack\x20and\x20unpack\x20a\x20message\x20in\x20C++.\n\n\x20\x20\x20\ \x20\x20Foo\x20foo\x20=\x20...;\n\x20\x20\x20\x20\x20Any\x20any;\n\x20\ \x20\x20\x20\x20any.PackFrom(foo);\n\x20\x20\x20\x20\x20...\n\x20\x20\ \x20\x20\x20if\x20(any.UnpackTo(&foo))\x20{\n\x20\x20\x20\x20\x20\x20\ \x20...\n\x20\x20\x20\x20\x20}\n\n\x20Example\x202:\x20Pack\x20and\x20un\ pack\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\x20Python.\n\n\x20\x20\x20\x20\x20foo\x20=\x20Foo\ (...)\n\x20\x20\x20\x20\x20any\x20=\x20Any()\n\x20\x20\x20\x20\x20any.Pa\ ck(foo)\n\x20\x20\x20\x20\x20...\n\x20\x20\x20\x20\x20if\x20any.Is(Foo.D\ ESCRIPTOR):\n\x20\x20\x20\x20\x20\x20\x20any.Unpack(foo)\n\x20\x20\x20\ \x20\x20\x20\x20...\n\n\x20\x20Example\x204:\x20Pack\x20and\x20unpack\ \x20a\x20message\x20in\x20Go\n\n\x20\x20\x20\x20\x20\x20foo\x20:=\x20&pb\ .Foo{...}\n\x20\x20\x20\x20\x20\x20any,\x20err\x20:=\x20anypb.New(foo)\n\ \x20\x20\x20\x20\x20\x20if\x20err\x20!=\x20nil\x20{\n\x20\x20\x20\x20\ \x20\x20\x20\x20...\n\x20\x20\x20\x20\x20\x20}\n\x20\x20\x20\x20\x20\x20\ ...\n\x20\x20\x20\x20\x20\x20foo\x20:=\x20&pb.Foo{}\n\x20\x20\x20\x20\ \x20\x20if\x20err\x20:=\x20any.UnmarshalTo(foo);\x20err\x20!=\x20nil\x20\ {\n\x20\x20\x20\x20\x20\x20\x20\x20...\n\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,\n\x20\x20\x20\ \x20\x20\x20\x20\"lastName\":\x20\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\x03|\x08\x0b\n\xd7\n\n\x04\x04\0\x02\0\x12\x04\x99\ \x01\x02\x16\x1a\xc8\n\x20A\x20URL/resource\x20name\x20that\x20uniquely\ \x20identifies\x20the\x20type\x20of\x20the\x20serialized\n\x20protocol\ \x20buffer\x20message.\x20This\x20string\x20must\x20contain\x20at\x20lea\ st\n\x20one\x20\"/\"\x20character.\x20The\x20last\x20segment\x20of\x20th\ e\x20URL's\x20path\x20must\x20represent\n\x20the\x20fully\x20qualified\ \x20name\x20of\x20the\x20type\x20(as\x20in\n\x20`path/google.protobuf.Du\ ration`).\x20The\x20name\x20should\x20be\x20in\x20a\x20canonical\x20form\ \n\x20(e.g.,\x20leading\x20\".\"\x20is\x20not\x20accepted).\n\n\x20In\ \x20practice,\x20teams\x20usually\x20precompile\x20into\x20the\x20binary\ \x20all\x20types\x20that\x20they\n\x20expect\x20it\x20to\x20use\x20in\ \x20the\x20context\x20of\x20Any.\x20However,\x20for\x20URLs\x20which\x20\ use\x20the\n\x20scheme\x20`http`,\x20`https`,\x20or\x20no\x20scheme,\x20\ one\x20can\x20optionally\x20set\x20up\x20a\x20type\n\x20server\x20that\ \x20maps\x20type\x20URLs\x20to\x20message\x20definitions\x20as\x20follow\ s:\n\n\x20*\x20If\x20no\x20scheme\x20is\x20provided,\x20`https`\x20is\ \x20assumed.\n\x20*\x20An\x20HTTP\x20GET\x20on\x20the\x20URL\x20must\x20\ yield\x20a\x20[google.protobuf.Type][]\n\x20\x20\x20value\x20in\x20binar\ y\x20format,\x20or\x20produce\x20an\x20error.\n\x20*\x20Applications\x20\ are\x20allowed\x20to\x20cache\x20lookup\x20results\x20based\x20on\x20the\ \n\x20\x20\x20URL,\x20or\x20have\x20them\x20precompiled\x20into\x20a\x20\ binary\x20to\x20avoid\x20any\n\x20\x20\x20lookup.\x20Therefore,\x20binar\ y\x20compatibility\x20needs\x20to\x20be\x20preserved\n\x20\x20\x20on\x20\ changes\x20to\x20types.\x20(Use\x20versioned\x20type\x20names\x20to\x20m\ anage\n\x20\x20\x20breaking\x20changes.)\n\n\x20Note:\x20this\x20functio\ nality\x20is\x20not\x20currently\x20available\x20in\x20the\x20official\n\ \x20protobuf\x20release,\x20and\x20it\x20is\x20not\x20used\x20for\x20typ\ e\x20URLs\x20beginning\x20with\n\x20type.googleapis.com.\n\n\x20Schemes\ \x20other\x20than\x20`http`,\x20`https`\x20(or\x20the\x20empty\x20scheme\ )\x20might\x20be\n\x20used\x20with\x20implementation\x20specific\x20sema\ ntics.\n\n\n\r\n\x05\x04\0\x02\0\x05\x12\x04\x99\x01\x02\x08\n\r\n\x05\ \x04\0\x02\0\x01\x12\x04\x99\x01\t\x11\n\r\n\x05\x04\0\x02\0\x03\x12\x04\ \x99\x01\x14\x15\nW\n\x04\x04\0\x02\x01\x12\x04\x9c\x01\x02\x12\x1aI\x20\ Must\x20be\x20a\x20valid\x20serialized\x20protocol\x20buffer\x20of\x20th\ e\x20above\x20specified\x20type.\n\n\r\n\x05\x04\0\x02\x01\x05\x12\x04\ \x9c\x01\x02\x07\n\r\n\x05\x04\0\x02\x01\x01\x12\x04\x9c\x01\x08\r\n\r\n\ \x05\x04\0\x02\x01\x03\x12\x04\x9c\x01\x10\x11b\x06proto3\ "; static file_descriptor_proto_lazy: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; fn parse_descriptor_proto() -> crate::descriptor::FileDescriptorProto { crate::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() } pub fn file_descriptor_proto() -> &'static crate::descriptor::FileDescriptorProto { file_descriptor_proto_lazy.get(|| { parse_descriptor_proto() }) } protobuf-2.25.2/src/well_known_types/api.rs000064400000000000000000001457530072674642500171340ustar 00000000000000// This file is generated by rust-protobuf 2.22.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![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(unused_imports)] #![allow(unused_results)] //! Generated file from `google/protobuf/api.proto` #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct Api { // message fields pub name: ::std::string::String, pub methods: crate::RepeatedField, pub options: crate::RepeatedField, pub version: ::std::string::String, pub source_context: crate::SingularPtrField, pub mixins: crate::RepeatedField, pub syntax: crate::well_known_types::Syntax, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a Api { fn default() -> &'a Api { ::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: crate::RepeatedField) { self.methods = v; } // Mutable pointer to the field. pub fn mut_methods(&mut self) -> &mut crate::RepeatedField { &mut self.methods } // Take field pub fn take_methods(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.methods, crate::RepeatedField::new()) } // repeated .google.protobuf.Option options = 3; pub fn get_options(&self) -> &[crate::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: crate::RepeatedField) { self.options = v; } // Mutable pointer to the field. pub fn mut_options(&mut self) -> &mut crate::RepeatedField { &mut self.options } // Take field pub fn take_options(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.options, crate::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) -> &crate::well_known_types::SourceContext { self.source_context.as_ref().unwrap_or_else(|| ::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: crate::well_known_types::SourceContext) { self.source_context = crate::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 crate::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) -> crate::well_known_types::SourceContext { self.source_context.take().unwrap_or_else(|| crate::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: crate::RepeatedField) { self.mixins = v; } // Mutable pointer to the field. pub fn mut_mixins(&mut self) -> &mut crate::RepeatedField { &mut self.mixins } // Take field pub fn take_mixins(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.mixins, crate::RepeatedField::new()) } // .google.protobuf.Syntax syntax = 7; pub fn get_syntax(&self) -> crate::well_known_types::Syntax { self.syntax } pub fn clear_syntax(&mut self) { self.syntax = crate::well_known_types::Syntax::SYNTAX_PROTO2; } // Param is passed by value, moved pub fn set_syntax(&mut self, v: crate::well_known_types::Syntax) { self.syntax = v; } } impl crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; }, 2 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.methods)?; }, 3 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.options)?; }, 4 => { crate::rt::read_singular_proto3_string_into(wire_type, is, &mut self.version)?; }, 5 => { crate::rt::read_singular_message_into(wire_type, is, &mut self.source_context)?; }, 6 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.mixins)?; }, 7 => { crate::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.syntax, 7, &mut self.unknown_fields)? }, _ => { crate::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 += crate::rt::string_size(1, &self.name); } for value in &self.methods { let len = value.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }; for value in &self.options { let len = value.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }; if !self.version.is_empty() { my_size += crate::rt::string_size(4, &self.version); } if let Some(ref v) = self.source_context.as_ref() { let len = v.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; } for value in &self.mixins { let len = value.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }; if self.syntax != crate::well_known_types::Syntax::SYNTAX_PROTO2 { my_size += crate::rt::enum_size(7, self.syntax); } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { if !self.name.is_empty() { os.write_string(1, &self.name)?; } for v in &self.methods { os.write_tag(2, crate::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, crate::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, crate::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, crate::wire_format::WireTypeLengthDelimited)?; os.write_raw_varint32(v.get_cached_size())?; v.write_to_with_cached_sizes(os)?; }; if self.syntax != crate::well_known_types::Syntax::SYNTAX_PROTO2 { os.write_enum(7, crate::ProtobufEnum::value(&self.syntax))?; } 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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> Api { Api::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_simple_field_accessor::<_, crate::types::ProtobufTypeString>( "name", |m: &Api| { &m.name }, |m: &mut Api| { &mut m.name }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "methods", |m: &Api| { &m.methods }, |m: &mut Api| { &mut m.methods }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "options", |m: &Api| { &m.options }, |m: &mut Api| { &mut m.options }, )); fields.push(crate::reflect::accessor::make_simple_field_accessor::<_, crate::types::ProtobufTypeString>( "version", |m: &Api| { &m.version }, |m: &mut Api| { &mut m.version }, )); fields.push(crate::reflect::accessor::make_singular_ptr_field_accessor::<_, crate::types::ProtobufTypeMessage>( "source_context", |m: &Api| { &m.source_context }, |m: &mut Api| { &mut m.source_context }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "mixins", |m: &Api| { &m.mixins }, |m: &mut Api| { &mut m.mixins }, )); fields.push(crate::reflect::accessor::make_simple_field_accessor::<_, crate::types::ProtobufTypeEnum>( "syntax", |m: &Api| { &m.syntax }, |m: &mut Api| { &mut m.syntax }, )); crate::reflect::MessageDescriptor::new_pb_name::( "Api", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static Api { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(Api::new) } } impl crate::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 = crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for Api { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::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: crate::RepeatedField, pub syntax: crate::well_known_types::Syntax, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a Method { fn default() -> &'a Method { ::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) -> &[crate::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: crate::RepeatedField) { self.options = v; } // Mutable pointer to the field. pub fn mut_options(&mut self) -> &mut crate::RepeatedField { &mut self.options } // Take field pub fn take_options(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.options, crate::RepeatedField::new()) } // .google.protobuf.Syntax syntax = 7; pub fn get_syntax(&self) -> crate::well_known_types::Syntax { self.syntax } pub fn clear_syntax(&mut self) { self.syntax = crate::well_known_types::Syntax::SYNTAX_PROTO2; } // Param is passed by value, moved pub fn set_syntax(&mut self, v: crate::well_known_types::Syntax) { self.syntax = v; } } impl crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; }, 2 => { crate::rt::read_singular_proto3_string_into(wire_type, is, &mut self.request_type_url)?; }, 3 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.request_streaming = tmp; }, 4 => { crate::rt::read_singular_proto3_string_into(wire_type, is, &mut self.response_type_url)?; }, 5 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_bool()?; self.response_streaming = tmp; }, 6 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.options)?; }, 7 => { crate::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.syntax, 7, &mut self.unknown_fields)? }, _ => { crate::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 += crate::rt::string_size(1, &self.name); } if !self.request_type_url.is_empty() { my_size += crate::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 += crate::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 + crate::rt::compute_raw_varint32_size(len) + len; }; if self.syntax != crate::well_known_types::Syntax::SYNTAX_PROTO2 { my_size += crate::rt::enum_size(7, self.syntax); } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::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, crate::wire_format::WireTypeLengthDelimited)?; os.write_raw_varint32(v.get_cached_size())?; v.write_to_with_cached_sizes(os)?; }; if self.syntax != crate::well_known_types::Syntax::SYNTAX_PROTO2 { os.write_enum(7, crate::ProtobufEnum::value(&self.syntax))?; } 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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> Method { Method::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_simple_field_accessor::<_, crate::types::ProtobufTypeString>( "name", |m: &Method| { &m.name }, |m: &mut Method| { &mut m.name }, )); fields.push(crate::reflect::accessor::make_simple_field_accessor::<_, crate::types::ProtobufTypeString>( "request_type_url", |m: &Method| { &m.request_type_url }, |m: &mut Method| { &mut m.request_type_url }, )); fields.push(crate::reflect::accessor::make_simple_field_accessor::<_, crate::types::ProtobufTypeBool>( "request_streaming", |m: &Method| { &m.request_streaming }, |m: &mut Method| { &mut m.request_streaming }, )); fields.push(crate::reflect::accessor::make_simple_field_accessor::<_, crate::types::ProtobufTypeString>( "response_type_url", |m: &Method| { &m.response_type_url }, |m: &mut Method| { &mut m.response_type_url }, )); fields.push(crate::reflect::accessor::make_simple_field_accessor::<_, crate::types::ProtobufTypeBool>( "response_streaming", |m: &Method| { &m.response_streaming }, |m: &mut Method| { &mut m.response_streaming }, )); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "options", |m: &Method| { &m.options }, |m: &mut Method| { &mut m.options }, )); fields.push(crate::reflect::accessor::make_simple_field_accessor::<_, crate::types::ProtobufTypeEnum>( "syntax", |m: &Method| { &m.syntax }, |m: &mut Method| { &mut m.syntax }, )); crate::reflect::MessageDescriptor::new_pb_name::( "Method", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static Method { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(Method::new) } } impl crate::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 = crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for Method { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::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: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a Mixin { fn default() -> &'a Mixin { ::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 crate::Message for Mixin { fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; }, 2 => { crate::rt::read_singular_proto3_string_into(wire_type, is, &mut self.root)?; }, _ => { crate::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 += crate::rt::string_size(1, &self.name); } if !self.root.is_empty() { my_size += crate::rt::string_size(2, &self.root); } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> Mixin { Mixin::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_simple_field_accessor::<_, crate::types::ProtobufTypeString>( "name", |m: &Mixin| { &m.name }, |m: &mut Mixin| { &mut m.name }, )); fields.push(crate::reflect::accessor::make_simple_field_accessor::<_, crate::types::ProtobufTypeString>( "root", |m: &Mixin| { &m.root }, |m: &mut Mixin| { &mut m.root }, )); crate::reflect::MessageDescriptor::new_pb_name::( "Mixin", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static Mixin { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(Mixin::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for Mixin { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::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\x04rootBv\n\x13com.google.protobu\ fB\x08ApiProtoP\x01Z,google.golang.org/protobuf/types/known/apipb\xa2\ \x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesJ\x81<\n\x07\x12\ \x05\x1e\0\xcf\x01\x01\n\xcc\x0c\n\x01\x0c\x12\x03\x1e\0\x122\xc1\x0c\ \x20Protocol\x20Buffers\x20-\x20Google's\x20data\x20interchange\x20forma\ t\n\x20Copyright\x202008\x20Google\x20Inc.\x20\x20All\x20rights\x20reser\ ved.\n\x20https://developers.google.com/protocol-buffers/\n\n\x20Redistr\ ibution\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\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!\n\x08\n\x01\x08\x12\x03*\0C\n\t\n\x02\x08\ \x0b\x12\x03*\0C\n\xab\x04\n\x02\x04\0\x12\x045\0`\x01\x1a\x9e\x04\x20Ap\ i\x20is\x20a\x20light-weight\x20descriptor\x20for\x20an\x20API\x20Interf\ ace.\n\n\x20Interfaces\x20are\x20also\x20described\x20as\x20\"protocol\ \x20buffer\x20services\"\x20in\x20some\x20contexts,\n\x20such\x20as\x20b\ y\x20the\x20\"service\"\x20keyword\x20in\x20a\x20.proto\x20file,\x20but\ \x20they\x20are\x20different\n\x20from\x20API\x20Services,\x20which\x20r\ epresent\x20a\x20concrete\x20implementation\x20of\x20an\x20interface\n\ \x20as\x20opposed\x20to\x20simply\x20a\x20description\x20of\x20methods\ \x20and\x20bindings.\x20They\x20are\x20also\n\x20sometimes\x20simply\x20\ referred\x20to\x20as\x20\"APIs\"\x20in\x20other\x20contexts,\x20such\x20\ as\x20the\x20name\x20of\n\x20this\x20message\x20itself.\x20See\x20https:\ //cloud.google.com/apis/design/glossary\x20for\n\x20detailed\x20terminol\ ogy.\n\n\n\n\x03\x04\0\x01\x12\x035\x08\x0b\n{\n\x04\x04\0\x02\0\x12\x03\ 8\x02\x12\x1an\x20The\x20fully\x20qualified\x20name\x20of\x20this\x20int\ erface,\x20including\x20package\x20name\n\x20followed\x20by\x20the\x20in\ terface's\x20simple\x20name.\n\n\x0c\n\x05\x04\0\x02\0\x05\x12\x038\x02\ \x08\n\x0c\n\x05\x04\0\x02\0\x01\x12\x038\t\r\n\x0c\n\x05\x04\0\x02\0\ \x03\x12\x038\x10\x11\nC\n\x04\x04\0\x02\x01\x12\x03;\x02\x1e\x1a6\x20Th\ e\x20methods\x20of\x20this\x20interface,\x20in\x20unspecified\x20order.\ \n\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03;\x02\n\n\x0c\n\x05\x04\0\x02\ \x01\x06\x12\x03;\x0b\x11\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03;\x12\x19\ \n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03;\x1c\x1d\n6\n\x04\x04\0\x02\x02\ \x12\x03>\x02\x1e\x1a)\x20Any\x20metadata\x20attached\x20to\x20the\x20in\ terface.\n\n\x0c\n\x05\x04\0\x02\x02\x04\x12\x03>\x02\n\n\x0c\n\x05\x04\ \0\x02\x02\x06\x12\x03>\x0b\x11\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03>\ \x12\x19\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03>\x1c\x1d\n\x82\x08\n\x04\ \x04\0\x02\x03\x12\x03U\x02\x15\x1a\xf4\x07\x20A\x20version\x20string\ \x20for\x20this\x20interface.\x20If\x20specified,\x20must\x20have\x20the\ \x20form\n\x20`major-version.minor-version`,\x20as\x20in\x20`1.10`.\x20I\ f\x20the\x20minor\x20version\x20is\n\x20omitted,\x20it\x20defaults\x20to\ \x20zero.\x20If\x20the\x20entire\x20version\x20field\x20is\x20empty,\x20\ the\n\x20major\x20version\x20is\x20derived\x20from\x20the\x20package\x20\ name,\x20as\x20outlined\x20below.\x20If\x20the\n\x20field\x20is\x20not\ \x20empty,\x20the\x20version\x20in\x20the\x20package\x20name\x20will\x20\ be\x20verified\x20to\x20be\n\x20consistent\x20with\x20what\x20is\x20prov\ ided\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\x20mi\ nor\x20version\x20an\x20additive,\n\x20non-breaking\x20change.\x20Both\ \x20version\x20numbers\x20are\x20signals\x20to\x20users\n\x20what\x20to\ \x20expect\x20from\x20different\x20versions,\x20and\x20should\x20be\x20c\ arefully\n\x20chosen\x20based\x20on\x20the\x20product\x20plan.\n\n\x20Th\ e\x20major\x20version\x20is\x20also\x20reflected\x20in\x20the\x20package\ \x20name\x20of\x20the\n\x20interface,\x20which\x20must\x20end\x20in\x20`\ v`,\x20as\x20in\n\x20`google.feature.v1`.\x20For\x20major\ \x20versions\x200\x20and\x201,\x20the\x20suffix\x20can\n\x20be\x20omitte\ d.\x20Zero\x20major\x20versions\x20must\x20only\x20be\x20used\x20for\n\ \x20experimental,\x20non-GA\x20interfaces.\n\n\n\n\x0c\n\x05\x04\0\x02\ \x03\x05\x12\x03U\x02\x08\n\x0c\n\x05\x04\0\x02\x03\x01\x12\x03U\t\x10\n\ \x0c\n\x05\x04\0\x02\x03\x03\x12\x03U\x13\x14\n[\n\x04\x04\0\x02\x04\x12\ \x03Y\x02#\x1aN\x20Source\x20context\x20for\x20the\x20protocol\x20buffer\ \x20service\x20represented\x20by\x20this\n\x20message.\n\n\x0c\n\x05\x04\ \0\x02\x04\x06\x12\x03Y\x02\x0f\n\x0c\n\x05\x04\0\x02\x04\x01\x12\x03Y\ \x10\x1e\n\x0c\n\x05\x04\0\x02\x04\x03\x12\x03Y!\"\n2\n\x04\x04\0\x02\ \x05\x12\x03\\\x02\x1c\x1a%\x20Included\x20interfaces.\x20See\x20[Mixin]\ [].\n\n\x0c\n\x05\x04\0\x02\x05\x04\x12\x03\\\x02\n\n\x0c\n\x05\x04\0\ \x02\x05\x06\x12\x03\\\x0b\x10\n\x0c\n\x05\x04\0\x02\x05\x01\x12\x03\\\ \x11\x17\n\x0c\n\x05\x04\0\x02\x05\x03\x12\x03\\\x1a\x1b\n0\n\x04\x04\0\ \x02\x06\x12\x03_\x02\x14\x1a#\x20The\x20source\x20syntax\x20of\x20the\ \x20service.\n\n\x0c\n\x05\x04\0\x02\x06\x06\x12\x03_\x02\x08\n\x0c\n\ \x05\x04\0\x02\x06\x01\x12\x03_\t\x0f\n\x0c\n\x05\x04\0\x02\x06\x03\x12\ \x03_\x12\x13\n=\n\x02\x04\x01\x12\x04c\0x\x01\x1a1\x20Method\x20represe\ nts\x20a\x20method\x20of\x20an\x20API\x20interface.\n\n\n\n\x03\x04\x01\ \x01\x12\x03c\x08\x0e\n.\n\x04\x04\x01\x02\0\x12\x03e\x02\x12\x1a!\x20Th\ e\x20simple\x20name\x20of\x20this\x20method.\n\n\x0c\n\x05\x04\x01\x02\0\ \x05\x12\x03e\x02\x08\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03e\t\r\n\x0c\n\ \x05\x04\x01\x02\0\x03\x12\x03e\x10\x11\n/\n\x04\x04\x01\x02\x01\x12\x03\ h\x02\x1e\x1a\"\x20A\x20URL\x20of\x20the\x20input\x20message\x20type.\n\ \n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03h\x02\x08\n\x0c\n\x05\x04\x01\ \x02\x01\x01\x12\x03h\t\x19\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03h\x1c\ \x1d\n0\n\x04\x04\x01\x02\x02\x12\x03k\x02\x1d\x1a#\x20If\x20true,\x20th\ e\x20request\x20is\x20streamed.\n\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\ \x03k\x02\x06\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03k\x07\x18\n\x0c\n\ \x05\x04\x01\x02\x02\x03\x12\x03k\x1b\x1c\n2\n\x04\x04\x01\x02\x03\x12\ \x03n\x02\x1f\x1a%\x20The\x20URL\x20of\x20the\x20output\x20message\x20ty\ pe.\n\n\x0c\n\x05\x04\x01\x02\x03\x05\x12\x03n\x02\x08\n\x0c\n\x05\x04\ \x01\x02\x03\x01\x12\x03n\t\x1a\n\x0c\n\x05\x04\x01\x02\x03\x03\x12\x03n\ \x1d\x1e\n1\n\x04\x04\x01\x02\x04\x12\x03q\x02\x1e\x1a$\x20If\x20true,\ \x20the\x20response\x20is\x20streamed.\n\n\x0c\n\x05\x04\x01\x02\x04\x05\ \x12\x03q\x02\x06\n\x0c\n\x05\x04\x01\x02\x04\x01\x12\x03q\x07\x19\n\x0c\ \n\x05\x04\x01\x02\x04\x03\x12\x03q\x1c\x1d\n3\n\x04\x04\x01\x02\x05\x12\ \x03t\x02\x1e\x1a&\x20Any\x20metadata\x20attached\x20to\x20the\x20method\ .\n\n\x0c\n\x05\x04\x01\x02\x05\x04\x12\x03t\x02\n\n\x0c\n\x05\x04\x01\ \x02\x05\x06\x12\x03t\x0b\x11\n\x0c\n\x05\x04\x01\x02\x05\x01\x12\x03t\ \x12\x19\n\x0c\n\x05\x04\x01\x02\x05\x03\x12\x03t\x1c\x1d\n0\n\x04\x04\ \x01\x02\x06\x12\x03w\x02\x14\x1a#\x20The\x20source\x20syntax\x20of\x20t\ his\x20method.\n\n\x0c\n\x05\x04\x01\x02\x06\x06\x12\x03w\x02\x08\n\x0c\ \n\x05\x04\x01\x02\x06\x01\x12\x03w\t\x0f\n\x0c\n\x05\x04\x01\x02\x06\ \x03\x12\x03w\x12\x13\n\xca\x13\n\x02\x04\x02\x12\x06\xc8\x01\0\xcf\x01\ \x01\x1a\xbb\x13\x20Declares\x20an\x20API\x20Interface\x20to\x20be\x20in\ cluded\x20in\x20this\x20interface.\x20The\x20including\n\x20interface\ \x20must\x20redeclare\x20all\x20the\x20methods\x20from\x20the\x20include\ d\x20interface,\x20but\n\x20documentation\x20and\x20options\x20are\x20in\ herited\x20as\x20follows:\n\n\x20-\x20If\x20after\x20comment\x20and\x20w\ hitespace\x20stripping,\x20the\x20documentation\n\x20\x20\x20string\x20o\ f\x20the\x20redeclared\x20method\x20is\x20empty,\x20it\x20will\x20be\x20\ inherited\n\x20\x20\x20from\x20the\x20original\x20method.\n\n\x20-\x20Ea\ ch\x20annotation\x20belonging\x20to\x20the\x20service\x20config\x20(http\ ,\n\x20\x20\x20visibility)\x20which\x20is\x20not\x20set\x20in\x20the\x20\ redeclared\x20method\x20will\x20be\n\x20\x20\x20inherited.\n\n\x20-\x20I\ f\x20an\x20http\x20annotation\x20is\x20inherited,\x20the\x20path\x20patt\ ern\x20will\x20be\n\x20\x20\x20modified\x20as\x20follows.\x20Any\x20vers\ ion\x20prefix\x20will\x20be\x20replaced\x20by\x20the\n\x20\x20\x20versio\ n\x20of\x20the\x20including\x20interface\x20plus\x20the\x20[root][]\x20p\ ath\x20if\n\x20\x20\x20specified.\n\n\x20Example\x20of\x20a\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\"/v\ 1/{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\x20\ GetAcl(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/{resou\ rce=**}\";\n\x20\x20\x20\x20\x20\x20\x20}\n\x20\x20\x20\x20\x20}\n\n\x20\ Example\x20of\x20a\x20mixin\x20configuration:\n\n\x20\x20\x20\x20\x20api\ s:\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\n\x20The\x20mixin\x20construct\x20impl\ ies\x20that\x20all\x20methods\x20in\x20`AccessControl`\x20are\n\x20also\ \x20declared\x20with\x20same\x20name\x20and\x20request/response\x20types\ \x20in\n\x20`Storage`.\x20A\x20documentation\x20generator\x20or\x20annot\ ation\x20processor\x20will\n\x20see\x20the\x20effective\x20`Storage.GetA\ cl`\x20method\x20after\x20inheriting\n\x20documentation\x20and\x20annota\ tions\x20as\x20follows:\n\n\x20\x20\x20\x20\x20service\x20Storage\x20{\n\ \x20\x20\x20\x20\x20\x20\x20//\x20Get\x20the\x20underlying\x20ACL\x20obj\ ect.\n\x20\x20\x20\x20\x20\x20\x20rpc\x20GetAcl(GetAclRequest)\x20return\ s\x20(Acl)\x20{\n\x20\x20\x20\x20\x20\x20\x20\x20\x20option\x20(google.a\ pi.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\x20cha\ nged\x20from\x20`v1`\x20to\x20`v2`.\n\n\x20If\x20the\x20`root`\x20field\ \x20in\x20the\x20mixin\x20is\x20specified,\x20it\x20should\x20be\x20a\n\ \x20relative\x20path\x20under\x20which\x20inherited\x20HTTP\x20paths\x20\ are\x20placed.\x20Example:\n\n\x20\x20\x20\x20\x20apis:\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\x20root:\x20acls\n\n\ \x20This\x20implies\x20the\x20following\x20inherited\x20HTTP\x20annotati\ on:\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.api.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\xc8\x01\x08\r\nL\n\x04\x04\x02\x02\0\x12\x04\xca\x01\ \x02\x12\x1a>\x20The\x20fully\x20qualified\x20name\x20of\x20the\x20inter\ face\x20which\x20is\x20included.\n\n\r\n\x05\x04\x02\x02\0\x05\x12\x04\ \xca\x01\x02\x08\n\r\n\x05\x04\x02\x02\0\x01\x12\x04\xca\x01\t\r\n\r\n\ \x05\x04\x02\x02\0\x03\x12\x04\xca\x01\x10\x11\n[\n\x04\x04\x02\x02\x01\ \x12\x04\xce\x01\x02\x12\x1aM\x20If\x20non-empty\x20specifies\x20a\x20pa\ th\x20under\x20which\x20inherited\x20HTTP\x20paths\n\x20are\x20rooted.\n\ \n\r\n\x05\x04\x02\x02\x01\x05\x12\x04\xce\x01\x02\x08\n\r\n\x05\x04\x02\ \x02\x01\x01\x12\x04\xce\x01\t\r\n\r\n\x05\x04\x02\x02\x01\x03\x12\x04\ \xce\x01\x10\x11b\x06proto3\ "; static file_descriptor_proto_lazy: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; fn parse_descriptor_proto() -> crate::descriptor::FileDescriptorProto { crate::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() } pub fn file_descriptor_proto() -> &'static crate::descriptor::FileDescriptorProto { file_descriptor_proto_lazy.get(|| { parse_descriptor_proto() }) } protobuf-2.25.2/src/well_known_types/duration.rs000064400000000000000000000361660072674642500202050ustar 00000000000000// This file is generated by rust-protobuf 2.22.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![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(unused_imports)] #![allow(unused_results)] //! Generated file from `google/protobuf/duration.proto` #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct Duration { // message fields pub seconds: i64, pub nanos: i32, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a Duration { fn default() -> &'a Duration { ::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 crate::Message for Duration { fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int64()?; self.seconds = tmp; }, 2 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int32()?; self.nanos = tmp; }, _ => { crate::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 += crate::rt::value_size(1, self.seconds, crate::wire_format::WireTypeVarint); } if self.nanos != 0 { my_size += crate::rt::value_size(2, self.nanos, crate::wire_format::WireTypeVarint); } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> Duration { Duration::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_simple_field_accessor::<_, crate::types::ProtobufTypeInt64>( "seconds", |m: &Duration| { &m.seconds }, |m: &mut Duration| { &mut m.seconds }, )); fields.push(crate::reflect::accessor::make_simple_field_accessor::<_, crate::types::ProtobufTypeInt32>( "nanos", |m: &Duration| { &m.nanos }, |m: &mut Duration| { &mut m.nanos }, )); crate::reflect::MessageDescriptor::new_pb_name::( "Duration", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static Duration { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(Duration::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for Duration { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::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\x83\x01\n\x13com.google.protobufB\ \rDurationProtoP\x01Z1google.golang.org/protobuf/types/known/durationpb\ \xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesJ\ \xda#\n\x06\x12\x04\x1e\0s\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://developers.google.com/protocol-buffers/\n\n\ \x20Redistribution\x20and\x20use\x20in\x20source\x20and\x20binary\x20for\ ms,\x20with\x20or\x20without\n\x20modification,\x20are\x20permitted\x20p\ rovided\x20that\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\x20\ of\x20conditions\x20and\x20the\x20following\x20disclaimer.\n\x20\x20\x20\ \x20\x20*\x20Redistributions\x20in\x20binary\x20form\x20must\x20reproduc\ e\x20the\x20above\n\x20copyright\x20notice,\x20this\x20list\x20of\x20con\ ditions\x20and\x20the\x20following\x20disclaimer\n\x20in\x20the\x20docum\ entation\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\x20to\x20endorse\x20or\x20promote\x20products\x20d\ erived\x20from\n\x20this\x20software\x20without\x20specific\x20prior\x20\ written\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\ \x20MERCHANTABILITY\x20AND\x20FITNESS\x20FOR\n\x20A\x20PARTICULAR\x20PUR\ POSE\x20ARE\x20DISCLAIMED.\x20IN\x20NO\x20EVENT\x20SHALL\x20THE\x20COPYR\ IGHT\n\x20OWNER\x20OR\x20CONTRIBUTORS\x20BE\x20LIABLE\x20FOR\x20ANY\x20D\ IRECT,\x20INDIRECT,\x20INCIDENTAL,\n\x20SPECIAL,\x20EXEMPLARY,\x20OR\x20\ CONSEQUENTIAL\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$\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\x9e\x10\n\x02\x04\0\x12\x04f\0s\x01\x1a\x91\ \x10\x20A\x20Duration\x20represents\x20a\x20signed,\x20fixed-length\x20s\ pan\x20of\x20time\x20represented\n\x20as\x20a\x20count\x20of\x20seconds\ \x20and\x20fractions\x20of\x20seconds\x20at\x20nanosecond\n\x20resolutio\ n.\x20It\x20is\x20independent\x20of\x20any\x20calendar\x20and\x20concept\ s\x20like\x20\"day\"\n\x20or\x20\"month\".\x20It\x20is\x20related\x20to\ \x20Timestamp\x20in\x20that\x20the\x20difference\x20between\n\x20two\x20\ Timestamp\x20values\x20is\x20a\x20Duration\x20and\x20it\x20can\x20be\x20\ added\x20or\x20subtracted\n\x20from\x20a\x20Timestamp.\x20Range\x20is\ \x20approximately\x20+-10,000\x20years.\n\n\x20#\x20Examples\n\n\x20Exam\ ple\x201:\x20Compute\x20Duration\x20from\x20two\x20Timestamps\x20in\x20p\ seudo\x20code.\n\n\x20\x20\x20\x20\x20Timestamp\x20start\x20=\x20...;\n\ \x20\x20\x20\x20\x20Timestamp\x20end\x20=\x20...;\n\x20\x20\x20\x20\x20D\ uration\x20duration\x20=\x20...;\n\n\x20\x20\x20\x20\x20duration.seconds\ \x20=\x20end.seconds\x20-\x20start.seconds;\n\x20\x20\x20\x20\x20duratio\ n.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(duration.seconds\x20>\x200\x20&&\x20duration.nan\ os\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}\n\n\x20Example\x202:\x20Compute\x20Timestamp\x20\ from\x20Timestamp\x20+\x20Duration\x20in\x20pseudo\x20code.\n\n\x20\x20\ \x20\x20\x20Timestamp\x20start\x20=\x20...;\n\x20\x20\x20\x20\x20Duratio\ n\x20duration\x20=\x20...;\n\x20\x20\x20\x20\x20Timestamp\x20end\x20=\ \x20...;\n\n\x20\x20\x20\x20\x20end.seconds\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\x20datetime.timedelta\x20in\x20Pyt\ hon.\n\n\x20\x20\x20\x20\x20td\x20=\x20datetime.timedelta(days=3,\x20min\ utes=10)\n\x20\x20\x20\x20\x20duration\x20=\x20Duration()\n\x20\x20\x20\ \x20\x20duration.FromTimedelta(td)\n\n\x20#\x20JSON\x20Mapping\n\n\x20In\ \x20JSON\x20format,\x20the\x20Duration\x20type\x20is\x20encoded\x20as\ \x20a\x20string\x20rather\x20than\x20an\n\x20object,\x20where\x20the\x20\ string\x20ends\x20in\x20the\x20suffix\x20\"s\"\x20(indicating\x20seconds\ )\x20and\n\x20is\x20preceded\x20by\x20the\x20number\x20of\x20seconds,\ \x20with\x20nanoseconds\x20expressed\x20as\n\x20fractional\x20seconds.\ \x20For\x20example,\x203\x20seconds\x20with\x200\x20nanoseconds\x20shoul\ d\x20be\n\x20encoded\x20in\x20JSON\x20format\x20as\x20\"3s\",\x20while\ \x203\x20seconds\x20and\x201\x20nanosecond\x20should\n\x20be\x20expresse\ d\x20in\x20JSON\x20format\x20as\x20\"3.000000001s\",\x20and\x203\x20seco\ nds\x20and\x201\n\x20microsecond\x20should\x20be\x20expressed\x20in\x20J\ SON\x20format\x20as\x20\"3.000001s\".\n\n\n\n\n\n\x03\x04\0\x01\x12\x03f\ \x08\x10\n\xdc\x01\n\x04\x04\0\x02\0\x12\x03j\x02\x14\x1a\xce\x01\x20Sig\ ned\x20seconds\x20of\x20the\x20span\x20of\x20time.\x20Must\x20be\x20from\ \x20-315,576,000,000\n\x20to\x20+315,576,000,000\x20inclusive.\x20Note:\ \x20these\x20bounds\x20are\x20computed\x20from:\n\x2060\x20sec/min\x20*\ \x2060\x20min/hr\x20*\x2024\x20hr/day\x20*\x20365.25\x20days/year\x20*\ \x2010000\x20years\n\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03j\x02\x07\n\x0c\ \n\x05\x04\0\x02\0\x01\x12\x03j\x08\x0f\n\x0c\n\x05\x04\0\x02\0\x03\x12\ \x03j\x12\x13\n\x83\x03\n\x04\x04\0\x02\x01\x12\x03r\x02\x12\x1a\xf5\x02\ \x20Signed\x20fractions\x20of\x20a\x20second\x20at\x20nanosecond\x20reso\ lution\x20of\x20the\x20span\n\x20of\x20time.\x20Durations\x20less\x20tha\ n\x20one\x20second\x20are\x20represented\x20with\x20a\x200\n\x20`seconds\ `\x20field\x20and\x20a\x20positive\x20or\x20negative\x20`nanos`\x20field\ .\x20For\x20durations\n\x20of\x20one\x20second\x20or\x20more,\x20a\x20no\ n-zero\x20value\x20for\x20the\x20`nanos`\x20field\x20must\x20be\n\x20of\ \x20the\x20same\x20sign\x20as\x20the\x20`seconds`\x20field.\x20Must\x20b\ e\x20from\x20-999,999,999\n\x20to\x20+999,999,999\x20inclusive.\n\n\x0c\ \n\x05\x04\0\x02\x01\x05\x12\x03r\x02\x07\n\x0c\n\x05\x04\0\x02\x01\x01\ \x12\x03r\x08\r\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03r\x10\x11b\x06proto\ 3\ "; static file_descriptor_proto_lazy: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; fn parse_descriptor_proto() -> crate::descriptor::FileDescriptorProto { crate::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() } pub fn file_descriptor_proto() -> &'static crate::descriptor::FileDescriptorProto { file_descriptor_proto_lazy.get(|| { parse_descriptor_proto() }) } protobuf-2.25.2/src/well_known_types/empty.rs000064400000000000000000000206300072674642500175030ustar 00000000000000// This file is generated by rust-protobuf 2.22.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![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(unused_imports)] #![allow(unused_results)] //! Generated file from `google/protobuf/empty.proto` #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct Empty { // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a Empty { fn default() -> &'a Empty { ::default_instance() } } impl Empty { pub fn new() -> Empty { ::std::default::Default::default() } } impl crate::Message for Empty { fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { _ => { crate::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 += crate::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 crate::CodedOutputStream<'_>) -> crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> Empty { Empty::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let fields = ::std::vec::Vec::new(); crate::reflect::MessageDescriptor::new_pb_name::( "Empty", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static Empty { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(Empty::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for Empty { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } static file_descriptor_proto_data: &'static [u8] = b"\ \n\x1bgoogle/protobuf/empty.proto\x12\x0fgoogle.protobuf\"\x07\n\x05Empt\ yB}\n\x13com.google.protobufB\nEmptyProtoP\x01Z.google.golang.org/protob\ uf/types/known/emptypb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Prot\ obuf.WellKnownTypesJ\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\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#\0E\n\t\n\x02\x08\x0b\x12\x03#\0E\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 file_descriptor_proto_lazy: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; fn parse_descriptor_proto() -> crate::descriptor::FileDescriptorProto { crate::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() } pub fn file_descriptor_proto() -> &'static crate::descriptor::FileDescriptorProto { file_descriptor_proto_lazy.get(|| { parse_descriptor_proto() }) } protobuf-2.25.2/src/well_known_types/field_mask.rs000064400000000000000000000477530072674642500204620ustar 00000000000000// This file is generated by rust-protobuf 2.22.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![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(unused_imports)] #![allow(unused_results)] //! Generated file from `google/protobuf/field_mask.proto` #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct FieldMask { // message fields pub paths: crate::RepeatedField<::std::string::String>, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a FieldMask { fn default() -> &'a FieldMask { ::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: crate::RepeatedField<::std::string::String>) { self.paths = v; } // Mutable pointer to the field. pub fn mut_paths(&mut self) -> &mut crate::RepeatedField<::std::string::String> { &mut self.paths } // Take field pub fn take_paths(&mut self) -> crate::RepeatedField<::std::string::String> { ::std::mem::replace(&mut self.paths, crate::RepeatedField::new()) } } impl crate::Message for FieldMask { fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_repeated_string_into(wire_type, is, &mut self.paths)?; }, _ => { crate::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 += crate::rt::string_size(1, &value); }; my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> FieldMask { FieldMask::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeString>( "paths", |m: &FieldMask| { &m.paths }, |m: &mut FieldMask| { &mut m.paths }, )); crate::reflect::MessageDescriptor::new_pb_name::( "FieldMask", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static FieldMask { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(FieldMask::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for FieldMask { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::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\x05pathsB\x85\x01\n\x13com.\ google.protobufB\x0eFieldMaskProtoP\x01Z2google.golang.org/protobuf/type\ s/known/fieldmaskpb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobu\ f.WellKnownTypesJ\xa1;\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\x08\n\x01\x08\x12\x03'\0I\n\t\n\x02\x08\x0b\x12\x03'\0I\n\ \x08\n\x01\x08\x12\x03(\0\x1f\n\t\n\x02\x08\x1f\x12\x03(\0\x1f\n\xb2,\n\ \x02\x04\0\x12\x06\xf1\x01\0\xf4\x01\x01\x1a\xa3,\x20`FieldMask`\x20repr\ esents\x20a\x20set\x20of\x20symbolic\x20field\x20paths,\x20for\x20exampl\ e:\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\x20a\x20field\x20in\x20so\ me\x20root\x20message,\x20`a`\x20and\x20`b`\n\x20fields\x20in\x20the\x20\ message\x20found\x20in\x20`f`,\x20and\x20`d`\x20a\x20field\x20found\x20i\ n\x20the\n\x20message\x20in\x20`f.b`.\n\n\x20Field\x20masks\x20are\x20us\ ed\x20to\x20specify\x20a\x20subset\x20of\x20fields\x20that\x20should\x20\ be\n\x20returned\x20by\x20a\x20get\x20operation\x20or\x20modified\x20by\ \x20an\x20update\x20operation.\n\x20Field\x20masks\x20also\x20have\x20a\ \x20custom\x20JSON\x20encoding\x20(see\x20below).\n\n\x20#\x20Field\x20M\ asks\x20in\x20Projections\n\n\x20When\x20used\x20in\x20the\x20context\ \x20of\x20a\x20projection,\x20a\x20response\x20message\x20or\n\x20sub-me\ ssage\x20is\x20filtered\x20by\x20the\x20API\x20to\x20only\x20contain\x20\ those\x20fields\x20as\n\x20specified\x20in\x20the\x20mask.\x20For\x20exa\ mple,\x20if\x20the\x20mask\x20in\x20the\x20previous\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\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\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\x20w\ ill\x20not\x20contain\x20specific\x20values\x20for\x20fields\x20x,y\x20a\ nd\x20z\n\x20(their\x20value\x20will\x20be\x20set\x20to\x20the\x20defaul\ t,\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\x20\ repeated\x20field\x20is\x20not\x20allowed\x20except\x20at\x20the\x20last\ \x20position\x20of\x20a\n\x20paths\x20string.\n\n\x20If\x20a\x20FieldMas\ k\x20object\x20is\x20not\x20present\x20in\x20a\x20get\x20operation,\x20t\ he\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\x20\ apply\x20to\x20the\n\x20top-level\x20response\x20message.\x20In\x20case\ \x20of\x20a\x20REST\x20get\x20operation,\x20the\n\x20field\x20mask\x20ap\ plies\x20directly\x20to\x20the\x20response,\x20but\x20in\x20case\x20of\ \x20a\x20REST\n\x20list\x20operation,\x20the\x20mask\x20instead\x20appli\ es\x20to\x20each\x20individual\x20message\n\x20in\x20the\x20returned\x20\ resource\x20list.\x20In\x20case\x20of\x20a\x20REST\x20custom\x20method,\ \n\x20other\x20definitions\x20may\x20be\x20used.\x20Where\x20the\x20mask\ \x20applies\x20will\x20be\n\x20clearly\x20documented\x20together\x20with\ \x20its\x20declaration\x20in\x20the\x20API.\x20\x20In\n\x20any\x20case,\ \x20the\x20effect\x20on\x20the\x20returned\x20resource/resources\x20is\ \x20required\n\x20behavior\x20for\x20APIs.\n\n\x20#\x20Field\x20Masks\ \x20in\x20Update\x20Operations\n\n\x20A\x20field\x20mask\x20in\x20update\ \x20operations\x20specifies\x20which\x20fields\x20of\x20the\n\x20targete\ d\x20resource\x20are\x20going\x20to\x20be\x20updated.\x20The\x20API\x20i\ s\x20required\n\x20to\x20only\x20change\x20the\x20values\x20of\x20the\ \x20fields\x20as\x20specified\x20in\x20the\x20mask\n\x20and\x20leave\x20\ the\x20others\x20untouched.\x20If\x20a\x20resource\x20is\x20passed\x20in\ \x20to\n\x20describe\x20the\x20updated\x20values,\x20the\x20API\x20ignor\ es\x20the\x20values\x20of\x20all\n\x20fields\x20not\x20covered\x20by\x20\ the\x20mask.\n\n\x20If\x20a\x20repeated\x20field\x20is\x20specified\x20f\ or\x20an\x20update\x20operation,\x20new\x20values\x20will\n\x20be\x20app\ ended\x20to\x20the\x20existing\x20repeated\x20field\x20in\x20the\x20targ\ et\x20resource.\x20Note\x20that\n\x20a\x20repeated\x20field\x20is\x20onl\ y\x20allowed\x20in\x20the\x20last\x20position\x20of\x20a\x20`paths`\x20s\ tring.\n\n\x20If\x20a\x20sub-message\x20is\x20specified\x20in\x20the\x20\ last\x20position\x20of\x20the\x20field\x20mask\x20for\x20an\n\x20update\ \x20operation,\x20then\x20new\x20value\x20will\x20be\x20merged\x20into\ \x20the\x20existing\x20sub-message\n\x20in\x20the\x20target\x20resource.\ \n\n\x20For\x20example,\x20given\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:\x201\n\x20\x20\x20\x20\x20\x20\x20\x20\x20x:\ \x202\n\x20\x20\x20\x20\x20\x20\x20}\n\x20\x20\x20\x20\x20\x20\x20c:\x20\ [1]\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:\x2010\n\x20\x20\x20\x20\x20\x20\x20}\n\ \x20\x20\x20\x20\x20\x20\x20c:\x20[2]\n\x20\x20\x20\x20\x20}\n\n\x20then\ \x20if\x20the\x20field\x20mask\x20is:\n\n\x20\x20paths:\x20[\"f.b\",\x20\ \"f.c\"]\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:\x2010\n\x20\x20\x20\x20\x20\x20\x20\x20\x20x:\x202\n\x20\ \x20\x20\x20\x20\x20\x20}\n\x20\x20\x20\x20\x20\x20\x20c:\x20[1,\x202]\n\ \x20\x20\x20\x20\x20}\n\n\x20An\x20implementation\x20may\x20provide\x20o\ ptions\x20to\x20override\x20this\x20default\x20behavior\x20for\n\x20repe\ ated\x20and\x20message\x20fields.\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\x20val\ ue\x20in\x20the\x20provided\x20resource.\n\x20Hence,\x20in\x20order\x20t\ o\x20reset\x20all\x20fields\x20of\x20a\x20resource,\x20provide\x20a\x20d\ efault\n\x20instance\x20of\x20the\x20resource\x20and\x20set\x20all\x20fi\ elds\x20in\x20the\x20mask,\x20or\x20do\n\x20not\x20provide\x20a\x20mask\ \x20as\x20described\x20below.\n\n\x20If\x20a\x20field\x20mask\x20is\x20n\ ot\x20present\x20on\x20update,\x20the\x20operation\x20applies\x20to\n\ \x20all\x20fields\x20(as\x20if\x20a\x20field\x20mask\x20of\x20all\x20fie\ lds\x20has\x20been\x20specified).\n\x20Note\x20that\x20in\x20the\x20pres\ ence\x20of\x20schema\x20evolution,\x20this\x20may\x20mean\x20that\n\x20f\ ields\x20the\x20client\x20does\x20not\x20know\x20and\x20has\x20therefore\ \x20not\x20filled\x20into\n\x20the\x20request\x20will\x20be\x20reset\x20\ to\x20their\x20default.\x20If\x20this\x20is\x20unwanted\n\x20behavior,\ \x20a\x20specific\x20service\x20may\x20require\x20a\x20client\x20to\x20a\ lways\x20specify\n\x20a\x20field\x20mask,\x20producing\x20an\x20error\ \x20if\x20not.\n\n\x20As\x20with\x20get\x20operations,\x20the\x20locatio\ n\x20of\x20the\x20resource\x20which\n\x20describes\x20the\x20updated\x20\ values\x20in\x20the\x20request\x20message\x20depends\x20on\x20the\n\x20o\ peration\x20kind.\x20In\x20any\x20case,\x20the\x20effect\x20of\x20the\ \x20field\x20mask\x20is\n\x20required\x20to\x20be\x20honored\x20by\x20th\ e\x20API.\n\n\x20##\x20Considerations\x20for\x20HTTP\x20REST\n\n\x20The\ \x20HTTP\x20kind\x20of\x20an\x20update\x20operation\x20which\x20uses\x20\ a\x20field\x20mask\x20must\n\x20be\x20set\x20to\x20PATCH\x20instead\x20o\ f\x20PUT\x20in\x20order\x20to\x20satisfy\x20HTTP\x20semantics\n\x20(PUT\ \x20must\x20only\x20be\x20used\x20for\x20full\x20updates).\n\n\x20#\x20J\ SON\x20Encoding\x20of\x20Field\x20Masks\n\n\x20In\x20JSON,\x20a\x20field\ \x20mask\x20is\x20encoded\x20as\x20a\x20single\x20string\x20where\x20pat\ hs\x20are\n\x20separated\x20by\x20a\x20comma.\x20Fields\x20name\x20in\ \x20each\x20path\x20are\x20converted\n\x20to/from\x20lower-camel\x20nami\ ng\x20conventions.\n\n\x20As\x20an\x20example,\x20consider\x20the\x20fol\ lowing\x20message\x20declarations:\n\n\x20\x20\x20\x20\x20message\x20Pro\ file\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\x20st\ ring\x20display_name\x20=\x201;\n\x20\x20\x20\x20\x20\x20\x20string\x20a\ ddress\x20=\x202;\n\x20\x20\x20\x20\x20}\n\n\x20In\x20proto\x20a\x20fiel\ d\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\x20##\x20Field\x20Mask\x20Verification\n\n\x20\ The\x20implementation\x20of\x20any\x20API\x20method\x20which\x20has\x20a\ \x20FieldMask\x20type\x20field\x20in\x20the\n\x20request\x20should\x20ve\ rify\x20the\x20included\x20field\x20paths,\x20and\x20return\x20an\n\x20`\ INVALID_ARGUMENT`\x20error\x20if\x20any\x20path\x20is\x20unmappable.\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\x20pat\ hs.\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\x06proto\ 3\ "; static file_descriptor_proto_lazy: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; fn parse_descriptor_proto() -> crate::descriptor::FileDescriptorProto { crate::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() } pub fn file_descriptor_proto() -> &'static crate::descriptor::FileDescriptorProto { file_descriptor_proto_lazy.get(|| { parse_descriptor_proto() }) } protobuf-2.25.2/src/well_known_types/mod.rs000064400000000000000000000011430072674642500171220ustar 00000000000000// 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::*; protobuf-2.25.2/src/well_known_types/source_context.rs000064400000000000000000000237110072674642500214140ustar 00000000000000// This file is generated by rust-protobuf 2.22.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![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(unused_imports)] #![allow(unused_results)] //! Generated file from `google/protobuf/source_context.proto` #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct SourceContext { // message fields pub file_name: ::std::string::String, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a SourceContext { fn default() -> &'a SourceContext { ::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 crate::Message for SourceContext { fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_singular_proto3_string_into(wire_type, is, &mut self.file_name)?; }, _ => { crate::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 += crate::rt::string_size(1, &self.file_name); } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> SourceContext { SourceContext::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_simple_field_accessor::<_, crate::types::ProtobufTypeString>( "file_name", |m: &SourceContext| { &m.file_name }, |m: &mut SourceContext| { &mut m.file_name }, )); crate::reflect::MessageDescriptor::new_pb_name::( "SourceContext", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static SourceContext { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(SourceContext::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for SourceContext { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::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\x08fileNameB\x8a\x01\ \n\x13com.google.protobufB\x12SourceContextProtoP\x01Z6google.golang.org\ /protobuf/types/known/sourcecontextpb\xa2\x02\x03GPB\xaa\x02\x1eGoogle.P\ rotobuf.WellKnownTypesJ\xc1\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\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$\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\x08\n\x01\x08\x12\x03'\0M\n\t\n\x02\x08\x0b\x12\x03'\0M\n\ \x83\x01\n\x02\x04\0\x12\x04+\0/\x01\x1aw\x20`SourceContext`\x20represen\ ts\x20information\x20about\x20the\x20source\x20of\x20a\n\x20protobuf\x20\ element,\x20like\x20the\x20file\x20in\x20which\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-qualified\x20name\x20of\x20the\ \x20.proto\x20file\x20that\x20contained\x20the\x20associated\n\x20protob\ uf\x20element.\x20\x20For\x20example:\x20`\"google/protobuf/source_conte\ xt.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 file_descriptor_proto_lazy: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; fn parse_descriptor_proto() -> crate::descriptor::FileDescriptorProto { crate::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() } pub fn file_descriptor_proto() -> &'static crate::descriptor::FileDescriptorProto { file_descriptor_proto_lazy.get(|| { parse_descriptor_proto() }) } protobuf-2.25.2/src/well_known_types/struct_pb.rs000064400000000000000000001130110072674642500203460ustar 00000000000000// This file is generated by rust-protobuf 2.22.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![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(unused_imports)] #![allow(unused_results)] //! Generated file from `google/protobuf/struct.proto` #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::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: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a Struct { fn default() -> &'a Struct { ::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 crate::Message for Struct { fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_map_into::>(wire_type, is, &mut self.fields)?; }, _ => { crate::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 += crate::rt::compute_map_size::>(1, &self.fields); my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { crate::rt::write_map_with_cached_sizes::>(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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> Struct { Struct::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_map_accessor::<_, crate::types::ProtobufTypeString, crate::types::ProtobufTypeMessage>( "fields", |m: &Struct| { &m.fields }, |m: &mut Struct| { &mut m.fields }, )); crate::reflect::MessageDescriptor::new_pb_name::( "Struct", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static Struct { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(Struct::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for Struct { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct Value { // message oneof groups pub kind: ::std::option::Option, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a Value { fn default() -> &'a Value { ::default_instance() } } #[derive(Clone,PartialEq,Debug)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::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, _ => ::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, _ => ::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 crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } self.kind = ::std::option::Option::Some(Value_oneof_kind::null_value(is.read_enum()?)); }, 2 => { if wire_type != crate::wire_format::WireTypeFixed64 { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } self.kind = ::std::option::Option::Some(Value_oneof_kind::number_value(is.read_double()?)); }, 3 => { if wire_type != crate::wire_format::WireTypeLengthDelimited { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } self.kind = ::std::option::Option::Some(Value_oneof_kind::string_value(is.read_string()?)); }, 4 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } self.kind = ::std::option::Option::Some(Value_oneof_kind::bool_value(is.read_bool()?)); }, 5 => { if wire_type != crate::wire_format::WireTypeLengthDelimited { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } self.kind = ::std::option::Option::Some(Value_oneof_kind::struct_value(is.read_message()?)); }, 6 => { if wire_type != crate::wire_format::WireTypeLengthDelimited { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } self.kind = ::std::option::Option::Some(Value_oneof_kind::list_value(is.read_message()?)); }, _ => { crate::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 += crate::rt::enum_size(1, v); }, &Value_oneof_kind::number_value(v) => { my_size += 9; }, &Value_oneof_kind::string_value(ref v) => { my_size += crate::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 + crate::rt::compute_raw_varint32_size(len) + len; }, &Value_oneof_kind::list_value(ref v) => { let len = v.compute_size(); my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; }, }; } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { if let ::std::option::Option::Some(ref v) = self.kind { match v { &Value_oneof_kind::null_value(v) => { os.write_enum(1, crate::ProtobufEnum::value(&v))?; }, &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, crate::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, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> Value { Value::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_singular_enum_accessor::<_, NullValue>( "null_value", Value::has_null_value, Value::get_null_value, )); fields.push(crate::reflect::accessor::make_singular_f64_accessor::<_>( "number_value", Value::has_number_value, Value::get_number_value, )); fields.push(crate::reflect::accessor::make_singular_string_accessor::<_>( "string_value", Value::has_string_value, Value::get_string_value, )); fields.push(crate::reflect::accessor::make_singular_bool_accessor::<_>( "bool_value", Value::has_bool_value, Value::get_bool_value, )); fields.push(crate::reflect::accessor::make_singular_message_accessor::<_, Struct>( "struct_value", Value::has_struct_value, Value::get_struct_value, )); fields.push(crate::reflect::accessor::make_singular_message_accessor::<_, ListValue>( "list_value", Value::has_list_value, Value::get_list_value, )); crate::reflect::MessageDescriptor::new_pb_name::( "Value", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static Value { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(Value::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for Value { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct ListValue { // message fields pub values: crate::RepeatedField, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a ListValue { fn default() -> &'a ListValue { ::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: crate::RepeatedField) { self.values = v; } // Mutable pointer to the field. pub fn mut_values(&mut self) -> &mut crate::RepeatedField { &mut self.values } // Take field pub fn take_values(&mut self) -> crate::RepeatedField { ::std::mem::replace(&mut self.values, crate::RepeatedField::new()) } } impl crate::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 crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { crate::rt::read_repeated_message_into(wire_type, is, &mut self.values)?; }, _ => { crate::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 + crate::rt::compute_raw_varint32_size(len) + len; }; my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { for v in &self.values { os.write_tag(1, crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> ListValue { ListValue::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage>( "values", |m: &ListValue| { &m.values }, |m: &mut ListValue| { &mut m.values }, )); crate::reflect::MessageDescriptor::new_pb_name::( "ListValue", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static ListValue { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(ListValue::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for ListValue { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Message(self) } } #[derive(Clone,PartialEq,Eq,Debug,Hash)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub enum NullValue { NULL_VALUE = 0, } impl crate::ProtobufEnum for NullValue { fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { 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 crate::reflect::EnumDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { crate::reflect::EnumDescriptor::new_pb_name::("NullValue", file_descriptor_proto()) }) } } impl ::std::marker::Copy for NullValue { } impl ::std::default::Default for NullValue { fn default() -> Self { NullValue::NULL_VALUE } } impl crate::reflect::ProtobufValue for NullValue { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::reflect::ReflectValueRef::Enum(crate::ProtobufEnum::descriptor(self)) } } 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\x7f\n\x13com.google.protobufB\x0bStructProtoP\x01Z/google.g\ olang.org/protobuf/types/known/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\x20Buffers\ \x20-\x20Google's\x20data\x20interchange\x20format\n\x20Copyright\x20200\ 8\x20Google\x20Inc.\x20\x20All\x20rights\x20reserved.\n\x20https://devel\ opers.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$\0F\n\t\n\x02\x08\x0b\x12\x03$\0F\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\x042\05\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\x032\x08\ \x0e\n9\n\x04\x04\0\x02\0\x12\x034\x02\x20\x1a,\x20Unordered\x20map\x20o\ f\x20dynamically\x20typed\x20values.\n\n\x0c\n\x05\x04\0\x02\0\x06\x12\ \x034\x02\x14\n\x0c\n\x05\x04\0\x02\0\x01\x12\x034\x15\x1b\n\x0c\n\x05\ \x04\0\x02\0\x03\x12\x034\x1e\x1f\n\xc3\x02\n\x02\x04\x01\x12\x04=\0M\ \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?\x02L\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\x03A\x04\x1d\x1a\x1a\x20Rep\ resents\x20a\x20null\x20value.\n\n\x0c\n\x05\x04\x01\x02\0\x06\x12\x03A\ \x04\r\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03A\x0e\x18\n\x0c\n\x05\x04\ \x01\x02\0\x03\x12\x03A\x1b\x1c\n)\n\x04\x04\x01\x02\x01\x12\x03C\x04\ \x1c\x1a\x1c\x20Represents\x20a\x20double\x20value.\n\n\x0c\n\x05\x04\ \x01\x02\x01\x05\x12\x03C\x04\n\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03C\ \x0b\x17\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03C\x1a\x1b\n)\n\x04\x04\ \x01\x02\x02\x12\x03E\x04\x1c\x1a\x1c\x20Represents\x20a\x20string\x20va\ lue.\n\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03E\x04\n\n\x0c\n\x05\x04\ \x01\x02\x02\x01\x12\x03E\x0b\x17\n\x0c\n\x05\x04\x01\x02\x02\x03\x12\ \x03E\x1a\x1b\n*\n\x04\x04\x01\x02\x03\x12\x03G\x04\x18\x1a\x1d\x20Repre\ sents\x20a\x20boolean\x20value.\n\n\x0c\n\x05\x04\x01\x02\x03\x05\x12\ \x03G\x04\x08\n\x0c\n\x05\x04\x01\x02\x03\x01\x12\x03G\t\x13\n\x0c\n\x05\ \x04\x01\x02\x03\x03\x12\x03G\x16\x17\n-\n\x04\x04\x01\x02\x04\x12\x03I\ \x04\x1c\x1a\x20\x20Represents\x20a\x20structured\x20value.\n\n\x0c\n\ \x05\x04\x01\x02\x04\x06\x12\x03I\x04\n\n\x0c\n\x05\x04\x01\x02\x04\x01\ \x12\x03I\x0b\x17\n\x0c\n\x05\x04\x01\x02\x04\x03\x12\x03I\x1a\x1b\n-\n\ \x04\x04\x01\x02\x05\x12\x03K\x04\x1d\x1a\x20\x20Represents\x20a\x20repe\ ated\x20`Value`.\n\n\x0c\n\x05\x04\x01\x02\x05\x06\x12\x03K\x04\r\n\x0c\ \n\x05\x04\x01\x02\x05\x01\x12\x03K\x0e\x18\n\x0c\n\x05\x04\x01\x02\x05\ \x03\x12\x03K\x1b\x1c\n\xa9\x01\n\x02\x05\0\x12\x04S\0V\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\x03S\x05\x0e\n\x1a\n\x04\x05\0\ \x02\0\x12\x03U\x02\x11\x1a\r\x20Null\x20value.\n\n\x0c\n\x05\x05\0\x02\ \0\x01\x12\x03U\x02\x0c\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03U\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 file_descriptor_proto_lazy: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; fn parse_descriptor_proto() -> crate::descriptor::FileDescriptorProto { crate::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() } pub fn file_descriptor_proto() -> &'static crate::descriptor::FileDescriptorProto { file_descriptor_proto_lazy.get(|| { parse_descriptor_proto() }) } protobuf-2.25.2/src/well_known_types/timestamp.rs000064400000000000000000000421140072674642500203510ustar 00000000000000// This file is generated by rust-protobuf 2.22.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![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(unused_imports)] #![allow(unused_results)] //! Generated file from `google/protobuf/timestamp.proto` #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct Timestamp { // message fields pub seconds: i64, pub nanos: i32, // special fields #[cfg_attr(feature = "with-serde", serde(skip))] pub unknown_fields: crate::UnknownFields, #[cfg_attr(feature = "with-serde", serde(skip))] pub cached_size: crate::CachedSize, } impl<'a> ::std::default::Default for &'a Timestamp { fn default() -> &'a Timestamp { ::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 crate::Message for Timestamp { fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { while !is.eof()? { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int64()?; self.seconds = tmp; }, 2 => { if wire_type != crate::wire_format::WireTypeVarint { return ::std::result::Result::Err(crate::rt::unexpected_wire_type(wire_type)); } let tmp = is.read_int32()?; self.nanos = tmp; }, _ => { crate::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 += crate::rt::value_size(1, self.seconds, crate::wire_format::WireTypeVarint); } if self.nanos != 0 { my_size += crate::rt::value_size(2, self.nanos, crate::wire_format::WireTypeVarint); } my_size += crate::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 crate::CodedOutputStream<'_>) -> crate::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) -> &crate::UnknownFields { &self.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut crate::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: ::std::boxed::Box) -> ::std::boxed::Box { self } fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { Self::descriptor_static() } fn new() -> Timestamp { Timestamp::new() } fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { static descriptor: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(crate::reflect::accessor::make_simple_field_accessor::<_, crate::types::ProtobufTypeInt64>( "seconds", |m: &Timestamp| { &m.seconds }, |m: &mut Timestamp| { &mut m.seconds }, )); fields.push(crate::reflect::accessor::make_simple_field_accessor::<_, crate::types::ProtobufTypeInt32>( "nanos", |m: &Timestamp| { &m.nanos }, |m: &mut Timestamp| { &mut m.nanos }, )); crate::reflect::MessageDescriptor::new_pb_name::( "Timestamp", fields, file_descriptor_proto() ) }) } fn default_instance() -> &'static Timestamp { static instance: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; instance.get(Timestamp::new) } } impl crate::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 { crate::text_format::fmt(self, f) } } impl crate::reflect::ProtobufValue for Timestamp { fn as_ref(&self) -> crate::reflect::ReflectValueRef { crate::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\x85\x01\n\x13com.google.protobufB\ \x0eTimestampProtoP\x01Z2google.golang.org/protobuf/types/known/timestam\ ppb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypes\ J\xc5/\n\x07\x12\x05\x1e\0\x92\x01\x01\n\xcc\x0c\n\x01\x0c\x12\x03\x1e\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.\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$\0I\n\t\n\x02\x08\ \x0b\x12\x03$\0I\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\xde\x1d\n\x02\x04\0\x12\x06\x87\ \x01\0\x92\x01\x01\x1a\xcf\x1d\x20A\x20Timestamp\x20represents\x20a\x20p\ oint\x20in\x20time\x20independent\x20of\x20any\x20time\x20zone\x20or\x20\ local\n\x20calendar,\x20encoded\x20as\x20a\x20count\x20of\x20seconds\x20\ and\x20fractions\x20of\x20seconds\x20at\n\x20nanosecond\x20resolution.\ \x20The\x20count\x20is\x20relative\x20to\x20an\x20epoch\x20at\x20UTC\x20\ midnight\x20on\n\x20January\x201,\x201970,\x20in\x20the\x20proleptic\x20\ Gregorian\x20calendar\x20which\x20extends\x20the\n\x20Gregorian\x20calen\ dar\x20backwards\x20to\x20year\x20one.\n\n\x20All\x20minutes\x20are\x206\ 0\x20seconds\x20long.\x20Leap\x20seconds\x20are\x20\"smeared\"\x20so\x20\ that\x20no\x20leap\n\x20second\x20table\x20is\x20needed\x20for\x20interp\ retation,\x20using\x20a\x20[24-hour\x20linear\n\x20smear](https://develo\ pers.google.com/time/smear).\n\n\x20The\x20range\x20is\x20from\x200001-0\ 1-01T00:00:00Z\x20to\x209999-12-31T23:59:59.999999999Z.\x20By\n\x20restr\ icting\x20to\x20that\x20range,\x20we\x20ensure\x20that\x20we\x20can\x20c\ onvert\x20to\x20and\x20from\x20[RFC\n\x203339](https://www.ietf.org/rfc/\ rfc3339.txt)\x20date\x20strings.\n\n\x20#\x20Examples\n\n\x20Example\x20\ 1:\x20Compute\x20Timestamp\x20from\x20POSIX\x20`time()`.\n\n\x20\x20\x20\ \x20\x20Timestamp\x20timestamp;\n\x20\x20\x20\x20\x20timestamp.set_secon\ ds(time(NULL));\n\x20\x20\x20\x20\x20timestamp.set_nanos(0);\n\n\x20Exam\ ple\x202:\x20Compute\x20Timestamp\x20from\x20POSIX\x20`gettimeofday()`.\ \n\n\x20\x20\x20\x20\x20struct\x20timeval\x20tv;\n\x20\x20\x20\x20\x20ge\ ttimeofday(&tv,\x20NULL);\n\n\x20\x20\x20\x20\x20Timestamp\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\x20\ 3:\x20Compute\x20Timestamp\x20from\x20Win32\x20`GetSystemTimeAsFileTime(\ )`.\n\n\x20\x20\x20\x20\x20FILETIME\x20ft;\n\x20\x20\x20\x20\x20GetSyste\ mTimeAsFileTime(&ft);\n\x20\x20\x20\x20\x20UINT64\x20ticks\x20=\x20(((UI\ NT64)ft.dwHighDateTime)\x20<<\x2032)\x20|\x20ft.dwLowDateTime;\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//\x20\ is\x2011644473600\x20seconds\x20before\x20Unix\x20epoch\x201970-01-01T00\ :00:00Z.\n\x20\x20\x20\x20\x20Timestamp\x20timestamp;\n\x20\x20\x20\x20\ \x20timestamp.set_seconds((INT64)\x20((ticks\x20/\x2010000000)\x20-\x201\ 1644473600LL));\n\x20\x20\x20\x20\x20timestamp.set_nanos((INT32)\x20((ti\ cks\x20%\x2010000000)\x20*\x20100));\n\n\x20Example\x204:\x20Compute\x20\ Timestamp\x20from\x20Java\x20`System.currentTimeMillis()`.\n\n\x20\x20\ \x20\x20\x20long\x20millis\x20=\x20System.currentTimeMillis();\n\n\x20\ \x20\x20\x20\x20Timestamp\x20timestamp\x20=\x20Timestamp.newBuilder().se\ tSeconds(millis\x20/\x201000)\n\x20\x20\x20\x20\x20\x20\x20\x20\x20.setN\ anos((int)\x20((millis\x20%\x201000)\x20*\x201000000)).build();\n\n\n\ \x20Example\x205:\x20Compute\x20Timestamp\x20from\x20Java\x20`Instant.no\ w()`.\n\n\x20\x20\x20\x20\x20Instant\x20now\x20=\x20Instant.now();\n\n\ \x20\x20\x20\x20\x20Timestamp\x20timestamp\x20=\n\x20\x20\x20\x20\x20\ \x20\x20\x20\x20Timestamp.newBuilder().setSeconds(now.getEpochSecond())\ \n\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.setNanos(now.getN\ ano()).build();\n\n\n\x20Example\x206:\x20Compute\x20Timestamp\x20from\ \x20current\x20time\x20in\x20Python.\n\n\x20\x20\x20\x20\x20timestamp\ \x20=\x20Timestamp()\n\x20\x20\x20\x20\x20timestamp.GetCurrentTime()\n\n\ \x20#\x20JSON\x20Mapping\n\n\x20In\x20JSON\x20format,\x20the\x20Timestam\ p\x20type\x20is\x20encoded\x20as\x20a\x20string\x20in\x20the\n\x20[RFC\ \x203339](https://www.ietf.org/rfc/rfc3339.txt)\x20format.\x20That\x20is\ ,\x20the\n\x20format\x20is\x20\"{year}-{month}-{day}T{hour}:{min}:{sec}[\ .{frac_sec}]Z\"\n\x20where\x20{year}\x20is\x20always\x20expressed\x20usi\ ng\x20four\x20digits\x20while\x20{month},\x20{day},\n\x20{hour},\x20{min\ },\x20and\x20{sec}\x20are\x20zero-padded\x20to\x20two\x20digits\x20each.\ \x20The\x20fractional\n\x20seconds,\x20which\x20can\x20go\x20up\x20to\ \x209\x20digits\x20(i.e.\x20up\x20to\x201\x20nanosecond\x20resolution),\ \n\x20are\x20optional.\x20The\x20\"Z\"\x20suffix\x20indicates\x20the\x20\ timezone\x20(\"UTC\");\x20the\x20timezone\n\x20is\x20required.\x20A\x20p\ roto3\x20JSON\x20serializer\x20should\x20always\x20use\x20UTC\x20(as\x20\ indicated\x20by\n\x20\"Z\")\x20when\x20printing\x20the\x20Timestamp\x20t\ ype\x20and\x20a\x20proto3\x20JSON\x20parser\x20should\x20be\n\x20able\ \x20to\x20accept\x20both\x20UTC\x20and\x20other\x20timezones\x20(as\x20i\ ndicated\x20by\x20an\x20offset).\n\n\x20For\x20example,\x20\"2017-01-15T\ 01:30:15.01Z\"\x20encodes\x2015.01\x20seconds\x20past\n\x2001:30\x20UTC\ \x20on\x20January\x2015,\x202017.\n\n\x20In\x20JavaScript,\x20one\x20can\ \x20convert\x20a\x20Date\x20object\x20to\x20this\x20format\x20using\x20t\ he\n\x20standard\n\x20[toISOString()](https://developer.mozilla.org/en-U\ S/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)\n\x20me\ thod.\x20In\x20Python,\x20a\x20standard\x20`datetime.datetime`\x20object\ \x20can\x20be\x20converted\n\x20to\x20this\x20format\x20using\n\x20[`str\ ftime`](https://docs.python.org/2/library/time.html#time.strftime)\x20wi\ th\n\x20the\x20time\x20format\x20spec\x20'%Y-%m-%dT%H:%M:%S.%fZ'.\x20Lik\ ewise,\x20in\x20Java,\x20one\x20can\x20use\n\x20the\x20Joda\x20Time's\ \x20[`ISODateTimeFormat.dateTime()`](\n\x20http://www.joda.org/joda-time\ /apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D\n\ \x20)\x20to\x20obtain\x20a\x20formatter\x20capable\x20of\x20generating\ \x20timestamps\x20in\x20this\x20format.\n\n\n\n\x0b\n\x03\x04\0\x01\x12\ \x04\x87\x01\x08\x11\n\x9d\x01\n\x04\x04\0\x02\0\x12\x04\x8b\x01\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\r\n\x05\ \x04\0\x02\0\x05\x12\x04\x8b\x01\x02\x07\n\r\n\x05\x04\0\x02\0\x01\x12\ \x04\x8b\x01\x08\x0f\n\r\n\x05\x04\0\x02\0\x03\x12\x04\x8b\x01\x12\x13\n\ \xe5\x01\n\x04\x04\0\x02\x01\x12\x04\x91\x01\x02\x12\x1a\xd6\x01\x20Non-\ negative\x20fractions\x20of\x20a\x20second\x20at\x20nanosecond\x20resolu\ tion.\x20Negative\n\x20second\x20values\x20with\x20fractions\x20must\x20\ still\x20have\x20non-negative\x20nanos\x20values\n\x20that\x20count\x20f\ orward\x20in\x20time.\x20Must\x20be\x20from\x200\x20to\x20999,999,999\n\ \x20inclusive.\n\n\r\n\x05\x04\0\x02\x01\x05\x12\x04\x91\x01\x02\x07\n\r\ \n\x05\x04\0\x02\x01\x01\x12\x04\x91\x01\x08\r\n\r\n\x05\x04\0\x02\x01\ \x03\x12\x04\x91\x01\x10\x11b\x06proto3\ "; static file_descriptor_proto_lazy: crate::rt::LazyV2 = crate::rt::LazyV2::INIT; fn parse_descriptor_proto() -> crate::descriptor::FileDescriptorProto { crate::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() } pub fn file_descriptor_proto() -> &'static crate::descriptor::FileDescriptorProto { file_descriptor_proto_lazy.get(|| { parse_descriptor_proto() }) } protobuf-2.25.2/src/well_known_types/type_pb.rs000064400000000000000000002462760072674642500200270ustar 00000000000000// This file is generated by rust-protobuf 2.22.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![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(unused_imports)] #![allow(unused_results)] //! Generated file from `google/protobuf/type.proto` #[derive(PartialEq,Clone,Default)] #[cfg_attr(feature = "with-serde", derive(::serde::Serialize, ::serde::Deserialize))] pub struct Type { // message fields pub name: ::std::string::String, pub fields: crate::RepeatedField, pub oneofs: crate::RepeatedField<::std::string::String>, pub options: crate::RepeatedField