Skip to main content

buffa_descriptor/generated/
google.protobuf.compiler.plugin.rs

1// @generated by buffa-codegen. DO NOT EDIT.
2// source: google/protobuf/compiler/plugin.proto
3
4/// The version number of protocol compiler.
5#[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    /// Field 1: `major`
11    #[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    /// Field 2: `minor`
21    #[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    /// Field 3: `patch`
31    #[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    /// A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
41    /// be empty for mainline stable releases.
42    ///
43    /// Field 4: `suffix`
44    #[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    /// Protobuf type URL for this message, for use with `Any::pack` and
65    /// `Any::unpack_if`.
66    ///
67    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
68    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    ///Sets [`Self::major`] to `Some(value)`, consuming and returning `self`.
74    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    ///Sets [`Self::minor`] to `Some(value)`, consuming and returning `self`.
81    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    ///Sets [`Self::patch`] to `Some(value)`, consuming and returning `self`.
88    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    ///Sets [`Self::suffix`] to `Some(value)`, consuming and returning `self`.
95    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}
103::buffa::impl_default_instance!(Version);
104impl ::buffa::MessageName for Version {
105    const PACKAGE: &'static str = "google.protobuf.compiler";
106    const NAME: &'static str = "Version";
107    const FULL_NAME: &'static str = "google.protobuf.compiler.Version";
108    const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.Version";
109}
110impl ::buffa::Message for Version {
111    /// Returns the total encoded size in bytes.
112    ///
113    /// Accumulates in `u64` (which cannot overflow for in-memory
114    /// data) and saturates to `u32` at return, so a message whose
115    /// encoded size exceeds the 2 GiB protobuf limit yields a value
116    /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry
117    /// points reject, never a silently wrapped size.
118    #[allow(clippy::let_and_return)]
119    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
120        #[allow(unused_imports)]
121        use ::buffa::Enumeration as _;
122        let mut size = 0u64;
123        if let Some(v) = self.major {
124            size += 1u64 + ::buffa::types::int32_encoded_len(v) as u64;
125        }
126        if let Some(v) = self.minor {
127            size += 1u64 + ::buffa::types::int32_encoded_len(v) as u64;
128        }
129        if let Some(v) = self.patch {
130            size += 1u64 + ::buffa::types::int32_encoded_len(v) as u64;
131        }
132        if let Some(ref v) = self.suffix {
133            size += 1u64 + ::buffa::types::string_encoded_len(v) as u64;
134        }
135        size += self.__buffa_unknown_fields.encoded_len() as u64;
136        ::buffa::saturate_size(size)
137    }
138    fn write_to(
139        &self,
140        _cache: &mut ::buffa::SizeCache,
141        buf: &mut impl ::buffa::EncodeSink,
142    ) {
143        #[allow(unused_imports)]
144        use ::buffa::Enumeration as _;
145        if let Some(v) = self.major {
146            ::buffa::types::put_int32_field(1u32, v, buf);
147        }
148        if let Some(v) = self.minor {
149            ::buffa::types::put_int32_field(2u32, v, buf);
150        }
151        if let Some(v) = self.patch {
152            ::buffa::types::put_int32_field(3u32, v, buf);
153        }
154        if let Some(ref v) = self.suffix {
155            ::buffa::types::put_string_field(4u32, v, buf);
156        }
157        self.__buffa_unknown_fields.write_to(buf);
158    }
159    fn merge_field(
160        &mut self,
161        tag: ::buffa::encoding::Tag,
162        buf: &mut impl ::buffa::bytes::Buf,
163        ctx: ::buffa::DecodeContext<'_>,
164    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
165        #[allow(unused_imports)]
166        use ::buffa::bytes::Buf as _;
167        #[allow(unused_imports)]
168        use ::buffa::Enumeration as _;
169        match tag.field_number() {
170            1u32 => {
171                ::buffa::encoding::check_wire_type(
172                    tag,
173                    ::buffa::encoding::WireType::Varint,
174                )?;
175                self.major = ::core::option::Option::Some(
176                    ::buffa::types::decode_int32(buf)?,
177                );
178            }
179            2u32 => {
180                ::buffa::encoding::check_wire_type(
181                    tag,
182                    ::buffa::encoding::WireType::Varint,
183                )?;
184                self.minor = ::core::option::Option::Some(
185                    ::buffa::types::decode_int32(buf)?,
186                );
187            }
188            3u32 => {
189                ::buffa::encoding::check_wire_type(
190                    tag,
191                    ::buffa::encoding::WireType::Varint,
192                )?;
193                self.patch = ::core::option::Option::Some(
194                    ::buffa::types::decode_int32(buf)?,
195                );
196            }
197            4u32 => {
198                ::buffa::encoding::check_wire_type(
199                    tag,
200                    ::buffa::encoding::WireType::LengthDelimited,
201                )?;
202                ::buffa::types::merge_string(
203                    self.suffix.get_or_insert_with(::buffa::alloc::string::String::new),
204                    buf,
205                )?;
206            }
207            _ => {
208                self.__buffa_unknown_fields
209                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
210            }
211        }
212        ::core::result::Result::Ok(())
213    }
214    fn clear(&mut self) {
215        self.major = ::core::option::Option::None;
216        self.minor = ::core::option::Option::None;
217        self.patch = ::core::option::Option::None;
218        self.suffix = ::core::option::Option::None;
219        self.__buffa_unknown_fields.clear();
220    }
221}
222impl ::buffa::ExtensionSet for Version {
223    const PROTO_FQN: &'static str = "google.protobuf.compiler.Version";
224    fn unknown_fields(&self) -> &::buffa::UnknownFields {
225        &self.__buffa_unknown_fields
226    }
227    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
228        &mut self.__buffa_unknown_fields
229    }
230}
231#[cfg(feature = "text")]
232impl ::buffa::text::TextFormat for Version {
233    fn encode_text(
234        &self,
235        enc: &mut ::buffa::text::TextEncoder<'_>,
236    ) -> ::core::fmt::Result {
237        #[allow(unused_imports)]
238        use ::buffa::Enumeration as _;
239        if let ::core::option::Option::Some(ref __v) = self.major {
240            enc.write_field_name("major")?;
241            enc.write_i32(*__v)?;
242        }
243        if let ::core::option::Option::Some(ref __v) = self.minor {
244            enc.write_field_name("minor")?;
245            enc.write_i32(*__v)?;
246        }
247        if let ::core::option::Option::Some(ref __v) = self.patch {
248            enc.write_field_name("patch")?;
249            enc.write_i32(*__v)?;
250        }
251        if let ::core::option::Option::Some(ref __v) = self.suffix {
252            enc.write_field_name("suffix")?;
253            enc.write_string(__v)?;
254        }
255        enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
256        ::core::result::Result::Ok(())
257    }
258    fn merge_text(
259        &mut self,
260        dec: &mut ::buffa::text::TextDecoder<'_>,
261    ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
262        #[allow(unused_imports)]
263        use ::buffa::Enumeration as _;
264        while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
265            match __name {
266                "major" => self.major = ::core::option::Option::Some(dec.read_i32()?),
267                "minor" => self.minor = ::core::option::Option::Some(dec.read_i32()?),
268                "patch" => self.patch = ::core::option::Option::Some(dec.read_i32()?),
269                "suffix" => {
270                    self.suffix = ::core::option::Option::Some(
271                        dec.read_string()?.into_owned(),
272                    );
273                }
274                _ => dec.skip_value()?,
275            }
276        }
277        ::core::result::Result::Ok(())
278    }
279}
280#[cfg(feature = "json")]
281impl ::buffa::json_helpers::ProtoElemJson for Version {
282    fn serialize_proto_json<S: ::serde::Serializer>(
283        v: &Self,
284        s: S,
285    ) -> ::core::result::Result<S::Ok, S::Error> {
286        ::serde::Serialize::serialize(v, s)
287    }
288    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
289        d: D,
290    ) -> ::core::result::Result<Self, D::Error> {
291        <Self as ::serde::Deserialize>::deserialize(d)
292    }
293}
294#[cfg(feature = "json")]
295#[doc(hidden)]
296pub const __VERSION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
297    type_url: "type.googleapis.com/google.protobuf.compiler.Version",
298    to_json: ::buffa::type_registry::any_to_json::<Version>,
299    from_json: ::buffa::type_registry::any_from_json::<Version>,
300    is_wkt: false,
301};
302#[cfg(feature = "text")]
303#[doc(hidden)]
304pub const __VERSION_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
305    type_url: "type.googleapis.com/google.protobuf.compiler.Version",
306    text_encode: ::buffa::type_registry::any_encode_text::<Version>,
307    text_merge: ::buffa::type_registry::any_merge_text::<Version>,
308};
309/// An encoded CodeGeneratorRequest is written to the plugin's stdin.
310#[derive(Clone, PartialEq, Default)]
311#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
312#[cfg_attr(feature = "json", serde(default))]
313#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
314pub struct CodeGeneratorRequest {
315    /// The .proto files that were explicitly listed on the command-line.  The
316    /// code generator should generate code only for these files.  Each file's
317    /// descriptor will be included in proto_file, below.
318    ///
319    /// Field 1: `file_to_generate`
320    #[cfg_attr(
321        feature = "json",
322        serde(
323            rename = "fileToGenerate",
324            alias = "file_to_generate",
325            skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
326            deserialize_with = "::buffa::json_helpers::null_as_default"
327        )
328    )]
329    pub file_to_generate: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
330    /// The generator parameter passed on the command-line.
331    ///
332    /// Field 2: `parameter`
333    #[cfg_attr(
334        feature = "json",
335        serde(
336            rename = "parameter",
337            skip_serializing_if = "::core::option::Option::is_none"
338        )
339    )]
340    pub parameter: ::core::option::Option<::buffa::alloc::string::String>,
341    /// FileDescriptorProtos for all files in files_to_generate and everything
342    /// they import.  The files will appear in topological order, so each file
343    /// appears before any file that imports it.
344    ///
345    /// Note: the files listed in files_to_generate will include runtime-retention
346    /// options only, but all other files will include source-retention options.
347    /// The source_file_descriptors field below is available in case you need
348    /// source-retention options for files_to_generate.
349    ///
350    /// protoc guarantees that all proto_files will be written after
351    /// the fields above, even though this is not technically guaranteed by the
352    /// protobuf wire format.  This theoretically could allow a plugin to stream
353    /// in the FileDescriptorProtos and handle them one by one rather than read
354    /// the entire set into memory at once.  However, as of this writing, this
355    /// is not similarly optimized on protoc's end -- it will store all fields in
356    /// memory at once before sending them to the plugin.
357    ///
358    /// Type names of fields and extensions in the FileDescriptorProto are always
359    /// fully qualified.
360    ///
361    /// Field 15: `proto_file`
362    #[cfg_attr(
363        feature = "json",
364        serde(
365            rename = "protoFile",
366            alias = "proto_file",
367            skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
368            deserialize_with = "::buffa::json_helpers::null_as_default"
369        )
370    )]
371    pub proto_file: ::buffa::alloc::vec::Vec<super::FileDescriptorProto>,
372    /// File descriptors with all options, including source-retention options.
373    /// These descriptors are only provided for the files listed in
374    /// files_to_generate.
375    ///
376    /// Field 17: `source_file_descriptors`
377    #[cfg_attr(
378        feature = "json",
379        serde(
380            rename = "sourceFileDescriptors",
381            alias = "source_file_descriptors",
382            skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
383            deserialize_with = "::buffa::json_helpers::null_as_default"
384        )
385    )]
386    pub source_file_descriptors: ::buffa::alloc::vec::Vec<super::FileDescriptorProto>,
387    /// The version number of protocol compiler.
388    ///
389    /// Field 3: `compiler_version`
390    #[cfg_attr(
391        feature = "json",
392        serde(
393            rename = "compilerVersion",
394            alias = "compiler_version",
395            skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
396        )
397    )]
398    pub compiler_version: ::buffa::MessageField<Version, ::buffa::Inline<Version>>,
399    #[cfg_attr(feature = "json", serde(skip))]
400    #[doc(hidden)]
401    pub __buffa_unknown_fields: ::buffa::UnknownFields,
402}
403impl ::core::fmt::Debug for CodeGeneratorRequest {
404    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
405        f.debug_struct("CodeGeneratorRequest")
406            .field("file_to_generate", &self.file_to_generate)
407            .field("parameter", &self.parameter)
408            .field("proto_file", &self.proto_file)
409            .field("source_file_descriptors", &self.source_file_descriptors)
410            .field("compiler_version", &self.compiler_version)
411            .finish()
412    }
413}
414impl CodeGeneratorRequest {
415    /// Protobuf type URL for this message, for use with `Any::pack` and
416    /// `Any::unpack_if`.
417    ///
418    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
419    pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorRequest";
420}
421impl CodeGeneratorRequest {
422    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
423    #[inline]
424    ///Sets [`Self::parameter`] to `Some(value)`, consuming and returning `self`.
425    pub fn with_parameter(
426        mut self,
427        value: impl Into<::buffa::alloc::string::String>,
428    ) -> Self {
429        self.parameter = Some(value.into());
430        self
431    }
432}
433::buffa::impl_default_instance!(CodeGeneratorRequest);
434impl ::buffa::MessageName for CodeGeneratorRequest {
435    const PACKAGE: &'static str = "google.protobuf.compiler";
436    const NAME: &'static str = "CodeGeneratorRequest";
437    const FULL_NAME: &'static str = "google.protobuf.compiler.CodeGeneratorRequest";
438    const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorRequest";
439}
440impl ::buffa::Message for CodeGeneratorRequest {
441    /// Returns the total encoded size in bytes.
442    ///
443    /// Accumulates in `u64` (which cannot overflow for in-memory
444    /// data) and saturates to `u32` at return, so a message whose
445    /// encoded size exceeds the 2 GiB protobuf limit yields a value
446    /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry
447    /// points reject, never a silently wrapped size.
448    #[allow(clippy::let_and_return)]
449    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
450        #[allow(unused_imports)]
451        use ::buffa::Enumeration as _;
452        let mut size = 0u64;
453        for v in &self.file_to_generate {
454            size += 1u64 + ::buffa::types::string_encoded_len(v) as u64;
455        }
456        if let Some(ref v) = self.parameter {
457            size += 1u64 + ::buffa::types::string_encoded_len(v) as u64;
458        }
459        if self.compiler_version.is_set() {
460            let __slot = __cache.reserve();
461            let inner_size = self.compiler_version.compute_size(__cache);
462            __cache.set(__slot, inner_size);
463            size
464                += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
465                    + inner_size as u64;
466        }
467        for v in &self.proto_file {
468            let __slot = __cache.reserve();
469            let inner_size = v.compute_size(__cache);
470            __cache.set(__slot, inner_size);
471            size
472                += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
473                    + inner_size as u64;
474        }
475        for v in &self.source_file_descriptors {
476            let __slot = __cache.reserve();
477            let inner_size = v.compute_size(__cache);
478            __cache.set(__slot, inner_size);
479            size
480                += 2u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
481                    + inner_size as u64;
482        }
483        size += self.__buffa_unknown_fields.encoded_len() as u64;
484        ::buffa::saturate_size(size)
485    }
486    fn write_to(
487        &self,
488        __cache: &mut ::buffa::SizeCache,
489        buf: &mut impl ::buffa::EncodeSink,
490    ) {
491        #[allow(unused_imports)]
492        use ::buffa::Enumeration as _;
493        for v in &self.file_to_generate {
494            ::buffa::types::put_string_field(1u32, v, buf);
495        }
496        if let Some(ref v) = self.parameter {
497            ::buffa::types::put_string_field(2u32, v, buf);
498        }
499        if self.compiler_version.is_set() {
500            ::buffa::types::put_len_delimited_header(
501                3u32,
502                u64::from(__cache.consume_next()),
503                buf,
504            );
505            self.compiler_version.write_to(__cache, buf);
506        }
507        for v in &self.proto_file {
508            ::buffa::types::put_len_delimited_header(
509                15u32,
510                u64::from(__cache.consume_next()),
511                buf,
512            );
513            v.write_to(__cache, buf);
514        }
515        for v in &self.source_file_descriptors {
516            ::buffa::types::put_len_delimited_header(
517                17u32,
518                u64::from(__cache.consume_next()),
519                buf,
520            );
521            v.write_to(__cache, buf);
522        }
523        self.__buffa_unknown_fields.write_to(buf);
524    }
525    fn merge_field(
526        &mut self,
527        tag: ::buffa::encoding::Tag,
528        buf: &mut impl ::buffa::bytes::Buf,
529        ctx: ::buffa::DecodeContext<'_>,
530    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
531        #[allow(unused_imports)]
532        use ::buffa::bytes::Buf as _;
533        #[allow(unused_imports)]
534        use ::buffa::Enumeration as _;
535        match tag.field_number() {
536            1u32 => {
537                ::buffa::encoding::check_wire_type(
538                    tag,
539                    ::buffa::encoding::WireType::LengthDelimited,
540                )?;
541                let __elem = ::buffa::types::decode_string(buf)?;
542                ctx.register_element_memory(
543                    ::buffa::__private::element_footprint(&__elem),
544                )?;
545                self.file_to_generate.push(__elem);
546            }
547            2u32 => {
548                ::buffa::encoding::check_wire_type(
549                    tag,
550                    ::buffa::encoding::WireType::LengthDelimited,
551                )?;
552                ::buffa::types::merge_string(
553                    self
554                        .parameter
555                        .get_or_insert_with(::buffa::alloc::string::String::new),
556                    buf,
557                )?;
558            }
559            3u32 => {
560                ::buffa::encoding::check_wire_type(
561                    tag,
562                    ::buffa::encoding::WireType::LengthDelimited,
563                )?;
564                ::buffa::Message::merge_length_delimited(
565                    self.compiler_version.get_or_insert_default(),
566                    buf,
567                    ctx,
568                )?;
569            }
570            15u32 => {
571                ::buffa::encoding::check_wire_type(
572                    tag,
573                    ::buffa::encoding::WireType::LengthDelimited,
574                )?;
575                let mut elem = ::core::default::Default::default();
576                ctx.register_element_memory(
577                    ::buffa::__private::element_footprint(&elem),
578                )?;
579                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
580                self.proto_file.push(elem);
581            }
582            17u32 => {
583                ::buffa::encoding::check_wire_type(
584                    tag,
585                    ::buffa::encoding::WireType::LengthDelimited,
586                )?;
587                let mut elem = ::core::default::Default::default();
588                ctx.register_element_memory(
589                    ::buffa::__private::element_footprint(&elem),
590                )?;
591                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
592                self.source_file_descriptors.push(elem);
593            }
594            _ => {
595                self.__buffa_unknown_fields
596                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
597            }
598        }
599        ::core::result::Result::Ok(())
600    }
601    fn clear(&mut self) {
602        self.file_to_generate.clear();
603        self.parameter = ::core::option::Option::None;
604        self.compiler_version = ::buffa::MessageField::none();
605        self.proto_file.clear();
606        self.source_file_descriptors.clear();
607        self.__buffa_unknown_fields.clear();
608    }
609}
610impl ::buffa::ExtensionSet for CodeGeneratorRequest {
611    const PROTO_FQN: &'static str = "google.protobuf.compiler.CodeGeneratorRequest";
612    fn unknown_fields(&self) -> &::buffa::UnknownFields {
613        &self.__buffa_unknown_fields
614    }
615    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
616        &mut self.__buffa_unknown_fields
617    }
618}
619#[cfg(feature = "text")]
620impl ::buffa::text::TextFormat for CodeGeneratorRequest {
621    fn encode_text(
622        &self,
623        enc: &mut ::buffa::text::TextEncoder<'_>,
624    ) -> ::core::fmt::Result {
625        #[allow(unused_imports)]
626        use ::buffa::Enumeration as _;
627        if let ::core::option::Option::Some(ref __v) = self.parameter {
628            enc.write_field_name("parameter")?;
629            enc.write_string(__v)?;
630        }
631        if self.compiler_version.is_set() {
632            enc.write_field_name("compiler_version")?;
633            enc.write_message(&*self.compiler_version)?;
634        }
635        for __v in &self.file_to_generate {
636            enc.write_field_name("file_to_generate")?;
637            enc.write_string(__v)?;
638        }
639        for __v in &self.proto_file {
640            enc.write_field_name("proto_file")?;
641            enc.write_message(__v)?;
642        }
643        for __v in &self.source_file_descriptors {
644            enc.write_field_name("source_file_descriptors")?;
645            enc.write_message(__v)?;
646        }
647        enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
648        ::core::result::Result::Ok(())
649    }
650    fn merge_text(
651        &mut self,
652        dec: &mut ::buffa::text::TextDecoder<'_>,
653    ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
654        #[allow(unused_imports)]
655        use ::buffa::Enumeration as _;
656        while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
657            match __name {
658                "parameter" => {
659                    self.parameter = ::core::option::Option::Some(
660                        dec.read_string()?.into_owned(),
661                    );
662                }
663                "compiler_version" => {
664                    dec.merge_message(self.compiler_version.get_or_insert_default())?
665                }
666                "file_to_generate" => {
667                    dec.read_repeated_into(
668                        &mut self.file_to_generate,
669                        |__d| ::core::result::Result::Ok(__d.read_string()?.into_owned()),
670                    )?
671                }
672                "proto_file" => {
673                    dec.read_repeated_into(
674                        &mut self.proto_file,
675                        |__d| {
676                            let mut __m = ::core::default::Default::default();
677                            __d.merge_message(&mut __m)?;
678                            ::core::result::Result::Ok(__m)
679                        },
680                    )?
681                }
682                "source_file_descriptors" => {
683                    dec.read_repeated_into(
684                        &mut self.source_file_descriptors,
685                        |__d| {
686                            let mut __m = ::core::default::Default::default();
687                            __d.merge_message(&mut __m)?;
688                            ::core::result::Result::Ok(__m)
689                        },
690                    )?
691                }
692                _ => dec.skip_value()?,
693            }
694        }
695        ::core::result::Result::Ok(())
696    }
697}
698#[cfg(feature = "json")]
699impl ::buffa::json_helpers::ProtoElemJson for CodeGeneratorRequest {
700    fn serialize_proto_json<S: ::serde::Serializer>(
701        v: &Self,
702        s: S,
703    ) -> ::core::result::Result<S::Ok, S::Error> {
704        ::serde::Serialize::serialize(v, s)
705    }
706    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
707        d: D,
708    ) -> ::core::result::Result<Self, D::Error> {
709        <Self as ::serde::Deserialize>::deserialize(d)
710    }
711}
712#[cfg(feature = "json")]
713#[doc(hidden)]
714pub const __CODE_GENERATOR_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
715    type_url: "type.googleapis.com/google.protobuf.compiler.CodeGeneratorRequest",
716    to_json: ::buffa::type_registry::any_to_json::<CodeGeneratorRequest>,
717    from_json: ::buffa::type_registry::any_from_json::<CodeGeneratorRequest>,
718    is_wkt: false,
719};
720#[cfg(feature = "text")]
721#[doc(hidden)]
722pub const __CODE_GENERATOR_REQUEST_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
723    type_url: "type.googleapis.com/google.protobuf.compiler.CodeGeneratorRequest",
724    text_encode: ::buffa::type_registry::any_encode_text::<CodeGeneratorRequest>,
725    text_merge: ::buffa::type_registry::any_merge_text::<CodeGeneratorRequest>,
726};
727/// The plugin writes an encoded CodeGeneratorResponse to stdout.
728#[derive(Clone, PartialEq, Default)]
729#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
730#[cfg_attr(feature = "json", serde(default))]
731#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
732pub struct CodeGeneratorResponse {
733    /// Error message.  If non-empty, code generation failed.  The plugin process
734    /// should exit with status code zero even if it reports an error in this way.
735    ///
736    /// This should be used to indicate errors in .proto files which prevent the
737    /// code generator from generating correct code.  Errors which indicate a
738    /// problem in protoc itself -- such as the input CodeGeneratorRequest being
739    /// unparseable -- should be reported by writing a message to stderr and
740    /// exiting with a non-zero status code.
741    ///
742    /// Field 1: `error`
743    #[cfg_attr(
744        feature = "json",
745        serde(rename = "error", skip_serializing_if = "::core::option::Option::is_none")
746    )]
747    pub error: ::core::option::Option<::buffa::alloc::string::String>,
748    /// A bitmask of supported features that the code generator supports.
749    /// This is a bitwise "or" of values from the Feature enum.
750    ///
751    /// Field 2: `supported_features`
752    #[cfg_attr(
753        feature = "json",
754        serde(
755            rename = "supportedFeatures",
756            alias = "supported_features",
757            with = "::buffa::json_helpers::opt_uint64",
758            skip_serializing_if = "::core::option::Option::is_none"
759        )
760    )]
761    pub supported_features: ::core::option::Option<u64>,
762    /// The minimum edition this plugin supports.  This will be treated as an
763    /// Edition enum, but we want to allow unknown values.  It should be specified
764    /// according the edition enum value, *not* the edition number.  Only takes
765    /// effect for plugins that have FEATURE_SUPPORTS_EDITIONS set.
766    ///
767    /// Field 3: `minimum_edition`
768    #[cfg_attr(
769        feature = "json",
770        serde(
771            rename = "minimumEdition",
772            alias = "minimum_edition",
773            with = "::buffa::json_helpers::opt_int32",
774            skip_serializing_if = "::core::option::Option::is_none"
775        )
776    )]
777    pub minimum_edition: ::core::option::Option<i32>,
778    /// The maximum edition this plugin supports.  This will be treated as an
779    /// Edition enum, but we want to allow unknown values.  It should be specified
780    /// according the edition enum value, *not* the edition number.  Only takes
781    /// effect for plugins that have FEATURE_SUPPORTS_EDITIONS set.
782    ///
783    /// Field 4: `maximum_edition`
784    #[cfg_attr(
785        feature = "json",
786        serde(
787            rename = "maximumEdition",
788            alias = "maximum_edition",
789            with = "::buffa::json_helpers::opt_int32",
790            skip_serializing_if = "::core::option::Option::is_none"
791        )
792    )]
793    pub maximum_edition: ::core::option::Option<i32>,
794    /// Field 15: `file`
795    #[cfg_attr(
796        feature = "json",
797        serde(
798            rename = "file",
799            skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
800            deserialize_with = "::buffa::json_helpers::null_as_default"
801        )
802    )]
803    pub file: ::buffa::alloc::vec::Vec<code_generator_response::File>,
804    #[cfg_attr(feature = "json", serde(skip))]
805    #[doc(hidden)]
806    pub __buffa_unknown_fields: ::buffa::UnknownFields,
807}
808impl ::core::fmt::Debug for CodeGeneratorResponse {
809    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
810        f.debug_struct("CodeGeneratorResponse")
811            .field("error", &self.error)
812            .field("supported_features", &self.supported_features)
813            .field("minimum_edition", &self.minimum_edition)
814            .field("maximum_edition", &self.maximum_edition)
815            .field("file", &self.file)
816            .finish()
817    }
818}
819impl CodeGeneratorResponse {
820    /// Protobuf type URL for this message, for use with `Any::pack` and
821    /// `Any::unpack_if`.
822    ///
823    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
824    pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse";
825}
826impl CodeGeneratorResponse {
827    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
828    #[inline]
829    ///Sets [`Self::error`] to `Some(value)`, consuming and returning `self`.
830    pub fn with_error(
831        mut self,
832        value: impl Into<::buffa::alloc::string::String>,
833    ) -> Self {
834        self.error = Some(value.into());
835        self
836    }
837    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
838    #[inline]
839    ///Sets [`Self::supported_features`] to `Some(value)`, consuming and returning `self`.
840    pub fn with_supported_features(mut self, value: u64) -> Self {
841        self.supported_features = Some(value);
842        self
843    }
844    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
845    #[inline]
846    ///Sets [`Self::minimum_edition`] to `Some(value)`, consuming and returning `self`.
847    pub fn with_minimum_edition(mut self, value: i32) -> Self {
848        self.minimum_edition = Some(value);
849        self
850    }
851    #[must_use = "with_* setters return `self` by value; assign or chain the result"]
852    #[inline]
853    ///Sets [`Self::maximum_edition`] to `Some(value)`, consuming and returning `self`.
854    pub fn with_maximum_edition(mut self, value: i32) -> Self {
855        self.maximum_edition = Some(value);
856        self
857    }
858}
859::buffa::impl_default_instance!(CodeGeneratorResponse);
860impl ::buffa::MessageName for CodeGeneratorResponse {
861    const PACKAGE: &'static str = "google.protobuf.compiler";
862    const NAME: &'static str = "CodeGeneratorResponse";
863    const FULL_NAME: &'static str = "google.protobuf.compiler.CodeGeneratorResponse";
864    const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse";
865}
866impl ::buffa::Message for CodeGeneratorResponse {
867    /// Returns the total encoded size in bytes.
868    ///
869    /// Accumulates in `u64` (which cannot overflow for in-memory
870    /// data) and saturates to `u32` at return, so a message whose
871    /// encoded size exceeds the 2 GiB protobuf limit yields a value
872    /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry
873    /// points reject, never a silently wrapped size.
874    #[allow(clippy::let_and_return)]
875    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
876        #[allow(unused_imports)]
877        use ::buffa::Enumeration as _;
878        let mut size = 0u64;
879        if let Some(ref v) = self.error {
880            size += 1u64 + ::buffa::types::string_encoded_len(v) as u64;
881        }
882        if let Some(v) = self.supported_features {
883            size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64;
884        }
885        if let Some(v) = self.minimum_edition {
886            size += 1u64 + ::buffa::types::int32_encoded_len(v) as u64;
887        }
888        if let Some(v) = self.maximum_edition {
889            size += 1u64 + ::buffa::types::int32_encoded_len(v) as u64;
890        }
891        for v in &self.file {
892            let __slot = __cache.reserve();
893            let inner_size = v.compute_size(__cache);
894            __cache.set(__slot, inner_size);
895            size
896                += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
897                    + inner_size as u64;
898        }
899        size += self.__buffa_unknown_fields.encoded_len() as u64;
900        ::buffa::saturate_size(size)
901    }
902    fn write_to(
903        &self,
904        __cache: &mut ::buffa::SizeCache,
905        buf: &mut impl ::buffa::EncodeSink,
906    ) {
907        #[allow(unused_imports)]
908        use ::buffa::Enumeration as _;
909        if let Some(ref v) = self.error {
910            ::buffa::types::put_string_field(1u32, v, buf);
911        }
912        if let Some(v) = self.supported_features {
913            ::buffa::types::put_uint64_field(2u32, v, buf);
914        }
915        if let Some(v) = self.minimum_edition {
916            ::buffa::types::put_int32_field(3u32, v, buf);
917        }
918        if let Some(v) = self.maximum_edition {
919            ::buffa::types::put_int32_field(4u32, v, buf);
920        }
921        for v in &self.file {
922            ::buffa::types::put_len_delimited_header(
923                15u32,
924                u64::from(__cache.consume_next()),
925                buf,
926            );
927            v.write_to(__cache, buf);
928        }
929        self.__buffa_unknown_fields.write_to(buf);
930    }
931    fn merge_field(
932        &mut self,
933        tag: ::buffa::encoding::Tag,
934        buf: &mut impl ::buffa::bytes::Buf,
935        ctx: ::buffa::DecodeContext<'_>,
936    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
937        #[allow(unused_imports)]
938        use ::buffa::bytes::Buf as _;
939        #[allow(unused_imports)]
940        use ::buffa::Enumeration as _;
941        match tag.field_number() {
942            1u32 => {
943                ::buffa::encoding::check_wire_type(
944                    tag,
945                    ::buffa::encoding::WireType::LengthDelimited,
946                )?;
947                ::buffa::types::merge_string(
948                    self.error.get_or_insert_with(::buffa::alloc::string::String::new),
949                    buf,
950                )?;
951            }
952            2u32 => {
953                ::buffa::encoding::check_wire_type(
954                    tag,
955                    ::buffa::encoding::WireType::Varint,
956                )?;
957                self.supported_features = ::core::option::Option::Some(
958                    ::buffa::types::decode_uint64(buf)?,
959                );
960            }
961            3u32 => {
962                ::buffa::encoding::check_wire_type(
963                    tag,
964                    ::buffa::encoding::WireType::Varint,
965                )?;
966                self.minimum_edition = ::core::option::Option::Some(
967                    ::buffa::types::decode_int32(buf)?,
968                );
969            }
970            4u32 => {
971                ::buffa::encoding::check_wire_type(
972                    tag,
973                    ::buffa::encoding::WireType::Varint,
974                )?;
975                self.maximum_edition = ::core::option::Option::Some(
976                    ::buffa::types::decode_int32(buf)?,
977                );
978            }
979            15u32 => {
980                ::buffa::encoding::check_wire_type(
981                    tag,
982                    ::buffa::encoding::WireType::LengthDelimited,
983                )?;
984                let mut elem = ::core::default::Default::default();
985                ctx.register_element_memory(
986                    ::buffa::__private::element_footprint(&elem),
987                )?;
988                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
989                self.file.push(elem);
990            }
991            _ => {
992                self.__buffa_unknown_fields
993                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
994            }
995        }
996        ::core::result::Result::Ok(())
997    }
998    fn clear(&mut self) {
999        self.error = ::core::option::Option::None;
1000        self.supported_features = ::core::option::Option::None;
1001        self.minimum_edition = ::core::option::Option::None;
1002        self.maximum_edition = ::core::option::Option::None;
1003        self.file.clear();
1004        self.__buffa_unknown_fields.clear();
1005    }
1006}
1007impl ::buffa::ExtensionSet for CodeGeneratorResponse {
1008    const PROTO_FQN: &'static str = "google.protobuf.compiler.CodeGeneratorResponse";
1009    fn unknown_fields(&self) -> &::buffa::UnknownFields {
1010        &self.__buffa_unknown_fields
1011    }
1012    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1013        &mut self.__buffa_unknown_fields
1014    }
1015}
1016#[cfg(feature = "text")]
1017impl ::buffa::text::TextFormat for CodeGeneratorResponse {
1018    fn encode_text(
1019        &self,
1020        enc: &mut ::buffa::text::TextEncoder<'_>,
1021    ) -> ::core::fmt::Result {
1022        #[allow(unused_imports)]
1023        use ::buffa::Enumeration as _;
1024        if let ::core::option::Option::Some(ref __v) = self.error {
1025            enc.write_field_name("error")?;
1026            enc.write_string(__v)?;
1027        }
1028        if let ::core::option::Option::Some(ref __v) = self.supported_features {
1029            enc.write_field_name("supported_features")?;
1030            enc.write_u64(*__v)?;
1031        }
1032        if let ::core::option::Option::Some(ref __v) = self.minimum_edition {
1033            enc.write_field_name("minimum_edition")?;
1034            enc.write_i32(*__v)?;
1035        }
1036        if let ::core::option::Option::Some(ref __v) = self.maximum_edition {
1037            enc.write_field_name("maximum_edition")?;
1038            enc.write_i32(*__v)?;
1039        }
1040        for __v in &self.file {
1041            enc.write_field_name("file")?;
1042            enc.write_message(__v)?;
1043        }
1044        enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
1045        ::core::result::Result::Ok(())
1046    }
1047    fn merge_text(
1048        &mut self,
1049        dec: &mut ::buffa::text::TextDecoder<'_>,
1050    ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
1051        #[allow(unused_imports)]
1052        use ::buffa::Enumeration as _;
1053        while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
1054            match __name {
1055                "error" => {
1056                    self.error = ::core::option::Option::Some(
1057                        dec.read_string()?.into_owned(),
1058                    );
1059                }
1060                "supported_features" => {
1061                    self.supported_features = ::core::option::Option::Some(
1062                        dec.read_u64()?,
1063                    );
1064                }
1065                "minimum_edition" => {
1066                    self.minimum_edition = ::core::option::Option::Some(dec.read_i32()?);
1067                }
1068                "maximum_edition" => {
1069                    self.maximum_edition = ::core::option::Option::Some(dec.read_i32()?);
1070                }
1071                "file" => {
1072                    dec.read_repeated_into(
1073                        &mut self.file,
1074                        |__d| {
1075                            let mut __m = ::core::default::Default::default();
1076                            __d.merge_message(&mut __m)?;
1077                            ::core::result::Result::Ok(__m)
1078                        },
1079                    )?
1080                }
1081                _ => dec.skip_value()?,
1082            }
1083        }
1084        ::core::result::Result::Ok(())
1085    }
1086}
1087#[cfg(feature = "json")]
1088impl ::buffa::json_helpers::ProtoElemJson for CodeGeneratorResponse {
1089    fn serialize_proto_json<S: ::serde::Serializer>(
1090        v: &Self,
1091        s: S,
1092    ) -> ::core::result::Result<S::Ok, S::Error> {
1093        ::serde::Serialize::serialize(v, s)
1094    }
1095    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1096        d: D,
1097    ) -> ::core::result::Result<Self, D::Error> {
1098        <Self as ::serde::Deserialize>::deserialize(d)
1099    }
1100}
1101#[cfg(feature = "json")]
1102#[doc(hidden)]
1103pub const __CODE_GENERATOR_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1104    type_url: "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse",
1105    to_json: ::buffa::type_registry::any_to_json::<CodeGeneratorResponse>,
1106    from_json: ::buffa::type_registry::any_from_json::<CodeGeneratorResponse>,
1107    is_wkt: false,
1108};
1109#[cfg(feature = "text")]
1110#[doc(hidden)]
1111pub const __CODE_GENERATOR_RESPONSE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
1112    type_url: "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse",
1113    text_encode: ::buffa::type_registry::any_encode_text::<CodeGeneratorResponse>,
1114    text_merge: ::buffa::type_registry::any_merge_text::<CodeGeneratorResponse>,
1115};
1116pub mod code_generator_response {
1117    #[allow(unused_imports)]
1118    use super::*;
1119    /// Sync with code_generator.h.
1120    #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
1121    #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
1122    #[repr(i32)]
1123    pub enum Feature {
1124        FEATURE_NONE = 0i32,
1125        FEATURE_PROTO3_OPTIONAL = 1i32,
1126        FEATURE_SUPPORTS_EDITIONS = 2i32,
1127    }
1128    impl Feature {
1129        ///Idiomatic alias for [`Self::FEATURE_NONE`]; `Debug` prints the variant name.
1130        #[allow(non_upper_case_globals)]
1131        pub const None: Self = Self::FEATURE_NONE;
1132        ///Idiomatic alias for [`Self::FEATURE_PROTO3_OPTIONAL`]; `Debug` prints the variant name.
1133        #[allow(non_upper_case_globals)]
1134        pub const Proto3Optional: Self = Self::FEATURE_PROTO3_OPTIONAL;
1135        ///Idiomatic alias for [`Self::FEATURE_SUPPORTS_EDITIONS`]; `Debug` prints the variant name.
1136        #[allow(non_upper_case_globals)]
1137        pub const SupportsEditions: Self = Self::FEATURE_SUPPORTS_EDITIONS;
1138    }
1139    impl ::core::default::Default for Feature {
1140        fn default() -> Self {
1141            Self::FEATURE_NONE
1142        }
1143    }
1144    #[cfg(feature = "json")]
1145    const _: () = {
1146        impl ::serde::Serialize for Feature {
1147            fn serialize<S: ::serde::Serializer>(
1148                &self,
1149                s: S,
1150            ) -> ::core::result::Result<S::Ok, S::Error> {
1151                s.serialize_str(::buffa::Enumeration::proto_name(self))
1152            }
1153        }
1154        impl<'de> ::serde::Deserialize<'de> for Feature {
1155            fn deserialize<D: ::serde::Deserializer<'de>>(
1156                d: D,
1157            ) -> ::core::result::Result<Self, D::Error> {
1158                struct _V;
1159                impl ::serde::de::Visitor<'_> for _V {
1160                    type Value = Feature;
1161                    fn expecting(
1162                        &self,
1163                        f: &mut ::core::fmt::Formatter<'_>,
1164                    ) -> ::core::fmt::Result {
1165                        f.write_str(
1166                            concat!(
1167                                "a string, integer, or null for ", stringify!(Feature)
1168                            ),
1169                        )
1170                    }
1171                    fn visit_str<E: ::serde::de::Error>(
1172                        self,
1173                        v: &str,
1174                    ) -> ::core::result::Result<Feature, E> {
1175                        <Feature as ::buffa::Enumeration>::from_proto_name(v)
1176                            .ok_or_else(|| {
1177                                ::serde::de::Error::unknown_variant(v, &[])
1178                            })
1179                    }
1180                    fn visit_i64<E: ::serde::de::Error>(
1181                        self,
1182                        v: i64,
1183                    ) -> ::core::result::Result<Feature, E> {
1184                        let v32 = i32::try_from(v)
1185                            .map_err(|_| {
1186                                ::serde::de::Error::custom(
1187                                    ::buffa::alloc::format!("enum value {v} out of i32 range"),
1188                                )
1189                            })?;
1190                        <Feature as ::buffa::Enumeration>::from_i32(v32)
1191                            .ok_or_else(|| {
1192                                ::serde::de::Error::custom(
1193                                    ::buffa::alloc::format!("unknown enum value {v32}"),
1194                                )
1195                            })
1196                    }
1197                    fn visit_u64<E: ::serde::de::Error>(
1198                        self,
1199                        v: u64,
1200                    ) -> ::core::result::Result<Feature, E> {
1201                        let v32 = i32::try_from(v)
1202                            .map_err(|_| {
1203                                ::serde::de::Error::custom(
1204                                    ::buffa::alloc::format!("enum value {v} out of i32 range"),
1205                                )
1206                            })?;
1207                        <Feature as ::buffa::Enumeration>::from_i32(v32)
1208                            .ok_or_else(|| {
1209                                ::serde::de::Error::custom(
1210                                    ::buffa::alloc::format!("unknown enum value {v32}"),
1211                                )
1212                            })
1213                    }
1214                    fn visit_unit<E: ::serde::de::Error>(
1215                        self,
1216                    ) -> ::core::result::Result<Feature, E> {
1217                        ::core::result::Result::Ok(::core::default::Default::default())
1218                    }
1219                }
1220                d.deserialize_any(_V)
1221            }
1222        }
1223        impl ::buffa::json_helpers::ProtoElemJson for Feature {
1224            fn serialize_proto_json<S: ::serde::Serializer>(
1225                v: &Self,
1226                s: S,
1227            ) -> ::core::result::Result<S::Ok, S::Error> {
1228                ::serde::Serialize::serialize(v, s)
1229            }
1230            fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1231                d: D,
1232            ) -> ::core::result::Result<Self, D::Error> {
1233                <Self as ::serde::Deserialize>::deserialize(d)
1234            }
1235        }
1236    };
1237    impl ::buffa::Enumeration for Feature {
1238        fn from_i32(value: i32) -> ::core::option::Option<Self> {
1239            match value {
1240                0i32 => ::core::option::Option::Some(Self::FEATURE_NONE),
1241                1i32 => ::core::option::Option::Some(Self::FEATURE_PROTO3_OPTIONAL),
1242                2i32 => ::core::option::Option::Some(Self::FEATURE_SUPPORTS_EDITIONS),
1243                _ => ::core::option::Option::None,
1244            }
1245        }
1246        fn to_i32(&self) -> i32 {
1247            *self as i32
1248        }
1249        fn proto_name(&self) -> &'static str {
1250            match self {
1251                Self::FEATURE_NONE => "FEATURE_NONE",
1252                Self::FEATURE_PROTO3_OPTIONAL => "FEATURE_PROTO3_OPTIONAL",
1253                Self::FEATURE_SUPPORTS_EDITIONS => "FEATURE_SUPPORTS_EDITIONS",
1254            }
1255        }
1256        fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
1257            match name {
1258                "FEATURE_NONE" => ::core::option::Option::Some(Self::FEATURE_NONE),
1259                "FEATURE_PROTO3_OPTIONAL" => {
1260                    ::core::option::Option::Some(Self::FEATURE_PROTO3_OPTIONAL)
1261                }
1262                "FEATURE_SUPPORTS_EDITIONS" => {
1263                    ::core::option::Option::Some(Self::FEATURE_SUPPORTS_EDITIONS)
1264                }
1265                _ => ::core::option::Option::None,
1266            }
1267        }
1268        fn values() -> &'static [Self] {
1269            &[
1270                Self::FEATURE_NONE,
1271                Self::FEATURE_PROTO3_OPTIONAL,
1272                Self::FEATURE_SUPPORTS_EDITIONS,
1273            ]
1274        }
1275    }
1276    /// Represents a single generated file.
1277    #[derive(Clone, PartialEq, Default)]
1278    #[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
1279    #[cfg_attr(feature = "json", serde(default))]
1280    #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
1281    pub struct File {
1282        /// The file name, relative to the output directory.  The name must not
1283        /// contain "." or ".." components and must be relative, not be absolute (so,
1284        /// the file cannot lie outside the output directory).  "/" must be used as
1285        /// the path separator, not "\".
1286        ///
1287        /// If the name is omitted, the content will be appended to the previous
1288        /// file.  This allows the generator to break large files into small chunks,
1289        /// and allows the generated text to be streamed back to protoc so that large
1290        /// files need not reside completely in memory at one time.  Note that as of
1291        /// this writing protoc does not optimize for this -- it will read the entire
1292        /// CodeGeneratorResponse before writing files to disk.
1293        ///
1294        /// Field 1: `name`
1295        #[cfg_attr(
1296            feature = "json",
1297            serde(
1298                rename = "name",
1299                skip_serializing_if = "::core::option::Option::is_none"
1300            )
1301        )]
1302        pub name: ::core::option::Option<::buffa::alloc::string::String>,
1303        /// If non-empty, indicates that the named file should already exist, and the
1304        /// content here is to be inserted into that file at a defined insertion
1305        /// point.  This feature allows a code generator to extend the output
1306        /// produced by another code generator.  The original generator may provide
1307        /// insertion points by placing special annotations in the file that look
1308        /// like:
1309        ///   @@protoc_insertion_point(NAME)
1310        /// The annotation can have arbitrary text before and after it on the line,
1311        /// which allows it to be placed in a comment.  NAME should be replaced with
1312        /// an identifier naming the point -- this is what other generators will use
1313        /// as the insertion_point.  Code inserted at this point will be placed
1314        /// immediately above the line containing the insertion point (thus multiple
1315        /// insertions to the same point will come out in the order they were added).
1316        /// The double-@ is intended to make it unlikely that the generated code
1317        /// could contain things that look like insertion points by accident.
1318        ///
1319        /// For example, the C++ code generator places the following line in the
1320        /// .pb.h files that it generates:
1321        ///   // @@protoc_insertion_point(namespace_scope)
1322        /// This line appears within the scope of the file's package namespace, but
1323        /// outside of any particular class.  Another plugin can then specify the
1324        /// insertion_point "namespace_scope" to generate additional classes or
1325        /// other declarations that should be placed in this scope.
1326        ///
1327        /// Note that if the line containing the insertion point begins with
1328        /// whitespace, the same whitespace will be added to every line of the
1329        /// inserted text.  This is useful for languages like Python, where
1330        /// indentation matters.  In these languages, the insertion point comment
1331        /// should be indented the same amount as any inserted code will need to be
1332        /// in order to work correctly in that context.
1333        ///
1334        /// The code generator that generates the initial file and the one which
1335        /// inserts into it must both run as part of a single invocation of protoc.
1336        /// Code generators are executed in the order in which they appear on the
1337        /// command line.
1338        ///
1339        /// If |insertion_point| is present, |name| must also be present.
1340        ///
1341        /// Field 2: `insertion_point`
1342        #[cfg_attr(
1343            feature = "json",
1344            serde(
1345                rename = "insertionPoint",
1346                alias = "insertion_point",
1347                skip_serializing_if = "::core::option::Option::is_none"
1348            )
1349        )]
1350        pub insertion_point: ::core::option::Option<::buffa::alloc::string::String>,
1351        /// The file contents.
1352        ///
1353        /// Field 15: `content`
1354        #[cfg_attr(
1355            feature = "json",
1356            serde(
1357                rename = "content",
1358                skip_serializing_if = "::core::option::Option::is_none"
1359            )
1360        )]
1361        pub content: ::core::option::Option<::buffa::alloc::string::String>,
1362        /// Information describing the file content being inserted. If an insertion
1363        /// point is used, this information will be appropriately offset and inserted
1364        /// into the code generation metadata for the generated files.
1365        ///
1366        /// Field 16: `generated_code_info`
1367        #[cfg_attr(
1368            feature = "json",
1369            serde(
1370                rename = "generatedCodeInfo",
1371                alias = "generated_code_info",
1372                skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
1373            )
1374        )]
1375        pub generated_code_info: ::buffa::MessageField<
1376            super::super::GeneratedCodeInfo,
1377            ::buffa::Inline<super::super::GeneratedCodeInfo>,
1378        >,
1379        #[cfg_attr(feature = "json", serde(skip))]
1380        #[doc(hidden)]
1381        pub __buffa_unknown_fields: ::buffa::UnknownFields,
1382    }
1383    impl ::core::fmt::Debug for File {
1384        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1385            f.debug_struct("File")
1386                .field("name", &self.name)
1387                .field("insertion_point", &self.insertion_point)
1388                .field("content", &self.content)
1389                .field("generated_code_info", &self.generated_code_info)
1390                .finish()
1391        }
1392    }
1393    impl File {
1394        /// Protobuf type URL for this message, for use with `Any::pack` and
1395        /// `Any::unpack_if`.
1396        ///
1397        /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
1398        pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse.File";
1399    }
1400    impl File {
1401        #[must_use = "with_* setters return `self` by value; assign or chain the result"]
1402        #[inline]
1403        ///Sets [`Self::name`] to `Some(value)`, consuming and returning `self`.
1404        pub fn with_name(
1405            mut self,
1406            value: impl Into<::buffa::alloc::string::String>,
1407        ) -> Self {
1408            self.name = Some(value.into());
1409            self
1410        }
1411        #[must_use = "with_* setters return `self` by value; assign or chain the result"]
1412        #[inline]
1413        ///Sets [`Self::insertion_point`] to `Some(value)`, consuming and returning `self`.
1414        pub fn with_insertion_point(
1415            mut self,
1416            value: impl Into<::buffa::alloc::string::String>,
1417        ) -> Self {
1418            self.insertion_point = Some(value.into());
1419            self
1420        }
1421        #[must_use = "with_* setters return `self` by value; assign or chain the result"]
1422        #[inline]
1423        ///Sets [`Self::content`] to `Some(value)`, consuming and returning `self`.
1424        pub fn with_content(
1425            mut self,
1426            value: impl Into<::buffa::alloc::string::String>,
1427        ) -> Self {
1428            self.content = Some(value.into());
1429            self
1430        }
1431    }
1432    ::buffa::impl_default_instance!(File);
1433    impl ::buffa::MessageName for File {
1434        const PACKAGE: &'static str = "google.protobuf.compiler";
1435        const NAME: &'static str = "CodeGeneratorResponse.File";
1436        const FULL_NAME: &'static str = "google.protobuf.compiler.CodeGeneratorResponse.File";
1437        const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse.File";
1438    }
1439    impl ::buffa::Message for File {
1440        /// Returns the total encoded size in bytes.
1441        ///
1442        /// Accumulates in `u64` (which cannot overflow for in-memory
1443        /// data) and saturates to `u32` at return, so a message whose
1444        /// encoded size exceeds the 2 GiB protobuf limit yields a value
1445        /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry
1446        /// points reject, never a silently wrapped size.
1447        #[allow(clippy::let_and_return)]
1448        fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
1449            #[allow(unused_imports)]
1450            use ::buffa::Enumeration as _;
1451            let mut size = 0u64;
1452            if let Some(ref v) = self.name {
1453                size += 1u64 + ::buffa::types::string_encoded_len(v) as u64;
1454            }
1455            if let Some(ref v) = self.insertion_point {
1456                size += 1u64 + ::buffa::types::string_encoded_len(v) as u64;
1457            }
1458            if let Some(ref v) = self.content {
1459                size += 1u64 + ::buffa::types::string_encoded_len(v) as u64;
1460            }
1461            if self.generated_code_info.is_set() {
1462                let __slot = __cache.reserve();
1463                let inner_size = self.generated_code_info.compute_size(__cache);
1464                __cache.set(__slot, inner_size);
1465                size
1466                    += 2u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
1467                        + inner_size as u64;
1468            }
1469            size += self.__buffa_unknown_fields.encoded_len() as u64;
1470            ::buffa::saturate_size(size)
1471        }
1472        fn write_to(
1473            &self,
1474            __cache: &mut ::buffa::SizeCache,
1475            buf: &mut impl ::buffa::EncodeSink,
1476        ) {
1477            #[allow(unused_imports)]
1478            use ::buffa::Enumeration as _;
1479            if let Some(ref v) = self.name {
1480                ::buffa::types::put_string_field(1u32, v, buf);
1481            }
1482            if let Some(ref v) = self.insertion_point {
1483                ::buffa::types::put_string_field(2u32, v, buf);
1484            }
1485            if let Some(ref v) = self.content {
1486                ::buffa::types::put_string_field(15u32, v, buf);
1487            }
1488            if self.generated_code_info.is_set() {
1489                ::buffa::types::put_len_delimited_header(
1490                    16u32,
1491                    u64::from(__cache.consume_next()),
1492                    buf,
1493                );
1494                self.generated_code_info.write_to(__cache, buf);
1495            }
1496            self.__buffa_unknown_fields.write_to(buf);
1497        }
1498        fn merge_field(
1499            &mut self,
1500            tag: ::buffa::encoding::Tag,
1501            buf: &mut impl ::buffa::bytes::Buf,
1502            ctx: ::buffa::DecodeContext<'_>,
1503        ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1504            #[allow(unused_imports)]
1505            use ::buffa::bytes::Buf as _;
1506            #[allow(unused_imports)]
1507            use ::buffa::Enumeration as _;
1508            match tag.field_number() {
1509                1u32 => {
1510                    ::buffa::encoding::check_wire_type(
1511                        tag,
1512                        ::buffa::encoding::WireType::LengthDelimited,
1513                    )?;
1514                    ::buffa::types::merge_string(
1515                        self
1516                            .name
1517                            .get_or_insert_with(::buffa::alloc::string::String::new),
1518                        buf,
1519                    )?;
1520                }
1521                2u32 => {
1522                    ::buffa::encoding::check_wire_type(
1523                        tag,
1524                        ::buffa::encoding::WireType::LengthDelimited,
1525                    )?;
1526                    ::buffa::types::merge_string(
1527                        self
1528                            .insertion_point
1529                            .get_or_insert_with(::buffa::alloc::string::String::new),
1530                        buf,
1531                    )?;
1532                }
1533                15u32 => {
1534                    ::buffa::encoding::check_wire_type(
1535                        tag,
1536                        ::buffa::encoding::WireType::LengthDelimited,
1537                    )?;
1538                    ::buffa::types::merge_string(
1539                        self
1540                            .content
1541                            .get_or_insert_with(::buffa::alloc::string::String::new),
1542                        buf,
1543                    )?;
1544                }
1545                16u32 => {
1546                    ::buffa::encoding::check_wire_type(
1547                        tag,
1548                        ::buffa::encoding::WireType::LengthDelimited,
1549                    )?;
1550                    ::buffa::Message::merge_length_delimited(
1551                        self.generated_code_info.get_or_insert_default(),
1552                        buf,
1553                        ctx,
1554                    )?;
1555                }
1556                _ => {
1557                    self.__buffa_unknown_fields
1558                        .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1559                }
1560            }
1561            ::core::result::Result::Ok(())
1562        }
1563        fn clear(&mut self) {
1564            self.name = ::core::option::Option::None;
1565            self.insertion_point = ::core::option::Option::None;
1566            self.content = ::core::option::Option::None;
1567            self.generated_code_info = ::buffa::MessageField::none();
1568            self.__buffa_unknown_fields.clear();
1569        }
1570    }
1571    impl ::buffa::ExtensionSet for File {
1572        const PROTO_FQN: &'static str = "google.protobuf.compiler.CodeGeneratorResponse.File";
1573        fn unknown_fields(&self) -> &::buffa::UnknownFields {
1574            &self.__buffa_unknown_fields
1575        }
1576        fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1577            &mut self.__buffa_unknown_fields
1578        }
1579    }
1580    #[cfg(feature = "text")]
1581    impl ::buffa::text::TextFormat for File {
1582        fn encode_text(
1583            &self,
1584            enc: &mut ::buffa::text::TextEncoder<'_>,
1585        ) -> ::core::fmt::Result {
1586            #[allow(unused_imports)]
1587            use ::buffa::Enumeration as _;
1588            if let ::core::option::Option::Some(ref __v) = self.name {
1589                enc.write_field_name("name")?;
1590                enc.write_string(__v)?;
1591            }
1592            if let ::core::option::Option::Some(ref __v) = self.insertion_point {
1593                enc.write_field_name("insertion_point")?;
1594                enc.write_string(__v)?;
1595            }
1596            if let ::core::option::Option::Some(ref __v) = self.content {
1597                enc.write_field_name("content")?;
1598                enc.write_string(__v)?;
1599            }
1600            if self.generated_code_info.is_set() {
1601                enc.write_field_name("generated_code_info")?;
1602                enc.write_message(&*self.generated_code_info)?;
1603            }
1604            enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
1605            ::core::result::Result::Ok(())
1606        }
1607        fn merge_text(
1608            &mut self,
1609            dec: &mut ::buffa::text::TextDecoder<'_>,
1610        ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
1611            #[allow(unused_imports)]
1612            use ::buffa::Enumeration as _;
1613            while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
1614                match __name {
1615                    "name" => {
1616                        self.name = ::core::option::Option::Some(
1617                            dec.read_string()?.into_owned(),
1618                        );
1619                    }
1620                    "insertion_point" => {
1621                        self.insertion_point = ::core::option::Option::Some(
1622                            dec.read_string()?.into_owned(),
1623                        );
1624                    }
1625                    "content" => {
1626                        self.content = ::core::option::Option::Some(
1627                            dec.read_string()?.into_owned(),
1628                        );
1629                    }
1630                    "generated_code_info" => {
1631                        dec.merge_message(
1632                            self.generated_code_info.get_or_insert_default(),
1633                        )?
1634                    }
1635                    _ => dec.skip_value()?,
1636                }
1637            }
1638            ::core::result::Result::Ok(())
1639        }
1640    }
1641    #[cfg(feature = "json")]
1642    impl ::buffa::json_helpers::ProtoElemJson for File {
1643        fn serialize_proto_json<S: ::serde::Serializer>(
1644            v: &Self,
1645            s: S,
1646        ) -> ::core::result::Result<S::Ok, S::Error> {
1647            ::serde::Serialize::serialize(v, s)
1648        }
1649        fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1650            d: D,
1651        ) -> ::core::result::Result<Self, D::Error> {
1652            <Self as ::serde::Deserialize>::deserialize(d)
1653        }
1654    }
1655    #[cfg(feature = "json")]
1656    #[doc(hidden)]
1657    pub const __FILE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1658        type_url: "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse.File",
1659        to_json: ::buffa::type_registry::any_to_json::<File>,
1660        from_json: ::buffa::type_registry::any_from_json::<File>,
1661        is_wkt: false,
1662    };
1663    #[cfg(feature = "text")]
1664    #[doc(hidden)]
1665    pub const __FILE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
1666        type_url: "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse.File",
1667        text_encode: ::buffa::type_registry::any_encode_text::<File>,
1668        text_merge: ::buffa::type_registry::any_merge_text::<File>,
1669    };
1670    #[cfg(feature = "views")]
1671    #[doc(inline)]
1672    pub use super::__buffa::view::code_generator_response::FileView;
1673    #[cfg(feature = "views")]
1674    #[doc(inline)]
1675    pub use super::__buffa::view::code_generator_response::FileOwnedView;
1676}