blob: 8f3dd2f2690f36fd03ae7efc2da92e29fd1f0d5f [file] [log] [blame] [edit]
// 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<FileDescriptorProto>,
// 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 {
<FileDescriptorSet as crate::Message>::default_instance()
}
}
impl FileDescriptorSet {
pub fn new() -> FileDescriptorSet {
::std::default::Default::default()
}
// repeated .google.protobuf.FileDescriptorProto file = 1;
pub fn get_file(&self) -> &[FileDescriptorProto] {
&self.file
}
pub fn clear_file(&mut self) {
self.file.clear();
}
// Param is passed by value, moved
pub fn set_file(&mut self, v: crate::RepeatedField<FileDescriptorProto>) {
self.file = v;
}
// Mutable pointer to the field.
pub fn mut_file(&mut self) -> &mut crate::RepeatedField<FileDescriptorProto> {
&mut self.file
}
// Take field
pub fn take_file(&mut self) -> crate::RepeatedField<FileDescriptorProto> {
::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<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
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::reflect::MessageDescriptor> = 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<FileDescriptorProto>>(
"file",
|m: &FileDescriptorSet| { &m.file },
|m: &mut FileDescriptorSet| { &mut m.file },
));
crate::reflect::MessageDescriptor::new_pb_name::<FileDescriptorSet>(
"FileDescriptorSet",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static FileDescriptorSet {
static instance: crate::rt::LazyV2<FileDescriptorSet> = 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<i32>,
pub weak_dependency: ::std::vec::Vec<i32>,
pub message_type: crate::RepeatedField<DescriptorProto>,
pub enum_type: crate::RepeatedField<EnumDescriptorProto>,
pub service: crate::RepeatedField<ServiceDescriptorProto>,
pub extension: crate::RepeatedField<FieldDescriptorProto>,
pub options: crate::SingularPtrField<FileOptions>,
pub source_code_info: crate::SingularPtrField<SourceCodeInfo>,
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 {
<FileDescriptorProto as crate::Message>::default_instance()
}
}
impl FileDescriptorProto {
pub fn new() -> FileDescriptorProto {
::std::default::Default::default()
}
// optional string name = 1;
pub fn get_name(&self) -> &str {
match self.name.as_ref() {
Some(v) => &v,
None => "",
}
}
pub fn clear_name(&mut self) {
self.name.clear();
}
pub fn has_name(&self) -> bool {
self.name.is_some()
}
// Param is passed by value, moved
pub fn set_name(&mut self, v: ::std::string::String) {
self.name = 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<i32>) {
self.public_dependency = v;
}
// Mutable pointer to the field.
pub fn mut_public_dependency(&mut self) -> &mut ::std::vec::Vec<i32> {
&mut self.public_dependency
}
// Take field
pub fn take_public_dependency(&mut self) -> ::std::vec::Vec<i32> {
::std::mem::replace(&mut self.public_dependency, ::std::vec::Vec::new())
}
// repeated int32 weak_dependency = 11;
pub fn get_weak_dependency(&self) -> &[i32] {
&self.weak_dependency
}
pub fn clear_weak_dependency(&mut self) {
self.weak_dependency.clear();
}
// Param is passed by value, moved
pub fn set_weak_dependency(&mut self, v: ::std::vec::Vec<i32>) {
self.weak_dependency = v;
}
// Mutable pointer to the field.
pub fn mut_weak_dependency(&mut self) -> &mut ::std::vec::Vec<i32> {
&mut self.weak_dependency
}
// Take field
pub fn take_weak_dependency(&mut self) -> ::std::vec::Vec<i32> {
::std::mem::replace(&mut self.weak_dependency, ::std::vec::Vec::new())
}
// repeated .google.protobuf.DescriptorProto message_type = 4;
pub fn get_message_type(&self) -> &[DescriptorProto] {
&self.message_type
}
pub fn clear_message_type(&mut self) {
self.message_type.clear();
}
// Param is passed by value, moved
pub fn set_message_type(&mut self, v: crate::RepeatedField<DescriptorProto>) {
self.message_type = v;
}
// Mutable pointer to the field.
pub fn mut_message_type(&mut self) -> &mut crate::RepeatedField<DescriptorProto> {
&mut self.message_type
}
// Take field
pub fn take_message_type(&mut self) -> crate::RepeatedField<DescriptorProto> {
::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<EnumDescriptorProto>) {
self.enum_type = v;
}
// Mutable pointer to the field.
pub fn mut_enum_type(&mut self) -> &mut crate::RepeatedField<EnumDescriptorProto> {
&mut self.enum_type
}
// Take field
pub fn take_enum_type(&mut self) -> crate::RepeatedField<EnumDescriptorProto> {
::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<ServiceDescriptorProto>) {
self.service = v;
}
// Mutable pointer to the field.
pub fn mut_service(&mut self) -> &mut crate::RepeatedField<ServiceDescriptorProto> {
&mut self.service
}
// Take field
pub fn take_service(&mut self) -> crate::RepeatedField<ServiceDescriptorProto> {
::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<FieldDescriptorProto>) {
self.extension = v;
}
// Mutable pointer to the field.
pub fn mut_extension(&mut self) -> &mut crate::RepeatedField<FieldDescriptorProto> {
&mut self.extension
}
// Take field
pub fn take_extension(&mut self) -> crate::RepeatedField<FieldDescriptorProto> {
::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(|| <FileOptions as crate::Message>::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(|| <SourceCodeInfo as crate::Message>::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<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
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::reflect::MessageDescriptor> = 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<DescriptorProto>>(
"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<EnumDescriptorProto>>(
"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<ServiceDescriptorProto>>(
"service",
|m: &FileDescriptorProto| { &m.service },
|m: &mut FileDescriptorProto| { &mut m.service },
));
fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage<FieldDescriptorProto>>(
"extension",
|m: &FileDescriptorProto| { &m.extension },
|m: &mut FileDescriptorProto| { &mut m.extension },
));
fields.push(crate::reflect::accessor::make_singular_ptr_field_accessor::<_, crate::types::ProtobufTypeMessage<FileOptions>>(
"options",
|m: &FileDescriptorProto| { &m.options },
|m: &mut FileDescriptorProto| { &mut m.options },
));
fields.push(crate::reflect::accessor::make_singular_ptr_field_accessor::<_, crate::types::ProtobufTypeMessage<SourceCodeInfo>>(
"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>(
"FileDescriptorProto",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static FileDescriptorProto {
static instance: crate::rt::LazyV2<FileDescriptorProto> = 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<FieldDescriptorProto>,
pub extension: crate::RepeatedField<FieldDescriptorProto>,
pub nested_type: crate::RepeatedField<DescriptorProto>,
pub enum_type: crate::RepeatedField<EnumDescriptorProto>,
pub extension_range: crate::RepeatedField<DescriptorProto_ExtensionRange>,
pub oneof_decl: crate::RepeatedField<OneofDescriptorProto>,
pub options: crate::SingularPtrField<MessageOptions>,
pub reserved_range: crate::RepeatedField<DescriptorProto_ReservedRange>,
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 {
<DescriptorProto as crate::Message>::default_instance()
}
}
impl DescriptorProto {
pub fn new() -> DescriptorProto {
::std::default::Default::default()
}
// optional string name = 1;
pub fn get_name(&self) -> &str {
match self.name.as_ref() {
Some(v) => &v,
None => "",
}
}
pub fn clear_name(&mut self) {
self.name.clear();
}
pub fn has_name(&self) -> bool {
self.name.is_some()
}
// Param is passed by value, moved
pub fn set_name(&mut self, v: ::std::string::String) {
self.name = 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<FieldDescriptorProto>) {
self.field = v;
}
// Mutable pointer to the field.
pub fn mut_field(&mut self) -> &mut crate::RepeatedField<FieldDescriptorProto> {
&mut self.field
}
// Take field
pub fn take_field(&mut self) -> crate::RepeatedField<FieldDescriptorProto> {
::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<FieldDescriptorProto>) {
self.extension = v;
}
// Mutable pointer to the field.
pub fn mut_extension(&mut self) -> &mut crate::RepeatedField<FieldDescriptorProto> {
&mut self.extension
}
// Take field
pub fn take_extension(&mut self) -> crate::RepeatedField<FieldDescriptorProto> {
::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<DescriptorProto>) {
self.nested_type = v;
}
// Mutable pointer to the field.
pub fn mut_nested_type(&mut self) -> &mut crate::RepeatedField<DescriptorProto> {
&mut self.nested_type
}
// Take field
pub fn take_nested_type(&mut self) -> crate::RepeatedField<DescriptorProto> {
::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<EnumDescriptorProto>) {
self.enum_type = v;
}
// Mutable pointer to the field.
pub fn mut_enum_type(&mut self) -> &mut crate::RepeatedField<EnumDescriptorProto> {
&mut self.enum_type
}
// Take field
pub fn take_enum_type(&mut self) -> crate::RepeatedField<EnumDescriptorProto> {
::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<DescriptorProto_ExtensionRange>) {
self.extension_range = v;
}
// Mutable pointer to the field.
pub fn mut_extension_range(&mut self) -> &mut crate::RepeatedField<DescriptorProto_ExtensionRange> {
&mut self.extension_range
}
// Take field
pub fn take_extension_range(&mut self) -> crate::RepeatedField<DescriptorProto_ExtensionRange> {
::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<OneofDescriptorProto>) {
self.oneof_decl = v;
}
// Mutable pointer to the field.
pub fn mut_oneof_decl(&mut self) -> &mut crate::RepeatedField<OneofDescriptorProto> {
&mut self.oneof_decl
}
// Take field
pub fn take_oneof_decl(&mut self) -> crate::RepeatedField<OneofDescriptorProto> {
::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(|| <MessageOptions as crate::Message>::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<DescriptorProto_ReservedRange>) {
self.reserved_range = v;
}
// Mutable pointer to the field.
pub fn mut_reserved_range(&mut self) -> &mut crate::RepeatedField<DescriptorProto_ReservedRange> {
&mut self.reserved_range
}
// Take field
pub fn take_reserved_range(&mut self) -> crate::RepeatedField<DescriptorProto_ReservedRange> {
::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<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
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::reflect::MessageDescriptor> = 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<FieldDescriptorProto>>(
"field",
|m: &DescriptorProto| { &m.field },
|m: &mut DescriptorProto| { &mut m.field },
));
fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage<FieldDescriptorProto>>(
"extension",
|m: &DescriptorProto| { &m.extension },
|m: &mut DescriptorProto| { &mut m.extension },
));
fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage<DescriptorProto>>(
"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<EnumDescriptorProto>>(
"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<DescriptorProto_ExtensionRange>>(
"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<OneofDescriptorProto>>(
"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<MessageOptions>>(
"options",
|m: &DescriptorProto| { &m.options },
|m: &mut DescriptorProto| { &mut m.options },
));
fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage<DescriptorProto_ReservedRange>>(
"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>(
"DescriptorProto",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static DescriptorProto {
static instance: crate::rt::LazyV2<DescriptorProto> = 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<i32>,
end: ::std::option::Option<i32>,
pub options: crate::SingularPtrField<ExtensionRangeOptions>,
// 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 {
<DescriptorProto_ExtensionRange as crate::Message>::default_instance()
}
}
impl DescriptorProto_ExtensionRange {
pub fn new() -> DescriptorProto_ExtensionRange {
::std::default::Default::default()
}
// optional int32 start = 1;
pub fn get_start(&self) -> i32 {
self.start.unwrap_or(0)
}
pub fn clear_start(&mut self) {
self.start = ::std::option::Option::None;
}
pub fn has_start(&self) -> bool {
self.start.is_some()
}
// Param is passed by value, moved
pub fn set_start(&mut self, v: i32) {
self.start = ::std::option::Option::Some(v);
}
// optional int32 end = 2;
pub fn get_end(&self) -> i32 {
self.end.unwrap_or(0)
}
pub fn clear_end(&mut self) {
self.end = ::std::option::Option::None;
}
pub fn has_end(&self) -> bool {
self.end.is_some()
}
// Param is passed by value, moved
pub fn set_end(&mut self, v: i32) {
self.end = ::std::option::Option::Some(v);
}
// optional .google.protobuf.ExtensionRangeOptions options = 3;
pub fn get_options(&self) -> &ExtensionRangeOptions {
self.options.as_ref().unwrap_or_else(|| <ExtensionRangeOptions as crate::Message>::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<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
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::reflect::MessageDescriptor> = 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<ExtensionRangeOptions>>(
"options",
|m: &DescriptorProto_ExtensionRange| { &m.options },
|m: &mut DescriptorProto_ExtensionRange| { &mut m.options },
));
crate::reflect::MessageDescriptor::new_pb_name::<DescriptorProto_ExtensionRange>(
"DescriptorProto.ExtensionRange",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static DescriptorProto_ExtensionRange {
static instance: crate::rt::LazyV2<DescriptorProto_ExtensionRange> = 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<i32>,
end: ::std::option::Option<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 DescriptorProto_ReservedRange {
fn default() -> &'a DescriptorProto_ReservedRange {
<DescriptorProto_ReservedRange as crate::Message>::default_instance()
}
}
impl DescriptorProto_ReservedRange {
pub fn new() -> DescriptorProto_ReservedRange {
::std::default::Default::default()
}
// optional int32 start = 1;
pub fn get_start(&self) -> i32 {
self.start.unwrap_or(0)
}
pub fn clear_start(&mut self) {
self.start = ::std::option::Option::None;
}
pub fn has_start(&self) -> bool {
self.start.is_some()
}
// Param is passed by value, moved
pub fn set_start(&mut self, v: i32) {
self.start = ::std::option::Option::Some(v);
}
// optional int32 end = 2;
pub fn get_end(&self) -> i32 {
self.end.unwrap_or(0)
}
pub fn clear_end(&mut self) {
self.end = ::std::option::Option::None;
}
pub fn has_end(&self) -> bool {
self.end.is_some()
}
// Param is passed by value, moved
pub fn set_end(&mut self, v: i32) {
self.end = ::std::option::Option::Some(v);
}
}
impl 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<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
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::reflect::MessageDescriptor> = 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>(
"DescriptorProto.ReservedRange",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static DescriptorProto_ReservedRange {
static instance: crate::rt::LazyV2<DescriptorProto_ReservedRange> = 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<UninterpretedOption>,
// 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 {
<ExtensionRangeOptions as crate::Message>::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<UninterpretedOption>) {
self.uninterpreted_option = v;
}
// Mutable pointer to the field.
pub fn mut_uninterpreted_option(&mut self) -> &mut crate::RepeatedField<UninterpretedOption> {
&mut self.uninterpreted_option
}
// Take field
pub fn take_uninterpreted_option(&mut self) -> crate::RepeatedField<UninterpretedOption> {
::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<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
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::reflect::MessageDescriptor> = 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<UninterpretedOption>>(
"uninterpreted_option",
|m: &ExtensionRangeOptions| { &m.uninterpreted_option },
|m: &mut ExtensionRangeOptions| { &mut m.uninterpreted_option },
));
crate::reflect::MessageDescriptor::new_pb_name::<ExtensionRangeOptions>(
"ExtensionRangeOptions",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static ExtensionRangeOptions {
static instance: crate::rt::LazyV2<ExtensionRangeOptions> = 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<i32>,
label: ::std::option::Option<FieldDescriptorProto_Label>,
field_type: ::std::option::Option<FieldDescriptorProto_Type>,
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<i32>,
json_name: crate::SingularField<::std::string::String>,
pub options: crate::SingularPtrField<FieldOptions>,
proto3_optional: ::std::option::Option<bool>,
// 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 {
<FieldDescriptorProto as crate::Message>::default_instance()
}
}
impl FieldDescriptorProto {
pub fn new() -> FieldDescriptorProto {
::std::default::Default::default()
}
// optional string name = 1;
pub fn get_name(&self) -> &str {
match self.name.as_ref() {
Some(v) => &v,
None => "",
}
}
pub fn clear_name(&mut self) {
self.name.clear();
}
pub fn has_name(&self) -> bool {
self.name.is_some()
}
// Param is passed by value, moved
pub fn set_name(&mut self, v: ::std::string::String) {
self.name = 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(|| <FieldOptions as crate::Message>::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