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