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