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)]
6pub struct Version {
7    /// Field 1: `major`
8    pub major: ::core::option::Option<i32>,
9    /// Field 2: `minor`
10    pub minor: ::core::option::Option<i32>,
11    /// Field 3: `patch`
12    pub patch: ::core::option::Option<i32>,
13    /// A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
14    /// be empty for mainline stable releases.
15    ///
16    /// Field 4: `suffix`
17    pub suffix: ::core::option::Option<::buffa::alloc::string::String>,
18    #[doc(hidden)]
19    pub __buffa_unknown_fields: ::buffa::UnknownFields,
20}
21impl ::core::fmt::Debug for Version {
22    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
23        f.debug_struct("Version")
24            .field("major", &self.major)
25            .field("minor", &self.minor)
26            .field("patch", &self.patch)
27            .field("suffix", &self.suffix)
28            .finish()
29    }
30}
31impl Version {
32    /// Protobuf type URL for this message, for use with `Any::pack` and
33    /// `Any::unpack_if`.
34    ///
35    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
36    pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.Version";
37}
38impl ::buffa::DefaultInstance for Version {
39    fn default_instance() -> &'static Self {
40        static VALUE: ::buffa::__private::OnceBox<Version> = ::buffa::__private::OnceBox::new();
41        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
42    }
43}
44impl ::buffa::Message for Version {
45    /// Returns the total encoded size in bytes.
46    ///
47    /// The result is a `u32`; the protobuf specification requires all
48    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
49    /// compliant message will never overflow this type.
50    #[allow(clippy::let_and_return)]
51    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
52        #[allow(unused_imports)]
53        use ::buffa::Enumeration as _;
54        let mut size = 0u32;
55        if let Some(v) = self.major {
56            size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
57        }
58        if let Some(v) = self.minor {
59            size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
60        }
61        if let Some(v) = self.patch {
62            size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
63        }
64        if let Some(ref v) = self.suffix {
65            size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
66        }
67        size += self.__buffa_unknown_fields.encoded_len() as u32;
68        size
69    }
70    fn write_to(
71        &self,
72        _cache: &mut ::buffa::SizeCache,
73        buf: &mut impl ::buffa::bytes::BufMut,
74    ) {
75        #[allow(unused_imports)]
76        use ::buffa::Enumeration as _;
77        if let Some(v) = self.major {
78            ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
79                .encode(buf);
80            ::buffa::types::encode_int32(v, buf);
81        }
82        if let Some(v) = self.minor {
83            ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
84                .encode(buf);
85            ::buffa::types::encode_int32(v, buf);
86        }
87        if let Some(v) = self.patch {
88            ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
89                .encode(buf);
90            ::buffa::types::encode_int32(v, buf);
91        }
92        if let Some(ref v) = self.suffix {
93            ::buffa::encoding::Tag::new(
94                    4u32,
95                    ::buffa::encoding::WireType::LengthDelimited,
96                )
97                .encode(buf);
98            ::buffa::types::encode_string(v, buf);
99        }
100        self.__buffa_unknown_fields.write_to(buf);
101    }
102    fn merge_field(
103        &mut self,
104        tag: ::buffa::encoding::Tag,
105        buf: &mut impl ::buffa::bytes::Buf,
106        depth: u32,
107    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
108        #[allow(unused_imports)]
109        use ::buffa::bytes::Buf as _;
110        #[allow(unused_imports)]
111        use ::buffa::Enumeration as _;
112        match tag.field_number() {
113            1u32 => {
114                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
115                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
116                        field_number: 1u32,
117                        expected: 0u8,
118                        actual: tag.wire_type() as u8,
119                    });
120                }
121                self.major = ::core::option::Option::Some(
122                    ::buffa::types::decode_int32(buf)?,
123                );
124            }
125            2u32 => {
126                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
127                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
128                        field_number: 2u32,
129                        expected: 0u8,
130                        actual: tag.wire_type() as u8,
131                    });
132                }
133                self.minor = ::core::option::Option::Some(
134                    ::buffa::types::decode_int32(buf)?,
135                );
136            }
137            3u32 => {
138                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
139                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
140                        field_number: 3u32,
141                        expected: 0u8,
142                        actual: tag.wire_type() as u8,
143                    });
144                }
145                self.patch = ::core::option::Option::Some(
146                    ::buffa::types::decode_int32(buf)?,
147                );
148            }
149            4u32 => {
150                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
151                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
152                        field_number: 4u32,
153                        expected: 2u8,
154                        actual: tag.wire_type() as u8,
155                    });
156                }
157                ::buffa::types::merge_string(
158                    self.suffix.get_or_insert_with(::buffa::alloc::string::String::new),
159                    buf,
160                )?;
161            }
162            _ => {
163                self.__buffa_unknown_fields
164                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
165            }
166        }
167        ::core::result::Result::Ok(())
168    }
169    fn clear(&mut self) {
170        self.major = ::core::option::Option::None;
171        self.minor = ::core::option::Option::None;
172        self.patch = ::core::option::Option::None;
173        self.suffix = ::core::option::Option::None;
174        self.__buffa_unknown_fields.clear();
175    }
176}
177impl ::buffa::ExtensionSet for Version {
178    const PROTO_FQN: &'static str = "google.protobuf.compiler.Version";
179    fn unknown_fields(&self) -> &::buffa::UnknownFields {
180        &self.__buffa_unknown_fields
181    }
182    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
183        &mut self.__buffa_unknown_fields
184    }
185}
186/// An encoded CodeGeneratorRequest is written to the plugin's stdin.
187#[derive(Clone, PartialEq, Default)]
188pub struct CodeGeneratorRequest {
189    /// The .proto files that were explicitly listed on the command-line.  The
190    /// code generator should generate code only for these files.  Each file's
191    /// descriptor will be included in proto_file, below.
192    ///
193    /// Field 1: `file_to_generate`
194    pub file_to_generate: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
195    /// The generator parameter passed on the command-line.
196    ///
197    /// Field 2: `parameter`
198    pub parameter: ::core::option::Option<::buffa::alloc::string::String>,
199    /// FileDescriptorProtos for all files in files_to_generate and everything
200    /// they import.  The files will appear in topological order, so each file
201    /// appears before any file that imports it.
202    ///
203    /// Note: the files listed in files_to_generate will include runtime-retention
204    /// options only, but all other files will include source-retention options.
205    /// The source_file_descriptors field below is available in case you need
206    /// source-retention options for files_to_generate.
207    ///
208    /// protoc guarantees that all proto_files will be written after
209    /// the fields above, even though this is not technically guaranteed by the
210    /// protobuf wire format.  This theoretically could allow a plugin to stream
211    /// in the FileDescriptorProtos and handle them one by one rather than read
212    /// the entire set into memory at once.  However, as of this writing, this
213    /// is not similarly optimized on protoc's end -- it will store all fields in
214    /// memory at once before sending them to the plugin.
215    ///
216    /// Type names of fields and extensions in the FileDescriptorProto are always
217    /// fully qualified.
218    ///
219    /// Field 15: `proto_file`
220    pub proto_file: ::buffa::alloc::vec::Vec<super::FileDescriptorProto>,
221    /// File descriptors with all options, including source-retention options.
222    /// These descriptors are only provided for the files listed in
223    /// files_to_generate.
224    ///
225    /// Field 17: `source_file_descriptors`
226    pub source_file_descriptors: ::buffa::alloc::vec::Vec<super::FileDescriptorProto>,
227    /// The version number of protocol compiler.
228    ///
229    /// Field 3: `compiler_version`
230    pub compiler_version: ::buffa::MessageField<Version>,
231    #[doc(hidden)]
232    pub __buffa_unknown_fields: ::buffa::UnknownFields,
233}
234impl ::core::fmt::Debug for CodeGeneratorRequest {
235    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
236        f.debug_struct("CodeGeneratorRequest")
237            .field("file_to_generate", &self.file_to_generate)
238            .field("parameter", &self.parameter)
239            .field("proto_file", &self.proto_file)
240            .field("source_file_descriptors", &self.source_file_descriptors)
241            .field("compiler_version", &self.compiler_version)
242            .finish()
243    }
244}
245impl CodeGeneratorRequest {
246    /// Protobuf type URL for this message, for use with `Any::pack` and
247    /// `Any::unpack_if`.
248    ///
249    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
250    pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorRequest";
251}
252impl ::buffa::DefaultInstance for CodeGeneratorRequest {
253    fn default_instance() -> &'static Self {
254        static VALUE: ::buffa::__private::OnceBox<CodeGeneratorRequest> = ::buffa::__private::OnceBox::new();
255        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
256    }
257}
258impl ::buffa::Message for CodeGeneratorRequest {
259    /// Returns the total encoded size in bytes.
260    ///
261    /// The result is a `u32`; the protobuf specification requires all
262    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
263    /// compliant message will never overflow this type.
264    #[allow(clippy::let_and_return)]
265    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
266        #[allow(unused_imports)]
267        use ::buffa::Enumeration as _;
268        let mut size = 0u32;
269        for v in &self.file_to_generate {
270            size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
271        }
272        if let Some(ref v) = self.parameter {
273            size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
274        }
275        if self.compiler_version.is_set() {
276            let __slot = __cache.reserve();
277            let inner_size = self.compiler_version.compute_size(__cache);
278            __cache.set(__slot, inner_size);
279            size
280                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
281                    + inner_size;
282        }
283        for v in &self.proto_file {
284            let __slot = __cache.reserve();
285            let inner_size = v.compute_size(__cache);
286            __cache.set(__slot, inner_size);
287            size
288                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
289                    + inner_size;
290        }
291        for v in &self.source_file_descriptors {
292            let __slot = __cache.reserve();
293            let inner_size = v.compute_size(__cache);
294            __cache.set(__slot, inner_size);
295            size
296                += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
297                    + inner_size;
298        }
299        size += self.__buffa_unknown_fields.encoded_len() as u32;
300        size
301    }
302    fn write_to(
303        &self,
304        __cache: &mut ::buffa::SizeCache,
305        buf: &mut impl ::buffa::bytes::BufMut,
306    ) {
307        #[allow(unused_imports)]
308        use ::buffa::Enumeration as _;
309        for v in &self.file_to_generate {
310            ::buffa::encoding::Tag::new(
311                    1u32,
312                    ::buffa::encoding::WireType::LengthDelimited,
313                )
314                .encode(buf);
315            ::buffa::types::encode_string(v, buf);
316        }
317        if let Some(ref v) = self.parameter {
318            ::buffa::encoding::Tag::new(
319                    2u32,
320                    ::buffa::encoding::WireType::LengthDelimited,
321                )
322                .encode(buf);
323            ::buffa::types::encode_string(v, buf);
324        }
325        if self.compiler_version.is_set() {
326            ::buffa::encoding::Tag::new(
327                    3u32,
328                    ::buffa::encoding::WireType::LengthDelimited,
329                )
330                .encode(buf);
331            ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
332            self.compiler_version.write_to(__cache, buf);
333        }
334        for v in &self.proto_file {
335            ::buffa::encoding::Tag::new(
336                    15u32,
337                    ::buffa::encoding::WireType::LengthDelimited,
338                )
339                .encode(buf);
340            ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
341            v.write_to(__cache, buf);
342        }
343        for v in &self.source_file_descriptors {
344            ::buffa::encoding::Tag::new(
345                    17u32,
346                    ::buffa::encoding::WireType::LengthDelimited,
347                )
348                .encode(buf);
349            ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
350            v.write_to(__cache, buf);
351        }
352        self.__buffa_unknown_fields.write_to(buf);
353    }
354    fn merge_field(
355        &mut self,
356        tag: ::buffa::encoding::Tag,
357        buf: &mut impl ::buffa::bytes::Buf,
358        depth: u32,
359    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
360        #[allow(unused_imports)]
361        use ::buffa::bytes::Buf as _;
362        #[allow(unused_imports)]
363        use ::buffa::Enumeration as _;
364        match tag.field_number() {
365            1u32 => {
366                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
367                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
368                        field_number: 1u32,
369                        expected: 2u8,
370                        actual: tag.wire_type() as u8,
371                    });
372                }
373                self.file_to_generate.push(::buffa::types::decode_string(buf)?);
374            }
375            2u32 => {
376                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
377                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
378                        field_number: 2u32,
379                        expected: 2u8,
380                        actual: tag.wire_type() as u8,
381                    });
382                }
383                ::buffa::types::merge_string(
384                    self
385                        .parameter
386                        .get_or_insert_with(::buffa::alloc::string::String::new),
387                    buf,
388                )?;
389            }
390            3u32 => {
391                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
392                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
393                        field_number: 3u32,
394                        expected: 2u8,
395                        actual: tag.wire_type() as u8,
396                    });
397                }
398                ::buffa::Message::merge_length_delimited(
399                    self.compiler_version.get_or_insert_default(),
400                    buf,
401                    depth,
402                )?;
403            }
404            15u32 => {
405                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
406                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
407                        field_number: 15u32,
408                        expected: 2u8,
409                        actual: tag.wire_type() as u8,
410                    });
411                }
412                let mut elem = ::core::default::Default::default();
413                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
414                self.proto_file.push(elem);
415            }
416            17u32 => {
417                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
418                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
419                        field_number: 17u32,
420                        expected: 2u8,
421                        actual: tag.wire_type() as u8,
422                    });
423                }
424                let mut elem = ::core::default::Default::default();
425                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
426                self.source_file_descriptors.push(elem);
427            }
428            _ => {
429                self.__buffa_unknown_fields
430                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
431            }
432        }
433        ::core::result::Result::Ok(())
434    }
435    fn clear(&mut self) {
436        self.file_to_generate.clear();
437        self.parameter = ::core::option::Option::None;
438        self.compiler_version = ::buffa::MessageField::none();
439        self.proto_file.clear();
440        self.source_file_descriptors.clear();
441        self.__buffa_unknown_fields.clear();
442    }
443}
444impl ::buffa::ExtensionSet for CodeGeneratorRequest {
445    const PROTO_FQN: &'static str = "google.protobuf.compiler.CodeGeneratorRequest";
446    fn unknown_fields(&self) -> &::buffa::UnknownFields {
447        &self.__buffa_unknown_fields
448    }
449    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
450        &mut self.__buffa_unknown_fields
451    }
452}
453/// The plugin writes an encoded CodeGeneratorResponse to stdout.
454#[derive(Clone, PartialEq, Default)]
455pub struct CodeGeneratorResponse {
456    /// Error message.  If non-empty, code generation failed.  The plugin process
457    /// should exit with status code zero even if it reports an error in this way.
458    ///
459    /// This should be used to indicate errors in .proto files which prevent the
460    /// code generator from generating correct code.  Errors which indicate a
461    /// problem in protoc itself -- such as the input CodeGeneratorRequest being
462    /// unparseable -- should be reported by writing a message to stderr and
463    /// exiting with a non-zero status code.
464    ///
465    /// Field 1: `error`
466    pub error: ::core::option::Option<::buffa::alloc::string::String>,
467    /// A bitmask of supported features that the code generator supports.
468    /// This is a bitwise "or" of values from the Feature enum.
469    ///
470    /// Field 2: `supported_features`
471    pub supported_features: ::core::option::Option<u64>,
472    /// The minimum edition this plugin supports.  This will be treated as an
473    /// Edition enum, but we want to allow unknown values.  It should be specified
474    /// according the edition enum value, *not* the edition number.  Only takes
475    /// effect for plugins that have FEATURE_SUPPORTS_EDITIONS set.
476    ///
477    /// Field 3: `minimum_edition`
478    pub minimum_edition: ::core::option::Option<i32>,
479    /// The maximum edition this plugin supports.  This will be treated as an
480    /// Edition enum, but we want to allow unknown values.  It should be specified
481    /// according the edition enum value, *not* the edition number.  Only takes
482    /// effect for plugins that have FEATURE_SUPPORTS_EDITIONS set.
483    ///
484    /// Field 4: `maximum_edition`
485    pub maximum_edition: ::core::option::Option<i32>,
486    /// Field 15: `file`
487    pub file: ::buffa::alloc::vec::Vec<code_generator_response::File>,
488    #[doc(hidden)]
489    pub __buffa_unknown_fields: ::buffa::UnknownFields,
490}
491impl ::core::fmt::Debug for CodeGeneratorResponse {
492    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
493        f.debug_struct("CodeGeneratorResponse")
494            .field("error", &self.error)
495            .field("supported_features", &self.supported_features)
496            .field("minimum_edition", &self.minimum_edition)
497            .field("maximum_edition", &self.maximum_edition)
498            .field("file", &self.file)
499            .finish()
500    }
501}
502impl CodeGeneratorResponse {
503    /// Protobuf type URL for this message, for use with `Any::pack` and
504    /// `Any::unpack_if`.
505    ///
506    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
507    pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse";
508}
509impl ::buffa::DefaultInstance for CodeGeneratorResponse {
510    fn default_instance() -> &'static Self {
511        static VALUE: ::buffa::__private::OnceBox<CodeGeneratorResponse> = ::buffa::__private::OnceBox::new();
512        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
513    }
514}
515impl ::buffa::Message for CodeGeneratorResponse {
516    /// Returns the total encoded size in bytes.
517    ///
518    /// The result is a `u32`; the protobuf specification requires all
519    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
520    /// compliant message will never overflow this type.
521    #[allow(clippy::let_and_return)]
522    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
523        #[allow(unused_imports)]
524        use ::buffa::Enumeration as _;
525        let mut size = 0u32;
526        if let Some(ref v) = self.error {
527            size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
528        }
529        if let Some(v) = self.supported_features {
530            size += 1u32 + ::buffa::types::uint64_encoded_len(v) as u32;
531        }
532        if let Some(v) = self.minimum_edition {
533            size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
534        }
535        if let Some(v) = self.maximum_edition {
536            size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
537        }
538        for v in &self.file {
539            let __slot = __cache.reserve();
540            let inner_size = v.compute_size(__cache);
541            __cache.set(__slot, inner_size);
542            size
543                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
544                    + inner_size;
545        }
546        size += self.__buffa_unknown_fields.encoded_len() as u32;
547        size
548    }
549    fn write_to(
550        &self,
551        __cache: &mut ::buffa::SizeCache,
552        buf: &mut impl ::buffa::bytes::BufMut,
553    ) {
554        #[allow(unused_imports)]
555        use ::buffa::Enumeration as _;
556        if let Some(ref v) = self.error {
557            ::buffa::encoding::Tag::new(
558                    1u32,
559                    ::buffa::encoding::WireType::LengthDelimited,
560                )
561                .encode(buf);
562            ::buffa::types::encode_string(v, buf);
563        }
564        if let Some(v) = self.supported_features {
565            ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
566                .encode(buf);
567            ::buffa::types::encode_uint64(v, buf);
568        }
569        if let Some(v) = self.minimum_edition {
570            ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
571                .encode(buf);
572            ::buffa::types::encode_int32(v, buf);
573        }
574        if let Some(v) = self.maximum_edition {
575            ::buffa::encoding::Tag::new(4u32, ::buffa::encoding::WireType::Varint)
576                .encode(buf);
577            ::buffa::types::encode_int32(v, buf);
578        }
579        for v in &self.file {
580            ::buffa::encoding::Tag::new(
581                    15u32,
582                    ::buffa::encoding::WireType::LengthDelimited,
583                )
584                .encode(buf);
585            ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
586            v.write_to(__cache, buf);
587        }
588        self.__buffa_unknown_fields.write_to(buf);
589    }
590    fn merge_field(
591        &mut self,
592        tag: ::buffa::encoding::Tag,
593        buf: &mut impl ::buffa::bytes::Buf,
594        depth: u32,
595    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
596        #[allow(unused_imports)]
597        use ::buffa::bytes::Buf as _;
598        #[allow(unused_imports)]
599        use ::buffa::Enumeration as _;
600        match tag.field_number() {
601            1u32 => {
602                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
603                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
604                        field_number: 1u32,
605                        expected: 2u8,
606                        actual: tag.wire_type() as u8,
607                    });
608                }
609                ::buffa::types::merge_string(
610                    self.error.get_or_insert_with(::buffa::alloc::string::String::new),
611                    buf,
612                )?;
613            }
614            2u32 => {
615                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
616                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
617                        field_number: 2u32,
618                        expected: 0u8,
619                        actual: tag.wire_type() as u8,
620                    });
621                }
622                self.supported_features = ::core::option::Option::Some(
623                    ::buffa::types::decode_uint64(buf)?,
624                );
625            }
626            3u32 => {
627                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
628                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
629                        field_number: 3u32,
630                        expected: 0u8,
631                        actual: tag.wire_type() as u8,
632                    });
633                }
634                self.minimum_edition = ::core::option::Option::Some(
635                    ::buffa::types::decode_int32(buf)?,
636                );
637            }
638            4u32 => {
639                if tag.wire_type() != ::buffa::encoding::WireType::Varint {
640                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
641                        field_number: 4u32,
642                        expected: 0u8,
643                        actual: tag.wire_type() as u8,
644                    });
645                }
646                self.maximum_edition = ::core::option::Option::Some(
647                    ::buffa::types::decode_int32(buf)?,
648                );
649            }
650            15u32 => {
651                if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
652                    return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
653                        field_number: 15u32,
654                        expected: 2u8,
655                        actual: tag.wire_type() as u8,
656                    });
657                }
658                let mut elem = ::core::default::Default::default();
659                ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
660                self.file.push(elem);
661            }
662            _ => {
663                self.__buffa_unknown_fields
664                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
665            }
666        }
667        ::core::result::Result::Ok(())
668    }
669    fn clear(&mut self) {
670        self.error = ::core::option::Option::None;
671        self.supported_features = ::core::option::Option::None;
672        self.minimum_edition = ::core::option::Option::None;
673        self.maximum_edition = ::core::option::Option::None;
674        self.file.clear();
675        self.__buffa_unknown_fields.clear();
676    }
677}
678impl ::buffa::ExtensionSet for CodeGeneratorResponse {
679    const PROTO_FQN: &'static str = "google.protobuf.compiler.CodeGeneratorResponse";
680    fn unknown_fields(&self) -> &::buffa::UnknownFields {
681        &self.__buffa_unknown_fields
682    }
683    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
684        &mut self.__buffa_unknown_fields
685    }
686}
687pub mod code_generator_response {
688    #[allow(unused_imports)]
689    use super::*;
690    /// Sync with code_generator.h.
691    #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
692    #[repr(i32)]
693    pub enum Feature {
694        FEATURE_NONE = 0i32,
695        FEATURE_PROTO3_OPTIONAL = 1i32,
696        FEATURE_SUPPORTS_EDITIONS = 2i32,
697    }
698    impl ::core::default::Default for Feature {
699        fn default() -> Self {
700            Self::FEATURE_NONE
701        }
702    }
703    impl ::buffa::Enumeration for Feature {
704        fn from_i32(value: i32) -> ::core::option::Option<Self> {
705            match value {
706                0i32 => ::core::option::Option::Some(Self::FEATURE_NONE),
707                1i32 => ::core::option::Option::Some(Self::FEATURE_PROTO3_OPTIONAL),
708                2i32 => ::core::option::Option::Some(Self::FEATURE_SUPPORTS_EDITIONS),
709                _ => ::core::option::Option::None,
710            }
711        }
712        fn to_i32(&self) -> i32 {
713            *self as i32
714        }
715        fn proto_name(&self) -> &'static str {
716            match self {
717                Self::FEATURE_NONE => "FEATURE_NONE",
718                Self::FEATURE_PROTO3_OPTIONAL => "FEATURE_PROTO3_OPTIONAL",
719                Self::FEATURE_SUPPORTS_EDITIONS => "FEATURE_SUPPORTS_EDITIONS",
720            }
721        }
722        fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
723            match name {
724                "FEATURE_NONE" => ::core::option::Option::Some(Self::FEATURE_NONE),
725                "FEATURE_PROTO3_OPTIONAL" => {
726                    ::core::option::Option::Some(Self::FEATURE_PROTO3_OPTIONAL)
727                }
728                "FEATURE_SUPPORTS_EDITIONS" => {
729                    ::core::option::Option::Some(Self::FEATURE_SUPPORTS_EDITIONS)
730                }
731                _ => ::core::option::Option::None,
732            }
733        }
734        fn values() -> &'static [Self] {
735            &[
736                Self::FEATURE_NONE,
737                Self::FEATURE_PROTO3_OPTIONAL,
738                Self::FEATURE_SUPPORTS_EDITIONS,
739            ]
740        }
741    }
742    /// Represents a single generated file.
743    #[derive(Clone, PartialEq, Default)]
744    pub struct File {
745        /// The file name, relative to the output directory.  The name must not
746        /// contain "." or ".." components and must be relative, not be absolute (so,
747        /// the file cannot lie outside the output directory).  "/" must be used as
748        /// the path separator, not "\".
749        ///
750        /// If the name is omitted, the content will be appended to the previous
751        /// file.  This allows the generator to break large files into small chunks,
752        /// and allows the generated text to be streamed back to protoc so that large
753        /// files need not reside completely in memory at one time.  Note that as of
754        /// this writing protoc does not optimize for this -- it will read the entire
755        /// CodeGeneratorResponse before writing files to disk.
756        ///
757        /// Field 1: `name`
758        pub name: ::core::option::Option<::buffa::alloc::string::String>,
759        /// If non-empty, indicates that the named file should already exist, and the
760        /// content here is to be inserted into that file at a defined insertion
761        /// point.  This feature allows a code generator to extend the output
762        /// produced by another code generator.  The original generator may provide
763        /// insertion points by placing special annotations in the file that look
764        /// like:
765        ///   @@protoc_insertion_point(NAME)
766        /// The annotation can have arbitrary text before and after it on the line,
767        /// which allows it to be placed in a comment.  NAME should be replaced with
768        /// an identifier naming the point -- this is what other generators will use
769        /// as the insertion_point.  Code inserted at this point will be placed
770        /// immediately above the line containing the insertion point (thus multiple
771        /// insertions to the same point will come out in the order they were added).
772        /// The double-@ is intended to make it unlikely that the generated code
773        /// could contain things that look like insertion points by accident.
774        ///
775        /// For example, the C++ code generator places the following line in the
776        /// .pb.h files that it generates:
777        ///   // @@protoc_insertion_point(namespace_scope)
778        /// This line appears within the scope of the file's package namespace, but
779        /// outside of any particular class.  Another plugin can then specify the
780        /// insertion_point "namespace_scope" to generate additional classes or
781        /// other declarations that should be placed in this scope.
782        ///
783        /// Note that if the line containing the insertion point begins with
784        /// whitespace, the same whitespace will be added to every line of the
785        /// inserted text.  This is useful for languages like Python, where
786        /// indentation matters.  In these languages, the insertion point comment
787        /// should be indented the same amount as any inserted code will need to be
788        /// in order to work correctly in that context.
789        ///
790        /// The code generator that generates the initial file and the one which
791        /// inserts into it must both run as part of a single invocation of protoc.
792        /// Code generators are executed in the order in which they appear on the
793        /// command line.
794        ///
795        /// If |insertion_point| is present, |name| must also be present.
796        ///
797        /// Field 2: `insertion_point`
798        pub insertion_point: ::core::option::Option<::buffa::alloc::string::String>,
799        /// The file contents.
800        ///
801        /// Field 15: `content`
802        pub content: ::core::option::Option<::buffa::alloc::string::String>,
803        /// Information describing the file content being inserted. If an insertion
804        /// point is used, this information will be appropriately offset and inserted
805        /// into the code generation metadata for the generated files.
806        ///
807        /// Field 16: `generated_code_info`
808        pub generated_code_info: ::buffa::MessageField<super::super::GeneratedCodeInfo>,
809        #[doc(hidden)]
810        pub __buffa_unknown_fields: ::buffa::UnknownFields,
811    }
812    impl ::core::fmt::Debug for File {
813        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
814            f.debug_struct("File")
815                .field("name", &self.name)
816                .field("insertion_point", &self.insertion_point)
817                .field("content", &self.content)
818                .field("generated_code_info", &self.generated_code_info)
819                .finish()
820        }
821    }
822    impl File {
823        /// Protobuf type URL for this message, for use with `Any::pack` and
824        /// `Any::unpack_if`.
825        ///
826        /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
827        pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse.File";
828    }
829    impl ::buffa::DefaultInstance for File {
830        fn default_instance() -> &'static Self {
831            static VALUE: ::buffa::__private::OnceBox<File> = ::buffa::__private::OnceBox::new();
832            VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
833        }
834    }
835    impl ::buffa::Message for File {
836        /// Returns the total encoded size in bytes.
837        ///
838        /// The result is a `u32`; the protobuf specification requires all
839        /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
840        /// compliant message will never overflow this type.
841        #[allow(clippy::let_and_return)]
842        fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
843            #[allow(unused_imports)]
844            use ::buffa::Enumeration as _;
845            let mut size = 0u32;
846            if let Some(ref v) = self.name {
847                size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
848            }
849            if let Some(ref v) = self.insertion_point {
850                size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
851            }
852            if let Some(ref v) = self.content {
853                size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
854            }
855            if self.generated_code_info.is_set() {
856                let __slot = __cache.reserve();
857                let inner_size = self.generated_code_info.compute_size(__cache);
858                __cache.set(__slot, inner_size);
859                size
860                    += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
861                        + inner_size;
862            }
863            size += self.__buffa_unknown_fields.encoded_len() as u32;
864            size
865        }
866        fn write_to(
867            &self,
868            __cache: &mut ::buffa::SizeCache,
869            buf: &mut impl ::buffa::bytes::BufMut,
870        ) {
871            #[allow(unused_imports)]
872            use ::buffa::Enumeration as _;
873            if let Some(ref v) = self.name {
874                ::buffa::encoding::Tag::new(
875                        1u32,
876                        ::buffa::encoding::WireType::LengthDelimited,
877                    )
878                    .encode(buf);
879                ::buffa::types::encode_string(v, buf);
880            }
881            if let Some(ref v) = self.insertion_point {
882                ::buffa::encoding::Tag::new(
883                        2u32,
884                        ::buffa::encoding::WireType::LengthDelimited,
885                    )
886                    .encode(buf);
887                ::buffa::types::encode_string(v, buf);
888            }
889            if let Some(ref v) = self.content {
890                ::buffa::encoding::Tag::new(
891                        15u32,
892                        ::buffa::encoding::WireType::LengthDelimited,
893                    )
894                    .encode(buf);
895                ::buffa::types::encode_string(v, buf);
896            }
897            if self.generated_code_info.is_set() {
898                ::buffa::encoding::Tag::new(
899                        16u32,
900                        ::buffa::encoding::WireType::LengthDelimited,
901                    )
902                    .encode(buf);
903                ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
904                self.generated_code_info.write_to(__cache, buf);
905            }
906            self.__buffa_unknown_fields.write_to(buf);
907        }
908        fn merge_field(
909            &mut self,
910            tag: ::buffa::encoding::Tag,
911            buf: &mut impl ::buffa::bytes::Buf,
912            depth: u32,
913        ) -> ::core::result::Result<(), ::buffa::DecodeError> {
914            #[allow(unused_imports)]
915            use ::buffa::bytes::Buf as _;
916            #[allow(unused_imports)]
917            use ::buffa::Enumeration as _;
918            match tag.field_number() {
919                1u32 => {
920                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
921                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
922                            field_number: 1u32,
923                            expected: 2u8,
924                            actual: tag.wire_type() as u8,
925                        });
926                    }
927                    ::buffa::types::merge_string(
928                        self
929                            .name
930                            .get_or_insert_with(::buffa::alloc::string::String::new),
931                        buf,
932                    )?;
933                }
934                2u32 => {
935                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
936                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
937                            field_number: 2u32,
938                            expected: 2u8,
939                            actual: tag.wire_type() as u8,
940                        });
941                    }
942                    ::buffa::types::merge_string(
943                        self
944                            .insertion_point
945                            .get_or_insert_with(::buffa::alloc::string::String::new),
946                        buf,
947                    )?;
948                }
949                15u32 => {
950                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
951                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
952                            field_number: 15u32,
953                            expected: 2u8,
954                            actual: tag.wire_type() as u8,
955                        });
956                    }
957                    ::buffa::types::merge_string(
958                        self
959                            .content
960                            .get_or_insert_with(::buffa::alloc::string::String::new),
961                        buf,
962                    )?;
963                }
964                16u32 => {
965                    if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
966                        return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
967                            field_number: 16u32,
968                            expected: 2u8,
969                            actual: tag.wire_type() as u8,
970                        });
971                    }
972                    ::buffa::Message::merge_length_delimited(
973                        self.generated_code_info.get_or_insert_default(),
974                        buf,
975                        depth,
976                    )?;
977                }
978                _ => {
979                    self.__buffa_unknown_fields
980                        .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
981                }
982            }
983            ::core::result::Result::Ok(())
984        }
985        fn clear(&mut self) {
986            self.name = ::core::option::Option::None;
987            self.insertion_point = ::core::option::Option::None;
988            self.content = ::core::option::Option::None;
989            self.generated_code_info = ::buffa::MessageField::none();
990            self.__buffa_unknown_fields.clear();
991        }
992    }
993    impl ::buffa::ExtensionSet for File {
994        const PROTO_FQN: &'static str = "google.protobuf.compiler.CodeGeneratorResponse.File";
995        fn unknown_fields(&self) -> &::buffa::UnknownFields {
996            &self.__buffa_unknown_fields
997        }
998        fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
999            &mut self.__buffa_unknown_fields
1000        }
1001    }
1002}