1#[derive(Clone, PartialEq, Default)]
5pub struct Version {
6 pub major: Option<i32>,
8 pub minor: Option<i32>,
10 pub patch: Option<i32>,
12 pub suffix: Option<::buffa::alloc::string::String>,
14 #[doc(hidden)]
15 pub __buffa_unknown_fields: ::buffa::UnknownFields,
16 #[doc(hidden)]
17 pub __buffa_cached_size: ::buffa::__private::CachedSize,
18}
19impl ::core::fmt::Debug for Version {
20 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
21 f.debug_struct("Version")
22 .field("major", &self.major)
23 .field("minor", &self.minor)
24 .field("patch", &self.patch)
25 .field("suffix", &self.suffix)
26 .finish()
27 }
28}
29impl Version {
30 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.Version";
35}
36unsafe impl ::buffa::DefaultInstance for Version {
37 fn default_instance() -> &'static Self {
38 static VALUE: ::buffa::__private::OnceBox<Version> = ::buffa::__private::OnceBox::new();
39 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Version::default()))
40 }
41}
42impl ::buffa::Message for Version {
43 fn compute_size(&self) -> u32 {
49 #[allow(unused_imports)]
50 use ::buffa::Enumeration as _;
51 let mut size = 0u32;
52 if let Some(v) = self.major {
53 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
54 }
55 if let Some(v) = self.minor {
56 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
57 }
58 if let Some(v) = self.patch {
59 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
60 }
61 if let Some(ref v) = self.suffix {
62 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
63 }
64 size += self.__buffa_unknown_fields.encoded_len() as u32;
65 self.__buffa_cached_size.set(size);
66 size
67 }
68 fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
69 #[allow(unused_imports)]
70 use ::buffa::Enumeration as _;
71 if let Some(v) = self.major {
72 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
73 .encode(buf);
74 ::buffa::types::encode_int32(v, buf);
75 }
76 if let Some(v) = self.minor {
77 ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
78 .encode(buf);
79 ::buffa::types::encode_int32(v, buf);
80 }
81 if let Some(v) = self.patch {
82 ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
83 .encode(buf);
84 ::buffa::types::encode_int32(v, buf);
85 }
86 if let Some(ref v) = self.suffix {
87 ::buffa::encoding::Tag::new(
88 4u32,
89 ::buffa::encoding::WireType::LengthDelimited,
90 )
91 .encode(buf);
92 ::buffa::types::encode_string(v, buf);
93 }
94 self.__buffa_unknown_fields.write_to(buf);
95 }
96 fn merge_field(
97 &mut self,
98 tag: ::buffa::encoding::Tag,
99 buf: &mut impl ::buffa::bytes::Buf,
100 depth: u32,
101 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
102 #[allow(unused_imports)]
103 use ::buffa::bytes::Buf as _;
104 #[allow(unused_imports)]
105 use ::buffa::Enumeration as _;
106 match tag.field_number() {
107 1u32 => {
108 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
109 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
110 field_number: 1u32,
111 expected: 0u8,
112 actual: tag.wire_type() as u8,
113 });
114 }
115 self.major = ::core::option::Option::Some(
116 ::buffa::types::decode_int32(buf)?,
117 );
118 }
119 2u32 => {
120 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
121 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
122 field_number: 2u32,
123 expected: 0u8,
124 actual: tag.wire_type() as u8,
125 });
126 }
127 self.minor = ::core::option::Option::Some(
128 ::buffa::types::decode_int32(buf)?,
129 );
130 }
131 3u32 => {
132 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
133 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
134 field_number: 3u32,
135 expected: 0u8,
136 actual: tag.wire_type() as u8,
137 });
138 }
139 self.patch = ::core::option::Option::Some(
140 ::buffa::types::decode_int32(buf)?,
141 );
142 }
143 4u32 => {
144 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
145 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
146 field_number: 4u32,
147 expected: 2u8,
148 actual: tag.wire_type() as u8,
149 });
150 }
151 ::buffa::types::merge_string(
152 self.suffix.get_or_insert_with(::buffa::alloc::string::String::new),
153 buf,
154 )?;
155 }
156 _ => {
157 self.__buffa_unknown_fields
158 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
159 }
160 }
161 ::core::result::Result::Ok(())
162 }
163 fn cached_size(&self) -> u32 {
164 self.__buffa_cached_size.get()
165 }
166 fn clear(&mut self) {
167 self.major = ::core::option::Option::None;
168 self.minor = ::core::option::Option::None;
169 self.patch = ::core::option::Option::None;
170 self.suffix = ::core::option::Option::None;
171 self.__buffa_unknown_fields.clear();
172 self.__buffa_cached_size.set(0);
173 }
174}
175#[derive(Clone, PartialEq, Default)]
176pub struct CodeGeneratorRequest {
177 pub file_to_generate: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
179 pub parameter: Option<::buffa::alloc::string::String>,
181 pub proto_file: ::buffa::alloc::vec::Vec<super::FileDescriptorProto>,
183 pub source_file_descriptors: ::buffa::alloc::vec::Vec<super::FileDescriptorProto>,
185 pub compiler_version: ::buffa::MessageField<Version>,
187 #[doc(hidden)]
188 pub __buffa_unknown_fields: ::buffa::UnknownFields,
189 #[doc(hidden)]
190 pub __buffa_cached_size: ::buffa::__private::CachedSize,
191}
192impl ::core::fmt::Debug for CodeGeneratorRequest {
193 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
194 f.debug_struct("CodeGeneratorRequest")
195 .field("file_to_generate", &self.file_to_generate)
196 .field("parameter", &self.parameter)
197 .field("proto_file", &self.proto_file)
198 .field("source_file_descriptors", &self.source_file_descriptors)
199 .field("compiler_version", &self.compiler_version)
200 .finish()
201 }
202}
203impl CodeGeneratorRequest {
204 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorRequest";
209}
210unsafe impl ::buffa::DefaultInstance for CodeGeneratorRequest {
211 fn default_instance() -> &'static Self {
212 static VALUE: ::buffa::__private::OnceBox<CodeGeneratorRequest> = ::buffa::__private::OnceBox::new();
213 VALUE
214 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
215 CodeGeneratorRequest::default(),
216 ))
217 }
218}
219impl ::buffa::Message for CodeGeneratorRequest {
220 fn compute_size(&self) -> u32 {
226 #[allow(unused_imports)]
227 use ::buffa::Enumeration as _;
228 let mut size = 0u32;
229 if let Some(ref v) = self.parameter {
230 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
231 }
232 if self.compiler_version.is_set() {
233 let inner_size = self.compiler_version.compute_size();
234 size
235 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
236 + inner_size;
237 }
238 for v in &self.file_to_generate {
239 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
240 }
241 for v in &self.proto_file {
242 let inner_size = v.compute_size();
243 size
244 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
245 + inner_size;
246 }
247 for v in &self.source_file_descriptors {
248 let inner_size = v.compute_size();
249 size
250 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
251 + inner_size;
252 }
253 size += self.__buffa_unknown_fields.encoded_len() as u32;
254 self.__buffa_cached_size.set(size);
255 size
256 }
257 fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
258 #[allow(unused_imports)]
259 use ::buffa::Enumeration as _;
260 if let Some(ref v) = self.parameter {
261 ::buffa::encoding::Tag::new(
262 2u32,
263 ::buffa::encoding::WireType::LengthDelimited,
264 )
265 .encode(buf);
266 ::buffa::types::encode_string(v, buf);
267 }
268 if self.compiler_version.is_set() {
269 ::buffa::encoding::Tag::new(
270 3u32,
271 ::buffa::encoding::WireType::LengthDelimited,
272 )
273 .encode(buf);
274 ::buffa::encoding::encode_varint(
275 self.compiler_version.cached_size() as u64,
276 buf,
277 );
278 self.compiler_version.write_to(buf);
279 }
280 for v in &self.file_to_generate {
281 ::buffa::encoding::Tag::new(
282 1u32,
283 ::buffa::encoding::WireType::LengthDelimited,
284 )
285 .encode(buf);
286 ::buffa::types::encode_string(v, buf);
287 }
288 for v in &self.proto_file {
289 ::buffa::encoding::Tag::new(
290 15u32,
291 ::buffa::encoding::WireType::LengthDelimited,
292 )
293 .encode(buf);
294 ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
295 v.write_to(buf);
296 }
297 for v in &self.source_file_descriptors {
298 ::buffa::encoding::Tag::new(
299 17u32,
300 ::buffa::encoding::WireType::LengthDelimited,
301 )
302 .encode(buf);
303 ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
304 v.write_to(buf);
305 }
306 self.__buffa_unknown_fields.write_to(buf);
307 }
308 fn merge_field(
309 &mut self,
310 tag: ::buffa::encoding::Tag,
311 buf: &mut impl ::buffa::bytes::Buf,
312 depth: u32,
313 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
314 #[allow(unused_imports)]
315 use ::buffa::bytes::Buf as _;
316 #[allow(unused_imports)]
317 use ::buffa::Enumeration as _;
318 match tag.field_number() {
319 2u32 => {
320 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
321 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
322 field_number: 2u32,
323 expected: 2u8,
324 actual: tag.wire_type() as u8,
325 });
326 }
327 ::buffa::types::merge_string(
328 self
329 .parameter
330 .get_or_insert_with(::buffa::alloc::string::String::new),
331 buf,
332 )?;
333 }
334 3u32 => {
335 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
336 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
337 field_number: 3u32,
338 expected: 2u8,
339 actual: tag.wire_type() as u8,
340 });
341 }
342 ::buffa::Message::merge_length_delimited(
343 self.compiler_version.get_or_insert_default(),
344 buf,
345 depth,
346 )?;
347 }
348 1u32 => {
349 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
350 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
351 field_number: 1u32,
352 expected: 2u8,
353 actual: tag.wire_type() as u8,
354 });
355 }
356 self.file_to_generate.push(::buffa::types::decode_string(buf)?);
357 }
358 15u32 => {
359 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
360 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
361 field_number: 15u32,
362 expected: 2u8,
363 actual: tag.wire_type() as u8,
364 });
365 }
366 let mut elem = ::core::default::Default::default();
367 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
368 self.proto_file.push(elem);
369 }
370 17u32 => {
371 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
372 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
373 field_number: 17u32,
374 expected: 2u8,
375 actual: tag.wire_type() as u8,
376 });
377 }
378 let mut elem = ::core::default::Default::default();
379 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
380 self.source_file_descriptors.push(elem);
381 }
382 _ => {
383 self.__buffa_unknown_fields
384 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
385 }
386 }
387 ::core::result::Result::Ok(())
388 }
389 fn cached_size(&self) -> u32 {
390 self.__buffa_cached_size.get()
391 }
392 fn clear(&mut self) {
393 self.parameter = ::core::option::Option::None;
394 self.compiler_version = ::buffa::MessageField::none();
395 self.file_to_generate.clear();
396 self.proto_file.clear();
397 self.source_file_descriptors.clear();
398 self.__buffa_unknown_fields.clear();
399 self.__buffa_cached_size.set(0);
400 }
401}
402#[derive(Clone, PartialEq, Default)]
403pub struct CodeGeneratorResponse {
404 pub error: Option<::buffa::alloc::string::String>,
406 pub supported_features: Option<u64>,
408 pub minimum_edition: Option<i32>,
410 pub maximum_edition: Option<i32>,
412 pub file: ::buffa::alloc::vec::Vec<code_generator_response::File>,
414 #[doc(hidden)]
415 pub __buffa_unknown_fields: ::buffa::UnknownFields,
416 #[doc(hidden)]
417 pub __buffa_cached_size: ::buffa::__private::CachedSize,
418}
419impl ::core::fmt::Debug for CodeGeneratorResponse {
420 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
421 f.debug_struct("CodeGeneratorResponse")
422 .field("error", &self.error)
423 .field("supported_features", &self.supported_features)
424 .field("minimum_edition", &self.minimum_edition)
425 .field("maximum_edition", &self.maximum_edition)
426 .field("file", &self.file)
427 .finish()
428 }
429}
430impl CodeGeneratorResponse {
431 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse";
436}
437unsafe impl ::buffa::DefaultInstance for CodeGeneratorResponse {
438 fn default_instance() -> &'static Self {
439 static VALUE: ::buffa::__private::OnceBox<CodeGeneratorResponse> = ::buffa::__private::OnceBox::new();
440 VALUE
441 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
442 CodeGeneratorResponse::default(),
443 ))
444 }
445}
446impl ::buffa::Message for CodeGeneratorResponse {
447 fn compute_size(&self) -> u32 {
453 #[allow(unused_imports)]
454 use ::buffa::Enumeration as _;
455 let mut size = 0u32;
456 if let Some(ref v) = self.error {
457 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
458 }
459 if let Some(v) = self.supported_features {
460 size += 1u32 + ::buffa::types::uint64_encoded_len(v) as u32;
461 }
462 if let Some(v) = self.minimum_edition {
463 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
464 }
465 if let Some(v) = self.maximum_edition {
466 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
467 }
468 for v in &self.file {
469 let inner_size = v.compute_size();
470 size
471 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
472 + inner_size;
473 }
474 size += self.__buffa_unknown_fields.encoded_len() as u32;
475 self.__buffa_cached_size.set(size);
476 size
477 }
478 fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
479 #[allow(unused_imports)]
480 use ::buffa::Enumeration as _;
481 if let Some(ref v) = self.error {
482 ::buffa::encoding::Tag::new(
483 1u32,
484 ::buffa::encoding::WireType::LengthDelimited,
485 )
486 .encode(buf);
487 ::buffa::types::encode_string(v, buf);
488 }
489 if let Some(v) = self.supported_features {
490 ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
491 .encode(buf);
492 ::buffa::types::encode_uint64(v, buf);
493 }
494 if let Some(v) = self.minimum_edition {
495 ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
496 .encode(buf);
497 ::buffa::types::encode_int32(v, buf);
498 }
499 if let Some(v) = self.maximum_edition {
500 ::buffa::encoding::Tag::new(4u32, ::buffa::encoding::WireType::Varint)
501 .encode(buf);
502 ::buffa::types::encode_int32(v, buf);
503 }
504 for v in &self.file {
505 ::buffa::encoding::Tag::new(
506 15u32,
507 ::buffa::encoding::WireType::LengthDelimited,
508 )
509 .encode(buf);
510 ::buffa::encoding::encode_varint(v.cached_size() as u64, buf);
511 v.write_to(buf);
512 }
513 self.__buffa_unknown_fields.write_to(buf);
514 }
515 fn merge_field(
516 &mut self,
517 tag: ::buffa::encoding::Tag,
518 buf: &mut impl ::buffa::bytes::Buf,
519 depth: u32,
520 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
521 #[allow(unused_imports)]
522 use ::buffa::bytes::Buf as _;
523 #[allow(unused_imports)]
524 use ::buffa::Enumeration as _;
525 match tag.field_number() {
526 1u32 => {
527 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
528 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
529 field_number: 1u32,
530 expected: 2u8,
531 actual: tag.wire_type() as u8,
532 });
533 }
534 ::buffa::types::merge_string(
535 self.error.get_or_insert_with(::buffa::alloc::string::String::new),
536 buf,
537 )?;
538 }
539 2u32 => {
540 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
541 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
542 field_number: 2u32,
543 expected: 0u8,
544 actual: tag.wire_type() as u8,
545 });
546 }
547 self.supported_features = ::core::option::Option::Some(
548 ::buffa::types::decode_uint64(buf)?,
549 );
550 }
551 3u32 => {
552 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
553 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
554 field_number: 3u32,
555 expected: 0u8,
556 actual: tag.wire_type() as u8,
557 });
558 }
559 self.minimum_edition = ::core::option::Option::Some(
560 ::buffa::types::decode_int32(buf)?,
561 );
562 }
563 4u32 => {
564 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
565 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
566 field_number: 4u32,
567 expected: 0u8,
568 actual: tag.wire_type() as u8,
569 });
570 }
571 self.maximum_edition = ::core::option::Option::Some(
572 ::buffa::types::decode_int32(buf)?,
573 );
574 }
575 15u32 => {
576 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
577 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
578 field_number: 15u32,
579 expected: 2u8,
580 actual: tag.wire_type() as u8,
581 });
582 }
583 let mut elem = ::core::default::Default::default();
584 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
585 self.file.push(elem);
586 }
587 _ => {
588 self.__buffa_unknown_fields
589 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
590 }
591 }
592 ::core::result::Result::Ok(())
593 }
594 fn cached_size(&self) -> u32 {
595 self.__buffa_cached_size.get()
596 }
597 fn clear(&mut self) {
598 self.error = ::core::option::Option::None;
599 self.supported_features = ::core::option::Option::None;
600 self.minimum_edition = ::core::option::Option::None;
601 self.maximum_edition = ::core::option::Option::None;
602 self.file.clear();
603 self.__buffa_unknown_fields.clear();
604 self.__buffa_cached_size.set(0);
605 }
606}
607pub mod code_generator_response {
608 #[allow(unused_imports)]
609 use super::*;
610 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
611 #[repr(i32)]
612 pub enum Feature {
613 FEATURE_NONE = 0i32,
614 FEATURE_PROTO3_OPTIONAL = 1i32,
615 FEATURE_SUPPORTS_EDITIONS = 2i32,
616 }
617 impl ::core::default::Default for Feature {
618 fn default() -> Self {
619 Self::FEATURE_NONE
620 }
621 }
622 impl ::buffa::Enumeration for Feature {
623 fn from_i32(value: i32) -> ::core::option::Option<Self> {
624 match value {
625 0i32 => ::core::option::Option::Some(Self::FEATURE_NONE),
626 1i32 => ::core::option::Option::Some(Self::FEATURE_PROTO3_OPTIONAL),
627 2i32 => ::core::option::Option::Some(Self::FEATURE_SUPPORTS_EDITIONS),
628 _ => ::core::option::Option::None,
629 }
630 }
631 fn to_i32(&self) -> i32 {
632 *self as i32
633 }
634 fn proto_name(&self) -> &'static str {
635 match self {
636 Self::FEATURE_NONE => "FEATURE_NONE",
637 Self::FEATURE_PROTO3_OPTIONAL => "FEATURE_PROTO3_OPTIONAL",
638 Self::FEATURE_SUPPORTS_EDITIONS => "FEATURE_SUPPORTS_EDITIONS",
639 }
640 }
641 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
642 match name {
643 "FEATURE_NONE" => ::core::option::Option::Some(Self::FEATURE_NONE),
644 "FEATURE_PROTO3_OPTIONAL" => {
645 ::core::option::Option::Some(Self::FEATURE_PROTO3_OPTIONAL)
646 }
647 "FEATURE_SUPPORTS_EDITIONS" => {
648 ::core::option::Option::Some(Self::FEATURE_SUPPORTS_EDITIONS)
649 }
650 _ => ::core::option::Option::None,
651 }
652 }
653 }
654 #[derive(Clone, PartialEq, Default)]
655 pub struct File {
656 pub name: Option<::buffa::alloc::string::String>,
658 pub insertion_point: Option<::buffa::alloc::string::String>,
660 pub content: Option<::buffa::alloc::string::String>,
662 pub generated_code_info: ::buffa::MessageField<super::GeneratedCodeInfo>,
664 #[doc(hidden)]
665 pub __buffa_unknown_fields: ::buffa::UnknownFields,
666 #[doc(hidden)]
667 pub __buffa_cached_size: ::buffa::__private::CachedSize,
668 }
669 impl ::core::fmt::Debug for File {
670 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
671 f.debug_struct("File")
672 .field("name", &self.name)
673 .field("insertion_point", &self.insertion_point)
674 .field("content", &self.content)
675 .field("generated_code_info", &self.generated_code_info)
676 .finish()
677 }
678 }
679 impl File {
680 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse.File";
685 }
686 unsafe impl ::buffa::DefaultInstance for File {
687 fn default_instance() -> &'static Self {
688 static VALUE: ::buffa::__private::OnceBox<File> = ::buffa::__private::OnceBox::new();
689 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(File::default()))
690 }
691 }
692 impl ::buffa::Message for File {
693 fn compute_size(&self) -> u32 {
699 #[allow(unused_imports)]
700 use ::buffa::Enumeration as _;
701 let mut size = 0u32;
702 if let Some(ref v) = self.name {
703 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
704 }
705 if let Some(ref v) = self.insertion_point {
706 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
707 }
708 if let Some(ref v) = self.content {
709 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
710 }
711 if self.generated_code_info.is_set() {
712 let inner_size = self.generated_code_info.compute_size();
713 size
714 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
715 + inner_size;
716 }
717 size += self.__buffa_unknown_fields.encoded_len() as u32;
718 self.__buffa_cached_size.set(size);
719 size
720 }
721 fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
722 #[allow(unused_imports)]
723 use ::buffa::Enumeration as _;
724 if let Some(ref v) = self.name {
725 ::buffa::encoding::Tag::new(
726 1u32,
727 ::buffa::encoding::WireType::LengthDelimited,
728 )
729 .encode(buf);
730 ::buffa::types::encode_string(v, buf);
731 }
732 if let Some(ref v) = self.insertion_point {
733 ::buffa::encoding::Tag::new(
734 2u32,
735 ::buffa::encoding::WireType::LengthDelimited,
736 )
737 .encode(buf);
738 ::buffa::types::encode_string(v, buf);
739 }
740 if let Some(ref v) = self.content {
741 ::buffa::encoding::Tag::new(
742 15u32,
743 ::buffa::encoding::WireType::LengthDelimited,
744 )
745 .encode(buf);
746 ::buffa::types::encode_string(v, buf);
747 }
748 if self.generated_code_info.is_set() {
749 ::buffa::encoding::Tag::new(
750 16u32,
751 ::buffa::encoding::WireType::LengthDelimited,
752 )
753 .encode(buf);
754 ::buffa::encoding::encode_varint(
755 self.generated_code_info.cached_size() as u64,
756 buf,
757 );
758 self.generated_code_info.write_to(buf);
759 }
760 self.__buffa_unknown_fields.write_to(buf);
761 }
762 fn merge_field(
763 &mut self,
764 tag: ::buffa::encoding::Tag,
765 buf: &mut impl ::buffa::bytes::Buf,
766 depth: u32,
767 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
768 #[allow(unused_imports)]
769 use ::buffa::bytes::Buf as _;
770 #[allow(unused_imports)]
771 use ::buffa::Enumeration as _;
772 match tag.field_number() {
773 1u32 => {
774 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
775 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
776 field_number: 1u32,
777 expected: 2u8,
778 actual: tag.wire_type() as u8,
779 });
780 }
781 ::buffa::types::merge_string(
782 self
783 .name
784 .get_or_insert_with(::buffa::alloc::string::String::new),
785 buf,
786 )?;
787 }
788 2u32 => {
789 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
790 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
791 field_number: 2u32,
792 expected: 2u8,
793 actual: tag.wire_type() as u8,
794 });
795 }
796 ::buffa::types::merge_string(
797 self
798 .insertion_point
799 .get_or_insert_with(::buffa::alloc::string::String::new),
800 buf,
801 )?;
802 }
803 15u32 => {
804 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
805 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
806 field_number: 15u32,
807 expected: 2u8,
808 actual: tag.wire_type() as u8,
809 });
810 }
811 ::buffa::types::merge_string(
812 self
813 .content
814 .get_or_insert_with(::buffa::alloc::string::String::new),
815 buf,
816 )?;
817 }
818 16u32 => {
819 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
820 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
821 field_number: 16u32,
822 expected: 2u8,
823 actual: tag.wire_type() as u8,
824 });
825 }
826 ::buffa::Message::merge_length_delimited(
827 self.generated_code_info.get_or_insert_default(),
828 buf,
829 depth,
830 )?;
831 }
832 _ => {
833 self.__buffa_unknown_fields
834 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
835 }
836 }
837 ::core::result::Result::Ok(())
838 }
839 fn cached_size(&self) -> u32 {
840 self.__buffa_cached_size.get()
841 }
842 fn clear(&mut self) {
843 self.name = ::core::option::Option::None;
844 self.insertion_point = ::core::option::Option::None;
845 self.content = ::core::option::Option::None;
846 self.generated_code_info = ::buffa::MessageField::none();
847 self.__buffa_unknown_fields.clear();
848 self.__buffa_cached_size.set(0);
849 }
850 }
851}