Haibo Huang | 914311b | 2021-01-07 18:06:15 -0800 | [diff] [blame^] | 1 | // This file is generated by rust-protobuf 2.19.0-pre. Do not edit |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 2 | // @generated |
| 3 | |
| 4 | // https://github.com/rust-lang/rust-clippy/issues/702 |
| 5 | #![allow(unknown_lints)] |
| 6 | #![allow(clippy::all)] |
| 7 | |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 8 | #![allow(unused_attributes)] |
| 9 | #![rustfmt::skip] |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 10 | |
| 11 | #![allow(box_pointers)] |
| 12 | #![allow(dead_code)] |
| 13 | #![allow(missing_docs)] |
| 14 | #![allow(non_camel_case_types)] |
| 15 | #![allow(non_snake_case)] |
| 16 | #![allow(non_upper_case_globals)] |
| 17 | #![allow(trivial_casts)] |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 18 | #![allow(unused_imports)] |
| 19 | #![allow(unused_results)] |
| 20 | //! Generated file from `google/protobuf/compiler/plugin.proto` |
| 21 | |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 22 | #[derive(PartialEq,Clone,Default)] |
| 23 | #[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))] |
| 24 | pub struct CodeGeneratorRequest { |
| 25 | // message fields |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 26 | pub file_to_generate: crate::RepeatedField<::std::string::String>, |
| 27 | parameter: crate::SingularField<::std::string::String>, |
| 28 | pub proto_file: crate::RepeatedField<crate::descriptor::FileDescriptorProto>, |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 29 | // special fields |
| 30 | #[cfg_attr(feature = "with-serde", serde(skip))] |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 31 | pub unknown_fields: crate::UnknownFields, |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 32 | #[cfg_attr(feature = "with-serde", serde(skip))] |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 33 | pub cached_size: crate::CachedSize, |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | impl<'a> ::std::default::Default for &'a CodeGeneratorRequest { |
| 37 | fn default() -> &'a CodeGeneratorRequest { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 38 | <CodeGeneratorRequest as crate::Message>::default_instance() |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 39 | } |
| 40 | } |
| 41 | |
| 42 | impl CodeGeneratorRequest { |
| 43 | pub fn new() -> CodeGeneratorRequest { |
| 44 | ::std::default::Default::default() |
| 45 | } |
| 46 | |
| 47 | // repeated string file_to_generate = 1; |
| 48 | |
| 49 | |
| 50 | pub fn get_file_to_generate(&self) -> &[::std::string::String] { |
| 51 | &self.file_to_generate |
| 52 | } |
| 53 | pub fn clear_file_to_generate(&mut self) { |
| 54 | self.file_to_generate.clear(); |
| 55 | } |
| 56 | |
| 57 | // Param is passed by value, moved |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 58 | pub fn set_file_to_generate(&mut self, v: crate::RepeatedField<::std::string::String>) { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 59 | self.file_to_generate = v; |
| 60 | } |
| 61 | |
| 62 | // Mutable pointer to the field. |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 63 | pub fn mut_file_to_generate(&mut self) -> &mut crate::RepeatedField<::std::string::String> { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 64 | &mut self.file_to_generate |
| 65 | } |
| 66 | |
| 67 | // Take field |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 68 | pub fn take_file_to_generate(&mut self) -> crate::RepeatedField<::std::string::String> { |
| 69 | ::std::mem::replace(&mut self.file_to_generate, crate::RepeatedField::new()) |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | // optional string parameter = 2; |
| 73 | |
| 74 | |
| 75 | pub fn get_parameter(&self) -> &str { |
| 76 | match self.parameter.as_ref() { |
| 77 | Some(v) => &v, |
| 78 | None => "", |
| 79 | } |
| 80 | } |
| 81 | pub fn clear_parameter(&mut self) { |
| 82 | self.parameter.clear(); |
| 83 | } |
| 84 | |
| 85 | pub fn has_parameter(&self) -> bool { |
| 86 | self.parameter.is_some() |
| 87 | } |
| 88 | |
| 89 | // Param is passed by value, moved |
| 90 | pub fn set_parameter(&mut self, v: ::std::string::String) { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 91 | self.parameter = crate::SingularField::some(v); |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | // Mutable pointer to the field. |
| 95 | // If field is not initialized, it is initialized with default value first. |
| 96 | pub fn mut_parameter(&mut self) -> &mut ::std::string::String { |
| 97 | if self.parameter.is_none() { |
| 98 | self.parameter.set_default(); |
| 99 | } |
| 100 | self.parameter.as_mut().unwrap() |
| 101 | } |
| 102 | |
| 103 | // Take field |
| 104 | pub fn take_parameter(&mut self) -> ::std::string::String { |
| 105 | self.parameter.take().unwrap_or_else(|| ::std::string::String::new()) |
| 106 | } |
| 107 | |
| 108 | // repeated .google.protobuf.FileDescriptorProto proto_file = 15; |
| 109 | |
| 110 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 111 | pub fn get_proto_file(&self) -> &[crate::descriptor::FileDescriptorProto] { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 112 | &self.proto_file |
| 113 | } |
| 114 | pub fn clear_proto_file(&mut self) { |
| 115 | self.proto_file.clear(); |
| 116 | } |
| 117 | |
| 118 | // Param is passed by value, moved |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 119 | pub fn set_proto_file(&mut self, v: crate::RepeatedField<crate::descriptor::FileDescriptorProto>) { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 120 | self.proto_file = v; |
| 121 | } |
| 122 | |
| 123 | // Mutable pointer to the field. |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 124 | pub fn mut_proto_file(&mut self) -> &mut crate::RepeatedField<crate::descriptor::FileDescriptorProto> { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 125 | &mut self.proto_file |
| 126 | } |
| 127 | |
| 128 | // Take field |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 129 | pub fn take_proto_file(&mut self) -> crate::RepeatedField<crate::descriptor::FileDescriptorProto> { |
| 130 | ::std::mem::replace(&mut self.proto_file, crate::RepeatedField::new()) |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 131 | } |
| 132 | } |
| 133 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 134 | impl crate::Message for CodeGeneratorRequest { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 135 | fn is_initialized(&self) -> bool { |
| 136 | for v in &self.proto_file { |
| 137 | if !v.is_initialized() { |
| 138 | return false; |
| 139 | } |
| 140 | }; |
| 141 | true |
| 142 | } |
| 143 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 144 | fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 145 | while !is.eof()? { |
| 146 | let (field_number, wire_type) = is.read_tag_unpack()?; |
| 147 | match field_number { |
| 148 | 1 => { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 149 | crate::rt::read_repeated_string_into(wire_type, is, &mut self.file_to_generate)?; |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 150 | }, |
| 151 | 2 => { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 152 | crate::rt::read_singular_string_into(wire_type, is, &mut self.parameter)?; |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 153 | }, |
| 154 | 15 => { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 155 | crate::rt::read_repeated_message_into(wire_type, is, &mut self.proto_file)?; |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 156 | }, |
| 157 | _ => { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 158 | crate::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 159 | }, |
| 160 | }; |
| 161 | } |
| 162 | ::std::result::Result::Ok(()) |
| 163 | } |
| 164 | |
| 165 | // Compute sizes of nested messages |
| 166 | #[allow(unused_variables)] |
| 167 | fn compute_size(&self) -> u32 { |
| 168 | let mut my_size = 0; |
| 169 | for value in &self.file_to_generate { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 170 | my_size += crate::rt::string_size(1, &value); |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 171 | }; |
| 172 | if let Some(ref v) = self.parameter.as_ref() { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 173 | my_size += crate::rt::string_size(2, &v); |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 174 | } |
| 175 | for value in &self.proto_file { |
| 176 | let len = value.compute_size(); |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 177 | my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 178 | }; |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 179 | my_size += crate::rt::unknown_fields_size(self.get_unknown_fields()); |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 180 | self.cached_size.set(my_size); |
| 181 | my_size |
| 182 | } |
| 183 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 184 | fn write_to_with_cached_sizes(&self, os: &mut crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 185 | for v in &self.file_to_generate { |
| 186 | os.write_string(1, &v)?; |
| 187 | }; |
| 188 | if let Some(ref v) = self.parameter.as_ref() { |
| 189 | os.write_string(2, &v)?; |
| 190 | } |
| 191 | for v in &self.proto_file { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 192 | os.write_tag(15, crate::wire_format::WireTypeLengthDelimited)?; |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 193 | os.write_raw_varint32(v.get_cached_size())?; |
| 194 | v.write_to_with_cached_sizes(os)?; |
| 195 | }; |
| 196 | os.write_unknown_fields(self.get_unknown_fields())?; |
| 197 | ::std::result::Result::Ok(()) |
| 198 | } |
| 199 | |
| 200 | fn get_cached_size(&self) -> u32 { |
| 201 | self.cached_size.get() |
| 202 | } |
| 203 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 204 | fn get_unknown_fields(&self) -> &crate::UnknownFields { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 205 | &self.unknown_fields |
| 206 | } |
| 207 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 208 | fn mut_unknown_fields(&mut self) -> &mut crate::UnknownFields { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 209 | &mut self.unknown_fields |
| 210 | } |
| 211 | |
| 212 | fn as_any(&self) -> &dyn (::std::any::Any) { |
| 213 | self as &dyn (::std::any::Any) |
| 214 | } |
| 215 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { |
| 216 | self as &mut dyn (::std::any::Any) |
| 217 | } |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 218 | fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 219 | self |
| 220 | } |
| 221 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 222 | fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 223 | Self::descriptor_static() |
| 224 | } |
| 225 | |
| 226 | fn new() -> CodeGeneratorRequest { |
| 227 | CodeGeneratorRequest::new() |
| 228 | } |
| 229 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 230 | fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { |
| 231 | static descriptor: crate::rt::LazyV2<crate::reflect::MessageDescriptor> = crate::rt::LazyV2::INIT; |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 232 | descriptor.get(|| { |
| 233 | let mut fields = ::std::vec::Vec::new(); |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 234 | fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeString>( |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 235 | "file_to_generate", |
| 236 | |m: &CodeGeneratorRequest| { &m.file_to_generate }, |
| 237 | |m: &mut CodeGeneratorRequest| { &mut m.file_to_generate }, |
| 238 | )); |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 239 | fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 240 | "parameter", |
| 241 | |m: &CodeGeneratorRequest| { &m.parameter }, |
| 242 | |m: &mut CodeGeneratorRequest| { &mut m.parameter }, |
| 243 | )); |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 244 | fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage<crate::descriptor::FileDescriptorProto>>( |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 245 | "proto_file", |
| 246 | |m: &CodeGeneratorRequest| { &m.proto_file }, |
| 247 | |m: &mut CodeGeneratorRequest| { &mut m.proto_file }, |
| 248 | )); |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 249 | crate::reflect::MessageDescriptor::new_pb_name::<CodeGeneratorRequest>( |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 250 | "CodeGeneratorRequest", |
| 251 | fields, |
| 252 | file_descriptor_proto() |
| 253 | ) |
| 254 | }) |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 255 | } |
| 256 | |
| 257 | fn default_instance() -> &'static CodeGeneratorRequest { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 258 | static instance: crate::rt::LazyV2<CodeGeneratorRequest> = crate::rt::LazyV2::INIT; |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 259 | instance.get(CodeGeneratorRequest::new) |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 260 | } |
| 261 | } |
| 262 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 263 | impl crate::Clear for CodeGeneratorRequest { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 264 | fn clear(&mut self) { |
| 265 | self.file_to_generate.clear(); |
| 266 | self.parameter.clear(); |
| 267 | self.proto_file.clear(); |
| 268 | self.unknown_fields.clear(); |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | impl ::std::fmt::Debug for CodeGeneratorRequest { |
| 273 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 274 | crate::text_format::fmt(self, f) |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 275 | } |
| 276 | } |
| 277 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 278 | impl crate::reflect::ProtobufValue for CodeGeneratorRequest { |
| 279 | fn as_ref(&self) -> crate::reflect::ReflectValueRef { |
| 280 | crate::reflect::ReflectValueRef::Message(self) |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 281 | } |
| 282 | } |
| 283 | |
| 284 | #[derive(PartialEq,Clone,Default)] |
| 285 | #[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))] |
| 286 | pub struct CodeGeneratorResponse { |
| 287 | // message fields |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 288 | error: crate::SingularField<::std::string::String>, |
| 289 | pub file: crate::RepeatedField<CodeGeneratorResponse_File>, |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 290 | // special fields |
| 291 | #[cfg_attr(feature = "with-serde", serde(skip))] |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 292 | pub unknown_fields: crate::UnknownFields, |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 293 | #[cfg_attr(feature = "with-serde", serde(skip))] |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 294 | pub cached_size: crate::CachedSize, |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 295 | } |
| 296 | |
| 297 | impl<'a> ::std::default::Default for &'a CodeGeneratorResponse { |
| 298 | fn default() -> &'a CodeGeneratorResponse { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 299 | <CodeGeneratorResponse as crate::Message>::default_instance() |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 300 | } |
| 301 | } |
| 302 | |
| 303 | impl CodeGeneratorResponse { |
| 304 | pub fn new() -> CodeGeneratorResponse { |
| 305 | ::std::default::Default::default() |
| 306 | } |
| 307 | |
| 308 | // optional string error = 1; |
| 309 | |
| 310 | |
| 311 | pub fn get_error(&self) -> &str { |
| 312 | match self.error.as_ref() { |
| 313 | Some(v) => &v, |
| 314 | None => "", |
| 315 | } |
| 316 | } |
| 317 | pub fn clear_error(&mut self) { |
| 318 | self.error.clear(); |
| 319 | } |
| 320 | |
| 321 | pub fn has_error(&self) -> bool { |
| 322 | self.error.is_some() |
| 323 | } |
| 324 | |
| 325 | // Param is passed by value, moved |
| 326 | pub fn set_error(&mut self, v: ::std::string::String) { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 327 | self.error = crate::SingularField::some(v); |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 328 | } |
| 329 | |
| 330 | // Mutable pointer to the field. |
| 331 | // If field is not initialized, it is initialized with default value first. |
| 332 | pub fn mut_error(&mut self) -> &mut ::std::string::String { |
| 333 | if self.error.is_none() { |
| 334 | self.error.set_default(); |
| 335 | } |
| 336 | self.error.as_mut().unwrap() |
| 337 | } |
| 338 | |
| 339 | // Take field |
| 340 | pub fn take_error(&mut self) -> ::std::string::String { |
| 341 | self.error.take().unwrap_or_else(|| ::std::string::String::new()) |
| 342 | } |
| 343 | |
| 344 | // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15; |
| 345 | |
| 346 | |
| 347 | pub fn get_file(&self) -> &[CodeGeneratorResponse_File] { |
| 348 | &self.file |
| 349 | } |
| 350 | pub fn clear_file(&mut self) { |
| 351 | self.file.clear(); |
| 352 | } |
| 353 | |
| 354 | // Param is passed by value, moved |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 355 | pub fn set_file(&mut self, v: crate::RepeatedField<CodeGeneratorResponse_File>) { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 356 | self.file = v; |
| 357 | } |
| 358 | |
| 359 | // Mutable pointer to the field. |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 360 | pub fn mut_file(&mut self) -> &mut crate::RepeatedField<CodeGeneratorResponse_File> { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 361 | &mut self.file |
| 362 | } |
| 363 | |
| 364 | // Take field |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 365 | pub fn take_file(&mut self) -> crate::RepeatedField<CodeGeneratorResponse_File> { |
| 366 | ::std::mem::replace(&mut self.file, crate::RepeatedField::new()) |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 367 | } |
| 368 | } |
| 369 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 370 | impl crate::Message for CodeGeneratorResponse { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 371 | fn is_initialized(&self) -> bool { |
| 372 | for v in &self.file { |
| 373 | if !v.is_initialized() { |
| 374 | return false; |
| 375 | } |
| 376 | }; |
| 377 | true |
| 378 | } |
| 379 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 380 | fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 381 | while !is.eof()? { |
| 382 | let (field_number, wire_type) = is.read_tag_unpack()?; |
| 383 | match field_number { |
| 384 | 1 => { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 385 | crate::rt::read_singular_string_into(wire_type, is, &mut self.error)?; |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 386 | }, |
| 387 | 15 => { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 388 | crate::rt::read_repeated_message_into(wire_type, is, &mut self.file)?; |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 389 | }, |
| 390 | _ => { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 391 | crate::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 392 | }, |
| 393 | }; |
| 394 | } |
| 395 | ::std::result::Result::Ok(()) |
| 396 | } |
| 397 | |
| 398 | // Compute sizes of nested messages |
| 399 | #[allow(unused_variables)] |
| 400 | fn compute_size(&self) -> u32 { |
| 401 | let mut my_size = 0; |
| 402 | if let Some(ref v) = self.error.as_ref() { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 403 | my_size += crate::rt::string_size(1, &v); |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 404 | } |
| 405 | for value in &self.file { |
| 406 | let len = value.compute_size(); |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 407 | my_size += 1 + crate::rt::compute_raw_varint32_size(len) + len; |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 408 | }; |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 409 | my_size += crate::rt::unknown_fields_size(self.get_unknown_fields()); |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 410 | self.cached_size.set(my_size); |
| 411 | my_size |
| 412 | } |
| 413 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 414 | fn write_to_with_cached_sizes(&self, os: &mut crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 415 | if let Some(ref v) = self.error.as_ref() { |
| 416 | os.write_string(1, &v)?; |
| 417 | } |
| 418 | for v in &self.file { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 419 | os.write_tag(15, crate::wire_format::WireTypeLengthDelimited)?; |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 420 | os.write_raw_varint32(v.get_cached_size())?; |
| 421 | v.write_to_with_cached_sizes(os)?; |
| 422 | }; |
| 423 | os.write_unknown_fields(self.get_unknown_fields())?; |
| 424 | ::std::result::Result::Ok(()) |
| 425 | } |
| 426 | |
| 427 | fn get_cached_size(&self) -> u32 { |
| 428 | self.cached_size.get() |
| 429 | } |
| 430 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 431 | fn get_unknown_fields(&self) -> &crate::UnknownFields { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 432 | &self.unknown_fields |
| 433 | } |
| 434 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 435 | fn mut_unknown_fields(&mut self) -> &mut crate::UnknownFields { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 436 | &mut self.unknown_fields |
| 437 | } |
| 438 | |
| 439 | fn as_any(&self) -> &dyn (::std::any::Any) { |
| 440 | self as &dyn (::std::any::Any) |
| 441 | } |
| 442 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { |
| 443 | self as &mut dyn (::std::any::Any) |
| 444 | } |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 445 | fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 446 | self |
| 447 | } |
| 448 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 449 | fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 450 | Self::descriptor_static() |
| 451 | } |
| 452 | |
| 453 | fn new() -> CodeGeneratorResponse { |
| 454 | CodeGeneratorResponse::new() |
| 455 | } |
| 456 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 457 | fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { |
| 458 | static descriptor: crate::rt::LazyV2<crate::reflect::MessageDescriptor> = crate::rt::LazyV2::INIT; |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 459 | descriptor.get(|| { |
| 460 | let mut fields = ::std::vec::Vec::new(); |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 461 | fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 462 | "error", |
| 463 | |m: &CodeGeneratorResponse| { &m.error }, |
| 464 | |m: &mut CodeGeneratorResponse| { &mut m.error }, |
| 465 | )); |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 466 | fields.push(crate::reflect::accessor::make_repeated_field_accessor::<_, crate::types::ProtobufTypeMessage<CodeGeneratorResponse_File>>( |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 467 | "file", |
| 468 | |m: &CodeGeneratorResponse| { &m.file }, |
| 469 | |m: &mut CodeGeneratorResponse| { &mut m.file }, |
| 470 | )); |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 471 | crate::reflect::MessageDescriptor::new_pb_name::<CodeGeneratorResponse>( |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 472 | "CodeGeneratorResponse", |
| 473 | fields, |
| 474 | file_descriptor_proto() |
| 475 | ) |
| 476 | }) |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 477 | } |
| 478 | |
| 479 | fn default_instance() -> &'static CodeGeneratorResponse { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 480 | static instance: crate::rt::LazyV2<CodeGeneratorResponse> = crate::rt::LazyV2::INIT; |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 481 | instance.get(CodeGeneratorResponse::new) |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 482 | } |
| 483 | } |
| 484 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 485 | impl crate::Clear for CodeGeneratorResponse { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 486 | fn clear(&mut self) { |
| 487 | self.error.clear(); |
| 488 | self.file.clear(); |
| 489 | self.unknown_fields.clear(); |
| 490 | } |
| 491 | } |
| 492 | |
| 493 | impl ::std::fmt::Debug for CodeGeneratorResponse { |
| 494 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 495 | crate::text_format::fmt(self, f) |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 496 | } |
| 497 | } |
| 498 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 499 | impl crate::reflect::ProtobufValue for CodeGeneratorResponse { |
| 500 | fn as_ref(&self) -> crate::reflect::ReflectValueRef { |
| 501 | crate::reflect::ReflectValueRef::Message(self) |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 502 | } |
| 503 | } |
| 504 | |
| 505 | #[derive(PartialEq,Clone,Default)] |
| 506 | #[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))] |
| 507 | pub struct CodeGeneratorResponse_File { |
| 508 | // message fields |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 509 | name: crate::SingularField<::std::string::String>, |
| 510 | insertion_point: crate::SingularField<::std::string::String>, |
| 511 | content: crate::SingularField<::std::string::String>, |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 512 | // special fields |
| 513 | #[cfg_attr(feature = "with-serde", serde(skip))] |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 514 | pub unknown_fields: crate::UnknownFields, |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 515 | #[cfg_attr(feature = "with-serde", serde(skip))] |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 516 | pub cached_size: crate::CachedSize, |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 517 | } |
| 518 | |
| 519 | impl<'a> ::std::default::Default for &'a CodeGeneratorResponse_File { |
| 520 | fn default() -> &'a CodeGeneratorResponse_File { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 521 | <CodeGeneratorResponse_File as crate::Message>::default_instance() |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 522 | } |
| 523 | } |
| 524 | |
| 525 | impl CodeGeneratorResponse_File { |
| 526 | pub fn new() -> CodeGeneratorResponse_File { |
| 527 | ::std::default::Default::default() |
| 528 | } |
| 529 | |
| 530 | // optional string name = 1; |
| 531 | |
| 532 | |
| 533 | pub fn get_name(&self) -> &str { |
| 534 | match self.name.as_ref() { |
| 535 | Some(v) => &v, |
| 536 | None => "", |
| 537 | } |
| 538 | } |
| 539 | pub fn clear_name(&mut self) { |
| 540 | self.name.clear(); |
| 541 | } |
| 542 | |
| 543 | pub fn has_name(&self) -> bool { |
| 544 | self.name.is_some() |
| 545 | } |
| 546 | |
| 547 | // Param is passed by value, moved |
| 548 | pub fn set_name(&mut self, v: ::std::string::String) { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 549 | self.name = crate::SingularField::some(v); |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 550 | } |
| 551 | |
| 552 | // Mutable pointer to the field. |
| 553 | // If field is not initialized, it is initialized with default value first. |
| 554 | pub fn mut_name(&mut self) -> &mut ::std::string::String { |
| 555 | if self.name.is_none() { |
| 556 | self.name.set_default(); |
| 557 | } |
| 558 | self.name.as_mut().unwrap() |
| 559 | } |
| 560 | |
| 561 | // Take field |
| 562 | pub fn take_name(&mut self) -> ::std::string::String { |
| 563 | self.name.take().unwrap_or_else(|| ::std::string::String::new()) |
| 564 | } |
| 565 | |
| 566 | // optional string insertion_point = 2; |
| 567 | |
| 568 | |
| 569 | pub fn get_insertion_point(&self) -> &str { |
| 570 | match self.insertion_point.as_ref() { |
| 571 | Some(v) => &v, |
| 572 | None => "", |
| 573 | } |
| 574 | } |
| 575 | pub fn clear_insertion_point(&mut self) { |
| 576 | self.insertion_point.clear(); |
| 577 | } |
| 578 | |
| 579 | pub fn has_insertion_point(&self) -> bool { |
| 580 | self.insertion_point.is_some() |
| 581 | } |
| 582 | |
| 583 | // Param is passed by value, moved |
| 584 | pub fn set_insertion_point(&mut self, v: ::std::string::String) { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 585 | self.insertion_point = crate::SingularField::some(v); |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 586 | } |
| 587 | |
| 588 | // Mutable pointer to the field. |
| 589 | // If field is not initialized, it is initialized with default value first. |
| 590 | pub fn mut_insertion_point(&mut self) -> &mut ::std::string::String { |
| 591 | if self.insertion_point.is_none() { |
| 592 | self.insertion_point.set_default(); |
| 593 | } |
| 594 | self.insertion_point.as_mut().unwrap() |
| 595 | } |
| 596 | |
| 597 | // Take field |
| 598 | pub fn take_insertion_point(&mut self) -> ::std::string::String { |
| 599 | self.insertion_point.take().unwrap_or_else(|| ::std::string::String::new()) |
| 600 | } |
| 601 | |
| 602 | // optional string content = 15; |
| 603 | |
| 604 | |
| 605 | pub fn get_content(&self) -> &str { |
| 606 | match self.content.as_ref() { |
| 607 | Some(v) => &v, |
| 608 | None => "", |
| 609 | } |
| 610 | } |
| 611 | pub fn clear_content(&mut self) { |
| 612 | self.content.clear(); |
| 613 | } |
| 614 | |
| 615 | pub fn has_content(&self) -> bool { |
| 616 | self.content.is_some() |
| 617 | } |
| 618 | |
| 619 | // Param is passed by value, moved |
| 620 | pub fn set_content(&mut self, v: ::std::string::String) { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 621 | self.content = crate::SingularField::some(v); |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 622 | } |
| 623 | |
| 624 | // Mutable pointer to the field. |
| 625 | // If field is not initialized, it is initialized with default value first. |
| 626 | pub fn mut_content(&mut self) -> &mut ::std::string::String { |
| 627 | if self.content.is_none() { |
| 628 | self.content.set_default(); |
| 629 | } |
| 630 | self.content.as_mut().unwrap() |
| 631 | } |
| 632 | |
| 633 | // Take field |
| 634 | pub fn take_content(&mut self) -> ::std::string::String { |
| 635 | self.content.take().unwrap_or_else(|| ::std::string::String::new()) |
| 636 | } |
| 637 | } |
| 638 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 639 | impl crate::Message for CodeGeneratorResponse_File { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 640 | fn is_initialized(&self) -> bool { |
| 641 | true |
| 642 | } |
| 643 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 644 | fn merge_from(&mut self, is: &mut crate::CodedInputStream<'_>) -> crate::ProtobufResult<()> { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 645 | while !is.eof()? { |
| 646 | let (field_number, wire_type) = is.read_tag_unpack()?; |
| 647 | match field_number { |
| 648 | 1 => { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 649 | crate::rt::read_singular_string_into(wire_type, is, &mut self.name)?; |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 650 | }, |
| 651 | 2 => { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 652 | crate::rt::read_singular_string_into(wire_type, is, &mut self.insertion_point)?; |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 653 | }, |
| 654 | 15 => { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 655 | crate::rt::read_singular_string_into(wire_type, is, &mut self.content)?; |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 656 | }, |
| 657 | _ => { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 658 | crate::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 659 | }, |
| 660 | }; |
| 661 | } |
| 662 | ::std::result::Result::Ok(()) |
| 663 | } |
| 664 | |
| 665 | // Compute sizes of nested messages |
| 666 | #[allow(unused_variables)] |
| 667 | fn compute_size(&self) -> u32 { |
| 668 | let mut my_size = 0; |
| 669 | if let Some(ref v) = self.name.as_ref() { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 670 | my_size += crate::rt::string_size(1, &v); |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 671 | } |
| 672 | if let Some(ref v) = self.insertion_point.as_ref() { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 673 | my_size += crate::rt::string_size(2, &v); |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 674 | } |
| 675 | if let Some(ref v) = self.content.as_ref() { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 676 | my_size += crate::rt::string_size(15, &v); |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 677 | } |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 678 | my_size += crate::rt::unknown_fields_size(self.get_unknown_fields()); |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 679 | self.cached_size.set(my_size); |
| 680 | my_size |
| 681 | } |
| 682 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 683 | fn write_to_with_cached_sizes(&self, os: &mut crate::CodedOutputStream<'_>) -> crate::ProtobufResult<()> { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 684 | if let Some(ref v) = self.name.as_ref() { |
| 685 | os.write_string(1, &v)?; |
| 686 | } |
| 687 | if let Some(ref v) = self.insertion_point.as_ref() { |
| 688 | os.write_string(2, &v)?; |
| 689 | } |
| 690 | if let Some(ref v) = self.content.as_ref() { |
| 691 | os.write_string(15, &v)?; |
| 692 | } |
| 693 | os.write_unknown_fields(self.get_unknown_fields())?; |
| 694 | ::std::result::Result::Ok(()) |
| 695 | } |
| 696 | |
| 697 | fn get_cached_size(&self) -> u32 { |
| 698 | self.cached_size.get() |
| 699 | } |
| 700 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 701 | fn get_unknown_fields(&self) -> &crate::UnknownFields { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 702 | &self.unknown_fields |
| 703 | } |
| 704 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 705 | fn mut_unknown_fields(&mut self) -> &mut crate::UnknownFields { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 706 | &mut self.unknown_fields |
| 707 | } |
| 708 | |
| 709 | fn as_any(&self) -> &dyn (::std::any::Any) { |
| 710 | self as &dyn (::std::any::Any) |
| 711 | } |
| 712 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { |
| 713 | self as &mut dyn (::std::any::Any) |
| 714 | } |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 715 | fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 716 | self |
| 717 | } |
| 718 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 719 | fn descriptor(&self) -> &'static crate::reflect::MessageDescriptor { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 720 | Self::descriptor_static() |
| 721 | } |
| 722 | |
| 723 | fn new() -> CodeGeneratorResponse_File { |
| 724 | CodeGeneratorResponse_File::new() |
| 725 | } |
| 726 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 727 | fn descriptor_static() -> &'static crate::reflect::MessageDescriptor { |
| 728 | static descriptor: crate::rt::LazyV2<crate::reflect::MessageDescriptor> = crate::rt::LazyV2::INIT; |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 729 | descriptor.get(|| { |
| 730 | let mut fields = ::std::vec::Vec::new(); |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 731 | fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 732 | "name", |
| 733 | |m: &CodeGeneratorResponse_File| { &m.name }, |
| 734 | |m: &mut CodeGeneratorResponse_File| { &mut m.name }, |
| 735 | )); |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 736 | fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 737 | "insertion_point", |
| 738 | |m: &CodeGeneratorResponse_File| { &m.insertion_point }, |
| 739 | |m: &mut CodeGeneratorResponse_File| { &mut m.insertion_point }, |
| 740 | )); |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 741 | fields.push(crate::reflect::accessor::make_singular_field_accessor::<_, crate::types::ProtobufTypeString>( |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 742 | "content", |
| 743 | |m: &CodeGeneratorResponse_File| { &m.content }, |
| 744 | |m: &mut CodeGeneratorResponse_File| { &mut m.content }, |
| 745 | )); |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 746 | crate::reflect::MessageDescriptor::new_pb_name::<CodeGeneratorResponse_File>( |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 747 | "CodeGeneratorResponse.File", |
| 748 | fields, |
| 749 | file_descriptor_proto() |
| 750 | ) |
| 751 | }) |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 752 | } |
| 753 | |
| 754 | fn default_instance() -> &'static CodeGeneratorResponse_File { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 755 | static instance: crate::rt::LazyV2<CodeGeneratorResponse_File> = crate::rt::LazyV2::INIT; |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 756 | instance.get(CodeGeneratorResponse_File::new) |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 757 | } |
| 758 | } |
| 759 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 760 | impl crate::Clear for CodeGeneratorResponse_File { |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 761 | fn clear(&mut self) { |
| 762 | self.name.clear(); |
| 763 | self.insertion_point.clear(); |
| 764 | self.content.clear(); |
| 765 | self.unknown_fields.clear(); |
| 766 | } |
| 767 | } |
| 768 | |
| 769 | impl ::std::fmt::Debug for CodeGeneratorResponse_File { |
| 770 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 771 | crate::text_format::fmt(self, f) |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 772 | } |
| 773 | } |
| 774 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 775 | impl crate::reflect::ProtobufValue for CodeGeneratorResponse_File { |
| 776 | fn as_ref(&self) -> crate::reflect::ReflectValueRef { |
| 777 | crate::reflect::ReflectValueRef::Message(self) |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 778 | } |
| 779 | } |
| 780 | |
| 781 | static file_descriptor_proto_data: &'static [u8] = b"\ |
| 782 | \n%google/protobuf/compiler/plugin.proto\x12\x18google.protobuf.compiler\ |
| 783 | \x1a\x20google/protobuf/descriptor.proto\"\xa3\x01\n\x14CodeGeneratorReq\ |
| 784 | uest\x12(\n\x10file_to_generate\x18\x01\x20\x03(\tR\x0efileToGenerate\ |
| 785 | \x12\x1c\n\tparameter\x18\x02\x20\x01(\tR\tparameter\x12C\n\nproto_file\ |
| 786 | \x18\x0f\x20\x03(\x0b2$.google.protobuf.FileDescriptorProtoR\tprotoFile\ |
| 787 | \"\xd6\x01\n\x15CodeGeneratorResponse\x12\x14\n\x05error\x18\x01\x20\x01\ |
| 788 | (\tR\x05error\x12H\n\x04file\x18\x0f\x20\x03(\x0b24.google.protobuf.comp\ |
| 789 | iler.CodeGeneratorResponse.FileR\x04file\x1a]\n\x04File\x12\x12\n\x04nam\ |
| 790 | e\x18\x01\x20\x01(\tR\x04name\x12'\n\x0finsertion_point\x18\x02\x20\x01(\ |
| 791 | \tR\x0einsertionPoint\x12\x18\n\x07content\x18\x0f\x20\x01(\tR\x07conten\ |
| 792 | tB7\n\x1ccom.google.protobuf.compilerB\x0cPluginProtosZ\tplugin_goJ\xd29\ |
| 793 | \n\x07\x12\x05.\0\x95\x01\x01\n\xca\x11\n\x01\x0c\x12\x03.\0\x122\xc1\ |
| 794 | \x0c\x20Protocol\x20Buffers\x20-\x20Google's\x20data\x20interchange\x20f\ |
| 795 | ormat\n\x20Copyright\x202008\x20Google\x20Inc.\x20\x20All\x20rights\x20r\ |
| 796 | eserved.\n\x20https://developers.google.com/protocol-buffers/\n\n\x20Red\ |
| 797 | istribution\x20and\x20use\x20in\x20source\x20and\x20binary\x20forms,\x20\ |
| 798 | with\x20or\x20without\n\x20modification,\x20are\x20permitted\x20provided\ |
| 799 | \x20that\x20the\x20following\x20conditions\x20are\n\x20met:\n\n\x20\x20\ |
| 800 | \x20\x20\x20*\x20Redistributions\x20of\x20source\x20code\x20must\x20reta\ |
| 801 | in\x20the\x20above\x20copyright\n\x20notice,\x20this\x20list\x20of\x20co\ |
| 802 | nditions\x20and\x20the\x20following\x20disclaimer.\n\x20\x20\x20\x20\x20\ |
| 803 | *\x20Redistributions\x20in\x20binary\x20form\x20must\x20reproduce\x20the\ |
| 804 | \x20above\n\x20copyright\x20notice,\x20this\x20list\x20of\x20conditions\ |
| 805 | \x20and\x20the\x20following\x20disclaimer\n\x20in\x20the\x20documentatio\ |
| 806 | n\x20and/or\x20other\x20materials\x20provided\x20with\x20the\n\x20distri\ |
| 807 | bution.\n\x20\x20\x20\x20\x20*\x20Neither\x20the\x20name\x20of\x20Google\ |
| 808 | \x20Inc.\x20nor\x20the\x20names\x20of\x20its\n\x20contributors\x20may\ |
| 809 | \x20be\x20used\x20to\x20endorse\x20or\x20promote\x20products\x20derived\ |
| 810 | \x20from\n\x20this\x20software\x20without\x20specific\x20prior\x20writte\ |
| 811 | n\x20permission.\n\n\x20THIS\x20SOFTWARE\x20IS\x20PROVIDED\x20BY\x20THE\ |
| 812 | \x20COPYRIGHT\x20HOLDERS\x20AND\x20CONTRIBUTORS\n\x20\"AS\x20IS\"\x20AND\ |
| 813 | \x20ANY\x20EXPRESS\x20OR\x20IMPLIED\x20WARRANTIES,\x20INCLUDING,\x20BUT\ |
| 814 | \x20NOT\n\x20LIMITED\x20TO,\x20THE\x20IMPLIED\x20WARRANTIES\x20OF\x20MER\ |
| 815 | CHANTABILITY\x20AND\x20FITNESS\x20FOR\n\x20A\x20PARTICULAR\x20PURPOSE\ |
| 816 | \x20ARE\x20DISCLAIMED.\x20IN\x20NO\x20EVENT\x20SHALL\x20THE\x20COPYRIGHT\ |
| 817 | \n\x20OWNER\x20OR\x20CONTRIBUTORS\x20BE\x20LIABLE\x20FOR\x20ANY\x20DIREC\ |
| 818 | T,\x20INDIRECT,\x20INCIDENTAL,\n\x20SPECIAL,\x20EXEMPLARY,\x20OR\x20CONS\ |
| 819 | EQUENTIAL\x20DAMAGES\x20(INCLUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\ |
| 820 | \x20PROCUREMENT\x20OF\x20SUBSTITUTE\x20GOODS\x20OR\x20SERVICES;\x20LOSS\ |
| 821 | \x20OF\x20USE,\n\x20DATA,\x20OR\x20PROFITS;\x20OR\x20BUSINESS\x20INTERRU\ |
| 822 | PTION)\x20HOWEVER\x20CAUSED\x20AND\x20ON\x20ANY\n\x20THEORY\x20OF\x20LIA\ |
| 823 | BILITY,\x20WHETHER\x20IN\x20CONTRACT,\x20STRICT\x20LIABILITY,\x20OR\x20T\ |
| 824 | ORT\n\x20(INCLUDING\x20NEGLIGENCE\x20OR\x20OTHERWISE)\x20ARISING\x20IN\ |
| 825 | \x20ANY\x20WAY\x20OUT\x20OF\x20THE\x20USE\n\x20OF\x20THIS\x20SOFTWARE,\ |
| 826 | \x20EVEN\x20IF\x20ADVISED\x20OF\x20THE\x20POSSIBILITY\x20OF\x20SUCH\x20D\ |
| 827 | AMAGE.\n2\xfb\x04\x20Author:\x20kenton@google.com\x20(Kenton\x20Varda)\n\ |
| 828 | \n\x20WARNING:\x20\x20The\x20plugin\x20interface\x20is\x20currently\x20E\ |
| 829 | XPERIMENTAL\x20and\x20is\x20subject\x20to\n\x20\x20\x20change.\n\n\x20pr\ |
| 830 | otoc\x20(aka\x20the\x20Protocol\x20Compiler)\x20can\x20be\x20extended\ |
| 831 | \x20via\x20plugins.\x20\x20A\x20plugin\x20is\n\x20just\x20a\x20program\ |
| 832 | \x20that\x20reads\x20a\x20CodeGeneratorRequest\x20from\x20stdin\x20and\ |
| 833 | \x20writes\x20a\n\x20CodeGeneratorResponse\x20to\x20stdout.\n\n\x20Plugi\ |
| 834 | ns\x20written\x20using\x20C++\x20can\x20use\x20google/protobuf/compiler/\ |
| 835 | plugin.h\x20instead\n\x20of\x20dealing\x20with\x20the\x20raw\x20protocol\ |
| 836 | \x20defined\x20here.\n\n\x20A\x20plugin\x20executable\x20needs\x20only\ |
| 837 | \x20to\x20be\x20placed\x20somewhere\x20in\x20the\x20path.\x20\x20The\n\ |
| 838 | \x20plugin\x20should\x20be\x20named\x20\"protoc-gen-$NAME\",\x20and\x20w\ |
| 839 | ill\x20then\x20be\x20used\x20when\x20the\n\x20flag\x20\"--${NAME}_out\"\ |
| 840 | \x20is\x20passed\x20to\x20protoc.\n\n\x08\n\x01\x02\x12\x03/\0!\n\x08\n\ |
| 841 | \x01\x08\x12\x030\05\n\t\n\x02\x08\x01\x12\x030\05\n\x08\n\x01\x08\x12\ |
| 842 | \x031\0-\n\t\n\x02\x08\x08\x12\x031\0-\n\x08\n\x01\x08\x12\x033\0\x20\n\ |
| 843 | \t\n\x02\x08\x0b\x12\x033\0\x20\n\t\n\x02\x03\0\x12\x035\0*\nO\n\x02\x04\ |
| 844 | \0\x12\x048\0M\x01\x1aC\x20An\x20encoded\x20CodeGeneratorRequest\x20is\ |
| 845 | \x20written\x20to\x20the\x20plugin's\x20stdin.\n\n\n\n\x03\x04\0\x01\x12\ |
| 846 | \x038\x08\x1c\n\xd1\x01\n\x04\x04\0\x02\0\x12\x03<\x02'\x1a\xc3\x01\x20T\ |
| 847 | he\x20.proto\x20files\x20that\x20were\x20explicitly\x20listed\x20on\x20t\ |
| 848 | he\x20command-line.\x20\x20The\n\x20code\x20generator\x20should\x20gener\ |
| 849 | ate\x20code\x20only\x20for\x20these\x20files.\x20\x20Each\x20file's\n\ |
| 850 | \x20descriptor\x20will\x20be\x20included\x20in\x20proto_file,\x20below.\ |
| 851 | \n\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03<\x02\n\n\x0c\n\x05\x04\0\x02\0\ |
| 852 | \x05\x12\x03<\x0b\x11\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03<\x12\"\n\x0c\n\ |
| 853 | \x05\x04\0\x02\0\x03\x12\x03<%&\nB\n\x04\x04\0\x02\x01\x12\x03?\x02\x20\ |
| 854 | \x1a5\x20The\x20generator\x20parameter\x20passed\x20on\x20the\x20command\ |
| 855 | -line.\n\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03?\x02\n\n\x0c\n\x05\x04\0\ |
| 856 | \x02\x01\x05\x12\x03?\x0b\x11\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03?\x12\ |
| 857 | \x1b\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03?\x1e\x1f\n\xa9\x05\n\x04\x04\ |
| 858 | \0\x02\x02\x12\x03L\x02/\x1a\x9b\x05\x20FileDescriptorProtos\x20for\x20a\ |
| 859 | ll\x20files\x20in\x20files_to_generate\x20and\x20everything\n\x20they\ |
| 860 | \x20import.\x20\x20The\x20files\x20will\x20appear\x20in\x20topological\ |
| 861 | \x20order,\x20so\x20each\x20file\n\x20appears\x20before\x20any\x20file\ |
| 862 | \x20that\x20imports\x20it.\n\n\x20protoc\x20guarantees\x20that\x20all\ |
| 863 | \x20proto_files\x20will\x20be\x20written\x20after\n\x20the\x20fields\x20\ |
| 864 | above,\x20even\x20though\x20this\x20is\x20not\x20technically\x20guarante\ |
| 865 | ed\x20by\x20the\n\x20protobuf\x20wire\x20format.\x20\x20This\x20theoreti\ |
| 866 | cally\x20could\x20allow\x20a\x20plugin\x20to\x20stream\n\x20in\x20the\ |
| 867 | \x20FileDescriptorProtos\x20and\x20handle\x20them\x20one\x20by\x20one\ |
| 868 | \x20rather\x20than\x20read\n\x20the\x20entire\x20set\x20into\x20memory\ |
| 869 | \x20at\x20once.\x20\x20However,\x20as\x20of\x20this\x20writing,\x20this\ |
| 870 | \n\x20is\x20not\x20similarly\x20optimized\x20on\x20protoc's\x20end\x20--\ |
| 871 | \x20it\x20will\x20store\x20all\x20fields\x20in\n\x20memory\x20at\x20once\ |
| 872 | \x20before\x20sending\x20them\x20to\x20the\x20plugin.\n\n\x0c\n\x05\x04\ |
| 873 | \0\x02\x02\x04\x12\x03L\x02\n\n\x0c\n\x05\x04\0\x02\x02\x06\x12\x03L\x0b\ |
| 874 | \x1e\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03L\x1f)\n\x0c\n\x05\x04\0\x02\ |
| 875 | \x02\x03\x12\x03L,.\nL\n\x02\x04\x01\x12\x05P\0\x95\x01\x01\x1a?\x20The\ |
| 876 | \x20plugin\x20writes\x20an\x20encoded\x20CodeGeneratorResponse\x20to\x20\ |
| 877 | stdout.\n\n\n\n\x03\x04\x01\x01\x12\x03P\x08\x1d\n\xed\x03\n\x04\x04\x01\ |
| 878 | \x02\0\x12\x03Y\x02\x1c\x1a\xdf\x03\x20Error\x20message.\x20\x20If\x20no\ |
| 879 | n-empty,\x20code\x20generation\x20failed.\x20\x20The\x20plugin\x20proces\ |
| 880 | s\n\x20should\x20exit\x20with\x20status\x20code\x20zero\x20even\x20if\ |
| 881 | \x20it\x20reports\x20an\x20error\x20in\x20this\x20way.\n\n\x20This\x20sh\ |
| 882 | ould\x20be\x20used\x20to\x20indicate\x20errors\x20in\x20.proto\x20files\ |
| 883 | \x20which\x20prevent\x20the\n\x20code\x20generator\x20from\x20generating\ |
| 884 | \x20correct\x20code.\x20\x20Errors\x20which\x20indicate\x20a\n\x20proble\ |
| 885 | m\x20in\x20protoc\x20itself\x20--\x20such\x20as\x20the\x20input\x20CodeG\ |
| 886 | eneratorRequest\x20being\n\x20unparseable\x20--\x20should\x20be\x20repor\ |
| 887 | ted\x20by\x20writing\x20a\x20message\x20to\x20stderr\x20and\n\x20exiting\ |
| 888 | \x20with\x20a\x20non-zero\x20status\x20code.\n\n\x0c\n\x05\x04\x01\x02\0\ |
| 889 | \x04\x12\x03Y\x02\n\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03Y\x0b\x11\n\x0c\ |
| 890 | \n\x05\x04\x01\x02\0\x01\x12\x03Y\x12\x17\n\x0c\n\x05\x04\x01\x02\0\x03\ |
| 891 | \x12\x03Y\x1a\x1b\n4\n\x04\x04\x01\x03\0\x12\x05\\\x02\x93\x01\x03\x1a%\ |
| 892 | \x20Represents\x20a\x20single\x20generated\x20file.\n\n\x0c\n\x05\x04\ |
| 893 | \x01\x03\0\x01\x12\x03\\\n\x0e\n\xad\x05\n\x06\x04\x01\x03\0\x02\0\x12\ |
| 894 | \x03h\x04\x1d\x1a\x9d\x05\x20The\x20file\x20name,\x20relative\x20to\x20t\ |
| 895 | he\x20output\x20directory.\x20\x20The\x20name\x20must\x20not\n\x20contai\ |
| 896 | n\x20\".\"\x20or\x20\"..\"\x20components\x20and\x20must\x20be\x20relativ\ |
| 897 | e,\x20not\x20be\x20absolute\x20(so,\n\x20the\x20file\x20cannot\x20lie\ |
| 898 | \x20outside\x20the\x20output\x20directory).\x20\x20\"/\"\x20must\x20be\ |
| 899 | \x20used\x20as\n\x20the\x20path\x20separator,\x20not\x20\"\\\".\n\n\x20I\ |
| 900 | f\x20the\x20name\x20is\x20omitted,\x20the\x20content\x20will\x20be\x20ap\ |
| 901 | pended\x20to\x20the\x20previous\n\x20file.\x20\x20This\x20allows\x20the\ |
| 902 | \x20generator\x20to\x20break\x20large\x20files\x20into\x20small\x20chunk\ |
| 903 | s,\n\x20and\x20allows\x20the\x20generated\x20text\x20to\x20be\x20streame\ |
| 904 | d\x20back\x20to\x20protoc\x20so\x20that\x20large\n\x20files\x20need\x20n\ |
| 905 | ot\x20reside\x20completely\x20in\x20memory\x20at\x20one\x20time.\x20\x20\ |
| 906 | Note\x20that\x20as\x20of\n\x20this\x20writing\x20protoc\x20does\x20not\ |
| 907 | \x20optimize\x20for\x20this\x20--\x20it\x20will\x20read\x20the\x20entire\ |
| 908 | \n\x20CodeGeneratorResponse\x20before\x20writing\x20files\x20to\x20disk.\ |
| 909 | \n\n\x0e\n\x07\x04\x01\x03\0\x02\0\x04\x12\x03h\x04\x0c\n\x0e\n\x07\x04\ |
| 910 | \x01\x03\0\x02\0\x05\x12\x03h\r\x13\n\x0e\n\x07\x04\x01\x03\0\x02\0\x01\ |
| 911 | \x12\x03h\x14\x18\n\x0e\n\x07\x04\x01\x03\0\x02\0\x03\x12\x03h\x1b\x1c\n\ |
| 912 | \xae\x10\n\x06\x04\x01\x03\0\x02\x01\x12\x04\x8f\x01\x04(\x1a\x9d\x10\ |
| 913 | \x20If\x20non-empty,\x20indicates\x20that\x20the\x20named\x20file\x20sho\ |
| 914 | uld\x20already\x20exist,\x20and\x20the\n\x20content\x20here\x20is\x20to\ |
| 915 | \x20be\x20inserted\x20into\x20that\x20file\x20at\x20a\x20defined\x20inse\ |
| 916 | rtion\n\x20point.\x20\x20This\x20feature\x20allows\x20a\x20code\x20gener\ |
| 917 | ator\x20to\x20extend\x20the\x20output\n\x20produced\x20by\x20another\x20\ |
| 918 | code\x20generator.\x20\x20The\x20original\x20generator\x20may\x20provide\ |
| 919 | \n\x20insertion\x20points\x20by\x20placing\x20special\x20annotations\x20\ |
| 920 | in\x20the\x20file\x20that\x20look\n\x20like:\n\x20\x20\x20@@protoc_inser\ |
| 921 | tion_point(NAME)\n\x20The\x20annotation\x20can\x20have\x20arbitrary\x20t\ |
| 922 | ext\x20before\x20and\x20after\x20it\x20on\x20the\x20line,\n\x20which\x20\ |
| 923 | allows\x20it\x20to\x20be\x20placed\x20in\x20a\x20comment.\x20\x20NAME\ |
| 924 | \x20should\x20be\x20replaced\x20with\n\x20an\x20identifier\x20naming\x20\ |
| 925 | the\x20point\x20--\x20this\x20is\x20what\x20other\x20generators\x20will\ |
| 926 | \x20use\n\x20as\x20the\x20insertion_point.\x20\x20Code\x20inserted\x20at\ |
| 927 | \x20this\x20point\x20will\x20be\x20placed\n\x20immediately\x20above\x20t\ |
| 928 | he\x20line\x20containing\x20the\x20insertion\x20point\x20(thus\x20multip\ |
| 929 | le\n\x20insertions\x20to\x20the\x20same\x20point\x20will\x20come\x20out\ |
| 930 | \x20in\x20the\x20order\x20they\x20were\x20added).\n\x20The\x20double-@\ |
| 931 | \x20is\x20intended\x20to\x20make\x20it\x20unlikely\x20that\x20the\x20gen\ |
| 932 | erated\x20code\n\x20could\x20contain\x20things\x20that\x20look\x20like\ |
| 933 | \x20insertion\x20points\x20by\x20accident.\n\n\x20For\x20example,\x20the\ |
| 934 | \x20C++\x20code\x20generator\x20places\x20the\x20following\x20line\x20in\ |
| 935 | \x20the\n\x20.pb.h\x20files\x20that\x20it\x20generates:\n\x20\x20\x20//\ |
| 936 | \x20@@protoc_insertion_point(namespace_scope)\n\x20This\x20line\x20appea\ |
| 937 | rs\x20within\x20the\x20scope\x20of\x20the\x20file's\x20package\x20namesp\ |
| 938 | ace,\x20but\n\x20outside\x20of\x20any\x20particular\x20class.\x20\x20Ano\ |
| 939 | ther\x20plugin\x20can\x20then\x20specify\x20the\n\x20insertion_point\x20\ |
| 940 | \"namespace_scope\"\x20to\x20generate\x20additional\x20classes\x20or\n\ |
| 941 | \x20other\x20declarations\x20that\x20should\x20be\x20placed\x20in\x20thi\ |
| 942 | s\x20scope.\n\n\x20Note\x20that\x20if\x20the\x20line\x20containing\x20th\ |
| 943 | e\x20insertion\x20point\x20begins\x20with\n\x20whitespace,\x20the\x20sam\ |
| 944 | e\x20whitespace\x20will\x20be\x20added\x20to\x20every\x20line\x20of\x20t\ |
| 945 | he\n\x20inserted\x20text.\x20\x20This\x20is\x20useful\x20for\x20language\ |
| 946 | s\x20like\x20Python,\x20where\n\x20indentation\x20matters.\x20\x20In\x20\ |
| 947 | these\x20languages,\x20the\x20insertion\x20point\x20comment\n\x20should\ |
| 948 | \x20be\x20indented\x20the\x20same\x20amount\x20as\x20any\x20inserted\x20\ |
| 949 | code\x20will\x20need\x20to\x20be\n\x20in\x20order\x20to\x20work\x20corre\ |
| 950 | ctly\x20in\x20that\x20context.\n\n\x20The\x20code\x20generator\x20that\ |
| 951 | \x20generates\x20the\x20initial\x20file\x20and\x20the\x20one\x20which\n\ |
| 952 | \x20inserts\x20into\x20it\x20must\x20both\x20run\x20as\x20part\x20of\x20\ |
| 953 | a\x20single\x20invocation\x20of\x20protoc.\n\x20Code\x20generators\x20ar\ |
| 954 | e\x20executed\x20in\x20the\x20order\x20in\x20which\x20they\x20appear\x20\ |
| 955 | on\x20the\n\x20command\x20line.\n\n\x20If\x20|insertion_point|\x20is\x20\ |
| 956 | present,\x20|name|\x20must\x20also\x20be\x20present.\n\n\x0f\n\x07\x04\ |
| 957 | \x01\x03\0\x02\x01\x04\x12\x04\x8f\x01\x04\x0c\n\x0f\n\x07\x04\x01\x03\0\ |
| 958 | \x02\x01\x05\x12\x04\x8f\x01\r\x13\n\x0f\n\x07\x04\x01\x03\0\x02\x01\x01\ |
| 959 | \x12\x04\x8f\x01\x14#\n\x0f\n\x07\x04\x01\x03\0\x02\x01\x03\x12\x04\x8f\ |
| 960 | \x01&'\n$\n\x06\x04\x01\x03\0\x02\x02\x12\x04\x92\x01\x04!\x1a\x14\x20Th\ |
| 961 | e\x20file\x20contents.\n\n\x0f\n\x07\x04\x01\x03\0\x02\x02\x04\x12\x04\ |
| 962 | \x92\x01\x04\x0c\n\x0f\n\x07\x04\x01\x03\0\x02\x02\x05\x12\x04\x92\x01\r\ |
| 963 | \x13\n\x0f\n\x07\x04\x01\x03\0\x02\x02\x01\x12\x04\x92\x01\x14\x1b\n\x0f\ |
| 964 | \n\x07\x04\x01\x03\0\x02\x02\x03\x12\x04\x92\x01\x1e\x20\n\x0c\n\x04\x04\ |
| 965 | \x01\x02\x01\x12\x04\x94\x01\x02\x1a\n\r\n\x05\x04\x01\x02\x01\x04\x12\ |
| 966 | \x04\x94\x01\x02\n\n\r\n\x05\x04\x01\x02\x01\x06\x12\x04\x94\x01\x0b\x0f\ |
| 967 | \n\r\n\x05\x04\x01\x02\x01\x01\x12\x04\x94\x01\x10\x14\n\r\n\x05\x04\x01\ |
| 968 | \x02\x01\x03\x12\x04\x94\x01\x17\x19\ |
| 969 | "; |
| 970 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 971 | static file_descriptor_proto_lazy: crate::rt::LazyV2<crate::descriptor::FileDescriptorProto> = crate::rt::LazyV2::INIT; |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 972 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 973 | fn parse_descriptor_proto() -> crate::descriptor::FileDescriptorProto { |
Haibo Huang | 914311b | 2021-01-07 18:06:15 -0800 | [diff] [blame^] | 974 | crate::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 975 | } |
| 976 | |
Haibo Huang | d32e6ee | 2020-08-12 13:52:04 -0700 | [diff] [blame] | 977 | pub fn file_descriptor_proto() -> &'static crate::descriptor::FileDescriptorProto { |
Haibo Huang | 52aa785 | 2020-07-10 20:23:55 -0700 | [diff] [blame] | 978 | file_descriptor_proto_lazy.get(|| { |
| 979 | parse_descriptor_proto() |
| 980 | }) |
Chih-Hung Hsieh | cfc3a23 | 2020-06-10 20:13:05 -0700 | [diff] [blame] | 981 | } |