google_cloud_wkt/generated/
mod.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::invalid_html_tags)]
18#![allow(rustdoc::redundant_explicit_links)]
19use crate as wkt;
20
21/// Api is a light-weight descriptor for an API Interface.
22///
23/// Interfaces are also described as "protocol buffer services" in some contexts,
24/// such as by the "service" keyword in a .proto file, but they are different
25/// from API Services, which represent a concrete implementation of an interface
26/// as opposed to simply a description of methods and bindings. They are also
27/// sometimes simply referred to as "APIs" in other contexts, such as the name of
28/// this message itself. See <https://cloud.google.com/apis/design/glossary> for
29/// detailed terminology.
30#[serde_with::serde_as]
31#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
32#[serde(default, rename_all = "camelCase")]
33#[non_exhaustive]
34pub struct Api {
35    /// The fully qualified name of this interface, including package name
36    /// followed by the interface's simple name.
37    #[serde(skip_serializing_if = "std::string::String::is_empty")]
38    pub name: std::string::String,
39
40    /// The methods of this interface, in unspecified order.
41    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
42    pub methods: std::vec::Vec<crate::Method>,
43
44    /// Any metadata attached to the interface.
45    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
46    pub options: std::vec::Vec<crate::Option>,
47
48    /// A version string for this interface. If specified, must have the form
49    /// `major-version.minor-version`, as in `1.10`. If the minor version is
50    /// omitted, it defaults to zero. If the entire version field is empty, the
51    /// major version is derived from the package name, as outlined below. If the
52    /// field is not empty, the version in the package name will be verified to be
53    /// consistent with what is provided here.
54    ///
55    /// The versioning schema uses [semantic
56    /// versioning](http://semver.org) where the major version number
57    /// indicates a breaking change and the minor version an additive,
58    /// non-breaking change. Both version numbers are signals to users
59    /// what to expect from different versions, and should be carefully
60    /// chosen based on the product plan.
61    ///
62    /// The major version is also reflected in the package name of the
63    /// interface, which must end in `v<major-version>`, as in
64    /// `google.feature.v1`. For major versions 0 and 1, the suffix can
65    /// be omitted. Zero major versions must only be used for
66    /// experimental, non-GA interfaces.
67    #[serde(skip_serializing_if = "std::string::String::is_empty")]
68    pub version: std::string::String,
69
70    /// Source context for the protocol buffer service represented by this
71    /// message.
72    #[serde(skip_serializing_if = "std::option::Option::is_none")]
73    pub source_context: std::option::Option<crate::SourceContext>,
74
75    /// Included interfaces. See [Mixin][].
76    ///
77    /// [Mixin]: crate::Mixin
78    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
79    pub mixins: std::vec::Vec<crate::Mixin>,
80
81    /// The source syntax of the service.
82    pub syntax: crate::Syntax,
83
84    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
85    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
86}
87
88impl Api {
89    pub fn new() -> Self {
90        std::default::Default::default()
91    }
92
93    /// Sets the value of [name][crate::Api::name].
94    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
95        self.name = v.into();
96        self
97    }
98
99    /// Sets the value of [version][crate::Api::version].
100    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
101        self.version = v.into();
102        self
103    }
104
105    /// Sets the value of [source_context][crate::Api::source_context].
106    pub fn set_source_context<T: std::convert::Into<std::option::Option<crate::SourceContext>>>(
107        mut self,
108        v: T,
109    ) -> Self {
110        self.source_context = v.into();
111        self
112    }
113
114    /// Sets the value of [syntax][crate::Api::syntax].
115    pub fn set_syntax<T: std::convert::Into<crate::Syntax>>(mut self, v: T) -> Self {
116        self.syntax = v.into();
117        self
118    }
119
120    /// Sets the value of [methods][crate::Api::methods].
121    pub fn set_methods<T, V>(mut self, v: T) -> Self
122    where
123        T: std::iter::IntoIterator<Item = V>,
124        V: std::convert::Into<crate::Method>,
125    {
126        use std::iter::Iterator;
127        self.methods = v.into_iter().map(|i| i.into()).collect();
128        self
129    }
130
131    /// Sets the value of [options][crate::Api::options].
132    pub fn set_options<T, V>(mut self, v: T) -> Self
133    where
134        T: std::iter::IntoIterator<Item = V>,
135        V: std::convert::Into<crate::Option>,
136    {
137        use std::iter::Iterator;
138        self.options = v.into_iter().map(|i| i.into()).collect();
139        self
140    }
141
142    /// Sets the value of [mixins][crate::Api::mixins].
143    pub fn set_mixins<T, V>(mut self, v: T) -> Self
144    where
145        T: std::iter::IntoIterator<Item = V>,
146        V: std::convert::Into<crate::Mixin>,
147    {
148        use std::iter::Iterator;
149        self.mixins = v.into_iter().map(|i| i.into()).collect();
150        self
151    }
152}
153
154impl wkt::message::Message for Api {
155    fn typename() -> &'static str {
156        "type.googleapis.com/google.protobuf.Api"
157    }
158}
159
160/// Method represents a method of an API interface.
161#[serde_with::serde_as]
162#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
163#[serde(default, rename_all = "camelCase")]
164#[non_exhaustive]
165pub struct Method {
166    /// The simple name of this method.
167    #[serde(skip_serializing_if = "std::string::String::is_empty")]
168    pub name: std::string::String,
169
170    /// A URL of the input message type.
171    #[serde(skip_serializing_if = "std::string::String::is_empty")]
172    pub request_type_url: std::string::String,
173
174    /// If true, the request is streamed.
175    pub request_streaming: bool,
176
177    /// The URL of the output message type.
178    #[serde(skip_serializing_if = "std::string::String::is_empty")]
179    pub response_type_url: std::string::String,
180
181    /// If true, the response is streamed.
182    pub response_streaming: bool,
183
184    /// Any metadata attached to the method.
185    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
186    pub options: std::vec::Vec<crate::Option>,
187
188    /// The source syntax of this method.
189    pub syntax: crate::Syntax,
190
191    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
192    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
193}
194
195impl Method {
196    pub fn new() -> Self {
197        std::default::Default::default()
198    }
199
200    /// Sets the value of [name][crate::Method::name].
201    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
202        self.name = v.into();
203        self
204    }
205
206    /// Sets the value of [request_type_url][crate::Method::request_type_url].
207    pub fn set_request_type_url<T: std::convert::Into<std::string::String>>(
208        mut self,
209        v: T,
210    ) -> Self {
211        self.request_type_url = v.into();
212        self
213    }
214
215    /// Sets the value of [request_streaming][crate::Method::request_streaming].
216    pub fn set_request_streaming<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
217        self.request_streaming = v.into();
218        self
219    }
220
221    /// Sets the value of [response_type_url][crate::Method::response_type_url].
222    pub fn set_response_type_url<T: std::convert::Into<std::string::String>>(
223        mut self,
224        v: T,
225    ) -> Self {
226        self.response_type_url = v.into();
227        self
228    }
229
230    /// Sets the value of [response_streaming][crate::Method::response_streaming].
231    pub fn set_response_streaming<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
232        self.response_streaming = v.into();
233        self
234    }
235
236    /// Sets the value of [syntax][crate::Method::syntax].
237    pub fn set_syntax<T: std::convert::Into<crate::Syntax>>(mut self, v: T) -> Self {
238        self.syntax = v.into();
239        self
240    }
241
242    /// Sets the value of [options][crate::Method::options].
243    pub fn set_options<T, V>(mut self, v: T) -> Self
244    where
245        T: std::iter::IntoIterator<Item = V>,
246        V: std::convert::Into<crate::Option>,
247    {
248        use std::iter::Iterator;
249        self.options = v.into_iter().map(|i| i.into()).collect();
250        self
251    }
252}
253
254impl wkt::message::Message for Method {
255    fn typename() -> &'static str {
256        "type.googleapis.com/google.protobuf.Method"
257    }
258}
259
260/// Declares an API Interface to be included in this interface. The including
261/// interface must redeclare all the methods from the included interface, but
262/// documentation and options are inherited as follows:
263///
264/// - If after comment and whitespace stripping, the documentation
265///   string of the redeclared method is empty, it will be inherited
266///   from the original method.
267///
268/// - Each annotation belonging to the service config (http,
269///   visibility) which is not set in the redeclared method will be
270///   inherited.
271///
272/// - If an http annotation is inherited, the path pattern will be
273///   modified as follows. Any version prefix will be replaced by the
274///   version of the including interface plus the [root][] path if
275///   specified.
276///
277///
278/// Example of a simple mixin:
279///
280/// ```norust
281/// package google.acl.v1;
282/// service AccessControl {
283///   // Get the underlying ACL object.
284///   rpc GetAcl(GetAclRequest) returns (Acl) {
285///     option (google.api.http).get = "/v1/{resource=**}:getAcl";
286///   }
287/// }
288///
289/// package google.storage.v2;
290/// service Storage {
291///   rpc GetAcl(GetAclRequest) returns (Acl);
292///
293///   // Get a data record.
294///   rpc GetData(GetDataRequest) returns (Data) {
295///     option (google.api.http).get = "/v2/{resource=**}";
296///   }
297/// }
298/// ```
299///
300/// Example of a mixin configuration:
301///
302/// ```norust
303/// apis:
304/// - name: google.storage.v2.Storage
305///   mixins:
306///   - name: google.acl.v1.AccessControl
307/// ```
308///
309/// The mixin construct implies that all methods in `AccessControl` are
310/// also declared with same name and request/response types in
311/// `Storage`. A documentation generator or annotation processor will
312/// see the effective `Storage.GetAcl` method after inheriting
313/// documentation and annotations as follows:
314///
315/// ```norust
316/// service Storage {
317///   // Get the underlying ACL object.
318///   rpc GetAcl(GetAclRequest) returns (Acl) {
319///     option (google.api.http).get = "/v2/{resource=**}:getAcl";
320///   }
321///   ...
322/// }
323/// ```
324///
325/// Note how the version in the path pattern changed from `v1` to `v2`.
326///
327/// If the `root` field in the mixin is specified, it should be a
328/// relative path under which inherited HTTP paths are placed. Example:
329///
330/// ```norust
331/// apis:
332/// - name: google.storage.v2.Storage
333///   mixins:
334///   - name: google.acl.v1.AccessControl
335///     root: acls
336/// ```
337///
338/// This implies the following inherited HTTP annotation:
339///
340/// ```norust
341/// service Storage {
342///   // Get the underlying ACL object.
343///   rpc GetAcl(GetAclRequest) returns (Acl) {
344///     option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
345///   }
346///   ...
347/// }
348/// ```
349///
350/// [root]: wkt::Mixin::root
351#[serde_with::serde_as]
352#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
353#[serde(default, rename_all = "camelCase")]
354#[non_exhaustive]
355pub struct Mixin {
356    /// The fully qualified name of the interface which is included.
357    #[serde(skip_serializing_if = "std::string::String::is_empty")]
358    pub name: std::string::String,
359
360    /// If non-empty specifies a path under which inherited HTTP paths
361    /// are rooted.
362    #[serde(skip_serializing_if = "std::string::String::is_empty")]
363    pub root: std::string::String,
364
365    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
366    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
367}
368
369impl Mixin {
370    pub fn new() -> Self {
371        std::default::Default::default()
372    }
373
374    /// Sets the value of [name][crate::Mixin::name].
375    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
376        self.name = v.into();
377        self
378    }
379
380    /// Sets the value of [root][crate::Mixin::root].
381    pub fn set_root<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
382        self.root = v.into();
383        self
384    }
385}
386
387impl wkt::message::Message for Mixin {
388    fn typename() -> &'static str {
389        "type.googleapis.com/google.protobuf.Mixin"
390    }
391}
392
393/// The protocol compiler can output a FileDescriptorSet containing the .proto
394/// files it parses.
395#[serde_with::serde_as]
396#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
397#[serde(default, rename_all = "camelCase")]
398#[non_exhaustive]
399pub struct FileDescriptorSet {
400    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
401    pub file: std::vec::Vec<crate::FileDescriptorProto>,
402
403    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
404    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
405}
406
407impl FileDescriptorSet {
408    pub fn new() -> Self {
409        std::default::Default::default()
410    }
411
412    /// Sets the value of [file][crate::FileDescriptorSet::file].
413    pub fn set_file<T, V>(mut self, v: T) -> Self
414    where
415        T: std::iter::IntoIterator<Item = V>,
416        V: std::convert::Into<crate::FileDescriptorProto>,
417    {
418        use std::iter::Iterator;
419        self.file = v.into_iter().map(|i| i.into()).collect();
420        self
421    }
422}
423
424impl wkt::message::Message for FileDescriptorSet {
425    fn typename() -> &'static str {
426        "type.googleapis.com/google.protobuf.FileDescriptorSet"
427    }
428}
429
430/// Describes a complete .proto file.
431#[serde_with::serde_as]
432#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
433#[serde(default, rename_all = "camelCase")]
434#[non_exhaustive]
435pub struct FileDescriptorProto {
436    #[serde(skip_serializing_if = "std::string::String::is_empty")]
437    pub name: std::string::String,
438
439    #[serde(skip_serializing_if = "std::string::String::is_empty")]
440    pub package: std::string::String,
441
442    /// Names of files imported by this file.
443    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
444    pub dependency: std::vec::Vec<std::string::String>,
445
446    /// Indexes of the public imported files in the dependency list above.
447    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
448    pub public_dependency: std::vec::Vec<i32>,
449
450    /// Indexes of the weak imported files in the dependency list.
451    /// For Google-internal migration only. Do not use.
452    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
453    pub weak_dependency: std::vec::Vec<i32>,
454
455    /// All top-level definitions in this file.
456    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
457    pub message_type: std::vec::Vec<crate::DescriptorProto>,
458
459    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
460    pub enum_type: std::vec::Vec<crate::EnumDescriptorProto>,
461
462    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
463    pub service: std::vec::Vec<crate::ServiceDescriptorProto>,
464
465    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
466    pub extension: std::vec::Vec<crate::FieldDescriptorProto>,
467
468    #[serde(skip_serializing_if = "std::option::Option::is_none")]
469    pub options: std::option::Option<crate::FileOptions>,
470
471    /// This field contains optional information about the original source code.
472    /// You may safely remove this entire field without harming runtime
473    /// functionality of the descriptors -- the information is needed only by
474    /// development tools.
475    #[serde(skip_serializing_if = "std::option::Option::is_none")]
476    pub source_code_info: std::option::Option<crate::SourceCodeInfo>,
477
478    /// The syntax of the proto file.
479    /// The supported values are "proto2", "proto3", and "editions".
480    ///
481    /// If `edition` is present, this value must be "editions".
482    #[serde(skip_serializing_if = "std::string::String::is_empty")]
483    pub syntax: std::string::String,
484
485    /// The edition of the proto file.
486    pub edition: crate::Edition,
487
488    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
489    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
490}
491
492impl FileDescriptorProto {
493    pub fn new() -> Self {
494        std::default::Default::default()
495    }
496
497    /// Sets the value of [name][crate::FileDescriptorProto::name].
498    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
499        self.name = v.into();
500        self
501    }
502
503    /// Sets the value of [package][crate::FileDescriptorProto::package].
504    pub fn set_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
505        self.package = v.into();
506        self
507    }
508
509    /// Sets the value of [options][crate::FileDescriptorProto::options].
510    pub fn set_options<T: std::convert::Into<std::option::Option<crate::FileOptions>>>(
511        mut self,
512        v: T,
513    ) -> Self {
514        self.options = v.into();
515        self
516    }
517
518    /// Sets the value of [source_code_info][crate::FileDescriptorProto::source_code_info].
519    pub fn set_source_code_info<
520        T: std::convert::Into<std::option::Option<crate::SourceCodeInfo>>,
521    >(
522        mut self,
523        v: T,
524    ) -> Self {
525        self.source_code_info = v.into();
526        self
527    }
528
529    /// Sets the value of [syntax][crate::FileDescriptorProto::syntax].
530    pub fn set_syntax<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
531        self.syntax = v.into();
532        self
533    }
534
535    /// Sets the value of [edition][crate::FileDescriptorProto::edition].
536    pub fn set_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
537        self.edition = v.into();
538        self
539    }
540
541    /// Sets the value of [dependency][crate::FileDescriptorProto::dependency].
542    pub fn set_dependency<T, V>(mut self, v: T) -> Self
543    where
544        T: std::iter::IntoIterator<Item = V>,
545        V: std::convert::Into<std::string::String>,
546    {
547        use std::iter::Iterator;
548        self.dependency = v.into_iter().map(|i| i.into()).collect();
549        self
550    }
551
552    /// Sets the value of [public_dependency][crate::FileDescriptorProto::public_dependency].
553    pub fn set_public_dependency<T, V>(mut self, v: T) -> Self
554    where
555        T: std::iter::IntoIterator<Item = V>,
556        V: std::convert::Into<i32>,
557    {
558        use std::iter::Iterator;
559        self.public_dependency = v.into_iter().map(|i| i.into()).collect();
560        self
561    }
562
563    /// Sets the value of [weak_dependency][crate::FileDescriptorProto::weak_dependency].
564    pub fn set_weak_dependency<T, V>(mut self, v: T) -> Self
565    where
566        T: std::iter::IntoIterator<Item = V>,
567        V: std::convert::Into<i32>,
568    {
569        use std::iter::Iterator;
570        self.weak_dependency = v.into_iter().map(|i| i.into()).collect();
571        self
572    }
573
574    /// Sets the value of [message_type][crate::FileDescriptorProto::message_type].
575    pub fn set_message_type<T, V>(mut self, v: T) -> Self
576    where
577        T: std::iter::IntoIterator<Item = V>,
578        V: std::convert::Into<crate::DescriptorProto>,
579    {
580        use std::iter::Iterator;
581        self.message_type = v.into_iter().map(|i| i.into()).collect();
582        self
583    }
584
585    /// Sets the value of [enum_type][crate::FileDescriptorProto::enum_type].
586    pub fn set_enum_type<T, V>(mut self, v: T) -> Self
587    where
588        T: std::iter::IntoIterator<Item = V>,
589        V: std::convert::Into<crate::EnumDescriptorProto>,
590    {
591        use std::iter::Iterator;
592        self.enum_type = v.into_iter().map(|i| i.into()).collect();
593        self
594    }
595
596    /// Sets the value of [service][crate::FileDescriptorProto::service].
597    pub fn set_service<T, V>(mut self, v: T) -> Self
598    where
599        T: std::iter::IntoIterator<Item = V>,
600        V: std::convert::Into<crate::ServiceDescriptorProto>,
601    {
602        use std::iter::Iterator;
603        self.service = v.into_iter().map(|i| i.into()).collect();
604        self
605    }
606
607    /// Sets the value of [extension][crate::FileDescriptorProto::extension].
608    pub fn set_extension<T, V>(mut self, v: T) -> Self
609    where
610        T: std::iter::IntoIterator<Item = V>,
611        V: std::convert::Into<crate::FieldDescriptorProto>,
612    {
613        use std::iter::Iterator;
614        self.extension = v.into_iter().map(|i| i.into()).collect();
615        self
616    }
617}
618
619impl wkt::message::Message for FileDescriptorProto {
620    fn typename() -> &'static str {
621        "type.googleapis.com/google.protobuf.FileDescriptorProto"
622    }
623}
624
625/// Describes a message type.
626#[serde_with::serde_as]
627#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
628#[serde(default, rename_all = "camelCase")]
629#[non_exhaustive]
630pub struct DescriptorProto {
631    #[serde(skip_serializing_if = "std::string::String::is_empty")]
632    pub name: std::string::String,
633
634    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
635    pub field: std::vec::Vec<crate::FieldDescriptorProto>,
636
637    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
638    pub extension: std::vec::Vec<crate::FieldDescriptorProto>,
639
640    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
641    pub nested_type: std::vec::Vec<crate::DescriptorProto>,
642
643    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
644    pub enum_type: std::vec::Vec<crate::EnumDescriptorProto>,
645
646    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
647    pub extension_range: std::vec::Vec<crate::descriptor_proto::ExtensionRange>,
648
649    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
650    pub oneof_decl: std::vec::Vec<crate::OneofDescriptorProto>,
651
652    #[serde(skip_serializing_if = "std::option::Option::is_none")]
653    pub options: std::option::Option<crate::MessageOptions>,
654
655    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
656    pub reserved_range: std::vec::Vec<crate::descriptor_proto::ReservedRange>,
657
658    /// Reserved field names, which may not be used by fields in the same message.
659    /// A given name may only be reserved once.
660    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
661    pub reserved_name: std::vec::Vec<std::string::String>,
662
663    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
664    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
665}
666
667impl DescriptorProto {
668    pub fn new() -> Self {
669        std::default::Default::default()
670    }
671
672    /// Sets the value of [name][crate::DescriptorProto::name].
673    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
674        self.name = v.into();
675        self
676    }
677
678    /// Sets the value of [options][crate::DescriptorProto::options].
679    pub fn set_options<T: std::convert::Into<std::option::Option<crate::MessageOptions>>>(
680        mut self,
681        v: T,
682    ) -> Self {
683        self.options = v.into();
684        self
685    }
686
687    /// Sets the value of [field][crate::DescriptorProto::field].
688    pub fn set_field<T, V>(mut self, v: T) -> Self
689    where
690        T: std::iter::IntoIterator<Item = V>,
691        V: std::convert::Into<crate::FieldDescriptorProto>,
692    {
693        use std::iter::Iterator;
694        self.field = v.into_iter().map(|i| i.into()).collect();
695        self
696    }
697
698    /// Sets the value of [extension][crate::DescriptorProto::extension].
699    pub fn set_extension<T, V>(mut self, v: T) -> Self
700    where
701        T: std::iter::IntoIterator<Item = V>,
702        V: std::convert::Into<crate::FieldDescriptorProto>,
703    {
704        use std::iter::Iterator;
705        self.extension = v.into_iter().map(|i| i.into()).collect();
706        self
707    }
708
709    /// Sets the value of [nested_type][crate::DescriptorProto::nested_type].
710    pub fn set_nested_type<T, V>(mut self, v: T) -> Self
711    where
712        T: std::iter::IntoIterator<Item = V>,
713        V: std::convert::Into<crate::DescriptorProto>,
714    {
715        use std::iter::Iterator;
716        self.nested_type = v.into_iter().map(|i| i.into()).collect();
717        self
718    }
719
720    /// Sets the value of [enum_type][crate::DescriptorProto::enum_type].
721    pub fn set_enum_type<T, V>(mut self, v: T) -> Self
722    where
723        T: std::iter::IntoIterator<Item = V>,
724        V: std::convert::Into<crate::EnumDescriptorProto>,
725    {
726        use std::iter::Iterator;
727        self.enum_type = v.into_iter().map(|i| i.into()).collect();
728        self
729    }
730
731    /// Sets the value of [extension_range][crate::DescriptorProto::extension_range].
732    pub fn set_extension_range<T, V>(mut self, v: T) -> Self
733    where
734        T: std::iter::IntoIterator<Item = V>,
735        V: std::convert::Into<crate::descriptor_proto::ExtensionRange>,
736    {
737        use std::iter::Iterator;
738        self.extension_range = v.into_iter().map(|i| i.into()).collect();
739        self
740    }
741
742    /// Sets the value of [oneof_decl][crate::DescriptorProto::oneof_decl].
743    pub fn set_oneof_decl<T, V>(mut self, v: T) -> Self
744    where
745        T: std::iter::IntoIterator<Item = V>,
746        V: std::convert::Into<crate::OneofDescriptorProto>,
747    {
748        use std::iter::Iterator;
749        self.oneof_decl = v.into_iter().map(|i| i.into()).collect();
750        self
751    }
752
753    /// Sets the value of [reserved_range][crate::DescriptorProto::reserved_range].
754    pub fn set_reserved_range<T, V>(mut self, v: T) -> Self
755    where
756        T: std::iter::IntoIterator<Item = V>,
757        V: std::convert::Into<crate::descriptor_proto::ReservedRange>,
758    {
759        use std::iter::Iterator;
760        self.reserved_range = v.into_iter().map(|i| i.into()).collect();
761        self
762    }
763
764    /// Sets the value of [reserved_name][crate::DescriptorProto::reserved_name].
765    pub fn set_reserved_name<T, V>(mut self, v: T) -> Self
766    where
767        T: std::iter::IntoIterator<Item = V>,
768        V: std::convert::Into<std::string::String>,
769    {
770        use std::iter::Iterator;
771        self.reserved_name = v.into_iter().map(|i| i.into()).collect();
772        self
773    }
774}
775
776impl wkt::message::Message for DescriptorProto {
777    fn typename() -> &'static str {
778        "type.googleapis.com/google.protobuf.DescriptorProto"
779    }
780}
781
782/// Defines additional types related to [DescriptorProto].
783pub mod descriptor_proto {
784    #[allow(unused_imports)]
785    use super::*;
786
787    #[serde_with::serde_as]
788    #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
789    #[serde(default, rename_all = "camelCase")]
790    #[non_exhaustive]
791    pub struct ExtensionRange {
792        pub start: i32,
793
794        pub end: i32,
795
796        #[serde(skip_serializing_if = "std::option::Option::is_none")]
797        pub options: std::option::Option<crate::ExtensionRangeOptions>,
798
799        #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
800        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
801    }
802
803    impl ExtensionRange {
804        pub fn new() -> Self {
805            std::default::Default::default()
806        }
807
808        /// Sets the value of [start][crate::descriptor_proto::ExtensionRange::start].
809        pub fn set_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
810            self.start = v.into();
811            self
812        }
813
814        /// Sets the value of [end][crate::descriptor_proto::ExtensionRange::end].
815        pub fn set_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
816            self.end = v.into();
817            self
818        }
819
820        /// Sets the value of [options][crate::descriptor_proto::ExtensionRange::options].
821        pub fn set_options<
822            T: std::convert::Into<std::option::Option<crate::ExtensionRangeOptions>>,
823        >(
824            mut self,
825            v: T,
826        ) -> Self {
827            self.options = v.into();
828            self
829        }
830    }
831
832    impl wkt::message::Message for ExtensionRange {
833        fn typename() -> &'static str {
834            "type.googleapis.com/google.protobuf.DescriptorProto.ExtensionRange"
835        }
836    }
837
838    /// Range of reserved tag numbers. Reserved tag numbers may not be used by
839    /// fields or extension ranges in the same message. Reserved ranges may
840    /// not overlap.
841    #[serde_with::serde_as]
842    #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
843    #[serde(default, rename_all = "camelCase")]
844    #[non_exhaustive]
845    pub struct ReservedRange {
846        pub start: i32,
847
848        pub end: i32,
849
850        #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
851        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
852    }
853
854    impl ReservedRange {
855        pub fn new() -> Self {
856            std::default::Default::default()
857        }
858
859        /// Sets the value of [start][crate::descriptor_proto::ReservedRange::start].
860        pub fn set_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
861            self.start = v.into();
862            self
863        }
864
865        /// Sets the value of [end][crate::descriptor_proto::ReservedRange::end].
866        pub fn set_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
867            self.end = v.into();
868            self
869        }
870    }
871
872    impl wkt::message::Message for ReservedRange {
873        fn typename() -> &'static str {
874            "type.googleapis.com/google.protobuf.DescriptorProto.ReservedRange"
875        }
876    }
877}
878
879#[serde_with::serde_as]
880#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
881#[serde(default, rename_all = "camelCase")]
882#[non_exhaustive]
883pub struct ExtensionRangeOptions {
884    /// The parser stores options it doesn't recognize here. See above.
885    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
886    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
887
888    /// For external users: DO NOT USE. We are in the process of open sourcing
889    /// extension declaration and executing internal cleanups before it can be
890    /// used externally.
891    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
892    pub declaration: std::vec::Vec<crate::extension_range_options::Declaration>,
893
894    /// Any features defined in the specific edition.
895    #[serde(skip_serializing_if = "std::option::Option::is_none")]
896    pub features: std::option::Option<crate::FeatureSet>,
897
898    /// The verification state of the range.
899    /// TODO: flip the default to DECLARATION once all empty ranges
900    /// are marked as UNVERIFIED.
901    pub verification: crate::extension_range_options::VerificationState,
902
903    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
904    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
905}
906
907impl ExtensionRangeOptions {
908    pub fn new() -> Self {
909        std::default::Default::default()
910    }
911
912    /// Sets the value of [features][crate::ExtensionRangeOptions::features].
913    pub fn set_features<T: std::convert::Into<std::option::Option<crate::FeatureSet>>>(
914        mut self,
915        v: T,
916    ) -> Self {
917        self.features = v.into();
918        self
919    }
920
921    /// Sets the value of [verification][crate::ExtensionRangeOptions::verification].
922    pub fn set_verification<
923        T: std::convert::Into<crate::extension_range_options::VerificationState>,
924    >(
925        mut self,
926        v: T,
927    ) -> Self {
928        self.verification = v.into();
929        self
930    }
931
932    /// Sets the value of [uninterpreted_option][crate::ExtensionRangeOptions::uninterpreted_option].
933    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
934    where
935        T: std::iter::IntoIterator<Item = V>,
936        V: std::convert::Into<crate::UninterpretedOption>,
937    {
938        use std::iter::Iterator;
939        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
940        self
941    }
942
943    /// Sets the value of [declaration][crate::ExtensionRangeOptions::declaration].
944    pub fn set_declaration<T, V>(mut self, v: T) -> Self
945    where
946        T: std::iter::IntoIterator<Item = V>,
947        V: std::convert::Into<crate::extension_range_options::Declaration>,
948    {
949        use std::iter::Iterator;
950        self.declaration = v.into_iter().map(|i| i.into()).collect();
951        self
952    }
953}
954
955impl wkt::message::Message for ExtensionRangeOptions {
956    fn typename() -> &'static str {
957        "type.googleapis.com/google.protobuf.ExtensionRangeOptions"
958    }
959}
960
961/// Defines additional types related to [ExtensionRangeOptions].
962pub mod extension_range_options {
963    #[allow(unused_imports)]
964    use super::*;
965
966    #[serde_with::serde_as]
967    #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
968    #[serde(default, rename_all = "camelCase")]
969    #[non_exhaustive]
970    pub struct Declaration {
971        /// The extension number declared within the extension range.
972        pub number: i32,
973
974        /// The fully-qualified name of the extension field. There must be a leading
975        /// dot in front of the full name.
976        #[serde(skip_serializing_if = "std::string::String::is_empty")]
977        pub full_name: std::string::String,
978
979        /// The fully-qualified type name of the extension field. Unlike
980        /// Metadata.type, Declaration.type must have a leading dot for messages
981        /// and enums.
982        #[serde(rename = "type")]
983        #[serde(skip_serializing_if = "std::string::String::is_empty")]
984        pub r#type: std::string::String,
985
986        /// If true, indicates that the number is reserved in the extension range,
987        /// and any extension field with the number will fail to compile. Set this
988        /// when a declared extension field is deleted.
989        pub reserved: bool,
990
991        /// If true, indicates that the extension must be defined as repeated.
992        /// Otherwise the extension must be defined as optional.
993        pub repeated: bool,
994
995        #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
996        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
997    }
998
999    impl Declaration {
1000        pub fn new() -> Self {
1001            std::default::Default::default()
1002        }
1003
1004        /// Sets the value of [number][crate::extension_range_options::Declaration::number].
1005        pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1006            self.number = v.into();
1007            self
1008        }
1009
1010        /// Sets the value of [full_name][crate::extension_range_options::Declaration::full_name].
1011        pub fn set_full_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1012            self.full_name = v.into();
1013            self
1014        }
1015
1016        /// Sets the value of [r#type][crate::extension_range_options::Declaration::type].
1017        pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1018            self.r#type = v.into();
1019            self
1020        }
1021
1022        /// Sets the value of [reserved][crate::extension_range_options::Declaration::reserved].
1023        pub fn set_reserved<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1024            self.reserved = v.into();
1025            self
1026        }
1027
1028        /// Sets the value of [repeated][crate::extension_range_options::Declaration::repeated].
1029        pub fn set_repeated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1030            self.repeated = v.into();
1031            self
1032        }
1033    }
1034
1035    impl wkt::message::Message for Declaration {
1036        fn typename() -> &'static str {
1037            "type.googleapis.com/google.protobuf.ExtensionRangeOptions.Declaration"
1038        }
1039    }
1040
1041    /// The verification state of the extension range.
1042    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
1043    pub struct VerificationState(i32);
1044
1045    impl VerificationState {
1046        /// All the extensions of the range must be declared.
1047        pub const DECLARATION: VerificationState = VerificationState::new(0);
1048
1049        pub const UNVERIFIED: VerificationState = VerificationState::new(1);
1050
1051        /// Creates a new VerificationState instance.
1052        pub(crate) const fn new(value: i32) -> Self {
1053            Self(value)
1054        }
1055
1056        /// Gets the enum value.
1057        pub fn value(&self) -> i32 {
1058            self.0
1059        }
1060
1061        /// Gets the enum value as a string.
1062        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
1063            match self.0 {
1064                0 => std::borrow::Cow::Borrowed("DECLARATION"),
1065                1 => std::borrow::Cow::Borrowed("UNVERIFIED"),
1066                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
1067            }
1068        }
1069
1070        /// Creates an enum value from the value name.
1071        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
1072            match name {
1073                "DECLARATION" => std::option::Option::Some(Self::DECLARATION),
1074                "UNVERIFIED" => std::option::Option::Some(Self::UNVERIFIED),
1075                _ => std::option::Option::None,
1076            }
1077        }
1078    }
1079
1080    impl std::convert::From<i32> for VerificationState {
1081        fn from(value: i32) -> Self {
1082            Self::new(value)
1083        }
1084    }
1085
1086    impl std::default::Default for VerificationState {
1087        fn default() -> Self {
1088            Self::new(0)
1089        }
1090    }
1091}
1092
1093/// Describes a field within a message.
1094#[serde_with::serde_as]
1095#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1096#[serde(default, rename_all = "camelCase")]
1097#[non_exhaustive]
1098pub struct FieldDescriptorProto {
1099    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1100    pub name: std::string::String,
1101
1102    pub number: i32,
1103
1104    pub label: crate::field_descriptor_proto::Label,
1105
1106    /// If type_name is set, this need not be set.  If both this and type_name
1107    /// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
1108    #[serde(rename = "type")]
1109    pub r#type: crate::field_descriptor_proto::Type,
1110
1111    /// For message and enum types, this is the name of the type.  If the name
1112    /// starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
1113    /// rules are used to find the type (i.e. first the nested types within this
1114    /// message are searched, then within the parent, on up to the root
1115    /// namespace).
1116    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1117    pub type_name: std::string::String,
1118
1119    /// For extensions, this is the name of the type being extended.  It is
1120    /// resolved in the same manner as type_name.
1121    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1122    pub extendee: std::string::String,
1123
1124    /// For numeric types, contains the original text representation of the value.
1125    /// For booleans, "true" or "false".
1126    /// For strings, contains the default text contents (not escaped in any way).
1127    /// For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
1128    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1129    pub default_value: std::string::String,
1130
1131    /// If set, gives the index of a oneof in the containing type's oneof_decl
1132    /// list.  This field is a member of that oneof.
1133    pub oneof_index: i32,
1134
1135    /// JSON name of this field. The value is set by protocol compiler. If the
1136    /// user has set a "json_name" option on this field, that option's value
1137    /// will be used. Otherwise, it's deduced from the field's name by converting
1138    /// it to camelCase.
1139    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1140    pub json_name: std::string::String,
1141
1142    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1143    pub options: std::option::Option<crate::FieldOptions>,
1144
1145    /// If true, this is a proto3 "optional". When a proto3 field is optional, it
1146    /// tracks presence regardless of field type.
1147    ///
1148    /// When proto3_optional is true, this field must belong to a oneof to signal
1149    /// to old proto3 clients that presence is tracked for this field. This oneof
1150    /// is known as a "synthetic" oneof, and this field must be its sole member
1151    /// (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs
1152    /// exist in the descriptor only, and do not generate any API. Synthetic oneofs
1153    /// must be ordered after all "real" oneofs.
1154    ///
1155    /// For message fields, proto3_optional doesn't create any semantic change,
1156    /// since non-repeated message fields always track presence. However it still
1157    /// indicates the semantic detail of whether the user wrote "optional" or not.
1158    /// This can be useful for round-tripping the .proto file. For consistency we
1159    /// give message fields a synthetic oneof also, even though it is not required
1160    /// to track presence. This is especially important because the parser can't
1161    /// tell if a field is a message or an enum, so it must always create a
1162    /// synthetic oneof.
1163    ///
1164    /// Proto2 optional fields do not set this flag, because they already indicate
1165    /// optional with `LABEL_OPTIONAL`.
1166    pub proto3_optional: bool,
1167
1168    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1169    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1170}
1171
1172impl FieldDescriptorProto {
1173    pub fn new() -> Self {
1174        std::default::Default::default()
1175    }
1176
1177    /// Sets the value of [name][crate::FieldDescriptorProto::name].
1178    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1179        self.name = v.into();
1180        self
1181    }
1182
1183    /// Sets the value of [number][crate::FieldDescriptorProto::number].
1184    pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1185        self.number = v.into();
1186        self
1187    }
1188
1189    /// Sets the value of [label][crate::FieldDescriptorProto::label].
1190    pub fn set_label<T: std::convert::Into<crate::field_descriptor_proto::Label>>(
1191        mut self,
1192        v: T,
1193    ) -> Self {
1194        self.label = v.into();
1195        self
1196    }
1197
1198    /// Sets the value of [r#type][crate::FieldDescriptorProto::type].
1199    pub fn set_type<T: std::convert::Into<crate::field_descriptor_proto::Type>>(
1200        mut self,
1201        v: T,
1202    ) -> Self {
1203        self.r#type = v.into();
1204        self
1205    }
1206
1207    /// Sets the value of [type_name][crate::FieldDescriptorProto::type_name].
1208    pub fn set_type_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1209        self.type_name = v.into();
1210        self
1211    }
1212
1213    /// Sets the value of [extendee][crate::FieldDescriptorProto::extendee].
1214    pub fn set_extendee<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1215        self.extendee = v.into();
1216        self
1217    }
1218
1219    /// Sets the value of [default_value][crate::FieldDescriptorProto::default_value].
1220    pub fn set_default_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1221        self.default_value = v.into();
1222        self
1223    }
1224
1225    /// Sets the value of [oneof_index][crate::FieldDescriptorProto::oneof_index].
1226    pub fn set_oneof_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1227        self.oneof_index = v.into();
1228        self
1229    }
1230
1231    /// Sets the value of [json_name][crate::FieldDescriptorProto::json_name].
1232    pub fn set_json_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1233        self.json_name = v.into();
1234        self
1235    }
1236
1237    /// Sets the value of [options][crate::FieldDescriptorProto::options].
1238    pub fn set_options<T: std::convert::Into<std::option::Option<crate::FieldOptions>>>(
1239        mut self,
1240        v: T,
1241    ) -> Self {
1242        self.options = v.into();
1243        self
1244    }
1245
1246    /// Sets the value of [proto3_optional][crate::FieldDescriptorProto::proto3_optional].
1247    pub fn set_proto3_optional<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1248        self.proto3_optional = v.into();
1249        self
1250    }
1251}
1252
1253impl wkt::message::Message for FieldDescriptorProto {
1254    fn typename() -> &'static str {
1255        "type.googleapis.com/google.protobuf.FieldDescriptorProto"
1256    }
1257}
1258
1259/// Defines additional types related to [FieldDescriptorProto].
1260pub mod field_descriptor_proto {
1261    #[allow(unused_imports)]
1262    use super::*;
1263
1264    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
1265    pub struct Type(i32);
1266
1267    impl Type {
1268        /// 0 is reserved for errors.
1269        /// Order is weird for historical reasons.
1270        pub const TYPE_DOUBLE: Type = Type::new(1);
1271
1272        pub const TYPE_FLOAT: Type = Type::new(2);
1273
1274        /// Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if
1275        /// negative values are likely.
1276        pub const TYPE_INT64: Type = Type::new(3);
1277
1278        pub const TYPE_UINT64: Type = Type::new(4);
1279
1280        /// Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if
1281        /// negative values are likely.
1282        pub const TYPE_INT32: Type = Type::new(5);
1283
1284        pub const TYPE_FIXED64: Type = Type::new(6);
1285
1286        pub const TYPE_FIXED32: Type = Type::new(7);
1287
1288        pub const TYPE_BOOL: Type = Type::new(8);
1289
1290        pub const TYPE_STRING: Type = Type::new(9);
1291
1292        /// Tag-delimited aggregate.
1293        /// Group type is deprecated and not supported after google.protobuf. However, Proto3
1294        /// implementations should still be able to parse the group wire format and
1295        /// treat group fields as unknown fields.  In Editions, the group wire format
1296        /// can be enabled via the `message_encoding` feature.
1297        pub const TYPE_GROUP: Type = Type::new(10);
1298
1299        pub const TYPE_MESSAGE: Type = Type::new(11);
1300
1301        /// New in version 2.
1302        pub const TYPE_BYTES: Type = Type::new(12);
1303
1304        pub const TYPE_UINT32: Type = Type::new(13);
1305
1306        pub const TYPE_ENUM: Type = Type::new(14);
1307
1308        pub const TYPE_SFIXED32: Type = Type::new(15);
1309
1310        pub const TYPE_SFIXED64: Type = Type::new(16);
1311
1312        pub const TYPE_SINT32: Type = Type::new(17);
1313
1314        pub const TYPE_SINT64: Type = Type::new(18);
1315
1316        /// Creates a new Type instance.
1317        pub(crate) const fn new(value: i32) -> Self {
1318            Self(value)
1319        }
1320
1321        /// Gets the enum value.
1322        pub fn value(&self) -> i32 {
1323            self.0
1324        }
1325
1326        /// Gets the enum value as a string.
1327        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
1328            match self.0 {
1329                1 => std::borrow::Cow::Borrowed("TYPE_DOUBLE"),
1330                2 => std::borrow::Cow::Borrowed("TYPE_FLOAT"),
1331                3 => std::borrow::Cow::Borrowed("TYPE_INT64"),
1332                4 => std::borrow::Cow::Borrowed("TYPE_UINT64"),
1333                5 => std::borrow::Cow::Borrowed("TYPE_INT32"),
1334                6 => std::borrow::Cow::Borrowed("TYPE_FIXED64"),
1335                7 => std::borrow::Cow::Borrowed("TYPE_FIXED32"),
1336                8 => std::borrow::Cow::Borrowed("TYPE_BOOL"),
1337                9 => std::borrow::Cow::Borrowed("TYPE_STRING"),
1338                10 => std::borrow::Cow::Borrowed("TYPE_GROUP"),
1339                11 => std::borrow::Cow::Borrowed("TYPE_MESSAGE"),
1340                12 => std::borrow::Cow::Borrowed("TYPE_BYTES"),
1341                13 => std::borrow::Cow::Borrowed("TYPE_UINT32"),
1342                14 => std::borrow::Cow::Borrowed("TYPE_ENUM"),
1343                15 => std::borrow::Cow::Borrowed("TYPE_SFIXED32"),
1344                16 => std::borrow::Cow::Borrowed("TYPE_SFIXED64"),
1345                17 => std::borrow::Cow::Borrowed("TYPE_SINT32"),
1346                18 => std::borrow::Cow::Borrowed("TYPE_SINT64"),
1347                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
1348            }
1349        }
1350
1351        /// Creates an enum value from the value name.
1352        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
1353            match name {
1354                "TYPE_DOUBLE" => std::option::Option::Some(Self::TYPE_DOUBLE),
1355                "TYPE_FLOAT" => std::option::Option::Some(Self::TYPE_FLOAT),
1356                "TYPE_INT64" => std::option::Option::Some(Self::TYPE_INT64),
1357                "TYPE_UINT64" => std::option::Option::Some(Self::TYPE_UINT64),
1358                "TYPE_INT32" => std::option::Option::Some(Self::TYPE_INT32),
1359                "TYPE_FIXED64" => std::option::Option::Some(Self::TYPE_FIXED64),
1360                "TYPE_FIXED32" => std::option::Option::Some(Self::TYPE_FIXED32),
1361                "TYPE_BOOL" => std::option::Option::Some(Self::TYPE_BOOL),
1362                "TYPE_STRING" => std::option::Option::Some(Self::TYPE_STRING),
1363                "TYPE_GROUP" => std::option::Option::Some(Self::TYPE_GROUP),
1364                "TYPE_MESSAGE" => std::option::Option::Some(Self::TYPE_MESSAGE),
1365                "TYPE_BYTES" => std::option::Option::Some(Self::TYPE_BYTES),
1366                "TYPE_UINT32" => std::option::Option::Some(Self::TYPE_UINT32),
1367                "TYPE_ENUM" => std::option::Option::Some(Self::TYPE_ENUM),
1368                "TYPE_SFIXED32" => std::option::Option::Some(Self::TYPE_SFIXED32),
1369                "TYPE_SFIXED64" => std::option::Option::Some(Self::TYPE_SFIXED64),
1370                "TYPE_SINT32" => std::option::Option::Some(Self::TYPE_SINT32),
1371                "TYPE_SINT64" => std::option::Option::Some(Self::TYPE_SINT64),
1372                _ => std::option::Option::None,
1373            }
1374        }
1375    }
1376
1377    impl std::convert::From<i32> for Type {
1378        fn from(value: i32) -> Self {
1379            Self::new(value)
1380        }
1381    }
1382
1383    impl std::default::Default for Type {
1384        fn default() -> Self {
1385            Self::new(0)
1386        }
1387    }
1388
1389    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
1390    pub struct Label(i32);
1391
1392    impl Label {
1393        /// 0 is reserved for errors
1394        pub const LABEL_OPTIONAL: Label = Label::new(1);
1395
1396        pub const LABEL_REPEATED: Label = Label::new(3);
1397
1398        /// The required label is only allowed in google.protobuf.  In proto3 and Editions
1399        /// it's explicitly prohibited.  In Editions, the `field_presence` feature
1400        /// can be used to get this behavior.
1401        pub const LABEL_REQUIRED: Label = Label::new(2);
1402
1403        /// Creates a new Label instance.
1404        pub(crate) const fn new(value: i32) -> Self {
1405            Self(value)
1406        }
1407
1408        /// Gets the enum value.
1409        pub fn value(&self) -> i32 {
1410            self.0
1411        }
1412
1413        /// Gets the enum value as a string.
1414        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
1415            match self.0 {
1416                1 => std::borrow::Cow::Borrowed("LABEL_OPTIONAL"),
1417                2 => std::borrow::Cow::Borrowed("LABEL_REQUIRED"),
1418                3 => std::borrow::Cow::Borrowed("LABEL_REPEATED"),
1419                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
1420            }
1421        }
1422
1423        /// Creates an enum value from the value name.
1424        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
1425            match name {
1426                "LABEL_OPTIONAL" => std::option::Option::Some(Self::LABEL_OPTIONAL),
1427                "LABEL_REPEATED" => std::option::Option::Some(Self::LABEL_REPEATED),
1428                "LABEL_REQUIRED" => std::option::Option::Some(Self::LABEL_REQUIRED),
1429                _ => std::option::Option::None,
1430            }
1431        }
1432    }
1433
1434    impl std::convert::From<i32> for Label {
1435        fn from(value: i32) -> Self {
1436            Self::new(value)
1437        }
1438    }
1439
1440    impl std::default::Default for Label {
1441        fn default() -> Self {
1442            Self::new(0)
1443        }
1444    }
1445}
1446
1447/// Describes a oneof.
1448#[serde_with::serde_as]
1449#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1450#[serde(default, rename_all = "camelCase")]
1451#[non_exhaustive]
1452pub struct OneofDescriptorProto {
1453    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1454    pub name: std::string::String,
1455
1456    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1457    pub options: std::option::Option<crate::OneofOptions>,
1458
1459    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1460    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1461}
1462
1463impl OneofDescriptorProto {
1464    pub fn new() -> Self {
1465        std::default::Default::default()
1466    }
1467
1468    /// Sets the value of [name][crate::OneofDescriptorProto::name].
1469    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1470        self.name = v.into();
1471        self
1472    }
1473
1474    /// Sets the value of [options][crate::OneofDescriptorProto::options].
1475    pub fn set_options<T: std::convert::Into<std::option::Option<crate::OneofOptions>>>(
1476        mut self,
1477        v: T,
1478    ) -> Self {
1479        self.options = v.into();
1480        self
1481    }
1482}
1483
1484impl wkt::message::Message for OneofDescriptorProto {
1485    fn typename() -> &'static str {
1486        "type.googleapis.com/google.protobuf.OneofDescriptorProto"
1487    }
1488}
1489
1490/// Describes an enum type.
1491#[serde_with::serde_as]
1492#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1493#[serde(default, rename_all = "camelCase")]
1494#[non_exhaustive]
1495pub struct EnumDescriptorProto {
1496    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1497    pub name: std::string::String,
1498
1499    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1500    pub value: std::vec::Vec<crate::EnumValueDescriptorProto>,
1501
1502    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1503    pub options: std::option::Option<crate::EnumOptions>,
1504
1505    /// Range of reserved numeric values. Reserved numeric values may not be used
1506    /// by enum values in the same enum declaration. Reserved ranges may not
1507    /// overlap.
1508    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1509    pub reserved_range: std::vec::Vec<crate::enum_descriptor_proto::EnumReservedRange>,
1510
1511    /// Reserved enum value names, which may not be reused. A given name may only
1512    /// be reserved once.
1513    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1514    pub reserved_name: std::vec::Vec<std::string::String>,
1515
1516    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1517    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1518}
1519
1520impl EnumDescriptorProto {
1521    pub fn new() -> Self {
1522        std::default::Default::default()
1523    }
1524
1525    /// Sets the value of [name][crate::EnumDescriptorProto::name].
1526    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1527        self.name = v.into();
1528        self
1529    }
1530
1531    /// Sets the value of [options][crate::EnumDescriptorProto::options].
1532    pub fn set_options<T: std::convert::Into<std::option::Option<crate::EnumOptions>>>(
1533        mut self,
1534        v: T,
1535    ) -> Self {
1536        self.options = v.into();
1537        self
1538    }
1539
1540    /// Sets the value of [value][crate::EnumDescriptorProto::value].
1541    pub fn set_value<T, V>(mut self, v: T) -> Self
1542    where
1543        T: std::iter::IntoIterator<Item = V>,
1544        V: std::convert::Into<crate::EnumValueDescriptorProto>,
1545    {
1546        use std::iter::Iterator;
1547        self.value = v.into_iter().map(|i| i.into()).collect();
1548        self
1549    }
1550
1551    /// Sets the value of [reserved_range][crate::EnumDescriptorProto::reserved_range].
1552    pub fn set_reserved_range<T, V>(mut self, v: T) -> Self
1553    where
1554        T: std::iter::IntoIterator<Item = V>,
1555        V: std::convert::Into<crate::enum_descriptor_proto::EnumReservedRange>,
1556    {
1557        use std::iter::Iterator;
1558        self.reserved_range = v.into_iter().map(|i| i.into()).collect();
1559        self
1560    }
1561
1562    /// Sets the value of [reserved_name][crate::EnumDescriptorProto::reserved_name].
1563    pub fn set_reserved_name<T, V>(mut self, v: T) -> Self
1564    where
1565        T: std::iter::IntoIterator<Item = V>,
1566        V: std::convert::Into<std::string::String>,
1567    {
1568        use std::iter::Iterator;
1569        self.reserved_name = v.into_iter().map(|i| i.into()).collect();
1570        self
1571    }
1572}
1573
1574impl wkt::message::Message for EnumDescriptorProto {
1575    fn typename() -> &'static str {
1576        "type.googleapis.com/google.protobuf.EnumDescriptorProto"
1577    }
1578}
1579
1580/// Defines additional types related to [EnumDescriptorProto].
1581pub mod enum_descriptor_proto {
1582    #[allow(unused_imports)]
1583    use super::*;
1584
1585    /// Range of reserved numeric values. Reserved values may not be used by
1586    /// entries in the same enum. Reserved ranges may not overlap.
1587    ///
1588    /// Note that this is distinct from DescriptorProto.ReservedRange in that it
1589    /// is inclusive such that it can appropriately represent the entire int32
1590    /// domain.
1591    #[serde_with::serde_as]
1592    #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1593    #[serde(default, rename_all = "camelCase")]
1594    #[non_exhaustive]
1595    pub struct EnumReservedRange {
1596        pub start: i32,
1597
1598        pub end: i32,
1599
1600        #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1601        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1602    }
1603
1604    impl EnumReservedRange {
1605        pub fn new() -> Self {
1606            std::default::Default::default()
1607        }
1608
1609        /// Sets the value of [start][crate::enum_descriptor_proto::EnumReservedRange::start].
1610        pub fn set_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1611            self.start = v.into();
1612            self
1613        }
1614
1615        /// Sets the value of [end][crate::enum_descriptor_proto::EnumReservedRange::end].
1616        pub fn set_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1617            self.end = v.into();
1618            self
1619        }
1620    }
1621
1622    impl wkt::message::Message for EnumReservedRange {
1623        fn typename() -> &'static str {
1624            "type.googleapis.com/google.protobuf.EnumDescriptorProto.EnumReservedRange"
1625        }
1626    }
1627}
1628
1629/// Describes a value within an enum.
1630#[serde_with::serde_as]
1631#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1632#[serde(default, rename_all = "camelCase")]
1633#[non_exhaustive]
1634pub struct EnumValueDescriptorProto {
1635    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1636    pub name: std::string::String,
1637
1638    pub number: i32,
1639
1640    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1641    pub options: std::option::Option<crate::EnumValueOptions>,
1642
1643    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1644    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1645}
1646
1647impl EnumValueDescriptorProto {
1648    pub fn new() -> Self {
1649        std::default::Default::default()
1650    }
1651
1652    /// Sets the value of [name][crate::EnumValueDescriptorProto::name].
1653    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1654        self.name = v.into();
1655        self
1656    }
1657
1658    /// Sets the value of [number][crate::EnumValueDescriptorProto::number].
1659    pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1660        self.number = v.into();
1661        self
1662    }
1663
1664    /// Sets the value of [options][crate::EnumValueDescriptorProto::options].
1665    pub fn set_options<T: std::convert::Into<std::option::Option<crate::EnumValueOptions>>>(
1666        mut self,
1667        v: T,
1668    ) -> Self {
1669        self.options = v.into();
1670        self
1671    }
1672}
1673
1674impl wkt::message::Message for EnumValueDescriptorProto {
1675    fn typename() -> &'static str {
1676        "type.googleapis.com/google.protobuf.EnumValueDescriptorProto"
1677    }
1678}
1679
1680/// Describes a service.
1681#[serde_with::serde_as]
1682#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1683#[serde(default, rename_all = "camelCase")]
1684#[non_exhaustive]
1685pub struct ServiceDescriptorProto {
1686    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1687    pub name: std::string::String,
1688
1689    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1690    pub method: std::vec::Vec<crate::MethodDescriptorProto>,
1691
1692    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1693    pub options: std::option::Option<crate::ServiceOptions>,
1694
1695    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1696    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1697}
1698
1699impl ServiceDescriptorProto {
1700    pub fn new() -> Self {
1701        std::default::Default::default()
1702    }
1703
1704    /// Sets the value of [name][crate::ServiceDescriptorProto::name].
1705    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1706        self.name = v.into();
1707        self
1708    }
1709
1710    /// Sets the value of [options][crate::ServiceDescriptorProto::options].
1711    pub fn set_options<T: std::convert::Into<std::option::Option<crate::ServiceOptions>>>(
1712        mut self,
1713        v: T,
1714    ) -> Self {
1715        self.options = v.into();
1716        self
1717    }
1718
1719    /// Sets the value of [method][crate::ServiceDescriptorProto::method].
1720    pub fn set_method<T, V>(mut self, v: T) -> Self
1721    where
1722        T: std::iter::IntoIterator<Item = V>,
1723        V: std::convert::Into<crate::MethodDescriptorProto>,
1724    {
1725        use std::iter::Iterator;
1726        self.method = v.into_iter().map(|i| i.into()).collect();
1727        self
1728    }
1729}
1730
1731impl wkt::message::Message for ServiceDescriptorProto {
1732    fn typename() -> &'static str {
1733        "type.googleapis.com/google.protobuf.ServiceDescriptorProto"
1734    }
1735}
1736
1737/// Describes a method of a service.
1738#[serde_with::serde_as]
1739#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1740#[serde(default, rename_all = "camelCase")]
1741#[non_exhaustive]
1742pub struct MethodDescriptorProto {
1743    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1744    pub name: std::string::String,
1745
1746    /// Input and output type names.  These are resolved in the same way as
1747    /// FieldDescriptorProto.type_name, but must refer to a message type.
1748    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1749    pub input_type: std::string::String,
1750
1751    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1752    pub output_type: std::string::String,
1753
1754    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1755    pub options: std::option::Option<crate::MethodOptions>,
1756
1757    /// Identifies if client streams multiple client messages
1758    pub client_streaming: bool,
1759
1760    /// Identifies if server streams multiple server messages
1761    pub server_streaming: bool,
1762
1763    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1764    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1765}
1766
1767impl MethodDescriptorProto {
1768    pub fn new() -> Self {
1769        std::default::Default::default()
1770    }
1771
1772    /// Sets the value of [name][crate::MethodDescriptorProto::name].
1773    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1774        self.name = v.into();
1775        self
1776    }
1777
1778    /// Sets the value of [input_type][crate::MethodDescriptorProto::input_type].
1779    pub fn set_input_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1780        self.input_type = v.into();
1781        self
1782    }
1783
1784    /// Sets the value of [output_type][crate::MethodDescriptorProto::output_type].
1785    pub fn set_output_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1786        self.output_type = v.into();
1787        self
1788    }
1789
1790    /// Sets the value of [options][crate::MethodDescriptorProto::options].
1791    pub fn set_options<T: std::convert::Into<std::option::Option<crate::MethodOptions>>>(
1792        mut self,
1793        v: T,
1794    ) -> Self {
1795        self.options = v.into();
1796        self
1797    }
1798
1799    /// Sets the value of [client_streaming][crate::MethodDescriptorProto::client_streaming].
1800    pub fn set_client_streaming<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1801        self.client_streaming = v.into();
1802        self
1803    }
1804
1805    /// Sets the value of [server_streaming][crate::MethodDescriptorProto::server_streaming].
1806    pub fn set_server_streaming<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1807        self.server_streaming = v.into();
1808        self
1809    }
1810}
1811
1812impl wkt::message::Message for MethodDescriptorProto {
1813    fn typename() -> &'static str {
1814        "type.googleapis.com/google.protobuf.MethodDescriptorProto"
1815    }
1816}
1817
1818#[serde_with::serde_as]
1819#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
1820#[serde(default, rename_all = "camelCase")]
1821#[non_exhaustive]
1822pub struct FileOptions {
1823    /// Sets the Java package where classes generated from this .proto will be
1824    /// placed.  By default, the proto package is used, but this is often
1825    /// inappropriate because proto packages do not normally start with backwards
1826    /// domain names.
1827    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1828    pub java_package: std::string::String,
1829
1830    /// Controls the name of the wrapper Java class generated for the .proto file.
1831    /// That class will always contain the .proto file's getDescriptor() method as
1832    /// well as any top-level extensions defined in the .proto file.
1833    /// If java_multiple_files is disabled, then all the other classes from the
1834    /// .proto file will be nested inside the single wrapper outer class.
1835    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1836    pub java_outer_classname: std::string::String,
1837
1838    /// If enabled, then the Java code generator will generate a separate .java
1839    /// file for each top-level message, enum, and service defined in the .proto
1840    /// file.  Thus, these types will *not* be nested inside the wrapper class
1841    /// named by java_outer_classname.  However, the wrapper class will still be
1842    /// generated to contain the file's getDescriptor() method as well as any
1843    /// top-level extensions defined in the file.
1844    pub java_multiple_files: bool,
1845
1846    /// This option does nothing.
1847    pub java_generate_equals_and_hash: bool,
1848
1849    /// A proto2 file can set this to true to opt in to UTF-8 checking for Java,
1850    /// which will throw an exception if invalid UTF-8 is parsed from the wire or
1851    /// assigned to a string field.
1852    ///
1853    /// TODO: clarify exactly what kinds of field types this option
1854    /// applies to, and update these docs accordingly.
1855    ///
1856    /// Proto3 files already perform these checks. Setting the option explicitly to
1857    /// false has no effect: it cannot be used to opt proto3 files out of UTF-8
1858    /// checks.
1859    pub java_string_check_utf8: bool,
1860
1861    pub optimize_for: crate::file_options::OptimizeMode,
1862
1863    /// Sets the Go package where structs generated from this .proto will be
1864    /// placed. If omitted, the Go package will be derived from the following:
1865    ///
1866    /// - The basename of the package import path, if provided.
1867    /// - Otherwise, the package statement in the .proto file, if present.
1868    /// - Otherwise, the basename of the .proto file, without extension.
1869    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1870    pub go_package: std::string::String,
1871
1872    /// Should generic services be generated in each language?  "Generic" services
1873    /// are not specific to any particular RPC system.  They are generated by the
1874    /// main code generators in each language (without additional plugins).
1875    /// Generic services were the only kind of service generation supported by
1876    /// early versions of google.protobuf.
1877    ///
1878    /// Generic services are now considered deprecated in favor of using plugins
1879    /// that generate code specific to your particular RPC system.  Therefore,
1880    /// these default to false.  Old code which depends on generic services should
1881    /// explicitly set them to true.
1882    pub cc_generic_services: bool,
1883
1884    pub java_generic_services: bool,
1885
1886    pub py_generic_services: bool,
1887
1888    /// Is this file deprecated?
1889    /// Depending on the target platform, this can emit Deprecated annotations
1890    /// for everything in the file, or it will be completely ignored; in the very
1891    /// least, this is a formalization for deprecating files.
1892    pub deprecated: bool,
1893
1894    /// Enables the use of arenas for the proto messages in this file. This applies
1895    /// only to generated classes for C++.
1896    pub cc_enable_arenas: bool,
1897
1898    /// Sets the objective c class prefix which is prepended to all objective c
1899    /// generated classes from this .proto. There is no default.
1900    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1901    pub objc_class_prefix: std::string::String,
1902
1903    /// Namespace for generated classes; defaults to the package.
1904    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1905    pub csharp_namespace: std::string::String,
1906
1907    /// By default Swift generators will take the proto package and CamelCase it
1908    /// replacing '.' with underscore and use that to prefix the types/symbols
1909    /// defined. When this options is provided, they will use this value instead
1910    /// to prefix the types/symbols defined.
1911    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1912    pub swift_prefix: std::string::String,
1913
1914    /// Sets the php class prefix which is prepended to all php generated classes
1915    /// from this .proto. Default is empty.
1916    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1917    pub php_class_prefix: std::string::String,
1918
1919    /// Use this option to change the namespace of php generated classes. Default
1920    /// is empty. When this option is empty, the package name will be used for
1921    /// determining the namespace.
1922    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1923    pub php_namespace: std::string::String,
1924
1925    /// Use this option to change the namespace of php generated metadata classes.
1926    /// Default is empty. When this option is empty, the proto file name will be
1927    /// used for determining the namespace.
1928    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1929    pub php_metadata_namespace: std::string::String,
1930
1931    /// Use this option to change the package of ruby generated classes. Default
1932    /// is empty. When this option is not set, the package name will be used for
1933    /// determining the ruby package.
1934    #[serde(skip_serializing_if = "std::string::String::is_empty")]
1935    pub ruby_package: std::string::String,
1936
1937    /// Any features defined in the specific edition.
1938    #[serde(skip_serializing_if = "std::option::Option::is_none")]
1939    pub features: std::option::Option<crate::FeatureSet>,
1940
1941    /// The parser stores options it doesn't recognize here.
1942    /// See the documentation for the "Options" section above.
1943    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
1944    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
1945
1946    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1947    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1948}
1949
1950impl FileOptions {
1951    pub fn new() -> Self {
1952        std::default::Default::default()
1953    }
1954
1955    /// Sets the value of [java_package][crate::FileOptions::java_package].
1956    pub fn set_java_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1957        self.java_package = v.into();
1958        self
1959    }
1960
1961    /// Sets the value of [java_outer_classname][crate::FileOptions::java_outer_classname].
1962    pub fn set_java_outer_classname<T: std::convert::Into<std::string::String>>(
1963        mut self,
1964        v: T,
1965    ) -> Self {
1966        self.java_outer_classname = v.into();
1967        self
1968    }
1969
1970    /// Sets the value of [java_multiple_files][crate::FileOptions::java_multiple_files].
1971    pub fn set_java_multiple_files<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1972        self.java_multiple_files = v.into();
1973        self
1974    }
1975
1976    /// Sets the value of [java_generate_equals_and_hash][crate::FileOptions::java_generate_equals_and_hash].
1977    pub fn set_java_generate_equals_and_hash<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1978        self.java_generate_equals_and_hash = v.into();
1979        self
1980    }
1981
1982    /// Sets the value of [java_string_check_utf8][crate::FileOptions::java_string_check_utf8].
1983    pub fn set_java_string_check_utf8<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1984        self.java_string_check_utf8 = v.into();
1985        self
1986    }
1987
1988    /// Sets the value of [optimize_for][crate::FileOptions::optimize_for].
1989    pub fn set_optimize_for<T: std::convert::Into<crate::file_options::OptimizeMode>>(
1990        mut self,
1991        v: T,
1992    ) -> Self {
1993        self.optimize_for = v.into();
1994        self
1995    }
1996
1997    /// Sets the value of [go_package][crate::FileOptions::go_package].
1998    pub fn set_go_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1999        self.go_package = v.into();
2000        self
2001    }
2002
2003    /// Sets the value of [cc_generic_services][crate::FileOptions::cc_generic_services].
2004    pub fn set_cc_generic_services<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2005        self.cc_generic_services = v.into();
2006        self
2007    }
2008
2009    /// Sets the value of [java_generic_services][crate::FileOptions::java_generic_services].
2010    pub fn set_java_generic_services<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2011        self.java_generic_services = v.into();
2012        self
2013    }
2014
2015    /// Sets the value of [py_generic_services][crate::FileOptions::py_generic_services].
2016    pub fn set_py_generic_services<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2017        self.py_generic_services = v.into();
2018        self
2019    }
2020
2021    /// Sets the value of [deprecated][crate::FileOptions::deprecated].
2022    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2023        self.deprecated = v.into();
2024        self
2025    }
2026
2027    /// Sets the value of [cc_enable_arenas][crate::FileOptions::cc_enable_arenas].
2028    pub fn set_cc_enable_arenas<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2029        self.cc_enable_arenas = v.into();
2030        self
2031    }
2032
2033    /// Sets the value of [objc_class_prefix][crate::FileOptions::objc_class_prefix].
2034    pub fn set_objc_class_prefix<T: std::convert::Into<std::string::String>>(
2035        mut self,
2036        v: T,
2037    ) -> Self {
2038        self.objc_class_prefix = v.into();
2039        self
2040    }
2041
2042    /// Sets the value of [csharp_namespace][crate::FileOptions::csharp_namespace].
2043    pub fn set_csharp_namespace<T: std::convert::Into<std::string::String>>(
2044        mut self,
2045        v: T,
2046    ) -> Self {
2047        self.csharp_namespace = v.into();
2048        self
2049    }
2050
2051    /// Sets the value of [swift_prefix][crate::FileOptions::swift_prefix].
2052    pub fn set_swift_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2053        self.swift_prefix = v.into();
2054        self
2055    }
2056
2057    /// Sets the value of [php_class_prefix][crate::FileOptions::php_class_prefix].
2058    pub fn set_php_class_prefix<T: std::convert::Into<std::string::String>>(
2059        mut self,
2060        v: T,
2061    ) -> Self {
2062        self.php_class_prefix = v.into();
2063        self
2064    }
2065
2066    /// Sets the value of [php_namespace][crate::FileOptions::php_namespace].
2067    pub fn set_php_namespace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2068        self.php_namespace = v.into();
2069        self
2070    }
2071
2072    /// Sets the value of [php_metadata_namespace][crate::FileOptions::php_metadata_namespace].
2073    pub fn set_php_metadata_namespace<T: std::convert::Into<std::string::String>>(
2074        mut self,
2075        v: T,
2076    ) -> Self {
2077        self.php_metadata_namespace = v.into();
2078        self
2079    }
2080
2081    /// Sets the value of [ruby_package][crate::FileOptions::ruby_package].
2082    pub fn set_ruby_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2083        self.ruby_package = v.into();
2084        self
2085    }
2086
2087    /// Sets the value of [features][crate::FileOptions::features].
2088    pub fn set_features<T: std::convert::Into<std::option::Option<crate::FeatureSet>>>(
2089        mut self,
2090        v: T,
2091    ) -> Self {
2092        self.features = v.into();
2093        self
2094    }
2095
2096    /// Sets the value of [uninterpreted_option][crate::FileOptions::uninterpreted_option].
2097    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
2098    where
2099        T: std::iter::IntoIterator<Item = V>,
2100        V: std::convert::Into<crate::UninterpretedOption>,
2101    {
2102        use std::iter::Iterator;
2103        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
2104        self
2105    }
2106}
2107
2108impl wkt::message::Message for FileOptions {
2109    fn typename() -> &'static str {
2110        "type.googleapis.com/google.protobuf.FileOptions"
2111    }
2112}
2113
2114/// Defines additional types related to [FileOptions].
2115pub mod file_options {
2116    #[allow(unused_imports)]
2117    use super::*;
2118
2119    /// Generated classes can be optimized for speed or code size.
2120    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
2121    pub struct OptimizeMode(i32);
2122
2123    impl OptimizeMode {
2124        pub const SPEED: OptimizeMode = OptimizeMode::new(1);
2125
2126        /// etc.
2127        pub const CODE_SIZE: OptimizeMode = OptimizeMode::new(2);
2128
2129        pub const LITE_RUNTIME: OptimizeMode = OptimizeMode::new(3);
2130
2131        /// Creates a new OptimizeMode instance.
2132        pub(crate) const fn new(value: i32) -> Self {
2133            Self(value)
2134        }
2135
2136        /// Gets the enum value.
2137        pub fn value(&self) -> i32 {
2138            self.0
2139        }
2140
2141        /// Gets the enum value as a string.
2142        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
2143            match self.0 {
2144                1 => std::borrow::Cow::Borrowed("SPEED"),
2145                2 => std::borrow::Cow::Borrowed("CODE_SIZE"),
2146                3 => std::borrow::Cow::Borrowed("LITE_RUNTIME"),
2147                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
2148            }
2149        }
2150
2151        /// Creates an enum value from the value name.
2152        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
2153            match name {
2154                "SPEED" => std::option::Option::Some(Self::SPEED),
2155                "CODE_SIZE" => std::option::Option::Some(Self::CODE_SIZE),
2156                "LITE_RUNTIME" => std::option::Option::Some(Self::LITE_RUNTIME),
2157                _ => std::option::Option::None,
2158            }
2159        }
2160    }
2161
2162    impl std::convert::From<i32> for OptimizeMode {
2163        fn from(value: i32) -> Self {
2164            Self::new(value)
2165        }
2166    }
2167
2168    impl std::default::Default for OptimizeMode {
2169        fn default() -> Self {
2170            Self::new(0)
2171        }
2172    }
2173}
2174
2175#[serde_with::serde_as]
2176#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2177#[serde(default, rename_all = "camelCase")]
2178#[non_exhaustive]
2179pub struct MessageOptions {
2180    /// Set true to use the old proto1 MessageSet wire format for extensions.
2181    /// This is provided for backwards-compatibility with the MessageSet wire
2182    /// format.  You should not use this for any other reason:  It's less
2183    /// efficient, has fewer features, and is more complicated.
2184    ///
2185    /// The message must be defined exactly as follows:
2186    /// message Foo {
2187    /// option message_set_wire_format = true;
2188    /// extensions 4 to max;
2189    /// }
2190    /// Note that the message cannot have any defined fields; MessageSets only
2191    /// have extensions.
2192    ///
2193    /// All extensions of your type must be singular messages; e.g. they cannot
2194    /// be int32s, enums, or repeated messages.
2195    ///
2196    /// Because this is an option, the above two restrictions are not enforced by
2197    /// the protocol compiler.
2198    pub message_set_wire_format: bool,
2199
2200    /// Disables the generation of the standard "descriptor()" accessor, which can
2201    /// conflict with a field of the same name.  This is meant to make migration
2202    /// from proto1 easier; new code should avoid fields named "descriptor".
2203    pub no_standard_descriptor_accessor: bool,
2204
2205    /// Is this message deprecated?
2206    /// Depending on the target platform, this can emit Deprecated annotations
2207    /// for the message, or it will be completely ignored; in the very least,
2208    /// this is a formalization for deprecating messages.
2209    pub deprecated: bool,
2210
2211    /// Whether the message is an automatically generated map entry type for the
2212    /// maps field.
2213    ///
2214    /// For maps fields:
2215    /// map<KeyType, ValueType> map_field = 1;
2216    /// The parsed descriptor looks like:
2217    /// message MapFieldEntry {
2218    /// option map_entry = true;
2219    /// optional KeyType key = 1;
2220    /// optional ValueType value = 2;
2221    /// }
2222    /// repeated MapFieldEntry map_field = 1;
2223    ///
2224    /// Implementations may choose not to generate the map_entry=true message, but
2225    /// use a native map in the target language to hold the keys and values.
2226    /// The reflection APIs in such implementations still need to work as
2227    /// if the field is a repeated message field.
2228    ///
2229    /// NOTE: Do not set the option in .proto files. Always use the maps syntax
2230    /// instead. The option should only be implicitly set by the proto compiler
2231    /// parser.
2232    pub map_entry: bool,
2233
2234    /// Enable the legacy handling of JSON field name conflicts.  This lowercases
2235    /// and strips underscored from the fields before comparison in proto3 only.
2236    /// The new behavior takes `json_name` into account and applies to proto2 as
2237    /// well.
2238    ///
2239    /// This should only be used as a temporary measure against broken builds due
2240    /// to the change in behavior for JSON field name conflicts.
2241    ///
2242    /// TODO This is legacy behavior we plan to remove once downstream
2243    /// teams have had time to migrate.
2244    pub deprecated_legacy_json_field_conflicts: bool,
2245
2246    /// Any features defined in the specific edition.
2247    #[serde(skip_serializing_if = "std::option::Option::is_none")]
2248    pub features: std::option::Option<crate::FeatureSet>,
2249
2250    /// The parser stores options it doesn't recognize here. See above.
2251    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2252    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
2253
2254    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2255    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2256}
2257
2258impl MessageOptions {
2259    pub fn new() -> Self {
2260        std::default::Default::default()
2261    }
2262
2263    /// Sets the value of [message_set_wire_format][crate::MessageOptions::message_set_wire_format].
2264    pub fn set_message_set_wire_format<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2265        self.message_set_wire_format = v.into();
2266        self
2267    }
2268
2269    /// Sets the value of [no_standard_descriptor_accessor][crate::MessageOptions::no_standard_descriptor_accessor].
2270    pub fn set_no_standard_descriptor_accessor<T: std::convert::Into<bool>>(
2271        mut self,
2272        v: T,
2273    ) -> Self {
2274        self.no_standard_descriptor_accessor = v.into();
2275        self
2276    }
2277
2278    /// Sets the value of [deprecated][crate::MessageOptions::deprecated].
2279    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2280        self.deprecated = v.into();
2281        self
2282    }
2283
2284    /// Sets the value of [map_entry][crate::MessageOptions::map_entry].
2285    pub fn set_map_entry<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2286        self.map_entry = v.into();
2287        self
2288    }
2289
2290    /// Sets the value of [deprecated_legacy_json_field_conflicts][crate::MessageOptions::deprecated_legacy_json_field_conflicts].
2291    pub fn set_deprecated_legacy_json_field_conflicts<T: std::convert::Into<bool>>(
2292        mut self,
2293        v: T,
2294    ) -> Self {
2295        self.deprecated_legacy_json_field_conflicts = v.into();
2296        self
2297    }
2298
2299    /// Sets the value of [features][crate::MessageOptions::features].
2300    pub fn set_features<T: std::convert::Into<std::option::Option<crate::FeatureSet>>>(
2301        mut self,
2302        v: T,
2303    ) -> Self {
2304        self.features = v.into();
2305        self
2306    }
2307
2308    /// Sets the value of [uninterpreted_option][crate::MessageOptions::uninterpreted_option].
2309    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
2310    where
2311        T: std::iter::IntoIterator<Item = V>,
2312        V: std::convert::Into<crate::UninterpretedOption>,
2313    {
2314        use std::iter::Iterator;
2315        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
2316        self
2317    }
2318}
2319
2320impl wkt::message::Message for MessageOptions {
2321    fn typename() -> &'static str {
2322        "type.googleapis.com/google.protobuf.MessageOptions"
2323    }
2324}
2325
2326#[serde_with::serde_as]
2327#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2328#[serde(default, rename_all = "camelCase")]
2329#[non_exhaustive]
2330pub struct FieldOptions {
2331    /// NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead.
2332    /// The ctype option instructs the C++ code generator to use a different
2333    /// representation of the field than it normally would.  See the specific
2334    /// options below.  This option is only implemented to support use of
2335    /// [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of
2336    /// type "bytes" in the open source release.
2337    /// TODO: make ctype actually deprecated.
2338    pub ctype: crate::field_options::CType,
2339
2340    /// The packed option can be enabled for repeated primitive fields to enable
2341    /// a more efficient representation on the wire. Rather than repeatedly
2342    /// writing the tag and type for each element, the entire array is encoded as
2343    /// a single length-delimited blob. In proto3, only explicit setting it to
2344    /// false will avoid using packed encoding.  This option is prohibited in
2345    /// Editions, but the `repeated_field_encoding` feature can be used to control
2346    /// the behavior.
2347    pub packed: bool,
2348
2349    /// The jstype option determines the JavaScript type used for values of the
2350    /// field.  The option is permitted only for 64 bit integral and fixed types
2351    /// (int64, uint64, sint64, fixed64, sfixed64).  A field with jstype JS_STRING
2352    /// is represented as JavaScript string, which avoids loss of precision that
2353    /// can happen when a large value is converted to a floating point JavaScript.
2354    /// Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
2355    /// use the JavaScript "number" type.  The behavior of the default option
2356    /// JS_NORMAL is implementation dependent.
2357    ///
2358    /// This option is an enum to permit additional types to be added, e.g.
2359    /// goog.math.Integer.
2360    pub jstype: crate::field_options::JSType,
2361
2362    /// Should this field be parsed lazily?  Lazy applies only to message-type
2363    /// fields.  It means that when the outer message is initially parsed, the
2364    /// inner message's contents will not be parsed but instead stored in encoded
2365    /// form.  The inner message will actually be parsed when it is first accessed.
2366    ///
2367    /// This is only a hint.  Implementations are free to choose whether to use
2368    /// eager or lazy parsing regardless of the value of this option.  However,
2369    /// setting this option true suggests that the protocol author believes that
2370    /// using lazy parsing on this field is worth the additional bookkeeping
2371    /// overhead typically needed to implement it.
2372    ///
2373    /// This option does not affect the public interface of any generated code;
2374    /// all method signatures remain the same.  Furthermore, thread-safety of the
2375    /// interface is not affected by this option; const methods remain safe to
2376    /// call from multiple threads concurrently, while non-const methods continue
2377    /// to require exclusive access.
2378    ///
2379    /// Note that lazy message fields are still eagerly verified to check
2380    /// ill-formed wireformat or missing required fields. Calling IsInitialized()
2381    /// on the outer message would fail if the inner message has missing required
2382    /// fields. Failed verification would result in parsing failure (except when
2383    /// uninitialized messages are acceptable).
2384    pub lazy: bool,
2385
2386    /// unverified_lazy does no correctness checks on the byte stream. This should
2387    /// only be used where lazy with verification is prohibitive for performance
2388    /// reasons.
2389    pub unverified_lazy: bool,
2390
2391    /// Is this field deprecated?
2392    /// Depending on the target platform, this can emit Deprecated annotations
2393    /// for accessors, or it will be completely ignored; in the very least, this
2394    /// is a formalization for deprecating fields.
2395    pub deprecated: bool,
2396
2397    /// For Google-internal migration only. Do not use.
2398    pub weak: bool,
2399
2400    /// Indicate that the field value should not be printed out when using debug
2401    /// formats, e.g. when the field contains sensitive credentials.
2402    pub debug_redact: bool,
2403
2404    pub retention: crate::field_options::OptionRetention,
2405
2406    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2407    pub targets: std::vec::Vec<crate::field_options::OptionTargetType>,
2408
2409    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2410    pub edition_defaults: std::vec::Vec<crate::field_options::EditionDefault>,
2411
2412    /// Any features defined in the specific edition.
2413    #[serde(skip_serializing_if = "std::option::Option::is_none")]
2414    pub features: std::option::Option<crate::FeatureSet>,
2415
2416    #[serde(skip_serializing_if = "std::option::Option::is_none")]
2417    pub feature_support: std::option::Option<crate::field_options::FeatureSupport>,
2418
2419    /// The parser stores options it doesn't recognize here. See above.
2420    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2421    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
2422
2423    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2424    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2425}
2426
2427impl FieldOptions {
2428    pub fn new() -> Self {
2429        std::default::Default::default()
2430    }
2431
2432    /// Sets the value of [ctype][crate::FieldOptions::ctype].
2433    pub fn set_ctype<T: std::convert::Into<crate::field_options::CType>>(mut self, v: T) -> Self {
2434        self.ctype = v.into();
2435        self
2436    }
2437
2438    /// Sets the value of [packed][crate::FieldOptions::packed].
2439    pub fn set_packed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2440        self.packed = v.into();
2441        self
2442    }
2443
2444    /// Sets the value of [jstype][crate::FieldOptions::jstype].
2445    pub fn set_jstype<T: std::convert::Into<crate::field_options::JSType>>(mut self, v: T) -> Self {
2446        self.jstype = v.into();
2447        self
2448    }
2449
2450    /// Sets the value of [lazy][crate::FieldOptions::lazy].
2451    pub fn set_lazy<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2452        self.lazy = v.into();
2453        self
2454    }
2455
2456    /// Sets the value of [unverified_lazy][crate::FieldOptions::unverified_lazy].
2457    pub fn set_unverified_lazy<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2458        self.unverified_lazy = v.into();
2459        self
2460    }
2461
2462    /// Sets the value of [deprecated][crate::FieldOptions::deprecated].
2463    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2464        self.deprecated = v.into();
2465        self
2466    }
2467
2468    /// Sets the value of [weak][crate::FieldOptions::weak].
2469    pub fn set_weak<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2470        self.weak = v.into();
2471        self
2472    }
2473
2474    /// Sets the value of [debug_redact][crate::FieldOptions::debug_redact].
2475    pub fn set_debug_redact<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2476        self.debug_redact = v.into();
2477        self
2478    }
2479
2480    /// Sets the value of [retention][crate::FieldOptions::retention].
2481    pub fn set_retention<T: std::convert::Into<crate::field_options::OptionRetention>>(
2482        mut self,
2483        v: T,
2484    ) -> Self {
2485        self.retention = v.into();
2486        self
2487    }
2488
2489    /// Sets the value of [features][crate::FieldOptions::features].
2490    pub fn set_features<T: std::convert::Into<std::option::Option<crate::FeatureSet>>>(
2491        mut self,
2492        v: T,
2493    ) -> Self {
2494        self.features = v.into();
2495        self
2496    }
2497
2498    /// Sets the value of [feature_support][crate::FieldOptions::feature_support].
2499    pub fn set_feature_support<
2500        T: std::convert::Into<std::option::Option<crate::field_options::FeatureSupport>>,
2501    >(
2502        mut self,
2503        v: T,
2504    ) -> Self {
2505        self.feature_support = v.into();
2506        self
2507    }
2508
2509    /// Sets the value of [targets][crate::FieldOptions::targets].
2510    pub fn set_targets<T, V>(mut self, v: T) -> Self
2511    where
2512        T: std::iter::IntoIterator<Item = V>,
2513        V: std::convert::Into<crate::field_options::OptionTargetType>,
2514    {
2515        use std::iter::Iterator;
2516        self.targets = v.into_iter().map(|i| i.into()).collect();
2517        self
2518    }
2519
2520    /// Sets the value of [edition_defaults][crate::FieldOptions::edition_defaults].
2521    pub fn set_edition_defaults<T, V>(mut self, v: T) -> Self
2522    where
2523        T: std::iter::IntoIterator<Item = V>,
2524        V: std::convert::Into<crate::field_options::EditionDefault>,
2525    {
2526        use std::iter::Iterator;
2527        self.edition_defaults = v.into_iter().map(|i| i.into()).collect();
2528        self
2529    }
2530
2531    /// Sets the value of [uninterpreted_option][crate::FieldOptions::uninterpreted_option].
2532    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
2533    where
2534        T: std::iter::IntoIterator<Item = V>,
2535        V: std::convert::Into<crate::UninterpretedOption>,
2536    {
2537        use std::iter::Iterator;
2538        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
2539        self
2540    }
2541}
2542
2543impl wkt::message::Message for FieldOptions {
2544    fn typename() -> &'static str {
2545        "type.googleapis.com/google.protobuf.FieldOptions"
2546    }
2547}
2548
2549/// Defines additional types related to [FieldOptions].
2550pub mod field_options {
2551    #[allow(unused_imports)]
2552    use super::*;
2553
2554    #[serde_with::serde_as]
2555    #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2556    #[serde(default, rename_all = "camelCase")]
2557    #[non_exhaustive]
2558    pub struct EditionDefault {
2559        pub edition: crate::Edition,
2560
2561        #[serde(skip_serializing_if = "std::string::String::is_empty")]
2562        pub value: std::string::String,
2563
2564        #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2565        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2566    }
2567
2568    impl EditionDefault {
2569        pub fn new() -> Self {
2570            std::default::Default::default()
2571        }
2572
2573        /// Sets the value of [edition][crate::field_options::EditionDefault::edition].
2574        pub fn set_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
2575            self.edition = v.into();
2576            self
2577        }
2578
2579        /// Sets the value of [value][crate::field_options::EditionDefault::value].
2580        pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2581            self.value = v.into();
2582            self
2583        }
2584    }
2585
2586    impl wkt::message::Message for EditionDefault {
2587        fn typename() -> &'static str {
2588            "type.googleapis.com/google.protobuf.FieldOptions.EditionDefault"
2589        }
2590    }
2591
2592    /// Information about the support window of a feature.
2593    #[serde_with::serde_as]
2594    #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2595    #[serde(default, rename_all = "camelCase")]
2596    #[non_exhaustive]
2597    pub struct FeatureSupport {
2598        /// The edition that this feature was first available in.  In editions
2599        /// earlier than this one, the default assigned to EDITION_LEGACY will be
2600        /// used, and proto files will not be able to override it.
2601        pub edition_introduced: crate::Edition,
2602
2603        /// The edition this feature becomes deprecated in.  Using this after this
2604        /// edition may trigger warnings.
2605        pub edition_deprecated: crate::Edition,
2606
2607        /// The deprecation warning text if this feature is used after the edition it
2608        /// was marked deprecated in.
2609        #[serde(skip_serializing_if = "std::string::String::is_empty")]
2610        pub deprecation_warning: std::string::String,
2611
2612        /// The edition this feature is no longer available in.  In editions after
2613        /// this one, the last default assigned will be used, and proto files will
2614        /// not be able to override it.
2615        pub edition_removed: crate::Edition,
2616
2617        #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2618        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2619    }
2620
2621    impl FeatureSupport {
2622        pub fn new() -> Self {
2623            std::default::Default::default()
2624        }
2625
2626        /// Sets the value of [edition_introduced][crate::field_options::FeatureSupport::edition_introduced].
2627        pub fn set_edition_introduced<T: std::convert::Into<crate::Edition>>(
2628            mut self,
2629            v: T,
2630        ) -> Self {
2631            self.edition_introduced = v.into();
2632            self
2633        }
2634
2635        /// Sets the value of [edition_deprecated][crate::field_options::FeatureSupport::edition_deprecated].
2636        pub fn set_edition_deprecated<T: std::convert::Into<crate::Edition>>(
2637            mut self,
2638            v: T,
2639        ) -> Self {
2640            self.edition_deprecated = v.into();
2641            self
2642        }
2643
2644        /// Sets the value of [deprecation_warning][crate::field_options::FeatureSupport::deprecation_warning].
2645        pub fn set_deprecation_warning<T: std::convert::Into<std::string::String>>(
2646            mut self,
2647            v: T,
2648        ) -> Self {
2649            self.deprecation_warning = v.into();
2650            self
2651        }
2652
2653        /// Sets the value of [edition_removed][crate::field_options::FeatureSupport::edition_removed].
2654        pub fn set_edition_removed<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
2655            self.edition_removed = v.into();
2656            self
2657        }
2658    }
2659
2660    impl wkt::message::Message for FeatureSupport {
2661        fn typename() -> &'static str {
2662            "type.googleapis.com/google.protobuf.FieldOptions.FeatureSupport"
2663        }
2664    }
2665
2666    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
2667    pub struct CType(i32);
2668
2669    impl CType {
2670        /// Default mode.
2671        pub const STRING: CType = CType::new(0);
2672
2673        /// The option [ctype=CORD] may be applied to a non-repeated field of type
2674        /// "bytes". It indicates that in C++, the data should be stored in a Cord
2675        /// instead of a string.  For very large strings, this may reduce memory
2676        /// fragmentation. It may also allow better performance when parsing from a
2677        /// Cord, or when parsing with aliasing enabled, as the parsed Cord may then
2678        /// alias the original buffer.
2679        pub const CORD: CType = CType::new(1);
2680
2681        pub const STRING_PIECE: CType = CType::new(2);
2682
2683        /// Creates a new CType instance.
2684        pub(crate) const fn new(value: i32) -> Self {
2685            Self(value)
2686        }
2687
2688        /// Gets the enum value.
2689        pub fn value(&self) -> i32 {
2690            self.0
2691        }
2692
2693        /// Gets the enum value as a string.
2694        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
2695            match self.0 {
2696                0 => std::borrow::Cow::Borrowed("STRING"),
2697                1 => std::borrow::Cow::Borrowed("CORD"),
2698                2 => std::borrow::Cow::Borrowed("STRING_PIECE"),
2699                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
2700            }
2701        }
2702
2703        /// Creates an enum value from the value name.
2704        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
2705            match name {
2706                "STRING" => std::option::Option::Some(Self::STRING),
2707                "CORD" => std::option::Option::Some(Self::CORD),
2708                "STRING_PIECE" => std::option::Option::Some(Self::STRING_PIECE),
2709                _ => std::option::Option::None,
2710            }
2711        }
2712    }
2713
2714    impl std::convert::From<i32> for CType {
2715        fn from(value: i32) -> Self {
2716            Self::new(value)
2717        }
2718    }
2719
2720    impl std::default::Default for CType {
2721        fn default() -> Self {
2722            Self::new(0)
2723        }
2724    }
2725
2726    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
2727    pub struct JSType(i32);
2728
2729    impl JSType {
2730        /// Use the default type.
2731        pub const JS_NORMAL: JSType = JSType::new(0);
2732
2733        /// Use JavaScript strings.
2734        pub const JS_STRING: JSType = JSType::new(1);
2735
2736        /// Use JavaScript numbers.
2737        pub const JS_NUMBER: JSType = JSType::new(2);
2738
2739        /// Creates a new JSType instance.
2740        pub(crate) const fn new(value: i32) -> Self {
2741            Self(value)
2742        }
2743
2744        /// Gets the enum value.
2745        pub fn value(&self) -> i32 {
2746            self.0
2747        }
2748
2749        /// Gets the enum value as a string.
2750        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
2751            match self.0 {
2752                0 => std::borrow::Cow::Borrowed("JS_NORMAL"),
2753                1 => std::borrow::Cow::Borrowed("JS_STRING"),
2754                2 => std::borrow::Cow::Borrowed("JS_NUMBER"),
2755                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
2756            }
2757        }
2758
2759        /// Creates an enum value from the value name.
2760        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
2761            match name {
2762                "JS_NORMAL" => std::option::Option::Some(Self::JS_NORMAL),
2763                "JS_STRING" => std::option::Option::Some(Self::JS_STRING),
2764                "JS_NUMBER" => std::option::Option::Some(Self::JS_NUMBER),
2765                _ => std::option::Option::None,
2766            }
2767        }
2768    }
2769
2770    impl std::convert::From<i32> for JSType {
2771        fn from(value: i32) -> Self {
2772            Self::new(value)
2773        }
2774    }
2775
2776    impl std::default::Default for JSType {
2777        fn default() -> Self {
2778            Self::new(0)
2779        }
2780    }
2781
2782    /// If set to RETENTION_SOURCE, the option will be omitted from the binary.
2783    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
2784    pub struct OptionRetention(i32);
2785
2786    impl OptionRetention {
2787        pub const RETENTION_UNKNOWN: OptionRetention = OptionRetention::new(0);
2788
2789        pub const RETENTION_RUNTIME: OptionRetention = OptionRetention::new(1);
2790
2791        pub const RETENTION_SOURCE: OptionRetention = OptionRetention::new(2);
2792
2793        /// Creates a new OptionRetention instance.
2794        pub(crate) const fn new(value: i32) -> Self {
2795            Self(value)
2796        }
2797
2798        /// Gets the enum value.
2799        pub fn value(&self) -> i32 {
2800            self.0
2801        }
2802
2803        /// Gets the enum value as a string.
2804        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
2805            match self.0 {
2806                0 => std::borrow::Cow::Borrowed("RETENTION_UNKNOWN"),
2807                1 => std::borrow::Cow::Borrowed("RETENTION_RUNTIME"),
2808                2 => std::borrow::Cow::Borrowed("RETENTION_SOURCE"),
2809                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
2810            }
2811        }
2812
2813        /// Creates an enum value from the value name.
2814        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
2815            match name {
2816                "RETENTION_UNKNOWN" => std::option::Option::Some(Self::RETENTION_UNKNOWN),
2817                "RETENTION_RUNTIME" => std::option::Option::Some(Self::RETENTION_RUNTIME),
2818                "RETENTION_SOURCE" => std::option::Option::Some(Self::RETENTION_SOURCE),
2819                _ => std::option::Option::None,
2820            }
2821        }
2822    }
2823
2824    impl std::convert::From<i32> for OptionRetention {
2825        fn from(value: i32) -> Self {
2826            Self::new(value)
2827        }
2828    }
2829
2830    impl std::default::Default for OptionRetention {
2831        fn default() -> Self {
2832            Self::new(0)
2833        }
2834    }
2835
2836    /// This indicates the types of entities that the field may apply to when used
2837    /// as an option. If it is unset, then the field may be freely used as an
2838    /// option on any kind of entity.
2839    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
2840    pub struct OptionTargetType(i32);
2841
2842    impl OptionTargetType {
2843        pub const TARGET_TYPE_UNKNOWN: OptionTargetType = OptionTargetType::new(0);
2844
2845        pub const TARGET_TYPE_FILE: OptionTargetType = OptionTargetType::new(1);
2846
2847        pub const TARGET_TYPE_EXTENSION_RANGE: OptionTargetType = OptionTargetType::new(2);
2848
2849        pub const TARGET_TYPE_MESSAGE: OptionTargetType = OptionTargetType::new(3);
2850
2851        pub const TARGET_TYPE_FIELD: OptionTargetType = OptionTargetType::new(4);
2852
2853        pub const TARGET_TYPE_ONEOF: OptionTargetType = OptionTargetType::new(5);
2854
2855        pub const TARGET_TYPE_ENUM: OptionTargetType = OptionTargetType::new(6);
2856
2857        pub const TARGET_TYPE_ENUM_ENTRY: OptionTargetType = OptionTargetType::new(7);
2858
2859        pub const TARGET_TYPE_SERVICE: OptionTargetType = OptionTargetType::new(8);
2860
2861        pub const TARGET_TYPE_METHOD: OptionTargetType = OptionTargetType::new(9);
2862
2863        /// Creates a new OptionTargetType instance.
2864        pub(crate) const fn new(value: i32) -> Self {
2865            Self(value)
2866        }
2867
2868        /// Gets the enum value.
2869        pub fn value(&self) -> i32 {
2870            self.0
2871        }
2872
2873        /// Gets the enum value as a string.
2874        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
2875            match self.0 {
2876                0 => std::borrow::Cow::Borrowed("TARGET_TYPE_UNKNOWN"),
2877                1 => std::borrow::Cow::Borrowed("TARGET_TYPE_FILE"),
2878                2 => std::borrow::Cow::Borrowed("TARGET_TYPE_EXTENSION_RANGE"),
2879                3 => std::borrow::Cow::Borrowed("TARGET_TYPE_MESSAGE"),
2880                4 => std::borrow::Cow::Borrowed("TARGET_TYPE_FIELD"),
2881                5 => std::borrow::Cow::Borrowed("TARGET_TYPE_ONEOF"),
2882                6 => std::borrow::Cow::Borrowed("TARGET_TYPE_ENUM"),
2883                7 => std::borrow::Cow::Borrowed("TARGET_TYPE_ENUM_ENTRY"),
2884                8 => std::borrow::Cow::Borrowed("TARGET_TYPE_SERVICE"),
2885                9 => std::borrow::Cow::Borrowed("TARGET_TYPE_METHOD"),
2886                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
2887            }
2888        }
2889
2890        /// Creates an enum value from the value name.
2891        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
2892            match name {
2893                "TARGET_TYPE_UNKNOWN" => std::option::Option::Some(Self::TARGET_TYPE_UNKNOWN),
2894                "TARGET_TYPE_FILE" => std::option::Option::Some(Self::TARGET_TYPE_FILE),
2895                "TARGET_TYPE_EXTENSION_RANGE" => {
2896                    std::option::Option::Some(Self::TARGET_TYPE_EXTENSION_RANGE)
2897                }
2898                "TARGET_TYPE_MESSAGE" => std::option::Option::Some(Self::TARGET_TYPE_MESSAGE),
2899                "TARGET_TYPE_FIELD" => std::option::Option::Some(Self::TARGET_TYPE_FIELD),
2900                "TARGET_TYPE_ONEOF" => std::option::Option::Some(Self::TARGET_TYPE_ONEOF),
2901                "TARGET_TYPE_ENUM" => std::option::Option::Some(Self::TARGET_TYPE_ENUM),
2902                "TARGET_TYPE_ENUM_ENTRY" => std::option::Option::Some(Self::TARGET_TYPE_ENUM_ENTRY),
2903                "TARGET_TYPE_SERVICE" => std::option::Option::Some(Self::TARGET_TYPE_SERVICE),
2904                "TARGET_TYPE_METHOD" => std::option::Option::Some(Self::TARGET_TYPE_METHOD),
2905                _ => std::option::Option::None,
2906            }
2907        }
2908    }
2909
2910    impl std::convert::From<i32> for OptionTargetType {
2911        fn from(value: i32) -> Self {
2912            Self::new(value)
2913        }
2914    }
2915
2916    impl std::default::Default for OptionTargetType {
2917        fn default() -> Self {
2918            Self::new(0)
2919        }
2920    }
2921}
2922
2923#[serde_with::serde_as]
2924#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2925#[serde(default, rename_all = "camelCase")]
2926#[non_exhaustive]
2927pub struct OneofOptions {
2928    /// Any features defined in the specific edition.
2929    #[serde(skip_serializing_if = "std::option::Option::is_none")]
2930    pub features: std::option::Option<crate::FeatureSet>,
2931
2932    /// The parser stores options it doesn't recognize here. See above.
2933    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
2934    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
2935
2936    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2937    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2938}
2939
2940impl OneofOptions {
2941    pub fn new() -> Self {
2942        std::default::Default::default()
2943    }
2944
2945    /// Sets the value of [features][crate::OneofOptions::features].
2946    pub fn set_features<T: std::convert::Into<std::option::Option<crate::FeatureSet>>>(
2947        mut self,
2948        v: T,
2949    ) -> Self {
2950        self.features = v.into();
2951        self
2952    }
2953
2954    /// Sets the value of [uninterpreted_option][crate::OneofOptions::uninterpreted_option].
2955    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
2956    where
2957        T: std::iter::IntoIterator<Item = V>,
2958        V: std::convert::Into<crate::UninterpretedOption>,
2959    {
2960        use std::iter::Iterator;
2961        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
2962        self
2963    }
2964}
2965
2966impl wkt::message::Message for OneofOptions {
2967    fn typename() -> &'static str {
2968        "type.googleapis.com/google.protobuf.OneofOptions"
2969    }
2970}
2971
2972#[serde_with::serde_as]
2973#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
2974#[serde(default, rename_all = "camelCase")]
2975#[non_exhaustive]
2976pub struct EnumOptions {
2977    /// Set this option to true to allow mapping different tag names to the same
2978    /// value.
2979    pub allow_alias: bool,
2980
2981    /// Is this enum deprecated?
2982    /// Depending on the target platform, this can emit Deprecated annotations
2983    /// for the enum, or it will be completely ignored; in the very least, this
2984    /// is a formalization for deprecating enums.
2985    pub deprecated: bool,
2986
2987    /// Enable the legacy handling of JSON field name conflicts.  This lowercases
2988    /// and strips underscored from the fields before comparison in proto3 only.
2989    /// The new behavior takes `json_name` into account and applies to proto2 as
2990    /// well.
2991    /// TODO Remove this legacy behavior once downstream teams have
2992    /// had time to migrate.
2993    pub deprecated_legacy_json_field_conflicts: bool,
2994
2995    /// Any features defined in the specific edition.
2996    #[serde(skip_serializing_if = "std::option::Option::is_none")]
2997    pub features: std::option::Option<crate::FeatureSet>,
2998
2999    /// The parser stores options it doesn't recognize here. See above.
3000    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3001    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
3002
3003    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3004    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3005}
3006
3007impl EnumOptions {
3008    pub fn new() -> Self {
3009        std::default::Default::default()
3010    }
3011
3012    /// Sets the value of [allow_alias][crate::EnumOptions::allow_alias].
3013    pub fn set_allow_alias<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3014        self.allow_alias = v.into();
3015        self
3016    }
3017
3018    /// Sets the value of [deprecated][crate::EnumOptions::deprecated].
3019    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3020        self.deprecated = v.into();
3021        self
3022    }
3023
3024    /// Sets the value of [deprecated_legacy_json_field_conflicts][crate::EnumOptions::deprecated_legacy_json_field_conflicts].
3025    pub fn set_deprecated_legacy_json_field_conflicts<T: std::convert::Into<bool>>(
3026        mut self,
3027        v: T,
3028    ) -> Self {
3029        self.deprecated_legacy_json_field_conflicts = v.into();
3030        self
3031    }
3032
3033    /// Sets the value of [features][crate::EnumOptions::features].
3034    pub fn set_features<T: std::convert::Into<std::option::Option<crate::FeatureSet>>>(
3035        mut self,
3036        v: T,
3037    ) -> Self {
3038        self.features = v.into();
3039        self
3040    }
3041
3042    /// Sets the value of [uninterpreted_option][crate::EnumOptions::uninterpreted_option].
3043    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
3044    where
3045        T: std::iter::IntoIterator<Item = V>,
3046        V: std::convert::Into<crate::UninterpretedOption>,
3047    {
3048        use std::iter::Iterator;
3049        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
3050        self
3051    }
3052}
3053
3054impl wkt::message::Message for EnumOptions {
3055    fn typename() -> &'static str {
3056        "type.googleapis.com/google.protobuf.EnumOptions"
3057    }
3058}
3059
3060#[serde_with::serde_as]
3061#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3062#[serde(default, rename_all = "camelCase")]
3063#[non_exhaustive]
3064pub struct EnumValueOptions {
3065    /// Is this enum value deprecated?
3066    /// Depending on the target platform, this can emit Deprecated annotations
3067    /// for the enum value, or it will be completely ignored; in the very least,
3068    /// this is a formalization for deprecating enum values.
3069    pub deprecated: bool,
3070
3071    /// Any features defined in the specific edition.
3072    #[serde(skip_serializing_if = "std::option::Option::is_none")]
3073    pub features: std::option::Option<crate::FeatureSet>,
3074
3075    /// Indicate that fields annotated with this enum value should not be printed
3076    /// out when using debug formats, e.g. when the field contains sensitive
3077    /// credentials.
3078    pub debug_redact: bool,
3079
3080    /// Information about the support window of a feature value.
3081    #[serde(skip_serializing_if = "std::option::Option::is_none")]
3082    pub feature_support: std::option::Option<crate::field_options::FeatureSupport>,
3083
3084    /// The parser stores options it doesn't recognize here. See above.
3085    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3086    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
3087
3088    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3089    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3090}
3091
3092impl EnumValueOptions {
3093    pub fn new() -> Self {
3094        std::default::Default::default()
3095    }
3096
3097    /// Sets the value of [deprecated][crate::EnumValueOptions::deprecated].
3098    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3099        self.deprecated = v.into();
3100        self
3101    }
3102
3103    /// Sets the value of [features][crate::EnumValueOptions::features].
3104    pub fn set_features<T: std::convert::Into<std::option::Option<crate::FeatureSet>>>(
3105        mut self,
3106        v: T,
3107    ) -> Self {
3108        self.features = v.into();
3109        self
3110    }
3111
3112    /// Sets the value of [debug_redact][crate::EnumValueOptions::debug_redact].
3113    pub fn set_debug_redact<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3114        self.debug_redact = v.into();
3115        self
3116    }
3117
3118    /// Sets the value of [feature_support][crate::EnumValueOptions::feature_support].
3119    pub fn set_feature_support<
3120        T: std::convert::Into<std::option::Option<crate::field_options::FeatureSupport>>,
3121    >(
3122        mut self,
3123        v: T,
3124    ) -> Self {
3125        self.feature_support = v.into();
3126        self
3127    }
3128
3129    /// Sets the value of [uninterpreted_option][crate::EnumValueOptions::uninterpreted_option].
3130    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
3131    where
3132        T: std::iter::IntoIterator<Item = V>,
3133        V: std::convert::Into<crate::UninterpretedOption>,
3134    {
3135        use std::iter::Iterator;
3136        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
3137        self
3138    }
3139}
3140
3141impl wkt::message::Message for EnumValueOptions {
3142    fn typename() -> &'static str {
3143        "type.googleapis.com/google.protobuf.EnumValueOptions"
3144    }
3145}
3146
3147#[serde_with::serde_as]
3148#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3149#[serde(default, rename_all = "camelCase")]
3150#[non_exhaustive]
3151pub struct ServiceOptions {
3152    /// Any features defined in the specific edition.
3153    #[serde(skip_serializing_if = "std::option::Option::is_none")]
3154    pub features: std::option::Option<crate::FeatureSet>,
3155
3156    /// Is this service deprecated?
3157    /// Depending on the target platform, this can emit Deprecated annotations
3158    /// for the service, or it will be completely ignored; in the very least,
3159    /// this is a formalization for deprecating services.
3160    pub deprecated: bool,
3161
3162    /// The parser stores options it doesn't recognize here. See above.
3163    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3164    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
3165
3166    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3167    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3168}
3169
3170impl ServiceOptions {
3171    pub fn new() -> Self {
3172        std::default::Default::default()
3173    }
3174
3175    /// Sets the value of [features][crate::ServiceOptions::features].
3176    pub fn set_features<T: std::convert::Into<std::option::Option<crate::FeatureSet>>>(
3177        mut self,
3178        v: T,
3179    ) -> Self {
3180        self.features = v.into();
3181        self
3182    }
3183
3184    /// Sets the value of [deprecated][crate::ServiceOptions::deprecated].
3185    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3186        self.deprecated = v.into();
3187        self
3188    }
3189
3190    /// Sets the value of [uninterpreted_option][crate::ServiceOptions::uninterpreted_option].
3191    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
3192    where
3193        T: std::iter::IntoIterator<Item = V>,
3194        V: std::convert::Into<crate::UninterpretedOption>,
3195    {
3196        use std::iter::Iterator;
3197        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
3198        self
3199    }
3200}
3201
3202impl wkt::message::Message for ServiceOptions {
3203    fn typename() -> &'static str {
3204        "type.googleapis.com/google.protobuf.ServiceOptions"
3205    }
3206}
3207
3208#[serde_with::serde_as]
3209#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3210#[serde(default, rename_all = "camelCase")]
3211#[non_exhaustive]
3212pub struct MethodOptions {
3213    /// Is this method deprecated?
3214    /// Depending on the target platform, this can emit Deprecated annotations
3215    /// for the method, or it will be completely ignored; in the very least,
3216    /// this is a formalization for deprecating methods.
3217    pub deprecated: bool,
3218
3219    pub idempotency_level: crate::method_options::IdempotencyLevel,
3220
3221    /// Any features defined in the specific edition.
3222    #[serde(skip_serializing_if = "std::option::Option::is_none")]
3223    pub features: std::option::Option<crate::FeatureSet>,
3224
3225    /// The parser stores options it doesn't recognize here. See above.
3226    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3227    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
3228
3229    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3230    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3231}
3232
3233impl MethodOptions {
3234    pub fn new() -> Self {
3235        std::default::Default::default()
3236    }
3237
3238    /// Sets the value of [deprecated][crate::MethodOptions::deprecated].
3239    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3240        self.deprecated = v.into();
3241        self
3242    }
3243
3244    /// Sets the value of [idempotency_level][crate::MethodOptions::idempotency_level].
3245    pub fn set_idempotency_level<T: std::convert::Into<crate::method_options::IdempotencyLevel>>(
3246        mut self,
3247        v: T,
3248    ) -> Self {
3249        self.idempotency_level = v.into();
3250        self
3251    }
3252
3253    /// Sets the value of [features][crate::MethodOptions::features].
3254    pub fn set_features<T: std::convert::Into<std::option::Option<crate::FeatureSet>>>(
3255        mut self,
3256        v: T,
3257    ) -> Self {
3258        self.features = v.into();
3259        self
3260    }
3261
3262    /// Sets the value of [uninterpreted_option][crate::MethodOptions::uninterpreted_option].
3263    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
3264    where
3265        T: std::iter::IntoIterator<Item = V>,
3266        V: std::convert::Into<crate::UninterpretedOption>,
3267    {
3268        use std::iter::Iterator;
3269        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
3270        self
3271    }
3272}
3273
3274impl wkt::message::Message for MethodOptions {
3275    fn typename() -> &'static str {
3276        "type.googleapis.com/google.protobuf.MethodOptions"
3277    }
3278}
3279
3280/// Defines additional types related to [MethodOptions].
3281pub mod method_options {
3282    #[allow(unused_imports)]
3283    use super::*;
3284
3285    /// Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
3286    /// or neither? HTTP based RPC implementation may choose GET verb for safe
3287    /// methods, and PUT verb for idempotent methods instead of the default POST.
3288    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
3289    pub struct IdempotencyLevel(i32);
3290
3291    impl IdempotencyLevel {
3292        pub const IDEMPOTENCY_UNKNOWN: IdempotencyLevel = IdempotencyLevel::new(0);
3293
3294        pub const NO_SIDE_EFFECTS: IdempotencyLevel = IdempotencyLevel::new(1);
3295
3296        pub const IDEMPOTENT: IdempotencyLevel = IdempotencyLevel::new(2);
3297
3298        /// Creates a new IdempotencyLevel instance.
3299        pub(crate) const fn new(value: i32) -> Self {
3300            Self(value)
3301        }
3302
3303        /// Gets the enum value.
3304        pub fn value(&self) -> i32 {
3305            self.0
3306        }
3307
3308        /// Gets the enum value as a string.
3309        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
3310            match self.0 {
3311                0 => std::borrow::Cow::Borrowed("IDEMPOTENCY_UNKNOWN"),
3312                1 => std::borrow::Cow::Borrowed("NO_SIDE_EFFECTS"),
3313                2 => std::borrow::Cow::Borrowed("IDEMPOTENT"),
3314                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
3315            }
3316        }
3317
3318        /// Creates an enum value from the value name.
3319        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
3320            match name {
3321                "IDEMPOTENCY_UNKNOWN" => std::option::Option::Some(Self::IDEMPOTENCY_UNKNOWN),
3322                "NO_SIDE_EFFECTS" => std::option::Option::Some(Self::NO_SIDE_EFFECTS),
3323                "IDEMPOTENT" => std::option::Option::Some(Self::IDEMPOTENT),
3324                _ => std::option::Option::None,
3325            }
3326        }
3327    }
3328
3329    impl std::convert::From<i32> for IdempotencyLevel {
3330        fn from(value: i32) -> Self {
3331            Self::new(value)
3332        }
3333    }
3334
3335    impl std::default::Default for IdempotencyLevel {
3336        fn default() -> Self {
3337            Self::new(0)
3338        }
3339    }
3340}
3341
3342/// A message representing a option the parser does not recognize. This only
3343/// appears in options protos created by the compiler::Parser class.
3344/// DescriptorPool resolves these when building Descriptor objects. Therefore,
3345/// options protos in descriptor objects (e.g. returned by Descriptor::options(),
3346/// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
3347/// in them.
3348#[serde_with::serde_as]
3349#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3350#[serde(default, rename_all = "camelCase")]
3351#[non_exhaustive]
3352pub struct UninterpretedOption {
3353    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3354    pub name: std::vec::Vec<crate::uninterpreted_option::NamePart>,
3355
3356    /// The value of the uninterpreted option, in whatever type the tokenizer
3357    /// identified it as during parsing. Exactly one of these should be set.
3358    #[serde(skip_serializing_if = "std::string::String::is_empty")]
3359    pub identifier_value: std::string::String,
3360
3361    #[serde_as(as = "serde_with::DisplayFromStr")]
3362    pub positive_int_value: u64,
3363
3364    #[serde_as(as = "serde_with::DisplayFromStr")]
3365    pub negative_int_value: i64,
3366
3367    pub double_value: f64,
3368
3369    #[serde(skip_serializing_if = "::bytes::Bytes::is_empty")]
3370    #[serde_as(as = "serde_with::base64::Base64")]
3371    pub string_value: ::bytes::Bytes,
3372
3373    #[serde(skip_serializing_if = "std::string::String::is_empty")]
3374    pub aggregate_value: std::string::String,
3375
3376    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3377    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3378}
3379
3380impl UninterpretedOption {
3381    pub fn new() -> Self {
3382        std::default::Default::default()
3383    }
3384
3385    /// Sets the value of [identifier_value][crate::UninterpretedOption::identifier_value].
3386    pub fn set_identifier_value<T: std::convert::Into<std::string::String>>(
3387        mut self,
3388        v: T,
3389    ) -> Self {
3390        self.identifier_value = v.into();
3391        self
3392    }
3393
3394    /// Sets the value of [positive_int_value][crate::UninterpretedOption::positive_int_value].
3395    pub fn set_positive_int_value<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
3396        self.positive_int_value = v.into();
3397        self
3398    }
3399
3400    /// Sets the value of [negative_int_value][crate::UninterpretedOption::negative_int_value].
3401    pub fn set_negative_int_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3402        self.negative_int_value = v.into();
3403        self
3404    }
3405
3406    /// Sets the value of [double_value][crate::UninterpretedOption::double_value].
3407    pub fn set_double_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3408        self.double_value = v.into();
3409        self
3410    }
3411
3412    /// Sets the value of [string_value][crate::UninterpretedOption::string_value].
3413    pub fn set_string_value<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
3414        self.string_value = v.into();
3415        self
3416    }
3417
3418    /// Sets the value of [aggregate_value][crate::UninterpretedOption::aggregate_value].
3419    pub fn set_aggregate_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3420        self.aggregate_value = v.into();
3421        self
3422    }
3423
3424    /// Sets the value of [name][crate::UninterpretedOption::name].
3425    pub fn set_name<T, V>(mut self, v: T) -> Self
3426    where
3427        T: std::iter::IntoIterator<Item = V>,
3428        V: std::convert::Into<crate::uninterpreted_option::NamePart>,
3429    {
3430        use std::iter::Iterator;
3431        self.name = v.into_iter().map(|i| i.into()).collect();
3432        self
3433    }
3434}
3435
3436impl wkt::message::Message for UninterpretedOption {
3437    fn typename() -> &'static str {
3438        "type.googleapis.com/google.protobuf.UninterpretedOption"
3439    }
3440}
3441
3442/// Defines additional types related to [UninterpretedOption].
3443pub mod uninterpreted_option {
3444    #[allow(unused_imports)]
3445    use super::*;
3446
3447    /// The name of the uninterpreted option.  Each string represents a segment in
3448    /// a dot-separated name.  is_extension is true iff a segment represents an
3449    /// extension (denoted with parentheses in options specs in .proto files).
3450    /// E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents
3451    /// "foo.(bar.baz).moo".
3452    #[serde_with::serde_as]
3453    #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3454    #[serde(default, rename_all = "camelCase")]
3455    #[non_exhaustive]
3456    pub struct NamePart {
3457        #[serde(skip_serializing_if = "std::string::String::is_empty")]
3458        pub name_part: std::string::String,
3459
3460        pub is_extension: bool,
3461
3462        #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3463        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3464    }
3465
3466    impl NamePart {
3467        pub fn new() -> Self {
3468            std::default::Default::default()
3469        }
3470
3471        /// Sets the value of [name_part][crate::uninterpreted_option::NamePart::name_part].
3472        pub fn set_name_part<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3473            self.name_part = v.into();
3474            self
3475        }
3476
3477        /// Sets the value of [is_extension][crate::uninterpreted_option::NamePart::is_extension].
3478        pub fn set_is_extension<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3479            self.is_extension = v.into();
3480            self
3481        }
3482    }
3483
3484    impl wkt::message::Message for NamePart {
3485        fn typename() -> &'static str {
3486            "type.googleapis.com/google.protobuf.UninterpretedOption.NamePart"
3487        }
3488    }
3489}
3490
3491/// TODO Enums in C++ gencode (and potentially other languages) are
3492/// not well scoped.  This means that each of the feature enums below can clash
3493/// with each other.  The short names we've chosen maximize call-site
3494/// readability, but leave us very open to this scenario.  A future feature will
3495/// be designed and implemented to handle this, hopefully before we ever hit a
3496/// conflict here.
3497#[serde_with::serde_as]
3498#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3499#[serde(default, rename_all = "camelCase")]
3500#[non_exhaustive]
3501pub struct FeatureSet {
3502    pub field_presence: crate::feature_set::FieldPresence,
3503
3504    pub enum_type: crate::feature_set::EnumType,
3505
3506    pub repeated_field_encoding: crate::feature_set::RepeatedFieldEncoding,
3507
3508    pub utf8_validation: crate::feature_set::Utf8Validation,
3509
3510    pub message_encoding: crate::feature_set::MessageEncoding,
3511
3512    pub json_format: crate::feature_set::JsonFormat,
3513
3514    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3515    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3516}
3517
3518impl FeatureSet {
3519    pub fn new() -> Self {
3520        std::default::Default::default()
3521    }
3522
3523    /// Sets the value of [field_presence][crate::FeatureSet::field_presence].
3524    pub fn set_field_presence<T: std::convert::Into<crate::feature_set::FieldPresence>>(
3525        mut self,
3526        v: T,
3527    ) -> Self {
3528        self.field_presence = v.into();
3529        self
3530    }
3531
3532    /// Sets the value of [enum_type][crate::FeatureSet::enum_type].
3533    pub fn set_enum_type<T: std::convert::Into<crate::feature_set::EnumType>>(
3534        mut self,
3535        v: T,
3536    ) -> Self {
3537        self.enum_type = v.into();
3538        self
3539    }
3540
3541    /// Sets the value of [repeated_field_encoding][crate::FeatureSet::repeated_field_encoding].
3542    pub fn set_repeated_field_encoding<
3543        T: std::convert::Into<crate::feature_set::RepeatedFieldEncoding>,
3544    >(
3545        mut self,
3546        v: T,
3547    ) -> Self {
3548        self.repeated_field_encoding = v.into();
3549        self
3550    }
3551
3552    /// Sets the value of [utf8_validation][crate::FeatureSet::utf8_validation].
3553    pub fn set_utf8_validation<T: std::convert::Into<crate::feature_set::Utf8Validation>>(
3554        mut self,
3555        v: T,
3556    ) -> Self {
3557        self.utf8_validation = v.into();
3558        self
3559    }
3560
3561    /// Sets the value of [message_encoding][crate::FeatureSet::message_encoding].
3562    pub fn set_message_encoding<T: std::convert::Into<crate::feature_set::MessageEncoding>>(
3563        mut self,
3564        v: T,
3565    ) -> Self {
3566        self.message_encoding = v.into();
3567        self
3568    }
3569
3570    /// Sets the value of [json_format][crate::FeatureSet::json_format].
3571    pub fn set_json_format<T: std::convert::Into<crate::feature_set::JsonFormat>>(
3572        mut self,
3573        v: T,
3574    ) -> Self {
3575        self.json_format = v.into();
3576        self
3577    }
3578}
3579
3580impl wkt::message::Message for FeatureSet {
3581    fn typename() -> &'static str {
3582        "type.googleapis.com/google.protobuf.FeatureSet"
3583    }
3584}
3585
3586/// Defines additional types related to [FeatureSet].
3587pub mod feature_set {
3588    #[allow(unused_imports)]
3589    use super::*;
3590
3591    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
3592    pub struct FieldPresence(i32);
3593
3594    impl FieldPresence {
3595        pub const FIELD_PRESENCE_UNKNOWN: FieldPresence = FieldPresence::new(0);
3596
3597        pub const EXPLICIT: FieldPresence = FieldPresence::new(1);
3598
3599        pub const IMPLICIT: FieldPresence = FieldPresence::new(2);
3600
3601        pub const LEGACY_REQUIRED: FieldPresence = FieldPresence::new(3);
3602
3603        /// Creates a new FieldPresence instance.
3604        pub(crate) const fn new(value: i32) -> Self {
3605            Self(value)
3606        }
3607
3608        /// Gets the enum value.
3609        pub fn value(&self) -> i32 {
3610            self.0
3611        }
3612
3613        /// Gets the enum value as a string.
3614        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
3615            match self.0 {
3616                0 => std::borrow::Cow::Borrowed("FIELD_PRESENCE_UNKNOWN"),
3617                1 => std::borrow::Cow::Borrowed("EXPLICIT"),
3618                2 => std::borrow::Cow::Borrowed("IMPLICIT"),
3619                3 => std::borrow::Cow::Borrowed("LEGACY_REQUIRED"),
3620                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
3621            }
3622        }
3623
3624        /// Creates an enum value from the value name.
3625        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
3626            match name {
3627                "FIELD_PRESENCE_UNKNOWN" => std::option::Option::Some(Self::FIELD_PRESENCE_UNKNOWN),
3628                "EXPLICIT" => std::option::Option::Some(Self::EXPLICIT),
3629                "IMPLICIT" => std::option::Option::Some(Self::IMPLICIT),
3630                "LEGACY_REQUIRED" => std::option::Option::Some(Self::LEGACY_REQUIRED),
3631                _ => std::option::Option::None,
3632            }
3633        }
3634    }
3635
3636    impl std::convert::From<i32> for FieldPresence {
3637        fn from(value: i32) -> Self {
3638            Self::new(value)
3639        }
3640    }
3641
3642    impl std::default::Default for FieldPresence {
3643        fn default() -> Self {
3644            Self::new(0)
3645        }
3646    }
3647
3648    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
3649    pub struct EnumType(i32);
3650
3651    impl EnumType {
3652        pub const ENUM_TYPE_UNKNOWN: EnumType = EnumType::new(0);
3653
3654        pub const OPEN: EnumType = EnumType::new(1);
3655
3656        pub const CLOSED: EnumType = EnumType::new(2);
3657
3658        /// Creates a new EnumType instance.
3659        pub(crate) const fn new(value: i32) -> Self {
3660            Self(value)
3661        }
3662
3663        /// Gets the enum value.
3664        pub fn value(&self) -> i32 {
3665            self.0
3666        }
3667
3668        /// Gets the enum value as a string.
3669        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
3670            match self.0 {
3671                0 => std::borrow::Cow::Borrowed("ENUM_TYPE_UNKNOWN"),
3672                1 => std::borrow::Cow::Borrowed("OPEN"),
3673                2 => std::borrow::Cow::Borrowed("CLOSED"),
3674                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
3675            }
3676        }
3677
3678        /// Creates an enum value from the value name.
3679        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
3680            match name {
3681                "ENUM_TYPE_UNKNOWN" => std::option::Option::Some(Self::ENUM_TYPE_UNKNOWN),
3682                "OPEN" => std::option::Option::Some(Self::OPEN),
3683                "CLOSED" => std::option::Option::Some(Self::CLOSED),
3684                _ => std::option::Option::None,
3685            }
3686        }
3687    }
3688
3689    impl std::convert::From<i32> for EnumType {
3690        fn from(value: i32) -> Self {
3691            Self::new(value)
3692        }
3693    }
3694
3695    impl std::default::Default for EnumType {
3696        fn default() -> Self {
3697            Self::new(0)
3698        }
3699    }
3700
3701    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
3702    pub struct RepeatedFieldEncoding(i32);
3703
3704    impl RepeatedFieldEncoding {
3705        pub const REPEATED_FIELD_ENCODING_UNKNOWN: RepeatedFieldEncoding =
3706            RepeatedFieldEncoding::new(0);
3707
3708        pub const PACKED: RepeatedFieldEncoding = RepeatedFieldEncoding::new(1);
3709
3710        pub const EXPANDED: RepeatedFieldEncoding = RepeatedFieldEncoding::new(2);
3711
3712        /// Creates a new RepeatedFieldEncoding instance.
3713        pub(crate) const fn new(value: i32) -> Self {
3714            Self(value)
3715        }
3716
3717        /// Gets the enum value.
3718        pub fn value(&self) -> i32 {
3719            self.0
3720        }
3721
3722        /// Gets the enum value as a string.
3723        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
3724            match self.0 {
3725                0 => std::borrow::Cow::Borrowed("REPEATED_FIELD_ENCODING_UNKNOWN"),
3726                1 => std::borrow::Cow::Borrowed("PACKED"),
3727                2 => std::borrow::Cow::Borrowed("EXPANDED"),
3728                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
3729            }
3730        }
3731
3732        /// Creates an enum value from the value name.
3733        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
3734            match name {
3735                "REPEATED_FIELD_ENCODING_UNKNOWN" => {
3736                    std::option::Option::Some(Self::REPEATED_FIELD_ENCODING_UNKNOWN)
3737                }
3738                "PACKED" => std::option::Option::Some(Self::PACKED),
3739                "EXPANDED" => std::option::Option::Some(Self::EXPANDED),
3740                _ => std::option::Option::None,
3741            }
3742        }
3743    }
3744
3745    impl std::convert::From<i32> for RepeatedFieldEncoding {
3746        fn from(value: i32) -> Self {
3747            Self::new(value)
3748        }
3749    }
3750
3751    impl std::default::Default for RepeatedFieldEncoding {
3752        fn default() -> Self {
3753            Self::new(0)
3754        }
3755    }
3756
3757    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
3758    pub struct Utf8Validation(i32);
3759
3760    impl Utf8Validation {
3761        pub const UTF8_VALIDATION_UNKNOWN: Utf8Validation = Utf8Validation::new(0);
3762
3763        pub const VERIFY: Utf8Validation = Utf8Validation::new(2);
3764
3765        pub const NONE: Utf8Validation = Utf8Validation::new(3);
3766
3767        /// Creates a new Utf8Validation instance.
3768        pub(crate) const fn new(value: i32) -> Self {
3769            Self(value)
3770        }
3771
3772        /// Gets the enum value.
3773        pub fn value(&self) -> i32 {
3774            self.0
3775        }
3776
3777        /// Gets the enum value as a string.
3778        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
3779            match self.0 {
3780                0 => std::borrow::Cow::Borrowed("UTF8_VALIDATION_UNKNOWN"),
3781                2 => std::borrow::Cow::Borrowed("VERIFY"),
3782                3 => std::borrow::Cow::Borrowed("NONE"),
3783                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
3784            }
3785        }
3786
3787        /// Creates an enum value from the value name.
3788        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
3789            match name {
3790                "UTF8_VALIDATION_UNKNOWN" => {
3791                    std::option::Option::Some(Self::UTF8_VALIDATION_UNKNOWN)
3792                }
3793                "VERIFY" => std::option::Option::Some(Self::VERIFY),
3794                "NONE" => std::option::Option::Some(Self::NONE),
3795                _ => std::option::Option::None,
3796            }
3797        }
3798    }
3799
3800    impl std::convert::From<i32> for Utf8Validation {
3801        fn from(value: i32) -> Self {
3802            Self::new(value)
3803        }
3804    }
3805
3806    impl std::default::Default for Utf8Validation {
3807        fn default() -> Self {
3808            Self::new(0)
3809        }
3810    }
3811
3812    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
3813    pub struct MessageEncoding(i32);
3814
3815    impl MessageEncoding {
3816        pub const MESSAGE_ENCODING_UNKNOWN: MessageEncoding = MessageEncoding::new(0);
3817
3818        pub const LENGTH_PREFIXED: MessageEncoding = MessageEncoding::new(1);
3819
3820        pub const DELIMITED: MessageEncoding = MessageEncoding::new(2);
3821
3822        /// Creates a new MessageEncoding instance.
3823        pub(crate) const fn new(value: i32) -> Self {
3824            Self(value)
3825        }
3826
3827        /// Gets the enum value.
3828        pub fn value(&self) -> i32 {
3829            self.0
3830        }
3831
3832        /// Gets the enum value as a string.
3833        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
3834            match self.0 {
3835                0 => std::borrow::Cow::Borrowed("MESSAGE_ENCODING_UNKNOWN"),
3836                1 => std::borrow::Cow::Borrowed("LENGTH_PREFIXED"),
3837                2 => std::borrow::Cow::Borrowed("DELIMITED"),
3838                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
3839            }
3840        }
3841
3842        /// Creates an enum value from the value name.
3843        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
3844            match name {
3845                "MESSAGE_ENCODING_UNKNOWN" => {
3846                    std::option::Option::Some(Self::MESSAGE_ENCODING_UNKNOWN)
3847                }
3848                "LENGTH_PREFIXED" => std::option::Option::Some(Self::LENGTH_PREFIXED),
3849                "DELIMITED" => std::option::Option::Some(Self::DELIMITED),
3850                _ => std::option::Option::None,
3851            }
3852        }
3853    }
3854
3855    impl std::convert::From<i32> for MessageEncoding {
3856        fn from(value: i32) -> Self {
3857            Self::new(value)
3858        }
3859    }
3860
3861    impl std::default::Default for MessageEncoding {
3862        fn default() -> Self {
3863            Self::new(0)
3864        }
3865    }
3866
3867    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
3868    pub struct JsonFormat(i32);
3869
3870    impl JsonFormat {
3871        pub const JSON_FORMAT_UNKNOWN: JsonFormat = JsonFormat::new(0);
3872
3873        pub const ALLOW: JsonFormat = JsonFormat::new(1);
3874
3875        pub const LEGACY_BEST_EFFORT: JsonFormat = JsonFormat::new(2);
3876
3877        /// Creates a new JsonFormat instance.
3878        pub(crate) const fn new(value: i32) -> Self {
3879            Self(value)
3880        }
3881
3882        /// Gets the enum value.
3883        pub fn value(&self) -> i32 {
3884            self.0
3885        }
3886
3887        /// Gets the enum value as a string.
3888        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
3889            match self.0 {
3890                0 => std::borrow::Cow::Borrowed("JSON_FORMAT_UNKNOWN"),
3891                1 => std::borrow::Cow::Borrowed("ALLOW"),
3892                2 => std::borrow::Cow::Borrowed("LEGACY_BEST_EFFORT"),
3893                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
3894            }
3895        }
3896
3897        /// Creates an enum value from the value name.
3898        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
3899            match name {
3900                "JSON_FORMAT_UNKNOWN" => std::option::Option::Some(Self::JSON_FORMAT_UNKNOWN),
3901                "ALLOW" => std::option::Option::Some(Self::ALLOW),
3902                "LEGACY_BEST_EFFORT" => std::option::Option::Some(Self::LEGACY_BEST_EFFORT),
3903                _ => std::option::Option::None,
3904            }
3905        }
3906    }
3907
3908    impl std::convert::From<i32> for JsonFormat {
3909        fn from(value: i32) -> Self {
3910            Self::new(value)
3911        }
3912    }
3913
3914    impl std::default::Default for JsonFormat {
3915        fn default() -> Self {
3916            Self::new(0)
3917        }
3918    }
3919}
3920
3921/// A compiled specification for the defaults of a set of features.  These
3922/// messages are generated from FeatureSet extensions and can be used to seed
3923/// feature resolution. The resolution with this object becomes a simple search
3924/// for the closest matching edition, followed by proto merges.
3925#[serde_with::serde_as]
3926#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3927#[serde(default, rename_all = "camelCase")]
3928#[non_exhaustive]
3929pub struct FeatureSetDefaults {
3930    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
3931    pub defaults: std::vec::Vec<crate::feature_set_defaults::FeatureSetEditionDefault>,
3932
3933    /// The minimum supported edition (inclusive) when this was constructed.
3934    /// Editions before this will not have defaults.
3935    pub minimum_edition: crate::Edition,
3936
3937    /// The maximum known edition (inclusive) when this was constructed. Editions
3938    /// after this will not have reliable defaults.
3939    pub maximum_edition: crate::Edition,
3940
3941    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
3942    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3943}
3944
3945impl FeatureSetDefaults {
3946    pub fn new() -> Self {
3947        std::default::Default::default()
3948    }
3949
3950    /// Sets the value of [minimum_edition][crate::FeatureSetDefaults::minimum_edition].
3951    pub fn set_minimum_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
3952        self.minimum_edition = v.into();
3953        self
3954    }
3955
3956    /// Sets the value of [maximum_edition][crate::FeatureSetDefaults::maximum_edition].
3957    pub fn set_maximum_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
3958        self.maximum_edition = v.into();
3959        self
3960    }
3961
3962    /// Sets the value of [defaults][crate::FeatureSetDefaults::defaults].
3963    pub fn set_defaults<T, V>(mut self, v: T) -> Self
3964    where
3965        T: std::iter::IntoIterator<Item = V>,
3966        V: std::convert::Into<crate::feature_set_defaults::FeatureSetEditionDefault>,
3967    {
3968        use std::iter::Iterator;
3969        self.defaults = v.into_iter().map(|i| i.into()).collect();
3970        self
3971    }
3972}
3973
3974impl wkt::message::Message for FeatureSetDefaults {
3975    fn typename() -> &'static str {
3976        "type.googleapis.com/google.protobuf.FeatureSetDefaults"
3977    }
3978}
3979
3980/// Defines additional types related to [FeatureSetDefaults].
3981pub mod feature_set_defaults {
3982    #[allow(unused_imports)]
3983    use super::*;
3984
3985    /// A map from every known edition with a unique set of defaults to its
3986    /// defaults. Not all editions may be contained here.  For a given edition,
3987    /// the defaults at the closest matching edition ordered at or before it should
3988    /// be used.  This field must be in strict ascending order by edition.
3989    #[serde_with::serde_as]
3990    #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
3991    #[serde(default, rename_all = "camelCase")]
3992    #[non_exhaustive]
3993    pub struct FeatureSetEditionDefault {
3994        pub edition: crate::Edition,
3995
3996        /// Defaults of features that can be overridden in this edition.
3997        #[serde(skip_serializing_if = "std::option::Option::is_none")]
3998        pub overridable_features: std::option::Option<crate::FeatureSet>,
3999
4000        /// Defaults of features that can't be overridden in this edition.
4001        #[serde(skip_serializing_if = "std::option::Option::is_none")]
4002        pub fixed_features: std::option::Option<crate::FeatureSet>,
4003
4004        #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4005        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4006    }
4007
4008    impl FeatureSetEditionDefault {
4009        pub fn new() -> Self {
4010            std::default::Default::default()
4011        }
4012
4013        /// Sets the value of [edition][crate::feature_set_defaults::FeatureSetEditionDefault::edition].
4014        pub fn set_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
4015            self.edition = v.into();
4016            self
4017        }
4018
4019        /// Sets the value of [overridable_features][crate::feature_set_defaults::FeatureSetEditionDefault::overridable_features].
4020        pub fn set_overridable_features<
4021            T: std::convert::Into<std::option::Option<crate::FeatureSet>>,
4022        >(
4023            mut self,
4024            v: T,
4025        ) -> Self {
4026            self.overridable_features = v.into();
4027            self
4028        }
4029
4030        /// Sets the value of [fixed_features][crate::feature_set_defaults::FeatureSetEditionDefault::fixed_features].
4031        pub fn set_fixed_features<T: std::convert::Into<std::option::Option<crate::FeatureSet>>>(
4032            mut self,
4033            v: T,
4034        ) -> Self {
4035            self.fixed_features = v.into();
4036            self
4037        }
4038    }
4039
4040    impl wkt::message::Message for FeatureSetEditionDefault {
4041        fn typename() -> &'static str {
4042            "type.googleapis.com/google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"
4043        }
4044    }
4045}
4046
4047/// Encapsulates information about the original source file from which a
4048/// FileDescriptorProto was generated.
4049#[serde_with::serde_as]
4050#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4051#[serde(default, rename_all = "camelCase")]
4052#[non_exhaustive]
4053pub struct SourceCodeInfo {
4054    /// A Location identifies a piece of source code in a .proto file which
4055    /// corresponds to a particular definition.  This information is intended
4056    /// to be useful to IDEs, code indexers, documentation generators, and similar
4057    /// tools.
4058    ///
4059    /// For example, say we have a file like:
4060    /// message Foo {
4061    /// optional string foo = 1;
4062    /// }
4063    /// Let's look at just the field definition:
4064    /// optional string foo = 1;
4065    /// ^       ^^     ^^  ^  ^^^
4066    /// a       bc     de  f  ghi
4067    /// We have the following locations:
4068    /// span   path               represents
4069    /// [a,i)  [ 4, 0, 2, 0 ]     The whole field definition.
4070    /// [a,b)  [ 4, 0, 2, 0, 4 ]  The label (optional).
4071    /// [c,d)  [ 4, 0, 2, 0, 5 ]  The type (string).
4072    /// [e,f)  [ 4, 0, 2, 0, 1 ]  The name (foo).
4073    /// [g,h)  [ 4, 0, 2, 0, 3 ]  The number (1).
4074    ///
4075    /// Notes:
4076    ///
4077    /// - A location may refer to a repeated field itself (i.e. not to any
4078    ///   particular index within it).  This is used whenever a set of elements are
4079    ///   logically enclosed in a single code segment.  For example, an entire
4080    ///   extend block (possibly containing multiple extension definitions) will
4081    ///   have an outer location whose path refers to the "extensions" repeated
4082    ///   field without an index.
4083    /// - Multiple locations may have the same path.  This happens when a single
4084    ///   logical declaration is spread out across multiple places.  The most
4085    ///   obvious example is the "extend" block again -- there may be multiple
4086    ///   extend blocks in the same scope, each of which will have the same path.
4087    /// - A location's span is not always a subset of its parent's span.  For
4088    ///   example, the "extendee" of an extension declaration appears at the
4089    ///   beginning of the "extend" block and is shared by all extensions within
4090    ///   the block.
4091    /// - Just because a location's span is a subset of some other location's span
4092    ///   does not mean that it is a descendant.  For example, a "group" defines
4093    ///   both a type and a field in a single declaration.  Thus, the locations
4094    ///   corresponding to the type and field and their components will overlap.
4095    /// - Code which tries to interpret locations should probably be designed to
4096    ///   ignore those that it doesn't understand, as more types of locations could
4097    ///   be recorded in the future.
4098    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4099    pub location: std::vec::Vec<crate::source_code_info::Location>,
4100
4101    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4102    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4103}
4104
4105impl SourceCodeInfo {
4106    pub fn new() -> Self {
4107        std::default::Default::default()
4108    }
4109
4110    /// Sets the value of [location][crate::SourceCodeInfo::location].
4111    pub fn set_location<T, V>(mut self, v: T) -> Self
4112    where
4113        T: std::iter::IntoIterator<Item = V>,
4114        V: std::convert::Into<crate::source_code_info::Location>,
4115    {
4116        use std::iter::Iterator;
4117        self.location = v.into_iter().map(|i| i.into()).collect();
4118        self
4119    }
4120}
4121
4122impl wkt::message::Message for SourceCodeInfo {
4123    fn typename() -> &'static str {
4124        "type.googleapis.com/google.protobuf.SourceCodeInfo"
4125    }
4126}
4127
4128/// Defines additional types related to [SourceCodeInfo].
4129pub mod source_code_info {
4130    #[allow(unused_imports)]
4131    use super::*;
4132
4133    #[serde_with::serde_as]
4134    #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4135    #[serde(default, rename_all = "camelCase")]
4136    #[non_exhaustive]
4137    pub struct Location {
4138        /// Identifies which part of the FileDescriptorProto was defined at this
4139        /// location.
4140        ///
4141        /// Each element is a field number or an index.  They form a path from
4142        /// the root FileDescriptorProto to the place where the definition appears.
4143        /// For example, this path:
4144        /// [ 4, 3, 2, 7, 1 ]
4145        /// refers to:
4146        /// file.message_type(3)  // 4, 3
4147        /// .field(7)         // 2, 7
4148        /// .name()           // 1
4149        /// This is because FileDescriptorProto.message_type has field number 4:
4150        /// repeated DescriptorProto message_type = 4;
4151        /// and DescriptorProto.field has field number 2:
4152        /// repeated FieldDescriptorProto field = 2;
4153        /// and FieldDescriptorProto.name has field number 1:
4154        /// optional string name = 1;
4155        ///
4156        /// Thus, the above path gives the location of a field name.  If we removed
4157        /// the last element:
4158        /// [ 4, 3, 2, 7 ]
4159        /// this path refers to the whole field declaration (from the beginning
4160        /// of the label to the terminating semicolon).
4161        #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4162        pub path: std::vec::Vec<i32>,
4163
4164        /// Always has exactly three or four elements: start line, start column,
4165        /// end line (optional, otherwise assumed same as start line), end column.
4166        /// These are packed into a single field for efficiency.  Note that line
4167        /// and column numbers are zero-based -- typically you will want to add
4168        /// 1 to each before displaying to a user.
4169        #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4170        pub span: std::vec::Vec<i32>,
4171
4172        /// If this SourceCodeInfo represents a complete declaration, these are any
4173        /// comments appearing before and after the declaration which appear to be
4174        /// attached to the declaration.
4175        ///
4176        /// A series of line comments appearing on consecutive lines, with no other
4177        /// tokens appearing on those lines, will be treated as a single comment.
4178        ///
4179        /// leading_detached_comments will keep paragraphs of comments that appear
4180        /// before (but not connected to) the current element. Each paragraph,
4181        /// separated by empty lines, will be one comment element in the repeated
4182        /// field.
4183        ///
4184        /// Only the comment content is provided; comment markers (e.g. //) are
4185        /// stripped out.  For block comments, leading whitespace and an asterisk
4186        /// will be stripped from the beginning of each line other than the first.
4187        /// Newlines are included in the output.
4188        ///
4189        /// Examples:
4190        ///
4191        /// optional int32 foo = 1;  // Comment attached to foo.
4192        /// // Comment attached to bar.
4193        /// optional int32 bar = 2;
4194        ///
4195        /// optional string baz = 3;
4196        /// // Comment attached to baz.
4197        /// // Another line attached to baz.
4198        ///
4199        /// // Comment attached to moo.
4200        /// //
4201        /// // Another line attached to moo.
4202        /// optional double moo = 4;
4203        ///
4204        /// // Detached comment for corge. This is not leading or trailing comments
4205        /// // to moo or corge because there are blank lines separating it from
4206        /// // both.
4207        ///
4208        /// // Detached comment for corge paragraph 2.
4209        ///
4210        /// optional string corge = 5;
4211        /// /* Block comment attached
4212        ///
4213        /// * to corge.  Leading asterisks
4214        /// * will be removed. */
4215        ///   /* Block comment attached to
4216        /// * grault. */
4217        ///   optional int32 grault = 6;
4218        ///
4219        /// // ignored detached comments.
4220        #[serde(skip_serializing_if = "std::string::String::is_empty")]
4221        pub leading_comments: std::string::String,
4222
4223        #[serde(skip_serializing_if = "std::string::String::is_empty")]
4224        pub trailing_comments: std::string::String,
4225
4226        #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4227        pub leading_detached_comments: std::vec::Vec<std::string::String>,
4228
4229        #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4230        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4231    }
4232
4233    impl Location {
4234        pub fn new() -> Self {
4235            std::default::Default::default()
4236        }
4237
4238        /// Sets the value of [leading_comments][crate::source_code_info::Location::leading_comments].
4239        pub fn set_leading_comments<T: std::convert::Into<std::string::String>>(
4240            mut self,
4241            v: T,
4242        ) -> Self {
4243            self.leading_comments = v.into();
4244            self
4245        }
4246
4247        /// Sets the value of [trailing_comments][crate::source_code_info::Location::trailing_comments].
4248        pub fn set_trailing_comments<T: std::convert::Into<std::string::String>>(
4249            mut self,
4250            v: T,
4251        ) -> Self {
4252            self.trailing_comments = v.into();
4253            self
4254        }
4255
4256        /// Sets the value of [path][crate::source_code_info::Location::path].
4257        pub fn set_path<T, V>(mut self, v: T) -> Self
4258        where
4259            T: std::iter::IntoIterator<Item = V>,
4260            V: std::convert::Into<i32>,
4261        {
4262            use std::iter::Iterator;
4263            self.path = v.into_iter().map(|i| i.into()).collect();
4264            self
4265        }
4266
4267        /// Sets the value of [span][crate::source_code_info::Location::span].
4268        pub fn set_span<T, V>(mut self, v: T) -> Self
4269        where
4270            T: std::iter::IntoIterator<Item = V>,
4271            V: std::convert::Into<i32>,
4272        {
4273            use std::iter::Iterator;
4274            self.span = v.into_iter().map(|i| i.into()).collect();
4275            self
4276        }
4277
4278        /// Sets the value of [leading_detached_comments][crate::source_code_info::Location::leading_detached_comments].
4279        pub fn set_leading_detached_comments<T, V>(mut self, v: T) -> Self
4280        where
4281            T: std::iter::IntoIterator<Item = V>,
4282            V: std::convert::Into<std::string::String>,
4283        {
4284            use std::iter::Iterator;
4285            self.leading_detached_comments = v.into_iter().map(|i| i.into()).collect();
4286            self
4287        }
4288    }
4289
4290    impl wkt::message::Message for Location {
4291        fn typename() -> &'static str {
4292            "type.googleapis.com/google.protobuf.SourceCodeInfo.Location"
4293        }
4294    }
4295}
4296
4297/// Describes the relationship between generated code and its original source
4298/// file. A GeneratedCodeInfo message is associated with only one generated
4299/// source file, but may contain references to different source .proto files.
4300#[serde_with::serde_as]
4301#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4302#[serde(default, rename_all = "camelCase")]
4303#[non_exhaustive]
4304pub struct GeneratedCodeInfo {
4305    /// An Annotation connects some span of text in generated code to an element
4306    /// of its generating .proto file.
4307    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4308    pub annotation: std::vec::Vec<crate::generated_code_info::Annotation>,
4309
4310    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4311    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4312}
4313
4314impl GeneratedCodeInfo {
4315    pub fn new() -> Self {
4316        std::default::Default::default()
4317    }
4318
4319    /// Sets the value of [annotation][crate::GeneratedCodeInfo::annotation].
4320    pub fn set_annotation<T, V>(mut self, v: T) -> Self
4321    where
4322        T: std::iter::IntoIterator<Item = V>,
4323        V: std::convert::Into<crate::generated_code_info::Annotation>,
4324    {
4325        use std::iter::Iterator;
4326        self.annotation = v.into_iter().map(|i| i.into()).collect();
4327        self
4328    }
4329}
4330
4331impl wkt::message::Message for GeneratedCodeInfo {
4332    fn typename() -> &'static str {
4333        "type.googleapis.com/google.protobuf.GeneratedCodeInfo"
4334    }
4335}
4336
4337/// Defines additional types related to [GeneratedCodeInfo].
4338pub mod generated_code_info {
4339    #[allow(unused_imports)]
4340    use super::*;
4341
4342    #[serde_with::serde_as]
4343    #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4344    #[serde(default, rename_all = "camelCase")]
4345    #[non_exhaustive]
4346    pub struct Annotation {
4347        /// Identifies the element in the original source .proto file. This field
4348        /// is formatted the same as SourceCodeInfo.Location.path.
4349        #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4350        pub path: std::vec::Vec<i32>,
4351
4352        /// Identifies the filesystem path to the original source .proto.
4353        #[serde(skip_serializing_if = "std::string::String::is_empty")]
4354        pub source_file: std::string::String,
4355
4356        /// Identifies the starting offset in bytes in the generated code
4357        /// that relates to the identified object.
4358        pub begin: i32,
4359
4360        /// Identifies the ending offset in bytes in the generated code that
4361        /// relates to the identified object. The end offset should be one past
4362        /// the last relevant byte (so the length of the text = end - begin).
4363        pub end: i32,
4364
4365        pub semantic: crate::generated_code_info::annotation::Semantic,
4366
4367        #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4368        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4369    }
4370
4371    impl Annotation {
4372        pub fn new() -> Self {
4373            std::default::Default::default()
4374        }
4375
4376        /// Sets the value of [source_file][crate::generated_code_info::Annotation::source_file].
4377        pub fn set_source_file<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4378            self.source_file = v.into();
4379            self
4380        }
4381
4382        /// Sets the value of [begin][crate::generated_code_info::Annotation::begin].
4383        pub fn set_begin<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4384            self.begin = v.into();
4385            self
4386        }
4387
4388        /// Sets the value of [end][crate::generated_code_info::Annotation::end].
4389        pub fn set_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4390            self.end = v.into();
4391            self
4392        }
4393
4394        /// Sets the value of [semantic][crate::generated_code_info::Annotation::semantic].
4395        pub fn set_semantic<
4396            T: std::convert::Into<crate::generated_code_info::annotation::Semantic>,
4397        >(
4398            mut self,
4399            v: T,
4400        ) -> Self {
4401            self.semantic = v.into();
4402            self
4403        }
4404
4405        /// Sets the value of [path][crate::generated_code_info::Annotation::path].
4406        pub fn set_path<T, V>(mut self, v: T) -> Self
4407        where
4408            T: std::iter::IntoIterator<Item = V>,
4409            V: std::convert::Into<i32>,
4410        {
4411            use std::iter::Iterator;
4412            self.path = v.into_iter().map(|i| i.into()).collect();
4413            self
4414        }
4415    }
4416
4417    impl wkt::message::Message for Annotation {
4418        fn typename() -> &'static str {
4419            "type.googleapis.com/google.protobuf.GeneratedCodeInfo.Annotation"
4420        }
4421    }
4422
4423    /// Defines additional types related to [Annotation].
4424    pub mod annotation {
4425        #[allow(unused_imports)]
4426        use super::*;
4427
4428        /// Represents the identified object's effect on the element in the original
4429        /// .proto file.
4430        #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
4431        pub struct Semantic(i32);
4432
4433        impl Semantic {
4434            /// There is no effect or the effect is indescribable.
4435            pub const NONE: Semantic = Semantic::new(0);
4436
4437            /// The element is set or otherwise mutated.
4438            pub const SET: Semantic = Semantic::new(1);
4439
4440            /// An alias to the element is returned.
4441            pub const ALIAS: Semantic = Semantic::new(2);
4442
4443            /// Creates a new Semantic instance.
4444            pub(crate) const fn new(value: i32) -> Self {
4445                Self(value)
4446            }
4447
4448            /// Gets the enum value.
4449            pub fn value(&self) -> i32 {
4450                self.0
4451            }
4452
4453            /// Gets the enum value as a string.
4454            pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
4455                match self.0 {
4456                    0 => std::borrow::Cow::Borrowed("NONE"),
4457                    1 => std::borrow::Cow::Borrowed("SET"),
4458                    2 => std::borrow::Cow::Borrowed("ALIAS"),
4459                    _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
4460                }
4461            }
4462
4463            /// Creates an enum value from the value name.
4464            pub fn from_str_name(name: &str) -> std::option::Option<Self> {
4465                match name {
4466                    "NONE" => std::option::Option::Some(Self::NONE),
4467                    "SET" => std::option::Option::Some(Self::SET),
4468                    "ALIAS" => std::option::Option::Some(Self::ALIAS),
4469                    _ => std::option::Option::None,
4470                }
4471            }
4472        }
4473
4474        impl std::convert::From<i32> for Semantic {
4475            fn from(value: i32) -> Self {
4476                Self::new(value)
4477            }
4478        }
4479
4480        impl std::default::Default for Semantic {
4481            fn default() -> Self {
4482                Self::new(0)
4483            }
4484        }
4485    }
4486}
4487
4488/// `SourceContext` represents information about the source of a
4489/// protobuf element, like the file in which it is defined.
4490#[serde_with::serde_as]
4491#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4492#[serde(default, rename_all = "camelCase")]
4493#[non_exhaustive]
4494pub struct SourceContext {
4495    /// The path-qualified name of the .proto file that contained the associated
4496    /// protobuf element.  For example: `"google/protobuf/source_context.proto"`.
4497    #[serde(skip_serializing_if = "std::string::String::is_empty")]
4498    pub file_name: std::string::String,
4499
4500    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4501    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4502}
4503
4504impl SourceContext {
4505    pub fn new() -> Self {
4506        std::default::Default::default()
4507    }
4508
4509    /// Sets the value of [file_name][crate::SourceContext::file_name].
4510    pub fn set_file_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4511        self.file_name = v.into();
4512        self
4513    }
4514}
4515
4516impl wkt::message::Message for SourceContext {
4517    fn typename() -> &'static str {
4518        "type.googleapis.com/google.protobuf.SourceContext"
4519    }
4520}
4521
4522/// A protocol buffer message type.
4523#[serde_with::serde_as]
4524#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4525#[serde(default, rename_all = "camelCase")]
4526#[non_exhaustive]
4527pub struct Type {
4528    /// The fully qualified message name.
4529    #[serde(skip_serializing_if = "std::string::String::is_empty")]
4530    pub name: std::string::String,
4531
4532    /// The list of fields.
4533    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4534    pub fields: std::vec::Vec<crate::Field>,
4535
4536    /// The list of types appearing in `oneof` definitions in this type.
4537    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4538    pub oneofs: std::vec::Vec<std::string::String>,
4539
4540    /// The protocol buffer options.
4541    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4542    pub options: std::vec::Vec<crate::Option>,
4543
4544    /// The source context.
4545    #[serde(skip_serializing_if = "std::option::Option::is_none")]
4546    pub source_context: std::option::Option<crate::SourceContext>,
4547
4548    /// The source syntax.
4549    pub syntax: crate::Syntax,
4550
4551    /// The source edition string, only valid when syntax is SYNTAX_EDITIONS.
4552    #[serde(skip_serializing_if = "std::string::String::is_empty")]
4553    pub edition: std::string::String,
4554
4555    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4556    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4557}
4558
4559impl Type {
4560    pub fn new() -> Self {
4561        std::default::Default::default()
4562    }
4563
4564    /// Sets the value of [name][crate::Type::name].
4565    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4566        self.name = v.into();
4567        self
4568    }
4569
4570    /// Sets the value of [source_context][crate::Type::source_context].
4571    pub fn set_source_context<T: std::convert::Into<std::option::Option<crate::SourceContext>>>(
4572        mut self,
4573        v: T,
4574    ) -> Self {
4575        self.source_context = v.into();
4576        self
4577    }
4578
4579    /// Sets the value of [syntax][crate::Type::syntax].
4580    pub fn set_syntax<T: std::convert::Into<crate::Syntax>>(mut self, v: T) -> Self {
4581        self.syntax = v.into();
4582        self
4583    }
4584
4585    /// Sets the value of [edition][crate::Type::edition].
4586    pub fn set_edition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4587        self.edition = v.into();
4588        self
4589    }
4590
4591    /// Sets the value of [fields][crate::Type::fields].
4592    pub fn set_fields<T, V>(mut self, v: T) -> Self
4593    where
4594        T: std::iter::IntoIterator<Item = V>,
4595        V: std::convert::Into<crate::Field>,
4596    {
4597        use std::iter::Iterator;
4598        self.fields = v.into_iter().map(|i| i.into()).collect();
4599        self
4600    }
4601
4602    /// Sets the value of [oneofs][crate::Type::oneofs].
4603    pub fn set_oneofs<T, V>(mut self, v: T) -> Self
4604    where
4605        T: std::iter::IntoIterator<Item = V>,
4606        V: std::convert::Into<std::string::String>,
4607    {
4608        use std::iter::Iterator;
4609        self.oneofs = v.into_iter().map(|i| i.into()).collect();
4610        self
4611    }
4612
4613    /// Sets the value of [options][crate::Type::options].
4614    pub fn set_options<T, V>(mut self, v: T) -> Self
4615    where
4616        T: std::iter::IntoIterator<Item = V>,
4617        V: std::convert::Into<crate::Option>,
4618    {
4619        use std::iter::Iterator;
4620        self.options = v.into_iter().map(|i| i.into()).collect();
4621        self
4622    }
4623}
4624
4625impl wkt::message::Message for Type {
4626    fn typename() -> &'static str {
4627        "type.googleapis.com/google.protobuf.Type"
4628    }
4629}
4630
4631/// A single field of a message type.
4632#[serde_with::serde_as]
4633#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4634#[serde(default, rename_all = "camelCase")]
4635#[non_exhaustive]
4636pub struct Field {
4637    /// The field type.
4638    pub kind: crate::field::Kind,
4639
4640    /// The field cardinality.
4641    pub cardinality: crate::field::Cardinality,
4642
4643    /// The field number.
4644    pub number: i32,
4645
4646    /// The field name.
4647    #[serde(skip_serializing_if = "std::string::String::is_empty")]
4648    pub name: std::string::String,
4649
4650    /// The field type URL, without the scheme, for message or enumeration
4651    /// types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
4652    #[serde(skip_serializing_if = "std::string::String::is_empty")]
4653    pub type_url: std::string::String,
4654
4655    /// The index of the field type in `Type.oneofs`, for message or enumeration
4656    /// types. The first type has index 1; zero means the type is not in the list.
4657    pub oneof_index: i32,
4658
4659    /// Whether to use alternative packed wire representation.
4660    pub packed: bool,
4661
4662    /// The protocol buffer options.
4663    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4664    pub options: std::vec::Vec<crate::Option>,
4665
4666    /// The field JSON name.
4667    #[serde(skip_serializing_if = "std::string::String::is_empty")]
4668    pub json_name: std::string::String,
4669
4670    /// The string value of the default value of this field. Proto2 syntax only.
4671    #[serde(skip_serializing_if = "std::string::String::is_empty")]
4672    pub default_value: std::string::String,
4673
4674    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4675    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4676}
4677
4678impl Field {
4679    pub fn new() -> Self {
4680        std::default::Default::default()
4681    }
4682
4683    /// Sets the value of [kind][crate::Field::kind].
4684    pub fn set_kind<T: std::convert::Into<crate::field::Kind>>(mut self, v: T) -> Self {
4685        self.kind = v.into();
4686        self
4687    }
4688
4689    /// Sets the value of [cardinality][crate::Field::cardinality].
4690    pub fn set_cardinality<T: std::convert::Into<crate::field::Cardinality>>(
4691        mut self,
4692        v: T,
4693    ) -> Self {
4694        self.cardinality = v.into();
4695        self
4696    }
4697
4698    /// Sets the value of [number][crate::Field::number].
4699    pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4700        self.number = v.into();
4701        self
4702    }
4703
4704    /// Sets the value of [name][crate::Field::name].
4705    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4706        self.name = v.into();
4707        self
4708    }
4709
4710    /// Sets the value of [type_url][crate::Field::type_url].
4711    pub fn set_type_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4712        self.type_url = v.into();
4713        self
4714    }
4715
4716    /// Sets the value of [oneof_index][crate::Field::oneof_index].
4717    pub fn set_oneof_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4718        self.oneof_index = v.into();
4719        self
4720    }
4721
4722    /// Sets the value of [packed][crate::Field::packed].
4723    pub fn set_packed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4724        self.packed = v.into();
4725        self
4726    }
4727
4728    /// Sets the value of [json_name][crate::Field::json_name].
4729    pub fn set_json_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4730        self.json_name = v.into();
4731        self
4732    }
4733
4734    /// Sets the value of [default_value][crate::Field::default_value].
4735    pub fn set_default_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4736        self.default_value = v.into();
4737        self
4738    }
4739
4740    /// Sets the value of [options][crate::Field::options].
4741    pub fn set_options<T, V>(mut self, v: T) -> Self
4742    where
4743        T: std::iter::IntoIterator<Item = V>,
4744        V: std::convert::Into<crate::Option>,
4745    {
4746        use std::iter::Iterator;
4747        self.options = v.into_iter().map(|i| i.into()).collect();
4748        self
4749    }
4750}
4751
4752impl wkt::message::Message for Field {
4753    fn typename() -> &'static str {
4754        "type.googleapis.com/google.protobuf.Field"
4755    }
4756}
4757
4758/// Defines additional types related to [Field].
4759pub mod field {
4760    #[allow(unused_imports)]
4761    use super::*;
4762
4763    /// Basic field types.
4764    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
4765    pub struct Kind(i32);
4766
4767    impl Kind {
4768        /// Field type unknown.
4769        pub const TYPE_UNKNOWN: Kind = Kind::new(0);
4770
4771        /// Field type double.
4772        pub const TYPE_DOUBLE: Kind = Kind::new(1);
4773
4774        /// Field type float.
4775        pub const TYPE_FLOAT: Kind = Kind::new(2);
4776
4777        /// Field type int64.
4778        pub const TYPE_INT64: Kind = Kind::new(3);
4779
4780        /// Field type uint64.
4781        pub const TYPE_UINT64: Kind = Kind::new(4);
4782
4783        /// Field type int32.
4784        pub const TYPE_INT32: Kind = Kind::new(5);
4785
4786        /// Field type fixed64.
4787        pub const TYPE_FIXED64: Kind = Kind::new(6);
4788
4789        /// Field type fixed32.
4790        pub const TYPE_FIXED32: Kind = Kind::new(7);
4791
4792        /// Field type bool.
4793        pub const TYPE_BOOL: Kind = Kind::new(8);
4794
4795        /// Field type string.
4796        pub const TYPE_STRING: Kind = Kind::new(9);
4797
4798        /// Field type group. Proto2 syntax only, and deprecated.
4799        pub const TYPE_GROUP: Kind = Kind::new(10);
4800
4801        /// Field type message.
4802        pub const TYPE_MESSAGE: Kind = Kind::new(11);
4803
4804        /// Field type bytes.
4805        pub const TYPE_BYTES: Kind = Kind::new(12);
4806
4807        /// Field type uint32.
4808        pub const TYPE_UINT32: Kind = Kind::new(13);
4809
4810        /// Field type enum.
4811        pub const TYPE_ENUM: Kind = Kind::new(14);
4812
4813        /// Field type sfixed32.
4814        pub const TYPE_SFIXED32: Kind = Kind::new(15);
4815
4816        /// Field type sfixed64.
4817        pub const TYPE_SFIXED64: Kind = Kind::new(16);
4818
4819        /// Field type sint32.
4820        pub const TYPE_SINT32: Kind = Kind::new(17);
4821
4822        /// Field type sint64.
4823        pub const TYPE_SINT64: Kind = Kind::new(18);
4824
4825        /// Creates a new Kind instance.
4826        pub(crate) const fn new(value: i32) -> Self {
4827            Self(value)
4828        }
4829
4830        /// Gets the enum value.
4831        pub fn value(&self) -> i32 {
4832            self.0
4833        }
4834
4835        /// Gets the enum value as a string.
4836        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
4837            match self.0 {
4838                0 => std::borrow::Cow::Borrowed("TYPE_UNKNOWN"),
4839                1 => std::borrow::Cow::Borrowed("TYPE_DOUBLE"),
4840                2 => std::borrow::Cow::Borrowed("TYPE_FLOAT"),
4841                3 => std::borrow::Cow::Borrowed("TYPE_INT64"),
4842                4 => std::borrow::Cow::Borrowed("TYPE_UINT64"),
4843                5 => std::borrow::Cow::Borrowed("TYPE_INT32"),
4844                6 => std::borrow::Cow::Borrowed("TYPE_FIXED64"),
4845                7 => std::borrow::Cow::Borrowed("TYPE_FIXED32"),
4846                8 => std::borrow::Cow::Borrowed("TYPE_BOOL"),
4847                9 => std::borrow::Cow::Borrowed("TYPE_STRING"),
4848                10 => std::borrow::Cow::Borrowed("TYPE_GROUP"),
4849                11 => std::borrow::Cow::Borrowed("TYPE_MESSAGE"),
4850                12 => std::borrow::Cow::Borrowed("TYPE_BYTES"),
4851                13 => std::borrow::Cow::Borrowed("TYPE_UINT32"),
4852                14 => std::borrow::Cow::Borrowed("TYPE_ENUM"),
4853                15 => std::borrow::Cow::Borrowed("TYPE_SFIXED32"),
4854                16 => std::borrow::Cow::Borrowed("TYPE_SFIXED64"),
4855                17 => std::borrow::Cow::Borrowed("TYPE_SINT32"),
4856                18 => std::borrow::Cow::Borrowed("TYPE_SINT64"),
4857                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
4858            }
4859        }
4860
4861        /// Creates an enum value from the value name.
4862        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
4863            match name {
4864                "TYPE_UNKNOWN" => std::option::Option::Some(Self::TYPE_UNKNOWN),
4865                "TYPE_DOUBLE" => std::option::Option::Some(Self::TYPE_DOUBLE),
4866                "TYPE_FLOAT" => std::option::Option::Some(Self::TYPE_FLOAT),
4867                "TYPE_INT64" => std::option::Option::Some(Self::TYPE_INT64),
4868                "TYPE_UINT64" => std::option::Option::Some(Self::TYPE_UINT64),
4869                "TYPE_INT32" => std::option::Option::Some(Self::TYPE_INT32),
4870                "TYPE_FIXED64" => std::option::Option::Some(Self::TYPE_FIXED64),
4871                "TYPE_FIXED32" => std::option::Option::Some(Self::TYPE_FIXED32),
4872                "TYPE_BOOL" => std::option::Option::Some(Self::TYPE_BOOL),
4873                "TYPE_STRING" => std::option::Option::Some(Self::TYPE_STRING),
4874                "TYPE_GROUP" => std::option::Option::Some(Self::TYPE_GROUP),
4875                "TYPE_MESSAGE" => std::option::Option::Some(Self::TYPE_MESSAGE),
4876                "TYPE_BYTES" => std::option::Option::Some(Self::TYPE_BYTES),
4877                "TYPE_UINT32" => std::option::Option::Some(Self::TYPE_UINT32),
4878                "TYPE_ENUM" => std::option::Option::Some(Self::TYPE_ENUM),
4879                "TYPE_SFIXED32" => std::option::Option::Some(Self::TYPE_SFIXED32),
4880                "TYPE_SFIXED64" => std::option::Option::Some(Self::TYPE_SFIXED64),
4881                "TYPE_SINT32" => std::option::Option::Some(Self::TYPE_SINT32),
4882                "TYPE_SINT64" => std::option::Option::Some(Self::TYPE_SINT64),
4883                _ => std::option::Option::None,
4884            }
4885        }
4886    }
4887
4888    impl std::convert::From<i32> for Kind {
4889        fn from(value: i32) -> Self {
4890            Self::new(value)
4891        }
4892    }
4893
4894    impl std::default::Default for Kind {
4895        fn default() -> Self {
4896            Self::new(0)
4897        }
4898    }
4899
4900    /// Whether a field is optional, required, or repeated.
4901    #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
4902    pub struct Cardinality(i32);
4903
4904    impl Cardinality {
4905        /// For fields with unknown cardinality.
4906        pub const CARDINALITY_UNKNOWN: Cardinality = Cardinality::new(0);
4907
4908        /// For optional fields.
4909        pub const CARDINALITY_OPTIONAL: Cardinality = Cardinality::new(1);
4910
4911        /// For required fields. Proto2 syntax only.
4912        pub const CARDINALITY_REQUIRED: Cardinality = Cardinality::new(2);
4913
4914        /// For repeated fields.
4915        pub const CARDINALITY_REPEATED: Cardinality = Cardinality::new(3);
4916
4917        /// Creates a new Cardinality instance.
4918        pub(crate) const fn new(value: i32) -> Self {
4919            Self(value)
4920        }
4921
4922        /// Gets the enum value.
4923        pub fn value(&self) -> i32 {
4924            self.0
4925        }
4926
4927        /// Gets the enum value as a string.
4928        pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
4929            match self.0 {
4930                0 => std::borrow::Cow::Borrowed("CARDINALITY_UNKNOWN"),
4931                1 => std::borrow::Cow::Borrowed("CARDINALITY_OPTIONAL"),
4932                2 => std::borrow::Cow::Borrowed("CARDINALITY_REQUIRED"),
4933                3 => std::borrow::Cow::Borrowed("CARDINALITY_REPEATED"),
4934                _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
4935            }
4936        }
4937
4938        /// Creates an enum value from the value name.
4939        pub fn from_str_name(name: &str) -> std::option::Option<Self> {
4940            match name {
4941                "CARDINALITY_UNKNOWN" => std::option::Option::Some(Self::CARDINALITY_UNKNOWN),
4942                "CARDINALITY_OPTIONAL" => std::option::Option::Some(Self::CARDINALITY_OPTIONAL),
4943                "CARDINALITY_REQUIRED" => std::option::Option::Some(Self::CARDINALITY_REQUIRED),
4944                "CARDINALITY_REPEATED" => std::option::Option::Some(Self::CARDINALITY_REPEATED),
4945                _ => std::option::Option::None,
4946            }
4947        }
4948    }
4949
4950    impl std::convert::From<i32> for Cardinality {
4951        fn from(value: i32) -> Self {
4952            Self::new(value)
4953        }
4954    }
4955
4956    impl std::default::Default for Cardinality {
4957        fn default() -> Self {
4958            Self::new(0)
4959        }
4960    }
4961}
4962
4963/// Enum type definition.
4964#[serde_with::serde_as]
4965#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
4966#[serde(default, rename_all = "camelCase")]
4967#[non_exhaustive]
4968pub struct Enum {
4969    /// Enum type name.
4970    #[serde(skip_serializing_if = "std::string::String::is_empty")]
4971    pub name: std::string::String,
4972
4973    /// Enum value definitions.
4974    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4975    pub enumvalue: std::vec::Vec<crate::EnumValue>,
4976
4977    /// Protocol buffer options.
4978    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
4979    pub options: std::vec::Vec<crate::Option>,
4980
4981    /// The source context.
4982    #[serde(skip_serializing_if = "std::option::Option::is_none")]
4983    pub source_context: std::option::Option<crate::SourceContext>,
4984
4985    /// The source syntax.
4986    pub syntax: crate::Syntax,
4987
4988    /// The source edition string, only valid when syntax is SYNTAX_EDITIONS.
4989    #[serde(skip_serializing_if = "std::string::String::is_empty")]
4990    pub edition: std::string::String,
4991
4992    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
4993    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4994}
4995
4996impl Enum {
4997    pub fn new() -> Self {
4998        std::default::Default::default()
4999    }
5000
5001    /// Sets the value of [name][crate::Enum::name].
5002    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5003        self.name = v.into();
5004        self
5005    }
5006
5007    /// Sets the value of [source_context][crate::Enum::source_context].
5008    pub fn set_source_context<T: std::convert::Into<std::option::Option<crate::SourceContext>>>(
5009        mut self,
5010        v: T,
5011    ) -> Self {
5012        self.source_context = v.into();
5013        self
5014    }
5015
5016    /// Sets the value of [syntax][crate::Enum::syntax].
5017    pub fn set_syntax<T: std::convert::Into<crate::Syntax>>(mut self, v: T) -> Self {
5018        self.syntax = v.into();
5019        self
5020    }
5021
5022    /// Sets the value of [edition][crate::Enum::edition].
5023    pub fn set_edition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5024        self.edition = v.into();
5025        self
5026    }
5027
5028    /// Sets the value of [enumvalue][crate::Enum::enumvalue].
5029    pub fn set_enumvalue<T, V>(mut self, v: T) -> Self
5030    where
5031        T: std::iter::IntoIterator<Item = V>,
5032        V: std::convert::Into<crate::EnumValue>,
5033    {
5034        use std::iter::Iterator;
5035        self.enumvalue = v.into_iter().map(|i| i.into()).collect();
5036        self
5037    }
5038
5039    /// Sets the value of [options][crate::Enum::options].
5040    pub fn set_options<T, V>(mut self, v: T) -> Self
5041    where
5042        T: std::iter::IntoIterator<Item = V>,
5043        V: std::convert::Into<crate::Option>,
5044    {
5045        use std::iter::Iterator;
5046        self.options = v.into_iter().map(|i| i.into()).collect();
5047        self
5048    }
5049}
5050
5051impl wkt::message::Message for Enum {
5052    fn typename() -> &'static str {
5053        "type.googleapis.com/google.protobuf.Enum"
5054    }
5055}
5056
5057/// Enum value definition.
5058#[serde_with::serde_as]
5059#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
5060#[serde(default, rename_all = "camelCase")]
5061#[non_exhaustive]
5062pub struct EnumValue {
5063    /// Enum value name.
5064    #[serde(skip_serializing_if = "std::string::String::is_empty")]
5065    pub name: std::string::String,
5066
5067    /// Enum value number.
5068    pub number: i32,
5069
5070    /// Protocol buffer options.
5071    #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
5072    pub options: std::vec::Vec<crate::Option>,
5073
5074    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
5075    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5076}
5077
5078impl EnumValue {
5079    pub fn new() -> Self {
5080        std::default::Default::default()
5081    }
5082
5083    /// Sets the value of [name][crate::EnumValue::name].
5084    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5085        self.name = v.into();
5086        self
5087    }
5088
5089    /// Sets the value of [number][crate::EnumValue::number].
5090    pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5091        self.number = v.into();
5092        self
5093    }
5094
5095    /// Sets the value of [options][crate::EnumValue::options].
5096    pub fn set_options<T, V>(mut self, v: T) -> Self
5097    where
5098        T: std::iter::IntoIterator<Item = V>,
5099        V: std::convert::Into<crate::Option>,
5100    {
5101        use std::iter::Iterator;
5102        self.options = v.into_iter().map(|i| i.into()).collect();
5103        self
5104    }
5105}
5106
5107impl wkt::message::Message for EnumValue {
5108    fn typename() -> &'static str {
5109        "type.googleapis.com/google.protobuf.EnumValue"
5110    }
5111}
5112
5113/// A protocol buffer option, which can be attached to a message, field,
5114/// enumeration, etc.
5115#[serde_with::serde_as]
5116#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
5117#[serde(default, rename_all = "camelCase")]
5118#[non_exhaustive]
5119pub struct Option {
5120    /// The option's name. For protobuf built-in options (options defined in
5121    /// descriptor.proto), this is the short name. For example, `"map_entry"`.
5122    /// For custom options, it should be the fully-qualified name. For example,
5123    /// `"google.api.http"`.
5124    #[serde(skip_serializing_if = "std::string::String::is_empty")]
5125    pub name: std::string::String,
5126
5127    /// The option's value packed in an Any message. If the value is a primitive,
5128    /// the corresponding wrapper type defined in google/protobuf/wrappers.proto
5129    /// should be used. If the value is an enum, it should be stored as an int32
5130    /// value using the google.protobuf.Int32Value type.
5131    #[serde(skip_serializing_if = "std::option::Option::is_none")]
5132    pub value: std::option::Option<crate::Any>,
5133
5134    #[serde(flatten, skip_serializing_if = "serde_json::Map::is_empty")]
5135    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5136}
5137
5138impl Option {
5139    pub fn new() -> Self {
5140        std::default::Default::default()
5141    }
5142
5143    /// Sets the value of [name][crate::Option::name].
5144    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5145        self.name = v.into();
5146        self
5147    }
5148
5149    /// Sets the value of [value][crate::Option::value].
5150    pub fn set_value<T: std::convert::Into<std::option::Option<crate::Any>>>(
5151        mut self,
5152        v: T,
5153    ) -> Self {
5154        self.value = v.into();
5155        self
5156    }
5157}
5158
5159impl wkt::message::Message for Option {
5160    fn typename() -> &'static str {
5161        "type.googleapis.com/google.protobuf.Option"
5162    }
5163}
5164
5165/// The full set of known editions.
5166#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
5167pub struct Edition(i32);
5168
5169impl Edition {
5170    /// A placeholder for an unknown edition value.
5171    pub const EDITION_UNKNOWN: Edition = Edition::new(0);
5172
5173    /// A placeholder edition for specifying default behaviors *before* a feature
5174    /// was first introduced.  This is effectively an "infinite past".
5175    pub const EDITION_LEGACY: Edition = Edition::new(900);
5176
5177    /// Legacy syntax "editions".  These pre-date editions, but behave much like
5178    /// distinct editions.  These can't be used to specify the edition of proto
5179    /// files, but feature definitions must supply proto2/proto3 defaults for
5180    /// backwards compatibility.
5181    pub const EDITION_PROTO2: Edition = Edition::new(998);
5182
5183    pub const EDITION_PROTO3: Edition = Edition::new(999);
5184
5185    /// Editions that have been released.  The specific values are arbitrary and
5186    /// should not be depended on, but they will always be time-ordered for easy
5187    /// comparison.
5188    pub const EDITION_2023: Edition = Edition::new(1000);
5189
5190    pub const EDITION_2024: Edition = Edition::new(1001);
5191
5192    /// Placeholder editions for testing feature resolution.  These should not be
5193    /// used or relied on outside of tests.
5194    pub const EDITION_1_TEST_ONLY: Edition = Edition::new(1);
5195
5196    pub const EDITION_2_TEST_ONLY: Edition = Edition::new(2);
5197
5198    pub const EDITION_99997_TEST_ONLY: Edition = Edition::new(99997);
5199
5200    pub const EDITION_99998_TEST_ONLY: Edition = Edition::new(99998);
5201
5202    pub const EDITION_99999_TEST_ONLY: Edition = Edition::new(99999);
5203
5204    /// Placeholder for specifying unbounded edition support.  This should only
5205    /// ever be used by plugins that can expect to never require any changes to
5206    /// support a new edition.
5207    pub const EDITION_MAX: Edition = Edition::new(2147483647);
5208
5209    /// Creates a new Edition instance.
5210    pub(crate) const fn new(value: i32) -> Self {
5211        Self(value)
5212    }
5213
5214    /// Gets the enum value.
5215    pub fn value(&self) -> i32 {
5216        self.0
5217    }
5218
5219    /// Gets the enum value as a string.
5220    pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
5221        match self.0 {
5222            0 => std::borrow::Cow::Borrowed("EDITION_UNKNOWN"),
5223            1 => std::borrow::Cow::Borrowed("EDITION_1_TEST_ONLY"),
5224            2 => std::borrow::Cow::Borrowed("EDITION_2_TEST_ONLY"),
5225            900 => std::borrow::Cow::Borrowed("EDITION_LEGACY"),
5226            998 => std::borrow::Cow::Borrowed("EDITION_PROTO2"),
5227            999 => std::borrow::Cow::Borrowed("EDITION_PROTO3"),
5228            1000 => std::borrow::Cow::Borrowed("EDITION_2023"),
5229            1001 => std::borrow::Cow::Borrowed("EDITION_2024"),
5230            99997 => std::borrow::Cow::Borrowed("EDITION_99997_TEST_ONLY"),
5231            99998 => std::borrow::Cow::Borrowed("EDITION_99998_TEST_ONLY"),
5232            99999 => std::borrow::Cow::Borrowed("EDITION_99999_TEST_ONLY"),
5233            2147483647 => std::borrow::Cow::Borrowed("EDITION_MAX"),
5234            _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
5235        }
5236    }
5237
5238    /// Creates an enum value from the value name.
5239    pub fn from_str_name(name: &str) -> std::option::Option<Self> {
5240        match name {
5241            "EDITION_UNKNOWN" => std::option::Option::Some(Self::EDITION_UNKNOWN),
5242            "EDITION_LEGACY" => std::option::Option::Some(Self::EDITION_LEGACY),
5243            "EDITION_PROTO2" => std::option::Option::Some(Self::EDITION_PROTO2),
5244            "EDITION_PROTO3" => std::option::Option::Some(Self::EDITION_PROTO3),
5245            "EDITION_2023" => std::option::Option::Some(Self::EDITION_2023),
5246            "EDITION_2024" => std::option::Option::Some(Self::EDITION_2024),
5247            "EDITION_1_TEST_ONLY" => std::option::Option::Some(Self::EDITION_1_TEST_ONLY),
5248            "EDITION_2_TEST_ONLY" => std::option::Option::Some(Self::EDITION_2_TEST_ONLY),
5249            "EDITION_99997_TEST_ONLY" => std::option::Option::Some(Self::EDITION_99997_TEST_ONLY),
5250            "EDITION_99998_TEST_ONLY" => std::option::Option::Some(Self::EDITION_99998_TEST_ONLY),
5251            "EDITION_99999_TEST_ONLY" => std::option::Option::Some(Self::EDITION_99999_TEST_ONLY),
5252            "EDITION_MAX" => std::option::Option::Some(Self::EDITION_MAX),
5253            _ => std::option::Option::None,
5254        }
5255    }
5256}
5257
5258impl std::convert::From<i32> for Edition {
5259    fn from(value: i32) -> Self {
5260        Self::new(value)
5261    }
5262}
5263
5264impl std::default::Default for Edition {
5265    fn default() -> Self {
5266        Self::new(0)
5267    }
5268}
5269
5270/// The syntax in which a protocol buffer element is defined.
5271#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
5272pub struct Syntax(i32);
5273
5274impl Syntax {
5275    /// Syntax `proto2`.
5276    pub const SYNTAX_PROTO2: Syntax = Syntax::new(0);
5277
5278    /// Syntax `proto3`.
5279    pub const SYNTAX_PROTO3: Syntax = Syntax::new(1);
5280
5281    /// Syntax `editions`.
5282    pub const SYNTAX_EDITIONS: Syntax = Syntax::new(2);
5283
5284    /// Creates a new Syntax instance.
5285    pub(crate) const fn new(value: i32) -> Self {
5286        Self(value)
5287    }
5288
5289    /// Gets the enum value.
5290    pub fn value(&self) -> i32 {
5291        self.0
5292    }
5293
5294    /// Gets the enum value as a string.
5295    pub fn as_str_name(&self) -> std::borrow::Cow<'static, str> {
5296        match self.0 {
5297            0 => std::borrow::Cow::Borrowed("SYNTAX_PROTO2"),
5298            1 => std::borrow::Cow::Borrowed("SYNTAX_PROTO3"),
5299            2 => std::borrow::Cow::Borrowed("SYNTAX_EDITIONS"),
5300            _ => std::borrow::Cow::Owned(std::format!("UNKNOWN-VALUE:{}", self.0)),
5301        }
5302    }
5303
5304    /// Creates an enum value from the value name.
5305    pub fn from_str_name(name: &str) -> std::option::Option<Self> {
5306        match name {
5307            "SYNTAX_PROTO2" => std::option::Option::Some(Self::SYNTAX_PROTO2),
5308            "SYNTAX_PROTO3" => std::option::Option::Some(Self::SYNTAX_PROTO3),
5309            "SYNTAX_EDITIONS" => std::option::Option::Some(Self::SYNTAX_EDITIONS),
5310            _ => std::option::Option::None,
5311        }
5312    }
5313}
5314
5315impl std::convert::From<i32> for Syntax {
5316    fn from(value: i32) -> Self {
5317        Self::new(value)
5318    }
5319}
5320
5321impl std::default::Default for Syntax {
5322    fn default() -> Self {
5323        Self::new(0)
5324    }
5325}