1#[derive(Clone, PartialEq, Default)]
6#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
7#[cfg_attr(feature = "json", serde(default))]
8#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
9pub struct Version {
10 #[cfg_attr(
12 feature = "json",
13 serde(
14 rename = "major",
15 with = "::buffa::json_helpers::opt_int32",
16 skip_serializing_if = "::core::option::Option::is_none"
17 )
18 )]
19 pub major: ::core::option::Option<i32>,
20 #[cfg_attr(
22 feature = "json",
23 serde(
24 rename = "minor",
25 with = "::buffa::json_helpers::opt_int32",
26 skip_serializing_if = "::core::option::Option::is_none"
27 )
28 )]
29 pub minor: ::core::option::Option<i32>,
30 #[cfg_attr(
32 feature = "json",
33 serde(
34 rename = "patch",
35 with = "::buffa::json_helpers::opt_int32",
36 skip_serializing_if = "::core::option::Option::is_none"
37 )
38 )]
39 pub patch: ::core::option::Option<i32>,
40 #[cfg_attr(
45 feature = "json",
46 serde(rename = "suffix", skip_serializing_if = "::core::option::Option::is_none")
47 )]
48 pub suffix: ::core::option::Option<::buffa::alloc::string::String>,
49 #[cfg_attr(feature = "json", serde(skip))]
50 #[doc(hidden)]
51 pub __buffa_unknown_fields: ::buffa::UnknownFields,
52}
53impl ::core::fmt::Debug for Version {
54 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
55 f.debug_struct("Version")
56 .field("major", &self.major)
57 .field("minor", &self.minor)
58 .field("patch", &self.patch)
59 .field("suffix", &self.suffix)
60 .finish()
61 }
62}
63impl Version {
64 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.Version";
69}
70impl Version {
71 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
72 #[inline]
73 pub fn with_major(mut self, value: i32) -> Self {
75 self.major = Some(value);
76 self
77 }
78 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
79 #[inline]
80 pub fn with_minor(mut self, value: i32) -> Self {
82 self.minor = Some(value);
83 self
84 }
85 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
86 #[inline]
87 pub fn with_patch(mut self, value: i32) -> Self {
89 self.patch = Some(value);
90 self
91 }
92 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
93 #[inline]
94 pub fn with_suffix(
96 mut self,
97 value: impl Into<::buffa::alloc::string::String>,
98 ) -> Self {
99 self.suffix = Some(value.into());
100 self
101 }
102}
103impl ::buffa::DefaultInstance for Version {
104 fn default_instance() -> &'static Self {
105 static VALUE: ::buffa::__private::OnceBox<Version> = ::buffa::__private::OnceBox::new();
106 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
107 }
108}
109impl ::buffa::MessageName for Version {
110 const PACKAGE: &'static str = "google.protobuf.compiler";
111 const NAME: &'static str = "Version";
112 const FULL_NAME: &'static str = "google.protobuf.compiler.Version";
113 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.Version";
114}
115impl ::buffa::Message for Version {
116 #[allow(clippy::let_and_return)]
122 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
123 #[allow(unused_imports)]
124 use ::buffa::Enumeration as _;
125 let mut size = 0u32;
126 if let Some(v) = self.major {
127 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
128 }
129 if let Some(v) = self.minor {
130 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
131 }
132 if let Some(v) = self.patch {
133 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
134 }
135 if let Some(ref v) = self.suffix {
136 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
137 }
138 size += self.__buffa_unknown_fields.encoded_len() as u32;
139 size
140 }
141 fn write_to(
142 &self,
143 _cache: &mut ::buffa::SizeCache,
144 buf: &mut impl ::buffa::bytes::BufMut,
145 ) {
146 #[allow(unused_imports)]
147 use ::buffa::Enumeration as _;
148 if let Some(v) = self.major {
149 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
150 .encode(buf);
151 ::buffa::types::encode_int32(v, buf);
152 }
153 if let Some(v) = self.minor {
154 ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
155 .encode(buf);
156 ::buffa::types::encode_int32(v, buf);
157 }
158 if let Some(v) = self.patch {
159 ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
160 .encode(buf);
161 ::buffa::types::encode_int32(v, buf);
162 }
163 if let Some(ref v) = self.suffix {
164 ::buffa::encoding::Tag::new(
165 4u32,
166 ::buffa::encoding::WireType::LengthDelimited,
167 )
168 .encode(buf);
169 ::buffa::types::encode_string(v, buf);
170 }
171 self.__buffa_unknown_fields.write_to(buf);
172 }
173 fn merge_field(
174 &mut self,
175 tag: ::buffa::encoding::Tag,
176 buf: &mut impl ::buffa::bytes::Buf,
177 depth: u32,
178 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
179 #[allow(unused_imports)]
180 use ::buffa::bytes::Buf as _;
181 #[allow(unused_imports)]
182 use ::buffa::Enumeration as _;
183 match tag.field_number() {
184 1u32 => {
185 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
186 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
187 field_number: 1u32,
188 expected: 0u8,
189 actual: tag.wire_type() as u8,
190 });
191 }
192 self.major = ::core::option::Option::Some(
193 ::buffa::types::decode_int32(buf)?,
194 );
195 }
196 2u32 => {
197 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
198 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
199 field_number: 2u32,
200 expected: 0u8,
201 actual: tag.wire_type() as u8,
202 });
203 }
204 self.minor = ::core::option::Option::Some(
205 ::buffa::types::decode_int32(buf)?,
206 );
207 }
208 3u32 => {
209 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
210 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
211 field_number: 3u32,
212 expected: 0u8,
213 actual: tag.wire_type() as u8,
214 });
215 }
216 self.patch = ::core::option::Option::Some(
217 ::buffa::types::decode_int32(buf)?,
218 );
219 }
220 4u32 => {
221 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
222 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
223 field_number: 4u32,
224 expected: 2u8,
225 actual: tag.wire_type() as u8,
226 });
227 }
228 ::buffa::types::merge_string(
229 self.suffix.get_or_insert_with(::buffa::alloc::string::String::new),
230 buf,
231 )?;
232 }
233 _ => {
234 self.__buffa_unknown_fields
235 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
236 }
237 }
238 ::core::result::Result::Ok(())
239 }
240 fn clear(&mut self) {
241 self.major = ::core::option::Option::None;
242 self.minor = ::core::option::Option::None;
243 self.patch = ::core::option::Option::None;
244 self.suffix = ::core::option::Option::None;
245 self.__buffa_unknown_fields.clear();
246 }
247}
248impl ::buffa::ExtensionSet for Version {
249 const PROTO_FQN: &'static str = "google.protobuf.compiler.Version";
250 fn unknown_fields(&self) -> &::buffa::UnknownFields {
251 &self.__buffa_unknown_fields
252 }
253 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
254 &mut self.__buffa_unknown_fields
255 }
256}
257#[cfg(feature = "text")]
258impl ::buffa::text::TextFormat for Version {
259 fn encode_text(
260 &self,
261 enc: &mut ::buffa::text::TextEncoder<'_>,
262 ) -> ::core::fmt::Result {
263 #[allow(unused_imports)]
264 use ::buffa::Enumeration as _;
265 if let ::core::option::Option::Some(ref __v) = self.major {
266 enc.write_field_name("major")?;
267 enc.write_i32(*__v)?;
268 }
269 if let ::core::option::Option::Some(ref __v) = self.minor {
270 enc.write_field_name("minor")?;
271 enc.write_i32(*__v)?;
272 }
273 if let ::core::option::Option::Some(ref __v) = self.patch {
274 enc.write_field_name("patch")?;
275 enc.write_i32(*__v)?;
276 }
277 if let ::core::option::Option::Some(ref __v) = self.suffix {
278 enc.write_field_name("suffix")?;
279 enc.write_string(__v)?;
280 }
281 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
282 ::core::result::Result::Ok(())
283 }
284 fn merge_text(
285 &mut self,
286 dec: &mut ::buffa::text::TextDecoder<'_>,
287 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
288 #[allow(unused_imports)]
289 use ::buffa::Enumeration as _;
290 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
291 match __name {
292 "major" => self.major = ::core::option::Option::Some(dec.read_i32()?),
293 "minor" => self.minor = ::core::option::Option::Some(dec.read_i32()?),
294 "patch" => self.patch = ::core::option::Option::Some(dec.read_i32()?),
295 "suffix" => {
296 self.suffix = ::core::option::Option::Some(
297 dec.read_string()?.into_owned(),
298 );
299 }
300 _ => dec.skip_value()?,
301 }
302 }
303 ::core::result::Result::Ok(())
304 }
305}
306#[cfg(feature = "json")]
307impl ::buffa::json_helpers::ProtoElemJson for Version {
308 fn serialize_proto_json<S: ::serde::Serializer>(
309 v: &Self,
310 s: S,
311 ) -> ::core::result::Result<S::Ok, S::Error> {
312 ::serde::Serialize::serialize(v, s)
313 }
314 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
315 d: D,
316 ) -> ::core::result::Result<Self, D::Error> {
317 <Self as ::serde::Deserialize>::deserialize(d)
318 }
319}
320#[cfg(feature = "json")]
321#[doc(hidden)]
322pub const __VERSION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
323 type_url: "type.googleapis.com/google.protobuf.compiler.Version",
324 to_json: ::buffa::type_registry::any_to_json::<Version>,
325 from_json: ::buffa::type_registry::any_from_json::<Version>,
326 is_wkt: false,
327};
328#[cfg(feature = "text")]
329#[doc(hidden)]
330pub const __VERSION_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
331 type_url: "type.googleapis.com/google.protobuf.compiler.Version",
332 text_encode: ::buffa::type_registry::any_encode_text::<Version>,
333 text_merge: ::buffa::type_registry::any_merge_text::<Version>,
334};
335#[derive(Clone, PartialEq, Default)]
337#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
338#[cfg_attr(feature = "json", serde(default))]
339#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
340pub struct CodeGeneratorRequest {
341 #[cfg_attr(
347 feature = "json",
348 serde(
349 rename = "fileToGenerate",
350 alias = "file_to_generate",
351 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
352 deserialize_with = "::buffa::json_helpers::null_as_default"
353 )
354 )]
355 pub file_to_generate: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
356 #[cfg_attr(
360 feature = "json",
361 serde(
362 rename = "parameter",
363 skip_serializing_if = "::core::option::Option::is_none"
364 )
365 )]
366 pub parameter: ::core::option::Option<::buffa::alloc::string::String>,
367 #[cfg_attr(
389 feature = "json",
390 serde(
391 rename = "protoFile",
392 alias = "proto_file",
393 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
394 deserialize_with = "::buffa::json_helpers::null_as_default"
395 )
396 )]
397 pub proto_file: ::buffa::alloc::vec::Vec<super::FileDescriptorProto>,
398 #[cfg_attr(
404 feature = "json",
405 serde(
406 rename = "sourceFileDescriptors",
407 alias = "source_file_descriptors",
408 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
409 deserialize_with = "::buffa::json_helpers::null_as_default"
410 )
411 )]
412 pub source_file_descriptors: ::buffa::alloc::vec::Vec<super::FileDescriptorProto>,
413 #[cfg_attr(
417 feature = "json",
418 serde(
419 rename = "compilerVersion",
420 alias = "compiler_version",
421 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
422 )
423 )]
424 pub compiler_version: ::buffa::MessageField<Version>,
425 #[cfg_attr(feature = "json", serde(skip))]
426 #[doc(hidden)]
427 pub __buffa_unknown_fields: ::buffa::UnknownFields,
428}
429impl ::core::fmt::Debug for CodeGeneratorRequest {
430 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
431 f.debug_struct("CodeGeneratorRequest")
432 .field("file_to_generate", &self.file_to_generate)
433 .field("parameter", &self.parameter)
434 .field("proto_file", &self.proto_file)
435 .field("source_file_descriptors", &self.source_file_descriptors)
436 .field("compiler_version", &self.compiler_version)
437 .finish()
438 }
439}
440impl CodeGeneratorRequest {
441 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorRequest";
446}
447impl CodeGeneratorRequest {
448 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
449 #[inline]
450 pub fn with_parameter(
452 mut self,
453 value: impl Into<::buffa::alloc::string::String>,
454 ) -> Self {
455 self.parameter = Some(value.into());
456 self
457 }
458}
459impl ::buffa::DefaultInstance for CodeGeneratorRequest {
460 fn default_instance() -> &'static Self {
461 static VALUE: ::buffa::__private::OnceBox<CodeGeneratorRequest> = ::buffa::__private::OnceBox::new();
462 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
463 }
464}
465impl ::buffa::MessageName for CodeGeneratorRequest {
466 const PACKAGE: &'static str = "google.protobuf.compiler";
467 const NAME: &'static str = "CodeGeneratorRequest";
468 const FULL_NAME: &'static str = "google.protobuf.compiler.CodeGeneratorRequest";
469 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorRequest";
470}
471impl ::buffa::Message for CodeGeneratorRequest {
472 #[allow(clippy::let_and_return)]
478 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
479 #[allow(unused_imports)]
480 use ::buffa::Enumeration as _;
481 let mut size = 0u32;
482 for v in &self.file_to_generate {
483 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
484 }
485 if let Some(ref v) = self.parameter {
486 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
487 }
488 if self.compiler_version.is_set() {
489 let __slot = __cache.reserve();
490 let inner_size = self.compiler_version.compute_size(__cache);
491 __cache.set(__slot, inner_size);
492 size
493 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
494 + inner_size;
495 }
496 for v in &self.proto_file {
497 let __slot = __cache.reserve();
498 let inner_size = v.compute_size(__cache);
499 __cache.set(__slot, inner_size);
500 size
501 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
502 + inner_size;
503 }
504 for v in &self.source_file_descriptors {
505 let __slot = __cache.reserve();
506 let inner_size = v.compute_size(__cache);
507 __cache.set(__slot, inner_size);
508 size
509 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
510 + inner_size;
511 }
512 size += self.__buffa_unknown_fields.encoded_len() as u32;
513 size
514 }
515 fn write_to(
516 &self,
517 __cache: &mut ::buffa::SizeCache,
518 buf: &mut impl ::buffa::bytes::BufMut,
519 ) {
520 #[allow(unused_imports)]
521 use ::buffa::Enumeration as _;
522 for v in &self.file_to_generate {
523 ::buffa::encoding::Tag::new(
524 1u32,
525 ::buffa::encoding::WireType::LengthDelimited,
526 )
527 .encode(buf);
528 ::buffa::types::encode_string(v, buf);
529 }
530 if let Some(ref v) = self.parameter {
531 ::buffa::encoding::Tag::new(
532 2u32,
533 ::buffa::encoding::WireType::LengthDelimited,
534 )
535 .encode(buf);
536 ::buffa::types::encode_string(v, buf);
537 }
538 if self.compiler_version.is_set() {
539 ::buffa::encoding::Tag::new(
540 3u32,
541 ::buffa::encoding::WireType::LengthDelimited,
542 )
543 .encode(buf);
544 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
545 self.compiler_version.write_to(__cache, buf);
546 }
547 for v in &self.proto_file {
548 ::buffa::encoding::Tag::new(
549 15u32,
550 ::buffa::encoding::WireType::LengthDelimited,
551 )
552 .encode(buf);
553 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
554 v.write_to(__cache, buf);
555 }
556 for v in &self.source_file_descriptors {
557 ::buffa::encoding::Tag::new(
558 17u32,
559 ::buffa::encoding::WireType::LengthDelimited,
560 )
561 .encode(buf);
562 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
563 v.write_to(__cache, buf);
564 }
565 self.__buffa_unknown_fields.write_to(buf);
566 }
567 fn merge_field(
568 &mut self,
569 tag: ::buffa::encoding::Tag,
570 buf: &mut impl ::buffa::bytes::Buf,
571 depth: u32,
572 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
573 #[allow(unused_imports)]
574 use ::buffa::bytes::Buf as _;
575 #[allow(unused_imports)]
576 use ::buffa::Enumeration as _;
577 match tag.field_number() {
578 1u32 => {
579 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
580 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
581 field_number: 1u32,
582 expected: 2u8,
583 actual: tag.wire_type() as u8,
584 });
585 }
586 self.file_to_generate.push(::buffa::types::decode_string(buf)?);
587 }
588 2u32 => {
589 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
590 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
591 field_number: 2u32,
592 expected: 2u8,
593 actual: tag.wire_type() as u8,
594 });
595 }
596 ::buffa::types::merge_string(
597 self
598 .parameter
599 .get_or_insert_with(::buffa::alloc::string::String::new),
600 buf,
601 )?;
602 }
603 3u32 => {
604 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
605 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
606 field_number: 3u32,
607 expected: 2u8,
608 actual: tag.wire_type() as u8,
609 });
610 }
611 ::buffa::Message::merge_length_delimited(
612 self.compiler_version.get_or_insert_default(),
613 buf,
614 depth,
615 )?;
616 }
617 15u32 => {
618 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
619 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
620 field_number: 15u32,
621 expected: 2u8,
622 actual: tag.wire_type() as u8,
623 });
624 }
625 let mut elem = ::core::default::Default::default();
626 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
627 self.proto_file.push(elem);
628 }
629 17u32 => {
630 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
631 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
632 field_number: 17u32,
633 expected: 2u8,
634 actual: tag.wire_type() as u8,
635 });
636 }
637 let mut elem = ::core::default::Default::default();
638 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
639 self.source_file_descriptors.push(elem);
640 }
641 _ => {
642 self.__buffa_unknown_fields
643 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
644 }
645 }
646 ::core::result::Result::Ok(())
647 }
648 fn clear(&mut self) {
649 self.file_to_generate.clear();
650 self.parameter = ::core::option::Option::None;
651 self.compiler_version = ::buffa::MessageField::none();
652 self.proto_file.clear();
653 self.source_file_descriptors.clear();
654 self.__buffa_unknown_fields.clear();
655 }
656}
657impl ::buffa::ExtensionSet for CodeGeneratorRequest {
658 const PROTO_FQN: &'static str = "google.protobuf.compiler.CodeGeneratorRequest";
659 fn unknown_fields(&self) -> &::buffa::UnknownFields {
660 &self.__buffa_unknown_fields
661 }
662 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
663 &mut self.__buffa_unknown_fields
664 }
665}
666#[cfg(feature = "text")]
667impl ::buffa::text::TextFormat for CodeGeneratorRequest {
668 fn encode_text(
669 &self,
670 enc: &mut ::buffa::text::TextEncoder<'_>,
671 ) -> ::core::fmt::Result {
672 #[allow(unused_imports)]
673 use ::buffa::Enumeration as _;
674 if let ::core::option::Option::Some(ref __v) = self.parameter {
675 enc.write_field_name("parameter")?;
676 enc.write_string(__v)?;
677 }
678 if self.compiler_version.is_set() {
679 enc.write_field_name("compiler_version")?;
680 enc.write_message(&*self.compiler_version)?;
681 }
682 for __v in &self.file_to_generate {
683 enc.write_field_name("file_to_generate")?;
684 enc.write_string(__v)?;
685 }
686 for __v in &self.proto_file {
687 enc.write_field_name("proto_file")?;
688 enc.write_message(__v)?;
689 }
690 for __v in &self.source_file_descriptors {
691 enc.write_field_name("source_file_descriptors")?;
692 enc.write_message(__v)?;
693 }
694 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
695 ::core::result::Result::Ok(())
696 }
697 fn merge_text(
698 &mut self,
699 dec: &mut ::buffa::text::TextDecoder<'_>,
700 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
701 #[allow(unused_imports)]
702 use ::buffa::Enumeration as _;
703 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
704 match __name {
705 "parameter" => {
706 self.parameter = ::core::option::Option::Some(
707 dec.read_string()?.into_owned(),
708 );
709 }
710 "compiler_version" => {
711 dec.merge_message(self.compiler_version.get_or_insert_default())?
712 }
713 "file_to_generate" => {
714 dec.read_repeated_into(
715 &mut self.file_to_generate,
716 |__d| ::core::result::Result::Ok(__d.read_string()?.into_owned()),
717 )?
718 }
719 "proto_file" => {
720 dec.read_repeated_into(
721 &mut self.proto_file,
722 |__d| {
723 let mut __m = ::core::default::Default::default();
724 __d.merge_message(&mut __m)?;
725 ::core::result::Result::Ok(__m)
726 },
727 )?
728 }
729 "source_file_descriptors" => {
730 dec.read_repeated_into(
731 &mut self.source_file_descriptors,
732 |__d| {
733 let mut __m = ::core::default::Default::default();
734 __d.merge_message(&mut __m)?;
735 ::core::result::Result::Ok(__m)
736 },
737 )?
738 }
739 _ => dec.skip_value()?,
740 }
741 }
742 ::core::result::Result::Ok(())
743 }
744}
745#[cfg(feature = "json")]
746impl ::buffa::json_helpers::ProtoElemJson for CodeGeneratorRequest {
747 fn serialize_proto_json<S: ::serde::Serializer>(
748 v: &Self,
749 s: S,
750 ) -> ::core::result::Result<S::Ok, S::Error> {
751 ::serde::Serialize::serialize(v, s)
752 }
753 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
754 d: D,
755 ) -> ::core::result::Result<Self, D::Error> {
756 <Self as ::serde::Deserialize>::deserialize(d)
757 }
758}
759#[cfg(feature = "json")]
760#[doc(hidden)]
761pub const __CODE_GENERATOR_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
762 type_url: "type.googleapis.com/google.protobuf.compiler.CodeGeneratorRequest",
763 to_json: ::buffa::type_registry::any_to_json::<CodeGeneratorRequest>,
764 from_json: ::buffa::type_registry::any_from_json::<CodeGeneratorRequest>,
765 is_wkt: false,
766};
767#[cfg(feature = "text")]
768#[doc(hidden)]
769pub const __CODE_GENERATOR_REQUEST_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
770 type_url: "type.googleapis.com/google.protobuf.compiler.CodeGeneratorRequest",
771 text_encode: ::buffa::type_registry::any_encode_text::<CodeGeneratorRequest>,
772 text_merge: ::buffa::type_registry::any_merge_text::<CodeGeneratorRequest>,
773};
774#[derive(Clone, PartialEq, Default)]
776#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
777#[cfg_attr(feature = "json", serde(default))]
778#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
779pub struct CodeGeneratorResponse {
780 #[cfg_attr(
791 feature = "json",
792 serde(rename = "error", skip_serializing_if = "::core::option::Option::is_none")
793 )]
794 pub error: ::core::option::Option<::buffa::alloc::string::String>,
795 #[cfg_attr(
800 feature = "json",
801 serde(
802 rename = "supportedFeatures",
803 alias = "supported_features",
804 with = "::buffa::json_helpers::opt_uint64",
805 skip_serializing_if = "::core::option::Option::is_none"
806 )
807 )]
808 pub supported_features: ::core::option::Option<u64>,
809 #[cfg_attr(
816 feature = "json",
817 serde(
818 rename = "minimumEdition",
819 alias = "minimum_edition",
820 with = "::buffa::json_helpers::opt_int32",
821 skip_serializing_if = "::core::option::Option::is_none"
822 )
823 )]
824 pub minimum_edition: ::core::option::Option<i32>,
825 #[cfg_attr(
832 feature = "json",
833 serde(
834 rename = "maximumEdition",
835 alias = "maximum_edition",
836 with = "::buffa::json_helpers::opt_int32",
837 skip_serializing_if = "::core::option::Option::is_none"
838 )
839 )]
840 pub maximum_edition: ::core::option::Option<i32>,
841 #[cfg_attr(
843 feature = "json",
844 serde(
845 rename = "file",
846 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
847 deserialize_with = "::buffa::json_helpers::null_as_default"
848 )
849 )]
850 pub file: ::buffa::alloc::vec::Vec<code_generator_response::File>,
851 #[cfg_attr(feature = "json", serde(skip))]
852 #[doc(hidden)]
853 pub __buffa_unknown_fields: ::buffa::UnknownFields,
854}
855impl ::core::fmt::Debug for CodeGeneratorResponse {
856 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
857 f.debug_struct("CodeGeneratorResponse")
858 .field("error", &self.error)
859 .field("supported_features", &self.supported_features)
860 .field("minimum_edition", &self.minimum_edition)
861 .field("maximum_edition", &self.maximum_edition)
862 .field("file", &self.file)
863 .finish()
864 }
865}
866impl CodeGeneratorResponse {
867 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse";
872}
873impl CodeGeneratorResponse {
874 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
875 #[inline]
876 pub fn with_error(
878 mut self,
879 value: impl Into<::buffa::alloc::string::String>,
880 ) -> Self {
881 self.error = Some(value.into());
882 self
883 }
884 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
885 #[inline]
886 pub fn with_supported_features(mut self, value: u64) -> Self {
888 self.supported_features = Some(value);
889 self
890 }
891 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
892 #[inline]
893 pub fn with_minimum_edition(mut self, value: i32) -> Self {
895 self.minimum_edition = Some(value);
896 self
897 }
898 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
899 #[inline]
900 pub fn with_maximum_edition(mut self, value: i32) -> Self {
902 self.maximum_edition = Some(value);
903 self
904 }
905}
906impl ::buffa::DefaultInstance for CodeGeneratorResponse {
907 fn default_instance() -> &'static Self {
908 static VALUE: ::buffa::__private::OnceBox<CodeGeneratorResponse> = ::buffa::__private::OnceBox::new();
909 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
910 }
911}
912impl ::buffa::MessageName for CodeGeneratorResponse {
913 const PACKAGE: &'static str = "google.protobuf.compiler";
914 const NAME: &'static str = "CodeGeneratorResponse";
915 const FULL_NAME: &'static str = "google.protobuf.compiler.CodeGeneratorResponse";
916 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse";
917}
918impl ::buffa::Message for CodeGeneratorResponse {
919 #[allow(clippy::let_and_return)]
925 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
926 #[allow(unused_imports)]
927 use ::buffa::Enumeration as _;
928 let mut size = 0u32;
929 if let Some(ref v) = self.error {
930 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
931 }
932 if let Some(v) = self.supported_features {
933 size += 1u32 + ::buffa::types::uint64_encoded_len(v) as u32;
934 }
935 if let Some(v) = self.minimum_edition {
936 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
937 }
938 if let Some(v) = self.maximum_edition {
939 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
940 }
941 for v in &self.file {
942 let __slot = __cache.reserve();
943 let inner_size = v.compute_size(__cache);
944 __cache.set(__slot, inner_size);
945 size
946 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
947 + inner_size;
948 }
949 size += self.__buffa_unknown_fields.encoded_len() as u32;
950 size
951 }
952 fn write_to(
953 &self,
954 __cache: &mut ::buffa::SizeCache,
955 buf: &mut impl ::buffa::bytes::BufMut,
956 ) {
957 #[allow(unused_imports)]
958 use ::buffa::Enumeration as _;
959 if let Some(ref v) = self.error {
960 ::buffa::encoding::Tag::new(
961 1u32,
962 ::buffa::encoding::WireType::LengthDelimited,
963 )
964 .encode(buf);
965 ::buffa::types::encode_string(v, buf);
966 }
967 if let Some(v) = self.supported_features {
968 ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
969 .encode(buf);
970 ::buffa::types::encode_uint64(v, buf);
971 }
972 if let Some(v) = self.minimum_edition {
973 ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
974 .encode(buf);
975 ::buffa::types::encode_int32(v, buf);
976 }
977 if let Some(v) = self.maximum_edition {
978 ::buffa::encoding::Tag::new(4u32, ::buffa::encoding::WireType::Varint)
979 .encode(buf);
980 ::buffa::types::encode_int32(v, buf);
981 }
982 for v in &self.file {
983 ::buffa::encoding::Tag::new(
984 15u32,
985 ::buffa::encoding::WireType::LengthDelimited,
986 )
987 .encode(buf);
988 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
989 v.write_to(__cache, buf);
990 }
991 self.__buffa_unknown_fields.write_to(buf);
992 }
993 fn merge_field(
994 &mut self,
995 tag: ::buffa::encoding::Tag,
996 buf: &mut impl ::buffa::bytes::Buf,
997 depth: u32,
998 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
999 #[allow(unused_imports)]
1000 use ::buffa::bytes::Buf as _;
1001 #[allow(unused_imports)]
1002 use ::buffa::Enumeration as _;
1003 match tag.field_number() {
1004 1u32 => {
1005 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1006 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1007 field_number: 1u32,
1008 expected: 2u8,
1009 actual: tag.wire_type() as u8,
1010 });
1011 }
1012 ::buffa::types::merge_string(
1013 self.error.get_or_insert_with(::buffa::alloc::string::String::new),
1014 buf,
1015 )?;
1016 }
1017 2u32 => {
1018 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
1019 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1020 field_number: 2u32,
1021 expected: 0u8,
1022 actual: tag.wire_type() as u8,
1023 });
1024 }
1025 self.supported_features = ::core::option::Option::Some(
1026 ::buffa::types::decode_uint64(buf)?,
1027 );
1028 }
1029 3u32 => {
1030 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
1031 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1032 field_number: 3u32,
1033 expected: 0u8,
1034 actual: tag.wire_type() as u8,
1035 });
1036 }
1037 self.minimum_edition = ::core::option::Option::Some(
1038 ::buffa::types::decode_int32(buf)?,
1039 );
1040 }
1041 4u32 => {
1042 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
1043 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1044 field_number: 4u32,
1045 expected: 0u8,
1046 actual: tag.wire_type() as u8,
1047 });
1048 }
1049 self.maximum_edition = ::core::option::Option::Some(
1050 ::buffa::types::decode_int32(buf)?,
1051 );
1052 }
1053 15u32 => {
1054 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1055 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1056 field_number: 15u32,
1057 expected: 2u8,
1058 actual: tag.wire_type() as u8,
1059 });
1060 }
1061 let mut elem = ::core::default::Default::default();
1062 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
1063 self.file.push(elem);
1064 }
1065 _ => {
1066 self.__buffa_unknown_fields
1067 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
1068 }
1069 }
1070 ::core::result::Result::Ok(())
1071 }
1072 fn clear(&mut self) {
1073 self.error = ::core::option::Option::None;
1074 self.supported_features = ::core::option::Option::None;
1075 self.minimum_edition = ::core::option::Option::None;
1076 self.maximum_edition = ::core::option::Option::None;
1077 self.file.clear();
1078 self.__buffa_unknown_fields.clear();
1079 }
1080}
1081impl ::buffa::ExtensionSet for CodeGeneratorResponse {
1082 const PROTO_FQN: &'static str = "google.protobuf.compiler.CodeGeneratorResponse";
1083 fn unknown_fields(&self) -> &::buffa::UnknownFields {
1084 &self.__buffa_unknown_fields
1085 }
1086 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1087 &mut self.__buffa_unknown_fields
1088 }
1089}
1090#[cfg(feature = "text")]
1091impl ::buffa::text::TextFormat for CodeGeneratorResponse {
1092 fn encode_text(
1093 &self,
1094 enc: &mut ::buffa::text::TextEncoder<'_>,
1095 ) -> ::core::fmt::Result {
1096 #[allow(unused_imports)]
1097 use ::buffa::Enumeration as _;
1098 if let ::core::option::Option::Some(ref __v) = self.error {
1099 enc.write_field_name("error")?;
1100 enc.write_string(__v)?;
1101 }
1102 if let ::core::option::Option::Some(ref __v) = self.supported_features {
1103 enc.write_field_name("supported_features")?;
1104 enc.write_u64(*__v)?;
1105 }
1106 if let ::core::option::Option::Some(ref __v) = self.minimum_edition {
1107 enc.write_field_name("minimum_edition")?;
1108 enc.write_i32(*__v)?;
1109 }
1110 if let ::core::option::Option::Some(ref __v) = self.maximum_edition {
1111 enc.write_field_name("maximum_edition")?;
1112 enc.write_i32(*__v)?;
1113 }
1114 for __v in &self.file {
1115 enc.write_field_name("file")?;
1116 enc.write_message(__v)?;
1117 }
1118 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
1119 ::core::result::Result::Ok(())
1120 }
1121 fn merge_text(
1122 &mut self,
1123 dec: &mut ::buffa::text::TextDecoder<'_>,
1124 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
1125 #[allow(unused_imports)]
1126 use ::buffa::Enumeration as _;
1127 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
1128 match __name {
1129 "error" => {
1130 self.error = ::core::option::Option::Some(
1131 dec.read_string()?.into_owned(),
1132 );
1133 }
1134 "supported_features" => {
1135 self.supported_features = ::core::option::Option::Some(
1136 dec.read_u64()?,
1137 );
1138 }
1139 "minimum_edition" => {
1140 self.minimum_edition = ::core::option::Option::Some(dec.read_i32()?);
1141 }
1142 "maximum_edition" => {
1143 self.maximum_edition = ::core::option::Option::Some(dec.read_i32()?);
1144 }
1145 "file" => {
1146 dec.read_repeated_into(
1147 &mut self.file,
1148 |__d| {
1149 let mut __m = ::core::default::Default::default();
1150 __d.merge_message(&mut __m)?;
1151 ::core::result::Result::Ok(__m)
1152 },
1153 )?
1154 }
1155 _ => dec.skip_value()?,
1156 }
1157 }
1158 ::core::result::Result::Ok(())
1159 }
1160}
1161#[cfg(feature = "json")]
1162impl ::buffa::json_helpers::ProtoElemJson for CodeGeneratorResponse {
1163 fn serialize_proto_json<S: ::serde::Serializer>(
1164 v: &Self,
1165 s: S,
1166 ) -> ::core::result::Result<S::Ok, S::Error> {
1167 ::serde::Serialize::serialize(v, s)
1168 }
1169 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1170 d: D,
1171 ) -> ::core::result::Result<Self, D::Error> {
1172 <Self as ::serde::Deserialize>::deserialize(d)
1173 }
1174}
1175#[cfg(feature = "json")]
1176#[doc(hidden)]
1177pub const __CODE_GENERATOR_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1178 type_url: "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse",
1179 to_json: ::buffa::type_registry::any_to_json::<CodeGeneratorResponse>,
1180 from_json: ::buffa::type_registry::any_from_json::<CodeGeneratorResponse>,
1181 is_wkt: false,
1182};
1183#[cfg(feature = "text")]
1184#[doc(hidden)]
1185pub const __CODE_GENERATOR_RESPONSE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
1186 type_url: "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse",
1187 text_encode: ::buffa::type_registry::any_encode_text::<CodeGeneratorResponse>,
1188 text_merge: ::buffa::type_registry::any_merge_text::<CodeGeneratorResponse>,
1189};
1190pub mod code_generator_response {
1191 #[allow(unused_imports)]
1192 use super::*;
1193 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
1195 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
1196 #[repr(i32)]
1197 pub enum Feature {
1198 FEATURE_NONE = 0i32,
1199 FEATURE_PROTO3_OPTIONAL = 1i32,
1200 FEATURE_SUPPORTS_EDITIONS = 2i32,
1201 }
1202 impl Feature {
1203 #[allow(non_upper_case_globals)]
1205 pub const None: Self = Self::FEATURE_NONE;
1206 #[allow(non_upper_case_globals)]
1208 pub const Proto3Optional: Self = Self::FEATURE_PROTO3_OPTIONAL;
1209 #[allow(non_upper_case_globals)]
1211 pub const SupportsEditions: Self = Self::FEATURE_SUPPORTS_EDITIONS;
1212 }
1213 impl ::core::default::Default for Feature {
1214 fn default() -> Self {
1215 Self::FEATURE_NONE
1216 }
1217 }
1218 #[cfg(feature = "json")]
1219 const _: () = {
1220 impl ::serde::Serialize for Feature {
1221 fn serialize<S: ::serde::Serializer>(
1222 &self,
1223 s: S,
1224 ) -> ::core::result::Result<S::Ok, S::Error> {
1225 s.serialize_str(::buffa::Enumeration::proto_name(self))
1226 }
1227 }
1228 impl<'de> ::serde::Deserialize<'de> for Feature {
1229 fn deserialize<D: ::serde::Deserializer<'de>>(
1230 d: D,
1231 ) -> ::core::result::Result<Self, D::Error> {
1232 struct _V;
1233 impl ::serde::de::Visitor<'_> for _V {
1234 type Value = Feature;
1235 fn expecting(
1236 &self,
1237 f: &mut ::core::fmt::Formatter<'_>,
1238 ) -> ::core::fmt::Result {
1239 f.write_str(
1240 concat!(
1241 "a string, integer, or null for ", stringify!(Feature)
1242 ),
1243 )
1244 }
1245 fn visit_str<E: ::serde::de::Error>(
1246 self,
1247 v: &str,
1248 ) -> ::core::result::Result<Feature, E> {
1249 <Feature as ::buffa::Enumeration>::from_proto_name(v)
1250 .ok_or_else(|| {
1251 ::serde::de::Error::unknown_variant(v, &[])
1252 })
1253 }
1254 fn visit_i64<E: ::serde::de::Error>(
1255 self,
1256 v: i64,
1257 ) -> ::core::result::Result<Feature, E> {
1258 let v32 = i32::try_from(v)
1259 .map_err(|_| {
1260 ::serde::de::Error::custom(
1261 ::buffa::alloc::format!("enum value {v} out of i32 range"),
1262 )
1263 })?;
1264 <Feature as ::buffa::Enumeration>::from_i32(v32)
1265 .ok_or_else(|| {
1266 ::serde::de::Error::custom(
1267 ::buffa::alloc::format!("unknown enum value {v32}"),
1268 )
1269 })
1270 }
1271 fn visit_u64<E: ::serde::de::Error>(
1272 self,
1273 v: u64,
1274 ) -> ::core::result::Result<Feature, E> {
1275 let v32 = i32::try_from(v)
1276 .map_err(|_| {
1277 ::serde::de::Error::custom(
1278 ::buffa::alloc::format!("enum value {v} out of i32 range"),
1279 )
1280 })?;
1281 <Feature as ::buffa::Enumeration>::from_i32(v32)
1282 .ok_or_else(|| {
1283 ::serde::de::Error::custom(
1284 ::buffa::alloc::format!("unknown enum value {v32}"),
1285 )
1286 })
1287 }
1288 fn visit_unit<E: ::serde::de::Error>(
1289 self,
1290 ) -> ::core::result::Result<Feature, E> {
1291 ::core::result::Result::Ok(::core::default::Default::default())
1292 }
1293 }
1294 d.deserialize_any(_V)
1295 }
1296 }
1297 impl ::buffa::json_helpers::ProtoElemJson for Feature {
1298 fn serialize_proto_json<S: ::serde::Serializer>(
1299 v: &Self,
1300 s: S,
1301 ) -> ::core::result::Result<S::Ok, S::Error> {
1302 ::serde::Serialize::serialize(v, s)
1303 }
1304 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1305 d: D,
1306 ) -> ::core::result::Result<Self, D::Error> {
1307 <Self as ::serde::Deserialize>::deserialize(d)
1308 }
1309 }
1310 };
1311 impl ::buffa::Enumeration for Feature {
1312 fn from_i32(value: i32) -> ::core::option::Option<Self> {
1313 match value {
1314 0i32 => ::core::option::Option::Some(Self::FEATURE_NONE),
1315 1i32 => ::core::option::Option::Some(Self::FEATURE_PROTO3_OPTIONAL),
1316 2i32 => ::core::option::Option::Some(Self::FEATURE_SUPPORTS_EDITIONS),
1317 _ => ::core::option::Option::None,
1318 }
1319 }
1320 fn to_i32(&self) -> i32 {
1321 *self as i32
1322 }
1323 fn proto_name(&self) -> &'static str {
1324 match self {
1325 Self::FEATURE_NONE => "FEATURE_NONE",
1326 Self::FEATURE_PROTO3_OPTIONAL => "FEATURE_PROTO3_OPTIONAL",
1327 Self::FEATURE_SUPPORTS_EDITIONS => "FEATURE_SUPPORTS_EDITIONS",
1328 }
1329 }
1330 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
1331 match name {
1332 "FEATURE_NONE" => ::core::option::Option::Some(Self::FEATURE_NONE),
1333 "FEATURE_PROTO3_OPTIONAL" => {
1334 ::core::option::Option::Some(Self::FEATURE_PROTO3_OPTIONAL)
1335 }
1336 "FEATURE_SUPPORTS_EDITIONS" => {
1337 ::core::option::Option::Some(Self::FEATURE_SUPPORTS_EDITIONS)
1338 }
1339 _ => ::core::option::Option::None,
1340 }
1341 }
1342 fn values() -> &'static [Self] {
1343 &[
1344 Self::FEATURE_NONE,
1345 Self::FEATURE_PROTO3_OPTIONAL,
1346 Self::FEATURE_SUPPORTS_EDITIONS,
1347 ]
1348 }
1349 }
1350 #[derive(Clone, PartialEq, Default)]
1352 #[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
1353 #[cfg_attr(feature = "json", serde(default))]
1354 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
1355 pub struct File {
1356 #[cfg_attr(
1370 feature = "json",
1371 serde(
1372 rename = "name",
1373 skip_serializing_if = "::core::option::Option::is_none"
1374 )
1375 )]
1376 pub name: ::core::option::Option<::buffa::alloc::string::String>,
1377 #[cfg_attr(
1417 feature = "json",
1418 serde(
1419 rename = "insertionPoint",
1420 alias = "insertion_point",
1421 skip_serializing_if = "::core::option::Option::is_none"
1422 )
1423 )]
1424 pub insertion_point: ::core::option::Option<::buffa::alloc::string::String>,
1425 #[cfg_attr(
1429 feature = "json",
1430 serde(
1431 rename = "content",
1432 skip_serializing_if = "::core::option::Option::is_none"
1433 )
1434 )]
1435 pub content: ::core::option::Option<::buffa::alloc::string::String>,
1436 #[cfg_attr(
1442 feature = "json",
1443 serde(
1444 rename = "generatedCodeInfo",
1445 alias = "generated_code_info",
1446 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
1447 )
1448 )]
1449 pub generated_code_info: ::buffa::MessageField<super::super::GeneratedCodeInfo>,
1450 #[cfg_attr(feature = "json", serde(skip))]
1451 #[doc(hidden)]
1452 pub __buffa_unknown_fields: ::buffa::UnknownFields,
1453 }
1454 impl ::core::fmt::Debug for File {
1455 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1456 f.debug_struct("File")
1457 .field("name", &self.name)
1458 .field("insertion_point", &self.insertion_point)
1459 .field("content", &self.content)
1460 .field("generated_code_info", &self.generated_code_info)
1461 .finish()
1462 }
1463 }
1464 impl File {
1465 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse.File";
1470 }
1471 impl File {
1472 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
1473 #[inline]
1474 pub fn with_name(
1476 mut self,
1477 value: impl Into<::buffa::alloc::string::String>,
1478 ) -> Self {
1479 self.name = Some(value.into());
1480 self
1481 }
1482 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
1483 #[inline]
1484 pub fn with_insertion_point(
1486 mut self,
1487 value: impl Into<::buffa::alloc::string::String>,
1488 ) -> Self {
1489 self.insertion_point = Some(value.into());
1490 self
1491 }
1492 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
1493 #[inline]
1494 pub fn with_content(
1496 mut self,
1497 value: impl Into<::buffa::alloc::string::String>,
1498 ) -> Self {
1499 self.content = Some(value.into());
1500 self
1501 }
1502 }
1503 impl ::buffa::DefaultInstance for File {
1504 fn default_instance() -> &'static Self {
1505 static VALUE: ::buffa::__private::OnceBox<File> = ::buffa::__private::OnceBox::new();
1506 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
1507 }
1508 }
1509 impl ::buffa::MessageName for File {
1510 const PACKAGE: &'static str = "google.protobuf.compiler";
1511 const NAME: &'static str = "CodeGeneratorResponse.File";
1512 const FULL_NAME: &'static str = "google.protobuf.compiler.CodeGeneratorResponse.File";
1513 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse.File";
1514 }
1515 impl ::buffa::Message for File {
1516 #[allow(clippy::let_and_return)]
1522 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
1523 #[allow(unused_imports)]
1524 use ::buffa::Enumeration as _;
1525 let mut size = 0u32;
1526 if let Some(ref v) = self.name {
1527 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
1528 }
1529 if let Some(ref v) = self.insertion_point {
1530 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
1531 }
1532 if let Some(ref v) = self.content {
1533 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
1534 }
1535 if self.generated_code_info.is_set() {
1536 let __slot = __cache.reserve();
1537 let inner_size = self.generated_code_info.compute_size(__cache);
1538 __cache.set(__slot, inner_size);
1539 size
1540 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1541 + inner_size;
1542 }
1543 size += self.__buffa_unknown_fields.encoded_len() as u32;
1544 size
1545 }
1546 fn write_to(
1547 &self,
1548 __cache: &mut ::buffa::SizeCache,
1549 buf: &mut impl ::buffa::bytes::BufMut,
1550 ) {
1551 #[allow(unused_imports)]
1552 use ::buffa::Enumeration as _;
1553 if let Some(ref v) = self.name {
1554 ::buffa::encoding::Tag::new(
1555 1u32,
1556 ::buffa::encoding::WireType::LengthDelimited,
1557 )
1558 .encode(buf);
1559 ::buffa::types::encode_string(v, buf);
1560 }
1561 if let Some(ref v) = self.insertion_point {
1562 ::buffa::encoding::Tag::new(
1563 2u32,
1564 ::buffa::encoding::WireType::LengthDelimited,
1565 )
1566 .encode(buf);
1567 ::buffa::types::encode_string(v, buf);
1568 }
1569 if let Some(ref v) = self.content {
1570 ::buffa::encoding::Tag::new(
1571 15u32,
1572 ::buffa::encoding::WireType::LengthDelimited,
1573 )
1574 .encode(buf);
1575 ::buffa::types::encode_string(v, buf);
1576 }
1577 if self.generated_code_info.is_set() {
1578 ::buffa::encoding::Tag::new(
1579 16u32,
1580 ::buffa::encoding::WireType::LengthDelimited,
1581 )
1582 .encode(buf);
1583 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
1584 self.generated_code_info.write_to(__cache, buf);
1585 }
1586 self.__buffa_unknown_fields.write_to(buf);
1587 }
1588 fn merge_field(
1589 &mut self,
1590 tag: ::buffa::encoding::Tag,
1591 buf: &mut impl ::buffa::bytes::Buf,
1592 depth: u32,
1593 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1594 #[allow(unused_imports)]
1595 use ::buffa::bytes::Buf as _;
1596 #[allow(unused_imports)]
1597 use ::buffa::Enumeration as _;
1598 match tag.field_number() {
1599 1u32 => {
1600 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1601 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1602 field_number: 1u32,
1603 expected: 2u8,
1604 actual: tag.wire_type() as u8,
1605 });
1606 }
1607 ::buffa::types::merge_string(
1608 self
1609 .name
1610 .get_or_insert_with(::buffa::alloc::string::String::new),
1611 buf,
1612 )?;
1613 }
1614 2u32 => {
1615 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1616 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1617 field_number: 2u32,
1618 expected: 2u8,
1619 actual: tag.wire_type() as u8,
1620 });
1621 }
1622 ::buffa::types::merge_string(
1623 self
1624 .insertion_point
1625 .get_or_insert_with(::buffa::alloc::string::String::new),
1626 buf,
1627 )?;
1628 }
1629 15u32 => {
1630 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1631 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1632 field_number: 15u32,
1633 expected: 2u8,
1634 actual: tag.wire_type() as u8,
1635 });
1636 }
1637 ::buffa::types::merge_string(
1638 self
1639 .content
1640 .get_or_insert_with(::buffa::alloc::string::String::new),
1641 buf,
1642 )?;
1643 }
1644 16u32 => {
1645 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1646 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1647 field_number: 16u32,
1648 expected: 2u8,
1649 actual: tag.wire_type() as u8,
1650 });
1651 }
1652 ::buffa::Message::merge_length_delimited(
1653 self.generated_code_info.get_or_insert_default(),
1654 buf,
1655 depth,
1656 )?;
1657 }
1658 _ => {
1659 self.__buffa_unknown_fields
1660 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
1661 }
1662 }
1663 ::core::result::Result::Ok(())
1664 }
1665 fn clear(&mut self) {
1666 self.name = ::core::option::Option::None;
1667 self.insertion_point = ::core::option::Option::None;
1668 self.content = ::core::option::Option::None;
1669 self.generated_code_info = ::buffa::MessageField::none();
1670 self.__buffa_unknown_fields.clear();
1671 }
1672 }
1673 impl ::buffa::ExtensionSet for File {
1674 const PROTO_FQN: &'static str = "google.protobuf.compiler.CodeGeneratorResponse.File";
1675 fn unknown_fields(&self) -> &::buffa::UnknownFields {
1676 &self.__buffa_unknown_fields
1677 }
1678 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1679 &mut self.__buffa_unknown_fields
1680 }
1681 }
1682 #[cfg(feature = "text")]
1683 impl ::buffa::text::TextFormat for File {
1684 fn encode_text(
1685 &self,
1686 enc: &mut ::buffa::text::TextEncoder<'_>,
1687 ) -> ::core::fmt::Result {
1688 #[allow(unused_imports)]
1689 use ::buffa::Enumeration as _;
1690 if let ::core::option::Option::Some(ref __v) = self.name {
1691 enc.write_field_name("name")?;
1692 enc.write_string(__v)?;
1693 }
1694 if let ::core::option::Option::Some(ref __v) = self.insertion_point {
1695 enc.write_field_name("insertion_point")?;
1696 enc.write_string(__v)?;
1697 }
1698 if let ::core::option::Option::Some(ref __v) = self.content {
1699 enc.write_field_name("content")?;
1700 enc.write_string(__v)?;
1701 }
1702 if self.generated_code_info.is_set() {
1703 enc.write_field_name("generated_code_info")?;
1704 enc.write_message(&*self.generated_code_info)?;
1705 }
1706 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
1707 ::core::result::Result::Ok(())
1708 }
1709 fn merge_text(
1710 &mut self,
1711 dec: &mut ::buffa::text::TextDecoder<'_>,
1712 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
1713 #[allow(unused_imports)]
1714 use ::buffa::Enumeration as _;
1715 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
1716 match __name {
1717 "name" => {
1718 self.name = ::core::option::Option::Some(
1719 dec.read_string()?.into_owned(),
1720 );
1721 }
1722 "insertion_point" => {
1723 self.insertion_point = ::core::option::Option::Some(
1724 dec.read_string()?.into_owned(),
1725 );
1726 }
1727 "content" => {
1728 self.content = ::core::option::Option::Some(
1729 dec.read_string()?.into_owned(),
1730 );
1731 }
1732 "generated_code_info" => {
1733 dec.merge_message(
1734 self.generated_code_info.get_or_insert_default(),
1735 )?
1736 }
1737 _ => dec.skip_value()?,
1738 }
1739 }
1740 ::core::result::Result::Ok(())
1741 }
1742 }
1743 #[cfg(feature = "json")]
1744 impl ::buffa::json_helpers::ProtoElemJson for File {
1745 fn serialize_proto_json<S: ::serde::Serializer>(
1746 v: &Self,
1747 s: S,
1748 ) -> ::core::result::Result<S::Ok, S::Error> {
1749 ::serde::Serialize::serialize(v, s)
1750 }
1751 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1752 d: D,
1753 ) -> ::core::result::Result<Self, D::Error> {
1754 <Self as ::serde::Deserialize>::deserialize(d)
1755 }
1756 }
1757 #[cfg(feature = "json")]
1758 #[doc(hidden)]
1759 pub const __FILE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1760 type_url: "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse.File",
1761 to_json: ::buffa::type_registry::any_to_json::<File>,
1762 from_json: ::buffa::type_registry::any_from_json::<File>,
1763 is_wkt: false,
1764 };
1765 #[cfg(feature = "text")]
1766 #[doc(hidden)]
1767 pub const __FILE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
1768 type_url: "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse.File",
1769 text_encode: ::buffa::type_registry::any_encode_text::<File>,
1770 text_merge: ::buffa::type_registry::any_merge_text::<File>,
1771 };
1772 #[cfg(feature = "views")]
1773 #[doc(inline)]
1774 pub use super::__buffa::view::code_generator_response::FileView;
1775 #[cfg(feature = "views")]
1776 #[doc(inline)]
1777 pub use super::__buffa::view::code_generator_response::FileOwnedView;
1778}