Skip to main content

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

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