Skip to main content

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::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19use crate as wkt;
20
21mod debug;
22mod deserialize;
23mod serialize;
24
25/// Api is a light-weight descriptor for an API Interface.
26///
27/// Interfaces are also described as "protocol buffer services" in some contexts,
28/// such as by the "service" keyword in a .proto file, but they are different
29/// from API Services, which represent a concrete implementation of an interface
30/// as opposed to simply a description of methods and bindings. They are also
31/// sometimes simply referred to as "APIs" in other contexts, such as the name of
32/// this message itself. See <https://cloud.google.com/apis/design/glossary> for
33/// detailed terminology.
34#[derive(Clone, Default, PartialEq)]
35#[non_exhaustive]
36pub struct Api {
37    /// The fully qualified name of this interface, including package name
38    /// followed by the interface's simple name.
39    pub name: std::string::String,
40
41    /// The methods of this interface, in unspecified order.
42    pub methods: std::vec::Vec<crate::Method>,
43
44    /// Any metadata attached to the interface.
45    pub options: std::vec::Vec<crate::Option>,
46
47    /// A version string for this interface. If specified, must have the form
48    /// `major-version.minor-version`, as in `1.10`. If the minor version is
49    /// omitted, it defaults to zero. If the entire version field is empty, the
50    /// major version is derived from the package name, as outlined below. If the
51    /// field is not empty, the version in the package name will be verified to be
52    /// consistent with what is provided here.
53    ///
54    /// The versioning schema uses [semantic
55    /// versioning](http://semver.org) where the major version number
56    /// indicates a breaking change and the minor version an additive,
57    /// non-breaking change. Both version numbers are signals to users
58    /// what to expect from different versions, and should be carefully
59    /// chosen based on the product plan.
60    ///
61    /// The major version is also reflected in the package name of the
62    /// interface, which must end in `v<major-version>`, as in
63    /// `google.feature.v1`. For major versions 0 and 1, the suffix can
64    /// be omitted. Zero major versions must only be used for
65    /// experimental, non-GA interfaces.
66    pub version: std::string::String,
67
68    /// Source context for the protocol buffer service represented by this
69    /// message.
70    pub source_context: std::option::Option<crate::SourceContext>,
71
72    /// Included interfaces. See [Mixin][].
73    ///
74    /// [Mixin]: crate::Mixin
75    pub mixins: std::vec::Vec<crate::Mixin>,
76
77    /// The source syntax of the service.
78    pub syntax: crate::Syntax,
79
80    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
81}
82
83impl Api {
84    /// Creates a new default instance.
85    pub fn new() -> Self {
86        std::default::Default::default()
87    }
88
89    /// Sets the value of [name][crate::Api::name].
90    ///
91    /// # Example
92    /// ```ignore,no_run
93    /// # use google_cloud_wkt::Api;
94    /// let x = Api::new().set_name("example");
95    /// ```
96    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
97        self.name = v.into();
98        self
99    }
100
101    /// Sets the value of [methods][crate::Api::methods].
102    ///
103    /// # Example
104    /// ```ignore,no_run
105    /// # use google_cloud_wkt::Api;
106    /// use google_cloud_wkt::Method;
107    /// let x = Api::new()
108    ///     .set_methods([
109    ///         Method::default()/* use setters */,
110    ///         Method::default()/* use (different) setters */,
111    ///     ]);
112    /// ```
113    pub fn set_methods<T, V>(mut self, v: T) -> Self
114    where
115        T: std::iter::IntoIterator<Item = V>,
116        V: std::convert::Into<crate::Method>,
117    {
118        use std::iter::Iterator;
119        self.methods = v.into_iter().map(|i| i.into()).collect();
120        self
121    }
122
123    /// Sets the value of [options][crate::Api::options].
124    ///
125    /// # Example
126    /// ```ignore,no_run
127    /// # use google_cloud_wkt::Api;
128    /// use google_cloud_wkt::Option;
129    /// let x = Api::new()
130    ///     .set_options([
131    ///         Option::default()/* use setters */,
132    ///         Option::default()/* use (different) setters */,
133    ///     ]);
134    /// ```
135    pub fn set_options<T, V>(mut self, v: T) -> Self
136    where
137        T: std::iter::IntoIterator<Item = V>,
138        V: std::convert::Into<crate::Option>,
139    {
140        use std::iter::Iterator;
141        self.options = v.into_iter().map(|i| i.into()).collect();
142        self
143    }
144
145    /// Sets the value of [version][crate::Api::version].
146    ///
147    /// # Example
148    /// ```ignore,no_run
149    /// # use google_cloud_wkt::Api;
150    /// let x = Api::new().set_version("example");
151    /// ```
152    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
153        self.version = v.into();
154        self
155    }
156
157    /// Sets the value of [source_context][crate::Api::source_context].
158    ///
159    /// # Example
160    /// ```ignore,no_run
161    /// # use google_cloud_wkt::Api;
162    /// use google_cloud_wkt::SourceContext;
163    /// let x = Api::new().set_source_context(SourceContext::default()/* use setters */);
164    /// ```
165    pub fn set_source_context<T>(mut self, v: T) -> Self
166    where
167        T: std::convert::Into<crate::SourceContext>,
168    {
169        self.source_context = std::option::Option::Some(v.into());
170        self
171    }
172
173    /// Sets or clears the value of [source_context][crate::Api::source_context].
174    ///
175    /// # Example
176    /// ```ignore,no_run
177    /// # use google_cloud_wkt::Api;
178    /// use google_cloud_wkt::SourceContext;
179    /// let x = Api::new().set_or_clear_source_context(Some(SourceContext::default()/* use setters */));
180    /// let x = Api::new().set_or_clear_source_context(None::<SourceContext>);
181    /// ```
182    pub fn set_or_clear_source_context<T>(mut self, v: std::option::Option<T>) -> Self
183    where
184        T: std::convert::Into<crate::SourceContext>,
185    {
186        self.source_context = v.map(|x| x.into());
187        self
188    }
189
190    /// Sets the value of [mixins][crate::Api::mixins].
191    ///
192    /// # Example
193    /// ```ignore,no_run
194    /// # use google_cloud_wkt::Api;
195    /// use google_cloud_wkt::Mixin;
196    /// let x = Api::new()
197    ///     .set_mixins([
198    ///         Mixin::default()/* use setters */,
199    ///         Mixin::default()/* use (different) setters */,
200    ///     ]);
201    /// ```
202    pub fn set_mixins<T, V>(mut self, v: T) -> Self
203    where
204        T: std::iter::IntoIterator<Item = V>,
205        V: std::convert::Into<crate::Mixin>,
206    {
207        use std::iter::Iterator;
208        self.mixins = v.into_iter().map(|i| i.into()).collect();
209        self
210    }
211
212    /// Sets the value of [syntax][crate::Api::syntax].
213    ///
214    /// # Example
215    /// ```ignore,no_run
216    /// # use google_cloud_wkt::Api;
217    /// use google_cloud_wkt::Syntax;
218    /// let x0 = Api::new().set_syntax(Syntax::Proto3);
219    /// let x1 = Api::new().set_syntax(Syntax::Editions);
220    /// ```
221    pub fn set_syntax<T: std::convert::Into<crate::Syntax>>(mut self, v: T) -> Self {
222        self.syntax = v.into();
223        self
224    }
225}
226
227impl wkt::message::Message for Api {
228    fn typename() -> &'static str {
229        "type.googleapis.com/google.protobuf.Api"
230    }
231}
232
233/// Method represents a method of an API interface.
234#[derive(Clone, Default, PartialEq)]
235#[non_exhaustive]
236pub struct Method {
237    /// The simple name of this method.
238    pub name: std::string::String,
239
240    /// A URL of the input message type.
241    pub request_type_url: std::string::String,
242
243    /// If true, the request is streamed.
244    pub request_streaming: bool,
245
246    /// The URL of the output message type.
247    pub response_type_url: std::string::String,
248
249    /// If true, the response is streamed.
250    pub response_streaming: bool,
251
252    /// Any metadata attached to the method.
253    pub options: std::vec::Vec<crate::Option>,
254
255    /// The source syntax of this method.
256    pub syntax: crate::Syntax,
257
258    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
259}
260
261impl Method {
262    /// Creates a new default instance.
263    pub fn new() -> Self {
264        std::default::Default::default()
265    }
266
267    /// Sets the value of [name][crate::Method::name].
268    ///
269    /// # Example
270    /// ```ignore,no_run
271    /// # use google_cloud_wkt::Method;
272    /// let x = Method::new().set_name("example");
273    /// ```
274    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
275        self.name = v.into();
276        self
277    }
278
279    /// Sets the value of [request_type_url][crate::Method::request_type_url].
280    ///
281    /// # Example
282    /// ```ignore,no_run
283    /// # use google_cloud_wkt::Method;
284    /// let x = Method::new().set_request_type_url("example");
285    /// ```
286    pub fn set_request_type_url<T: std::convert::Into<std::string::String>>(
287        mut self,
288        v: T,
289    ) -> Self {
290        self.request_type_url = v.into();
291        self
292    }
293
294    /// Sets the value of [request_streaming][crate::Method::request_streaming].
295    ///
296    /// # Example
297    /// ```ignore,no_run
298    /// # use google_cloud_wkt::Method;
299    /// let x = Method::new().set_request_streaming(true);
300    /// ```
301    pub fn set_request_streaming<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
302        self.request_streaming = v.into();
303        self
304    }
305
306    /// Sets the value of [response_type_url][crate::Method::response_type_url].
307    ///
308    /// # Example
309    /// ```ignore,no_run
310    /// # use google_cloud_wkt::Method;
311    /// let x = Method::new().set_response_type_url("example");
312    /// ```
313    pub fn set_response_type_url<T: std::convert::Into<std::string::String>>(
314        mut self,
315        v: T,
316    ) -> Self {
317        self.response_type_url = v.into();
318        self
319    }
320
321    /// Sets the value of [response_streaming][crate::Method::response_streaming].
322    ///
323    /// # Example
324    /// ```ignore,no_run
325    /// # use google_cloud_wkt::Method;
326    /// let x = Method::new().set_response_streaming(true);
327    /// ```
328    pub fn set_response_streaming<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
329        self.response_streaming = v.into();
330        self
331    }
332
333    /// Sets the value of [options][crate::Method::options].
334    ///
335    /// # Example
336    /// ```ignore,no_run
337    /// # use google_cloud_wkt::Method;
338    /// use google_cloud_wkt::Option;
339    /// let x = Method::new()
340    ///     .set_options([
341    ///         Option::default()/* use setters */,
342    ///         Option::default()/* use (different) setters */,
343    ///     ]);
344    /// ```
345    pub fn set_options<T, V>(mut self, v: T) -> Self
346    where
347        T: std::iter::IntoIterator<Item = V>,
348        V: std::convert::Into<crate::Option>,
349    {
350        use std::iter::Iterator;
351        self.options = v.into_iter().map(|i| i.into()).collect();
352        self
353    }
354
355    /// Sets the value of [syntax][crate::Method::syntax].
356    ///
357    /// # Example
358    /// ```ignore,no_run
359    /// # use google_cloud_wkt::Method;
360    /// use google_cloud_wkt::Syntax;
361    /// let x0 = Method::new().set_syntax(Syntax::Proto3);
362    /// let x1 = Method::new().set_syntax(Syntax::Editions);
363    /// ```
364    pub fn set_syntax<T: std::convert::Into<crate::Syntax>>(mut self, v: T) -> Self {
365        self.syntax = v.into();
366        self
367    }
368}
369
370impl wkt::message::Message for Method {
371    fn typename() -> &'static str {
372        "type.googleapis.com/google.protobuf.Method"
373    }
374}
375
376/// Declares an API Interface to be included in this interface. The including
377/// interface must redeclare all the methods from the included interface, but
378/// documentation and options are inherited as follows:
379///
380/// - If after comment and whitespace stripping, the documentation
381///   string of the redeclared method is empty, it will be inherited
382///   from the original method.
383///
384/// - Each annotation belonging to the service config (http,
385///   visibility) which is not set in the redeclared method will be
386///   inherited.
387///
388/// - If an http annotation is inherited, the path pattern will be
389///   modified as follows. Any version prefix will be replaced by the
390///   version of the including interface plus the [root][] path if
391///   specified.
392///
393///
394/// Example of a simple mixin:
395///
396/// ```norust
397/// package google.acl.v1;
398/// service AccessControl {
399///   // Get the underlying ACL object.
400///   rpc GetAcl(GetAclRequest) returns (Acl) {
401///     option (google.api.http).get = "/v1/{resource=**}:getAcl";
402///   }
403/// }
404///
405/// package google.storage.v2;
406/// service Storage {
407///   rpc GetAcl(GetAclRequest) returns (Acl);
408///
409///   // Get a data record.
410///   rpc GetData(GetDataRequest) returns (Data) {
411///     option (google.api.http).get = "/v2/{resource=**}";
412///   }
413/// }
414/// ```
415///
416/// Example of a mixin configuration:
417///
418/// ```norust
419/// apis:
420/// - name: google.storage.v2.Storage
421///   mixins:
422///   - name: google.acl.v1.AccessControl
423/// ```
424///
425/// The mixin construct implies that all methods in `AccessControl` are
426/// also declared with same name and request/response types in
427/// `Storage`. A documentation generator or annotation processor will
428/// see the effective `Storage.GetAcl` method after inheriting
429/// documentation and annotations as follows:
430///
431/// ```norust
432/// service Storage {
433///   // Get the underlying ACL object.
434///   rpc GetAcl(GetAclRequest) returns (Acl) {
435///     option (google.api.http).get = "/v2/{resource=**}:getAcl";
436///   }
437///   ...
438/// }
439/// ```
440///
441/// Note how the version in the path pattern changed from `v1` to `v2`.
442///
443/// If the `root` field in the mixin is specified, it should be a
444/// relative path under which inherited HTTP paths are placed. Example:
445///
446/// ```norust
447/// apis:
448/// - name: google.storage.v2.Storage
449///   mixins:
450///   - name: google.acl.v1.AccessControl
451///     root: acls
452/// ```
453///
454/// This implies the following inherited HTTP annotation:
455///
456/// ```norust
457/// service Storage {
458///   // Get the underlying ACL object.
459///   rpc GetAcl(GetAclRequest) returns (Acl) {
460///     option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
461///   }
462///   ...
463/// }
464/// ```
465///
466/// [root]: wkt::Mixin::root
467#[derive(Clone, Default, PartialEq)]
468#[non_exhaustive]
469pub struct Mixin {
470    /// The fully qualified name of the interface which is included.
471    pub name: std::string::String,
472
473    /// If non-empty specifies a path under which inherited HTTP paths
474    /// are rooted.
475    pub root: std::string::String,
476
477    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
478}
479
480impl Mixin {
481    /// Creates a new default instance.
482    pub fn new() -> Self {
483        std::default::Default::default()
484    }
485
486    /// Sets the value of [name][crate::Mixin::name].
487    ///
488    /// # Example
489    /// ```ignore,no_run
490    /// # use google_cloud_wkt::Mixin;
491    /// let x = Mixin::new().set_name("example");
492    /// ```
493    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
494        self.name = v.into();
495        self
496    }
497
498    /// Sets the value of [root][crate::Mixin::root].
499    ///
500    /// # Example
501    /// ```ignore,no_run
502    /// # use google_cloud_wkt::Mixin;
503    /// let x = Mixin::new().set_root("example");
504    /// ```
505    pub fn set_root<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
506        self.root = v.into();
507        self
508    }
509}
510
511impl wkt::message::Message for Mixin {
512    fn typename() -> &'static str {
513        "type.googleapis.com/google.protobuf.Mixin"
514    }
515}
516
517/// The protocol compiler can output a FileDescriptorSet containing the .proto
518/// files it parses.
519#[derive(Clone, Default, PartialEq)]
520#[non_exhaustive]
521pub struct FileDescriptorSet {
522    #[allow(missing_docs)]
523    pub file: std::vec::Vec<crate::FileDescriptorProto>,
524
525    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
526}
527
528impl FileDescriptorSet {
529    /// Creates a new default instance.
530    pub fn new() -> Self {
531        std::default::Default::default()
532    }
533
534    /// Sets the value of [file][crate::FileDescriptorSet::file].
535    ///
536    /// # Example
537    /// ```ignore,no_run
538    /// # use google_cloud_wkt::FileDescriptorSet;
539    /// use google_cloud_wkt::FileDescriptorProto;
540    /// let x = FileDescriptorSet::new()
541    ///     .set_file([
542    ///         FileDescriptorProto::default()/* use setters */,
543    ///         FileDescriptorProto::default()/* use (different) setters */,
544    ///     ]);
545    /// ```
546    pub fn set_file<T, V>(mut self, v: T) -> Self
547    where
548        T: std::iter::IntoIterator<Item = V>,
549        V: std::convert::Into<crate::FileDescriptorProto>,
550    {
551        use std::iter::Iterator;
552        self.file = v.into_iter().map(|i| i.into()).collect();
553        self
554    }
555}
556
557impl wkt::message::Message for FileDescriptorSet {
558    fn typename() -> &'static str {
559        "type.googleapis.com/google.protobuf.FileDescriptorSet"
560    }
561}
562
563/// Describes a complete .proto file.
564#[derive(Clone, Default, PartialEq)]
565#[non_exhaustive]
566pub struct FileDescriptorProto {
567    #[allow(missing_docs)]
568    pub name: std::string::String,
569
570    #[allow(missing_docs)]
571    pub package: std::string::String,
572
573    /// Names of files imported by this file.
574    pub dependency: std::vec::Vec<std::string::String>,
575
576    /// Indexes of the public imported files in the dependency list above.
577    pub public_dependency: std::vec::Vec<i32>,
578
579    /// Indexes of the weak imported files in the dependency list.
580    /// For Google-internal migration only. Do not use.
581    pub weak_dependency: std::vec::Vec<i32>,
582
583    /// All top-level definitions in this file.
584    pub message_type: std::vec::Vec<crate::DescriptorProto>,
585
586    #[allow(missing_docs)]
587    pub enum_type: std::vec::Vec<crate::EnumDescriptorProto>,
588
589    #[allow(missing_docs)]
590    pub service: std::vec::Vec<crate::ServiceDescriptorProto>,
591
592    #[allow(missing_docs)]
593    pub extension: std::vec::Vec<crate::FieldDescriptorProto>,
594
595    #[allow(missing_docs)]
596    pub options: std::option::Option<crate::FileOptions>,
597
598    /// This field contains optional information about the original source code.
599    /// You may safely remove this entire field without harming runtime
600    /// functionality of the descriptors -- the information is needed only by
601    /// development tools.
602    pub source_code_info: std::option::Option<crate::SourceCodeInfo>,
603
604    /// The syntax of the proto file.
605    /// The supported values are "proto2", "proto3", and "editions".
606    ///
607    /// If `edition` is present, this value must be "editions".
608    pub syntax: std::string::String,
609
610    /// The edition of the proto file.
611    pub edition: crate::Edition,
612
613    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
614}
615
616impl FileDescriptorProto {
617    /// Creates a new default instance.
618    pub fn new() -> Self {
619        std::default::Default::default()
620    }
621
622    /// Sets the value of [name][crate::FileDescriptorProto::name].
623    ///
624    /// # Example
625    /// ```ignore,no_run
626    /// # use google_cloud_wkt::FileDescriptorProto;
627    /// let x = FileDescriptorProto::new().set_name("example");
628    /// ```
629    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
630        self.name = v.into();
631        self
632    }
633
634    /// Sets the value of [package][crate::FileDescriptorProto::package].
635    ///
636    /// # Example
637    /// ```ignore,no_run
638    /// # use google_cloud_wkt::FileDescriptorProto;
639    /// let x = FileDescriptorProto::new().set_package("example");
640    /// ```
641    pub fn set_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
642        self.package = v.into();
643        self
644    }
645
646    /// Sets the value of [dependency][crate::FileDescriptorProto::dependency].
647    ///
648    /// # Example
649    /// ```ignore,no_run
650    /// # use google_cloud_wkt::FileDescriptorProto;
651    /// let x = FileDescriptorProto::new().set_dependency(["a", "b", "c"]);
652    /// ```
653    pub fn set_dependency<T, V>(mut self, v: T) -> Self
654    where
655        T: std::iter::IntoIterator<Item = V>,
656        V: std::convert::Into<std::string::String>,
657    {
658        use std::iter::Iterator;
659        self.dependency = v.into_iter().map(|i| i.into()).collect();
660        self
661    }
662
663    /// Sets the value of [public_dependency][crate::FileDescriptorProto::public_dependency].
664    ///
665    /// # Example
666    /// ```ignore,no_run
667    /// # use google_cloud_wkt::FileDescriptorProto;
668    /// let x = FileDescriptorProto::new().set_public_dependency([1, 2, 3]);
669    /// ```
670    pub fn set_public_dependency<T, V>(mut self, v: T) -> Self
671    where
672        T: std::iter::IntoIterator<Item = V>,
673        V: std::convert::Into<i32>,
674    {
675        use std::iter::Iterator;
676        self.public_dependency = v.into_iter().map(|i| i.into()).collect();
677        self
678    }
679
680    /// Sets the value of [weak_dependency][crate::FileDescriptorProto::weak_dependency].
681    ///
682    /// # Example
683    /// ```ignore,no_run
684    /// # use google_cloud_wkt::FileDescriptorProto;
685    /// let x = FileDescriptorProto::new().set_weak_dependency([1, 2, 3]);
686    /// ```
687    pub fn set_weak_dependency<T, V>(mut self, v: T) -> Self
688    where
689        T: std::iter::IntoIterator<Item = V>,
690        V: std::convert::Into<i32>,
691    {
692        use std::iter::Iterator;
693        self.weak_dependency = v.into_iter().map(|i| i.into()).collect();
694        self
695    }
696
697    /// Sets the value of [message_type][crate::FileDescriptorProto::message_type].
698    ///
699    /// # Example
700    /// ```ignore,no_run
701    /// # use google_cloud_wkt::FileDescriptorProto;
702    /// use google_cloud_wkt::DescriptorProto;
703    /// let x = FileDescriptorProto::new()
704    ///     .set_message_type([
705    ///         DescriptorProto::default()/* use setters */,
706    ///         DescriptorProto::default()/* use (different) setters */,
707    ///     ]);
708    /// ```
709    pub fn set_message_type<T, V>(mut self, v: T) -> Self
710    where
711        T: std::iter::IntoIterator<Item = V>,
712        V: std::convert::Into<crate::DescriptorProto>,
713    {
714        use std::iter::Iterator;
715        self.message_type = v.into_iter().map(|i| i.into()).collect();
716        self
717    }
718
719    /// Sets the value of [enum_type][crate::FileDescriptorProto::enum_type].
720    ///
721    /// # Example
722    /// ```ignore,no_run
723    /// # use google_cloud_wkt::FileDescriptorProto;
724    /// use google_cloud_wkt::EnumDescriptorProto;
725    /// let x = FileDescriptorProto::new()
726    ///     .set_enum_type([
727    ///         EnumDescriptorProto::default()/* use setters */,
728    ///         EnumDescriptorProto::default()/* use (different) setters */,
729    ///     ]);
730    /// ```
731    pub fn set_enum_type<T, V>(mut self, v: T) -> Self
732    where
733        T: std::iter::IntoIterator<Item = V>,
734        V: std::convert::Into<crate::EnumDescriptorProto>,
735    {
736        use std::iter::Iterator;
737        self.enum_type = v.into_iter().map(|i| i.into()).collect();
738        self
739    }
740
741    /// Sets the value of [service][crate::FileDescriptorProto::service].
742    ///
743    /// # Example
744    /// ```ignore,no_run
745    /// # use google_cloud_wkt::FileDescriptorProto;
746    /// use google_cloud_wkt::ServiceDescriptorProto;
747    /// let x = FileDescriptorProto::new()
748    ///     .set_service([
749    ///         ServiceDescriptorProto::default()/* use setters */,
750    ///         ServiceDescriptorProto::default()/* use (different) setters */,
751    ///     ]);
752    /// ```
753    pub fn set_service<T, V>(mut self, v: T) -> Self
754    where
755        T: std::iter::IntoIterator<Item = V>,
756        V: std::convert::Into<crate::ServiceDescriptorProto>,
757    {
758        use std::iter::Iterator;
759        self.service = v.into_iter().map(|i| i.into()).collect();
760        self
761    }
762
763    /// Sets the value of [extension][crate::FileDescriptorProto::extension].
764    ///
765    /// # Example
766    /// ```ignore,no_run
767    /// # use google_cloud_wkt::FileDescriptorProto;
768    /// use google_cloud_wkt::FieldDescriptorProto;
769    /// let x = FileDescriptorProto::new()
770    ///     .set_extension([
771    ///         FieldDescriptorProto::default()/* use setters */,
772    ///         FieldDescriptorProto::default()/* use (different) setters */,
773    ///     ]);
774    /// ```
775    pub fn set_extension<T, V>(mut self, v: T) -> Self
776    where
777        T: std::iter::IntoIterator<Item = V>,
778        V: std::convert::Into<crate::FieldDescriptorProto>,
779    {
780        use std::iter::Iterator;
781        self.extension = v.into_iter().map(|i| i.into()).collect();
782        self
783    }
784
785    /// Sets the value of [options][crate::FileDescriptorProto::options].
786    ///
787    /// # Example
788    /// ```ignore,no_run
789    /// # use google_cloud_wkt::FileDescriptorProto;
790    /// use google_cloud_wkt::FileOptions;
791    /// let x = FileDescriptorProto::new().set_options(FileOptions::default()/* use setters */);
792    /// ```
793    pub fn set_options<T>(mut self, v: T) -> Self
794    where
795        T: std::convert::Into<crate::FileOptions>,
796    {
797        self.options = std::option::Option::Some(v.into());
798        self
799    }
800
801    /// Sets or clears the value of [options][crate::FileDescriptorProto::options].
802    ///
803    /// # Example
804    /// ```ignore,no_run
805    /// # use google_cloud_wkt::FileDescriptorProto;
806    /// use google_cloud_wkt::FileOptions;
807    /// let x = FileDescriptorProto::new().set_or_clear_options(Some(FileOptions::default()/* use setters */));
808    /// let x = FileDescriptorProto::new().set_or_clear_options(None::<FileOptions>);
809    /// ```
810    pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
811    where
812        T: std::convert::Into<crate::FileOptions>,
813    {
814        self.options = v.map(|x| x.into());
815        self
816    }
817
818    /// Sets the value of [source_code_info][crate::FileDescriptorProto::source_code_info].
819    ///
820    /// # Example
821    /// ```ignore,no_run
822    /// # use google_cloud_wkt::FileDescriptorProto;
823    /// use google_cloud_wkt::SourceCodeInfo;
824    /// let x = FileDescriptorProto::new().set_source_code_info(SourceCodeInfo::default()/* use setters */);
825    /// ```
826    pub fn set_source_code_info<T>(mut self, v: T) -> Self
827    where
828        T: std::convert::Into<crate::SourceCodeInfo>,
829    {
830        self.source_code_info = std::option::Option::Some(v.into());
831        self
832    }
833
834    /// Sets or clears the value of [source_code_info][crate::FileDescriptorProto::source_code_info].
835    ///
836    /// # Example
837    /// ```ignore,no_run
838    /// # use google_cloud_wkt::FileDescriptorProto;
839    /// use google_cloud_wkt::SourceCodeInfo;
840    /// let x = FileDescriptorProto::new().set_or_clear_source_code_info(Some(SourceCodeInfo::default()/* use setters */));
841    /// let x = FileDescriptorProto::new().set_or_clear_source_code_info(None::<SourceCodeInfo>);
842    /// ```
843    pub fn set_or_clear_source_code_info<T>(mut self, v: std::option::Option<T>) -> Self
844    where
845        T: std::convert::Into<crate::SourceCodeInfo>,
846    {
847        self.source_code_info = v.map(|x| x.into());
848        self
849    }
850
851    /// Sets the value of [syntax][crate::FileDescriptorProto::syntax].
852    ///
853    /// # Example
854    /// ```ignore,no_run
855    /// # use google_cloud_wkt::FileDescriptorProto;
856    /// let x = FileDescriptorProto::new().set_syntax("example");
857    /// ```
858    pub fn set_syntax<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
859        self.syntax = v.into();
860        self
861    }
862
863    /// Sets the value of [edition][crate::FileDescriptorProto::edition].
864    ///
865    /// # Example
866    /// ```ignore,no_run
867    /// # use google_cloud_wkt::FileDescriptorProto;
868    /// use google_cloud_wkt::Edition;
869    /// let x0 = FileDescriptorProto::new().set_edition(Edition::Legacy);
870    /// let x1 = FileDescriptorProto::new().set_edition(Edition::Proto2);
871    /// let x2 = FileDescriptorProto::new().set_edition(Edition::Proto3);
872    /// ```
873    pub fn set_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
874        self.edition = v.into();
875        self
876    }
877}
878
879impl wkt::message::Message for FileDescriptorProto {
880    fn typename() -> &'static str {
881        "type.googleapis.com/google.protobuf.FileDescriptorProto"
882    }
883}
884
885/// Describes a message type.
886#[derive(Clone, Default, PartialEq)]
887#[non_exhaustive]
888pub struct DescriptorProto {
889    #[allow(missing_docs)]
890    pub name: std::string::String,
891
892    #[allow(missing_docs)]
893    pub field: std::vec::Vec<crate::FieldDescriptorProto>,
894
895    #[allow(missing_docs)]
896    pub extension: std::vec::Vec<crate::FieldDescriptorProto>,
897
898    #[allow(missing_docs)]
899    pub nested_type: std::vec::Vec<crate::DescriptorProto>,
900
901    #[allow(missing_docs)]
902    pub enum_type: std::vec::Vec<crate::EnumDescriptorProto>,
903
904    #[allow(missing_docs)]
905    pub extension_range: std::vec::Vec<crate::descriptor_proto::ExtensionRange>,
906
907    #[allow(missing_docs)]
908    pub oneof_decl: std::vec::Vec<crate::OneofDescriptorProto>,
909
910    #[allow(missing_docs)]
911    pub options: std::option::Option<crate::MessageOptions>,
912
913    #[allow(missing_docs)]
914    pub reserved_range: std::vec::Vec<crate::descriptor_proto::ReservedRange>,
915
916    /// Reserved field names, which may not be used by fields in the same message.
917    /// A given name may only be reserved once.
918    pub reserved_name: std::vec::Vec<std::string::String>,
919
920    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
921}
922
923impl DescriptorProto {
924    /// Creates a new default instance.
925    pub fn new() -> Self {
926        std::default::Default::default()
927    }
928
929    /// Sets the value of [name][crate::DescriptorProto::name].
930    ///
931    /// # Example
932    /// ```ignore,no_run
933    /// # use google_cloud_wkt::DescriptorProto;
934    /// let x = DescriptorProto::new().set_name("example");
935    /// ```
936    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
937        self.name = v.into();
938        self
939    }
940
941    /// Sets the value of [field][crate::DescriptorProto::field].
942    ///
943    /// # Example
944    /// ```ignore,no_run
945    /// # use google_cloud_wkt::DescriptorProto;
946    /// use google_cloud_wkt::FieldDescriptorProto;
947    /// let x = DescriptorProto::new()
948    ///     .set_field([
949    ///         FieldDescriptorProto::default()/* use setters */,
950    ///         FieldDescriptorProto::default()/* use (different) setters */,
951    ///     ]);
952    /// ```
953    pub fn set_field<T, V>(mut self, v: T) -> Self
954    where
955        T: std::iter::IntoIterator<Item = V>,
956        V: std::convert::Into<crate::FieldDescriptorProto>,
957    {
958        use std::iter::Iterator;
959        self.field = v.into_iter().map(|i| i.into()).collect();
960        self
961    }
962
963    /// Sets the value of [extension][crate::DescriptorProto::extension].
964    ///
965    /// # Example
966    /// ```ignore,no_run
967    /// # use google_cloud_wkt::DescriptorProto;
968    /// use google_cloud_wkt::FieldDescriptorProto;
969    /// let x = DescriptorProto::new()
970    ///     .set_extension([
971    ///         FieldDescriptorProto::default()/* use setters */,
972    ///         FieldDescriptorProto::default()/* use (different) setters */,
973    ///     ]);
974    /// ```
975    pub fn set_extension<T, V>(mut self, v: T) -> Self
976    where
977        T: std::iter::IntoIterator<Item = V>,
978        V: std::convert::Into<crate::FieldDescriptorProto>,
979    {
980        use std::iter::Iterator;
981        self.extension = v.into_iter().map(|i| i.into()).collect();
982        self
983    }
984
985    /// Sets the value of [nested_type][crate::DescriptorProto::nested_type].
986    ///
987    /// # Example
988    /// ```ignore,no_run
989    /// # use google_cloud_wkt::DescriptorProto;
990    /// let x = DescriptorProto::new()
991    ///     .set_nested_type([
992    ///         DescriptorProto::default()/* use setters */,
993    ///         DescriptorProto::default()/* use (different) setters */,
994    ///     ]);
995    /// ```
996    pub fn set_nested_type<T, V>(mut self, v: T) -> Self
997    where
998        T: std::iter::IntoIterator<Item = V>,
999        V: std::convert::Into<crate::DescriptorProto>,
1000    {
1001        use std::iter::Iterator;
1002        self.nested_type = v.into_iter().map(|i| i.into()).collect();
1003        self
1004    }
1005
1006    /// Sets the value of [enum_type][crate::DescriptorProto::enum_type].
1007    ///
1008    /// # Example
1009    /// ```ignore,no_run
1010    /// # use google_cloud_wkt::DescriptorProto;
1011    /// use google_cloud_wkt::EnumDescriptorProto;
1012    /// let x = DescriptorProto::new()
1013    ///     .set_enum_type([
1014    ///         EnumDescriptorProto::default()/* use setters */,
1015    ///         EnumDescriptorProto::default()/* use (different) setters */,
1016    ///     ]);
1017    /// ```
1018    pub fn set_enum_type<T, V>(mut self, v: T) -> Self
1019    where
1020        T: std::iter::IntoIterator<Item = V>,
1021        V: std::convert::Into<crate::EnumDescriptorProto>,
1022    {
1023        use std::iter::Iterator;
1024        self.enum_type = v.into_iter().map(|i| i.into()).collect();
1025        self
1026    }
1027
1028    /// Sets the value of [extension_range][crate::DescriptorProto::extension_range].
1029    ///
1030    /// # Example
1031    /// ```ignore,no_run
1032    /// # use google_cloud_wkt::DescriptorProto;
1033    /// use google_cloud_wkt::descriptor_proto::ExtensionRange;
1034    /// let x = DescriptorProto::new()
1035    ///     .set_extension_range([
1036    ///         ExtensionRange::default()/* use setters */,
1037    ///         ExtensionRange::default()/* use (different) setters */,
1038    ///     ]);
1039    /// ```
1040    pub fn set_extension_range<T, V>(mut self, v: T) -> Self
1041    where
1042        T: std::iter::IntoIterator<Item = V>,
1043        V: std::convert::Into<crate::descriptor_proto::ExtensionRange>,
1044    {
1045        use std::iter::Iterator;
1046        self.extension_range = v.into_iter().map(|i| i.into()).collect();
1047        self
1048    }
1049
1050    /// Sets the value of [oneof_decl][crate::DescriptorProto::oneof_decl].
1051    ///
1052    /// # Example
1053    /// ```ignore,no_run
1054    /// # use google_cloud_wkt::DescriptorProto;
1055    /// use google_cloud_wkt::OneofDescriptorProto;
1056    /// let x = DescriptorProto::new()
1057    ///     .set_oneof_decl([
1058    ///         OneofDescriptorProto::default()/* use setters */,
1059    ///         OneofDescriptorProto::default()/* use (different) setters */,
1060    ///     ]);
1061    /// ```
1062    pub fn set_oneof_decl<T, V>(mut self, v: T) -> Self
1063    where
1064        T: std::iter::IntoIterator<Item = V>,
1065        V: std::convert::Into<crate::OneofDescriptorProto>,
1066    {
1067        use std::iter::Iterator;
1068        self.oneof_decl = v.into_iter().map(|i| i.into()).collect();
1069        self
1070    }
1071
1072    /// Sets the value of [options][crate::DescriptorProto::options].
1073    ///
1074    /// # Example
1075    /// ```ignore,no_run
1076    /// # use google_cloud_wkt::DescriptorProto;
1077    /// use google_cloud_wkt::MessageOptions;
1078    /// let x = DescriptorProto::new().set_options(MessageOptions::default()/* use setters */);
1079    /// ```
1080    pub fn set_options<T>(mut self, v: T) -> Self
1081    where
1082        T: std::convert::Into<crate::MessageOptions>,
1083    {
1084        self.options = std::option::Option::Some(v.into());
1085        self
1086    }
1087
1088    /// Sets or clears the value of [options][crate::DescriptorProto::options].
1089    ///
1090    /// # Example
1091    /// ```ignore,no_run
1092    /// # use google_cloud_wkt::DescriptorProto;
1093    /// use google_cloud_wkt::MessageOptions;
1094    /// let x = DescriptorProto::new().set_or_clear_options(Some(MessageOptions::default()/* use setters */));
1095    /// let x = DescriptorProto::new().set_or_clear_options(None::<MessageOptions>);
1096    /// ```
1097    pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1098    where
1099        T: std::convert::Into<crate::MessageOptions>,
1100    {
1101        self.options = v.map(|x| x.into());
1102        self
1103    }
1104
1105    /// Sets the value of [reserved_range][crate::DescriptorProto::reserved_range].
1106    ///
1107    /// # Example
1108    /// ```ignore,no_run
1109    /// # use google_cloud_wkt::DescriptorProto;
1110    /// use google_cloud_wkt::descriptor_proto::ReservedRange;
1111    /// let x = DescriptorProto::new()
1112    ///     .set_reserved_range([
1113    ///         ReservedRange::default()/* use setters */,
1114    ///         ReservedRange::default()/* use (different) setters */,
1115    ///     ]);
1116    /// ```
1117    pub fn set_reserved_range<T, V>(mut self, v: T) -> Self
1118    where
1119        T: std::iter::IntoIterator<Item = V>,
1120        V: std::convert::Into<crate::descriptor_proto::ReservedRange>,
1121    {
1122        use std::iter::Iterator;
1123        self.reserved_range = v.into_iter().map(|i| i.into()).collect();
1124        self
1125    }
1126
1127    /// Sets the value of [reserved_name][crate::DescriptorProto::reserved_name].
1128    ///
1129    /// # Example
1130    /// ```ignore,no_run
1131    /// # use google_cloud_wkt::DescriptorProto;
1132    /// let x = DescriptorProto::new().set_reserved_name(["a", "b", "c"]);
1133    /// ```
1134    pub fn set_reserved_name<T, V>(mut self, v: T) -> Self
1135    where
1136        T: std::iter::IntoIterator<Item = V>,
1137        V: std::convert::Into<std::string::String>,
1138    {
1139        use std::iter::Iterator;
1140        self.reserved_name = v.into_iter().map(|i| i.into()).collect();
1141        self
1142    }
1143}
1144
1145impl wkt::message::Message for DescriptorProto {
1146    fn typename() -> &'static str {
1147        "type.googleapis.com/google.protobuf.DescriptorProto"
1148    }
1149}
1150
1151/// Defines additional types related to [DescriptorProto].
1152pub mod descriptor_proto {
1153    #[allow(unused_imports)]
1154    use super::*;
1155
1156    #[allow(missing_docs)]
1157    #[derive(Clone, Default, PartialEq)]
1158    #[non_exhaustive]
1159    pub struct ExtensionRange {
1160        #[allow(missing_docs)]
1161        pub start: i32,
1162
1163        #[allow(missing_docs)]
1164        pub end: i32,
1165
1166        #[allow(missing_docs)]
1167        pub options: std::option::Option<crate::ExtensionRangeOptions>,
1168
1169        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1170    }
1171
1172    impl ExtensionRange {
1173        /// Creates a new default instance.
1174        pub fn new() -> Self {
1175            std::default::Default::default()
1176        }
1177
1178        /// Sets the value of [start][crate::descriptor_proto::ExtensionRange::start].
1179        ///
1180        /// # Example
1181        /// ```ignore,no_run
1182        /// # use google_cloud_wkt::descriptor_proto::ExtensionRange;
1183        /// let x = ExtensionRange::new().set_start(42);
1184        /// ```
1185        pub fn set_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1186            self.start = v.into();
1187            self
1188        }
1189
1190        /// Sets the value of [end][crate::descriptor_proto::ExtensionRange::end].
1191        ///
1192        /// # Example
1193        /// ```ignore,no_run
1194        /// # use google_cloud_wkt::descriptor_proto::ExtensionRange;
1195        /// let x = ExtensionRange::new().set_end(42);
1196        /// ```
1197        pub fn set_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1198            self.end = v.into();
1199            self
1200        }
1201
1202        /// Sets the value of [options][crate::descriptor_proto::ExtensionRange::options].
1203        ///
1204        /// # Example
1205        /// ```ignore,no_run
1206        /// # use google_cloud_wkt::descriptor_proto::ExtensionRange;
1207        /// use google_cloud_wkt::ExtensionRangeOptions;
1208        /// let x = ExtensionRange::new().set_options(ExtensionRangeOptions::default()/* use setters */);
1209        /// ```
1210        pub fn set_options<T>(mut self, v: T) -> Self
1211        where
1212            T: std::convert::Into<crate::ExtensionRangeOptions>,
1213        {
1214            self.options = std::option::Option::Some(v.into());
1215            self
1216        }
1217
1218        /// Sets or clears the value of [options][crate::descriptor_proto::ExtensionRange::options].
1219        ///
1220        /// # Example
1221        /// ```ignore,no_run
1222        /// # use google_cloud_wkt::descriptor_proto::ExtensionRange;
1223        /// use google_cloud_wkt::ExtensionRangeOptions;
1224        /// let x = ExtensionRange::new().set_or_clear_options(Some(ExtensionRangeOptions::default()/* use setters */));
1225        /// let x = ExtensionRange::new().set_or_clear_options(None::<ExtensionRangeOptions>);
1226        /// ```
1227        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1228        where
1229            T: std::convert::Into<crate::ExtensionRangeOptions>,
1230        {
1231            self.options = v.map(|x| x.into());
1232            self
1233        }
1234    }
1235
1236    impl wkt::message::Message for ExtensionRange {
1237        fn typename() -> &'static str {
1238            "type.googleapis.com/google.protobuf.DescriptorProto.ExtensionRange"
1239        }
1240    }
1241
1242    /// Range of reserved tag numbers. Reserved tag numbers may not be used by
1243    /// fields or extension ranges in the same message. Reserved ranges may
1244    /// not overlap.
1245    #[derive(Clone, Default, PartialEq)]
1246    #[non_exhaustive]
1247    pub struct ReservedRange {
1248        #[allow(missing_docs)]
1249        pub start: i32,
1250
1251        #[allow(missing_docs)]
1252        pub end: i32,
1253
1254        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1255    }
1256
1257    impl ReservedRange {
1258        /// Creates a new default instance.
1259        pub fn new() -> Self {
1260            std::default::Default::default()
1261        }
1262
1263        /// Sets the value of [start][crate::descriptor_proto::ReservedRange::start].
1264        ///
1265        /// # Example
1266        /// ```ignore,no_run
1267        /// # use google_cloud_wkt::descriptor_proto::ReservedRange;
1268        /// let x = ReservedRange::new().set_start(42);
1269        /// ```
1270        pub fn set_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1271            self.start = v.into();
1272            self
1273        }
1274
1275        /// Sets the value of [end][crate::descriptor_proto::ReservedRange::end].
1276        ///
1277        /// # Example
1278        /// ```ignore,no_run
1279        /// # use google_cloud_wkt::descriptor_proto::ReservedRange;
1280        /// let x = ReservedRange::new().set_end(42);
1281        /// ```
1282        pub fn set_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1283            self.end = v.into();
1284            self
1285        }
1286    }
1287
1288    impl wkt::message::Message for ReservedRange {
1289        fn typename() -> &'static str {
1290            "type.googleapis.com/google.protobuf.DescriptorProto.ReservedRange"
1291        }
1292    }
1293}
1294
1295#[allow(missing_docs)]
1296#[derive(Clone, Default, PartialEq)]
1297#[non_exhaustive]
1298pub struct ExtensionRangeOptions {
1299    /// The parser stores options it doesn't recognize here. See above.
1300    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
1301
1302    /// For external users: DO NOT USE. We are in the process of open sourcing
1303    /// extension declaration and executing internal cleanups before it can be
1304    /// used externally.
1305    pub declaration: std::vec::Vec<crate::extension_range_options::Declaration>,
1306
1307    /// Any features defined in the specific edition.
1308    pub features: std::option::Option<crate::FeatureSet>,
1309
1310    /// The verification state of the range.
1311    /// TODO: flip the default to DECLARATION once all empty ranges
1312    /// are marked as UNVERIFIED.
1313    pub verification: crate::extension_range_options::VerificationState,
1314
1315    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1316}
1317
1318impl ExtensionRangeOptions {
1319    /// Creates a new default instance.
1320    pub fn new() -> Self {
1321        std::default::Default::default()
1322    }
1323
1324    /// Sets the value of [uninterpreted_option][crate::ExtensionRangeOptions::uninterpreted_option].
1325    ///
1326    /// # Example
1327    /// ```ignore,no_run
1328    /// # use google_cloud_wkt::ExtensionRangeOptions;
1329    /// use google_cloud_wkt::UninterpretedOption;
1330    /// let x = ExtensionRangeOptions::new()
1331    ///     .set_uninterpreted_option([
1332    ///         UninterpretedOption::default()/* use setters */,
1333    ///         UninterpretedOption::default()/* use (different) setters */,
1334    ///     ]);
1335    /// ```
1336    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
1337    where
1338        T: std::iter::IntoIterator<Item = V>,
1339        V: std::convert::Into<crate::UninterpretedOption>,
1340    {
1341        use std::iter::Iterator;
1342        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
1343        self
1344    }
1345
1346    /// Sets the value of [declaration][crate::ExtensionRangeOptions::declaration].
1347    ///
1348    /// # Example
1349    /// ```ignore,no_run
1350    /// # use google_cloud_wkt::ExtensionRangeOptions;
1351    /// use google_cloud_wkt::extension_range_options::Declaration;
1352    /// let x = ExtensionRangeOptions::new()
1353    ///     .set_declaration([
1354    ///         Declaration::default()/* use setters */,
1355    ///         Declaration::default()/* use (different) setters */,
1356    ///     ]);
1357    /// ```
1358    pub fn set_declaration<T, V>(mut self, v: T) -> Self
1359    where
1360        T: std::iter::IntoIterator<Item = V>,
1361        V: std::convert::Into<crate::extension_range_options::Declaration>,
1362    {
1363        use std::iter::Iterator;
1364        self.declaration = v.into_iter().map(|i| i.into()).collect();
1365        self
1366    }
1367
1368    /// Sets the value of [features][crate::ExtensionRangeOptions::features].
1369    ///
1370    /// # Example
1371    /// ```ignore,no_run
1372    /// # use google_cloud_wkt::ExtensionRangeOptions;
1373    /// use google_cloud_wkt::FeatureSet;
1374    /// let x = ExtensionRangeOptions::new().set_features(FeatureSet::default()/* use setters */);
1375    /// ```
1376    pub fn set_features<T>(mut self, v: T) -> Self
1377    where
1378        T: std::convert::Into<crate::FeatureSet>,
1379    {
1380        self.features = std::option::Option::Some(v.into());
1381        self
1382    }
1383
1384    /// Sets or clears the value of [features][crate::ExtensionRangeOptions::features].
1385    ///
1386    /// # Example
1387    /// ```ignore,no_run
1388    /// # use google_cloud_wkt::ExtensionRangeOptions;
1389    /// use google_cloud_wkt::FeatureSet;
1390    /// let x = ExtensionRangeOptions::new().set_or_clear_features(Some(FeatureSet::default()/* use setters */));
1391    /// let x = ExtensionRangeOptions::new().set_or_clear_features(None::<FeatureSet>);
1392    /// ```
1393    pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
1394    where
1395        T: std::convert::Into<crate::FeatureSet>,
1396    {
1397        self.features = v.map(|x| x.into());
1398        self
1399    }
1400
1401    /// Sets the value of [verification][crate::ExtensionRangeOptions::verification].
1402    ///
1403    /// # Example
1404    /// ```ignore,no_run
1405    /// # use google_cloud_wkt::ExtensionRangeOptions;
1406    /// use google_cloud_wkt::extension_range_options::VerificationState;
1407    /// let x0 = ExtensionRangeOptions::new().set_verification(VerificationState::Unverified);
1408    /// ```
1409    pub fn set_verification<
1410        T: std::convert::Into<crate::extension_range_options::VerificationState>,
1411    >(
1412        mut self,
1413        v: T,
1414    ) -> Self {
1415        self.verification = v.into();
1416        self
1417    }
1418}
1419
1420impl wkt::message::Message for ExtensionRangeOptions {
1421    fn typename() -> &'static str {
1422        "type.googleapis.com/google.protobuf.ExtensionRangeOptions"
1423    }
1424}
1425
1426/// Defines additional types related to [ExtensionRangeOptions].
1427pub mod extension_range_options {
1428    #[allow(unused_imports)]
1429    use super::*;
1430
1431    #[allow(missing_docs)]
1432    #[derive(Clone, Default, PartialEq)]
1433    #[non_exhaustive]
1434    pub struct Declaration {
1435        /// The extension number declared within the extension range.
1436        pub number: i32,
1437
1438        /// The fully-qualified name of the extension field. There must be a leading
1439        /// dot in front of the full name.
1440        pub full_name: std::string::String,
1441
1442        /// The fully-qualified type name of the extension field. Unlike
1443        /// Metadata.type, Declaration.type must have a leading dot for messages
1444        /// and enums.
1445        pub r#type: std::string::String,
1446
1447        /// If true, indicates that the number is reserved in the extension range,
1448        /// and any extension field with the number will fail to compile. Set this
1449        /// when a declared extension field is deleted.
1450        pub reserved: bool,
1451
1452        /// If true, indicates that the extension must be defined as repeated.
1453        /// Otherwise the extension must be defined as optional.
1454        pub repeated: bool,
1455
1456        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1457    }
1458
1459    impl Declaration {
1460        /// Creates a new default instance.
1461        pub fn new() -> Self {
1462            std::default::Default::default()
1463        }
1464
1465        /// Sets the value of [number][crate::extension_range_options::Declaration::number].
1466        ///
1467        /// # Example
1468        /// ```ignore,no_run
1469        /// # use google_cloud_wkt::extension_range_options::Declaration;
1470        /// let x = Declaration::new().set_number(42);
1471        /// ```
1472        pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1473            self.number = v.into();
1474            self
1475        }
1476
1477        /// Sets the value of [full_name][crate::extension_range_options::Declaration::full_name].
1478        ///
1479        /// # Example
1480        /// ```ignore,no_run
1481        /// # use google_cloud_wkt::extension_range_options::Declaration;
1482        /// let x = Declaration::new().set_full_name("example");
1483        /// ```
1484        pub fn set_full_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1485            self.full_name = v.into();
1486            self
1487        }
1488
1489        /// Sets the value of [r#type][crate::extension_range_options::Declaration::type].
1490        ///
1491        /// # Example
1492        /// ```ignore,no_run
1493        /// # use google_cloud_wkt::extension_range_options::Declaration;
1494        /// let x = Declaration::new().set_type("example");
1495        /// ```
1496        pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1497            self.r#type = v.into();
1498            self
1499        }
1500
1501        /// Sets the value of [reserved][crate::extension_range_options::Declaration::reserved].
1502        ///
1503        /// # Example
1504        /// ```ignore,no_run
1505        /// # use google_cloud_wkt::extension_range_options::Declaration;
1506        /// let x = Declaration::new().set_reserved(true);
1507        /// ```
1508        pub fn set_reserved<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1509            self.reserved = v.into();
1510            self
1511        }
1512
1513        /// Sets the value of [repeated][crate::extension_range_options::Declaration::repeated].
1514        ///
1515        /// # Example
1516        /// ```ignore,no_run
1517        /// # use google_cloud_wkt::extension_range_options::Declaration;
1518        /// let x = Declaration::new().set_repeated(true);
1519        /// ```
1520        pub fn set_repeated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1521            self.repeated = v.into();
1522            self
1523        }
1524    }
1525
1526    impl wkt::message::Message for Declaration {
1527        fn typename() -> &'static str {
1528            "type.googleapis.com/google.protobuf.ExtensionRangeOptions.Declaration"
1529        }
1530    }
1531
1532    /// The verification state of the extension range.
1533    ///
1534    /// # Working with unknown values
1535    ///
1536    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1537    /// additional enum variants at any time. Adding new variants is not considered
1538    /// a breaking change. Applications should write their code in anticipation of:
1539    ///
1540    /// - New values appearing in future releases of the client library, **and**
1541    /// - New values received dynamically, without application changes.
1542    ///
1543    /// Please consult the [Working with enums] section in the user guide for some
1544    /// guidelines.
1545    ///
1546    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1547    #[derive(Clone, Debug, PartialEq)]
1548    #[non_exhaustive]
1549    pub enum VerificationState {
1550        /// All the extensions of the range must be declared.
1551        Declaration,
1552        #[allow(missing_docs)]
1553        Unverified,
1554        /// If set, the enum was initialized with an unknown value.
1555        ///
1556        /// Applications can examine the value using [VerificationState::value] or
1557        /// [VerificationState::name].
1558        UnknownValue(verification_state::UnknownValue),
1559    }
1560
1561    #[doc(hidden)]
1562    pub mod verification_state {
1563        #[allow(unused_imports)]
1564        use super::*;
1565        #[derive(Clone, Debug, PartialEq)]
1566        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1567    }
1568
1569    impl VerificationState {
1570        /// Gets the enum value.
1571        ///
1572        /// Returns `None` if the enum contains an unknown value deserialized from
1573        /// the string representation of enums.
1574        pub fn value(&self) -> std::option::Option<i32> {
1575            match self {
1576                Self::Declaration => std::option::Option::Some(0),
1577                Self::Unverified => std::option::Option::Some(1),
1578                Self::UnknownValue(u) => u.0.value(),
1579            }
1580        }
1581
1582        /// Gets the enum value as a string.
1583        ///
1584        /// Returns `None` if the enum contains an unknown value deserialized from
1585        /// the integer representation of enums.
1586        pub fn name(&self) -> std::option::Option<&str> {
1587            match self {
1588                Self::Declaration => std::option::Option::Some("DECLARATION"),
1589                Self::Unverified => std::option::Option::Some("UNVERIFIED"),
1590                Self::UnknownValue(u) => u.0.name(),
1591            }
1592        }
1593    }
1594
1595    impl std::default::Default for VerificationState {
1596        fn default() -> Self {
1597            use std::convert::From;
1598            Self::from(0)
1599        }
1600    }
1601
1602    impl std::fmt::Display for VerificationState {
1603        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1604            wkt::internal::display_enum(f, self.name(), self.value())
1605        }
1606    }
1607
1608    impl std::convert::From<i32> for VerificationState {
1609        fn from(value: i32) -> Self {
1610            match value {
1611                0 => Self::Declaration,
1612                1 => Self::Unverified,
1613                _ => Self::UnknownValue(verification_state::UnknownValue(
1614                    wkt::internal::UnknownEnumValue::Integer(value),
1615                )),
1616            }
1617        }
1618    }
1619
1620    impl std::convert::From<&str> for VerificationState {
1621        fn from(value: &str) -> Self {
1622            use std::string::ToString;
1623            match value {
1624                "DECLARATION" => Self::Declaration,
1625                "UNVERIFIED" => Self::Unverified,
1626                _ => Self::UnknownValue(verification_state::UnknownValue(
1627                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1628                )),
1629            }
1630        }
1631    }
1632
1633    impl serde::ser::Serialize for VerificationState {
1634        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1635        where
1636            S: serde::Serializer,
1637        {
1638            match self {
1639                Self::Declaration => serializer.serialize_i32(0),
1640                Self::Unverified => serializer.serialize_i32(1),
1641                Self::UnknownValue(u) => u.0.serialize(serializer),
1642            }
1643        }
1644    }
1645
1646    impl<'de> serde::de::Deserialize<'de> for VerificationState {
1647        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1648        where
1649            D: serde::Deserializer<'de>,
1650        {
1651            deserializer.deserialize_any(wkt::internal::EnumVisitor::<VerificationState>::new(
1652                ".google.protobuf.ExtensionRangeOptions.VerificationState",
1653            ))
1654        }
1655    }
1656}
1657
1658/// Describes a field within a message.
1659#[derive(Clone, Default, PartialEq)]
1660#[non_exhaustive]
1661pub struct FieldDescriptorProto {
1662    #[allow(missing_docs)]
1663    pub name: std::string::String,
1664
1665    #[allow(missing_docs)]
1666    pub number: i32,
1667
1668    #[allow(missing_docs)]
1669    pub label: crate::field_descriptor_proto::Label,
1670
1671    /// If type_name is set, this need not be set.  If both this and type_name
1672    /// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
1673    pub r#type: crate::field_descriptor_proto::Type,
1674
1675    /// For message and enum types, this is the name of the type.  If the name
1676    /// starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
1677    /// rules are used to find the type (i.e. first the nested types within this
1678    /// message are searched, then within the parent, on up to the root
1679    /// namespace).
1680    pub type_name: std::string::String,
1681
1682    /// For extensions, this is the name of the type being extended.  It is
1683    /// resolved in the same manner as type_name.
1684    pub extendee: std::string::String,
1685
1686    /// For numeric types, contains the original text representation of the value.
1687    /// For booleans, "true" or "false".
1688    /// For strings, contains the default text contents (not escaped in any way).
1689    /// For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
1690    pub default_value: std::string::String,
1691
1692    /// If set, gives the index of a oneof in the containing type's oneof_decl
1693    /// list.  This field is a member of that oneof.
1694    pub oneof_index: i32,
1695
1696    /// JSON name of this field. The value is set by protocol compiler. If the
1697    /// user has set a "json_name" option on this field, that option's value
1698    /// will be used. Otherwise, it's deduced from the field's name by converting
1699    /// it to camelCase.
1700    pub json_name: std::string::String,
1701
1702    #[allow(missing_docs)]
1703    pub options: std::option::Option<crate::FieldOptions>,
1704
1705    /// If true, this is a proto3 "optional". When a proto3 field is optional, it
1706    /// tracks presence regardless of field type.
1707    ///
1708    /// When proto3_optional is true, this field must belong to a oneof to signal
1709    /// to old proto3 clients that presence is tracked for this field. This oneof
1710    /// is known as a "synthetic" oneof, and this field must be its sole member
1711    /// (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs
1712    /// exist in the descriptor only, and do not generate any API. Synthetic oneofs
1713    /// must be ordered after all "real" oneofs.
1714    ///
1715    /// For message fields, proto3_optional doesn't create any semantic change,
1716    /// since non-repeated message fields always track presence. However it still
1717    /// indicates the semantic detail of whether the user wrote "optional" or not.
1718    /// This can be useful for round-tripping the .proto file. For consistency we
1719    /// give message fields a synthetic oneof also, even though it is not required
1720    /// to track presence. This is especially important because the parser can't
1721    /// tell if a field is a message or an enum, so it must always create a
1722    /// synthetic oneof.
1723    ///
1724    /// Proto2 optional fields do not set this flag, because they already indicate
1725    /// optional with `LABEL_OPTIONAL`.
1726    pub proto3_optional: bool,
1727
1728    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1729}
1730
1731impl FieldDescriptorProto {
1732    /// Creates a new default instance.
1733    pub fn new() -> Self {
1734        std::default::Default::default()
1735    }
1736
1737    /// Sets the value of [name][crate::FieldDescriptorProto::name].
1738    ///
1739    /// # Example
1740    /// ```ignore,no_run
1741    /// # use google_cloud_wkt::FieldDescriptorProto;
1742    /// let x = FieldDescriptorProto::new().set_name("example");
1743    /// ```
1744    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1745        self.name = v.into();
1746        self
1747    }
1748
1749    /// Sets the value of [number][crate::FieldDescriptorProto::number].
1750    ///
1751    /// # Example
1752    /// ```ignore,no_run
1753    /// # use google_cloud_wkt::FieldDescriptorProto;
1754    /// let x = FieldDescriptorProto::new().set_number(42);
1755    /// ```
1756    pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1757        self.number = v.into();
1758        self
1759    }
1760
1761    /// Sets the value of [label][crate::FieldDescriptorProto::label].
1762    ///
1763    /// # Example
1764    /// ```ignore,no_run
1765    /// # use google_cloud_wkt::FieldDescriptorProto;
1766    /// use google_cloud_wkt::field_descriptor_proto::Label;
1767    /// let x0 = FieldDescriptorProto::new().set_label(Label::Optional);
1768    /// let x1 = FieldDescriptorProto::new().set_label(Label::Repeated);
1769    /// let x2 = FieldDescriptorProto::new().set_label(Label::Required);
1770    /// ```
1771    pub fn set_label<T: std::convert::Into<crate::field_descriptor_proto::Label>>(
1772        mut self,
1773        v: T,
1774    ) -> Self {
1775        self.label = v.into();
1776        self
1777    }
1778
1779    /// Sets the value of [r#type][crate::FieldDescriptorProto::type].
1780    ///
1781    /// # Example
1782    /// ```ignore,no_run
1783    /// # use google_cloud_wkt::FieldDescriptorProto;
1784    /// use google_cloud_wkt::field_descriptor_proto::Type;
1785    /// let x0 = FieldDescriptorProto::new().set_type(Type::Double);
1786    /// let x1 = FieldDescriptorProto::new().set_type(Type::Float);
1787    /// let x2 = FieldDescriptorProto::new().set_type(Type::Int64);
1788    /// ```
1789    pub fn set_type<T: std::convert::Into<crate::field_descriptor_proto::Type>>(
1790        mut self,
1791        v: T,
1792    ) -> Self {
1793        self.r#type = v.into();
1794        self
1795    }
1796
1797    /// Sets the value of [type_name][crate::FieldDescriptorProto::type_name].
1798    ///
1799    /// # Example
1800    /// ```ignore,no_run
1801    /// # use google_cloud_wkt::FieldDescriptorProto;
1802    /// let x = FieldDescriptorProto::new().set_type_name("example");
1803    /// ```
1804    pub fn set_type_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1805        self.type_name = v.into();
1806        self
1807    }
1808
1809    /// Sets the value of [extendee][crate::FieldDescriptorProto::extendee].
1810    ///
1811    /// # Example
1812    /// ```ignore,no_run
1813    /// # use google_cloud_wkt::FieldDescriptorProto;
1814    /// let x = FieldDescriptorProto::new().set_extendee("example");
1815    /// ```
1816    pub fn set_extendee<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1817        self.extendee = v.into();
1818        self
1819    }
1820
1821    /// Sets the value of [default_value][crate::FieldDescriptorProto::default_value].
1822    ///
1823    /// # Example
1824    /// ```ignore,no_run
1825    /// # use google_cloud_wkt::FieldDescriptorProto;
1826    /// let x = FieldDescriptorProto::new().set_default_value("example");
1827    /// ```
1828    pub fn set_default_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1829        self.default_value = v.into();
1830        self
1831    }
1832
1833    /// Sets the value of [oneof_index][crate::FieldDescriptorProto::oneof_index].
1834    ///
1835    /// # Example
1836    /// ```ignore,no_run
1837    /// # use google_cloud_wkt::FieldDescriptorProto;
1838    /// let x = FieldDescriptorProto::new().set_oneof_index(42);
1839    /// ```
1840    pub fn set_oneof_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1841        self.oneof_index = v.into();
1842        self
1843    }
1844
1845    /// Sets the value of [json_name][crate::FieldDescriptorProto::json_name].
1846    ///
1847    /// # Example
1848    /// ```ignore,no_run
1849    /// # use google_cloud_wkt::FieldDescriptorProto;
1850    /// let x = FieldDescriptorProto::new().set_json_name("example");
1851    /// ```
1852    pub fn set_json_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1853        self.json_name = v.into();
1854        self
1855    }
1856
1857    /// Sets the value of [options][crate::FieldDescriptorProto::options].
1858    ///
1859    /// # Example
1860    /// ```ignore,no_run
1861    /// # use google_cloud_wkt::FieldDescriptorProto;
1862    /// use google_cloud_wkt::FieldOptions;
1863    /// let x = FieldDescriptorProto::new().set_options(FieldOptions::default()/* use setters */);
1864    /// ```
1865    pub fn set_options<T>(mut self, v: T) -> Self
1866    where
1867        T: std::convert::Into<crate::FieldOptions>,
1868    {
1869        self.options = std::option::Option::Some(v.into());
1870        self
1871    }
1872
1873    /// Sets or clears the value of [options][crate::FieldDescriptorProto::options].
1874    ///
1875    /// # Example
1876    /// ```ignore,no_run
1877    /// # use google_cloud_wkt::FieldDescriptorProto;
1878    /// use google_cloud_wkt::FieldOptions;
1879    /// let x = FieldDescriptorProto::new().set_or_clear_options(Some(FieldOptions::default()/* use setters */));
1880    /// let x = FieldDescriptorProto::new().set_or_clear_options(None::<FieldOptions>);
1881    /// ```
1882    pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1883    where
1884        T: std::convert::Into<crate::FieldOptions>,
1885    {
1886        self.options = v.map(|x| x.into());
1887        self
1888    }
1889
1890    /// Sets the value of [proto3_optional][crate::FieldDescriptorProto::proto3_optional].
1891    ///
1892    /// # Example
1893    /// ```ignore,no_run
1894    /// # use google_cloud_wkt::FieldDescriptorProto;
1895    /// let x = FieldDescriptorProto::new().set_proto3_optional(true);
1896    /// ```
1897    pub fn set_proto3_optional<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1898        self.proto3_optional = v.into();
1899        self
1900    }
1901}
1902
1903impl wkt::message::Message for FieldDescriptorProto {
1904    fn typename() -> &'static str {
1905        "type.googleapis.com/google.protobuf.FieldDescriptorProto"
1906    }
1907}
1908
1909/// Defines additional types related to [FieldDescriptorProto].
1910pub mod field_descriptor_proto {
1911    #[allow(unused_imports)]
1912    use super::*;
1913
1914    /// Enum for [Type].
1915    ///
1916    /// # Working with unknown values
1917    ///
1918    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1919    /// additional enum variants at any time. Adding new variants is not considered
1920    /// a breaking change. Applications should write their code in anticipation of:
1921    ///
1922    /// - New values appearing in future releases of the client library, **and**
1923    /// - New values received dynamically, without application changes.
1924    ///
1925    /// Please consult the [Working with enums] section in the user guide for some
1926    /// guidelines.
1927    ///
1928    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1929    #[derive(Clone, Debug, PartialEq)]
1930    #[non_exhaustive]
1931    pub enum Type {
1932        /// 0 is reserved for errors.
1933        /// Order is weird for historical reasons.
1934        Double,
1935        #[allow(missing_docs)]
1936        Float,
1937        /// Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if
1938        /// negative values are likely.
1939        Int64,
1940        #[allow(missing_docs)]
1941        Uint64,
1942        /// Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if
1943        /// negative values are likely.
1944        Int32,
1945        #[allow(missing_docs)]
1946        Fixed64,
1947        #[allow(missing_docs)]
1948        Fixed32,
1949        #[allow(missing_docs)]
1950        Bool,
1951        #[allow(missing_docs)]
1952        String,
1953        /// Tag-delimited aggregate.
1954        /// Group type is deprecated and not supported after google.protobuf. However, Proto3
1955        /// implementations should still be able to parse the group wire format and
1956        /// treat group fields as unknown fields.  In Editions, the group wire format
1957        /// can be enabled via the `message_encoding` feature.
1958        Group,
1959        #[allow(missing_docs)]
1960        Message,
1961        /// New in version 2.
1962        Bytes,
1963        #[allow(missing_docs)]
1964        Uint32,
1965        #[allow(missing_docs)]
1966        Enum,
1967        #[allow(missing_docs)]
1968        Sfixed32,
1969        #[allow(missing_docs)]
1970        Sfixed64,
1971        #[allow(missing_docs)]
1972        Sint32,
1973        #[allow(missing_docs)]
1974        Sint64,
1975        /// If set, the enum was initialized with an unknown value.
1976        ///
1977        /// Applications can examine the value using [Type::value] or
1978        /// [Type::name].
1979        UnknownValue(r#type::UnknownValue),
1980    }
1981
1982    #[doc(hidden)]
1983    pub mod r#type {
1984        #[allow(unused_imports)]
1985        use super::*;
1986        #[derive(Clone, Debug, PartialEq)]
1987        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1988    }
1989
1990    impl Type {
1991        /// Gets the enum value.
1992        ///
1993        /// Returns `None` if the enum contains an unknown value deserialized from
1994        /// the string representation of enums.
1995        pub fn value(&self) -> std::option::Option<i32> {
1996            match self {
1997                Self::Double => std::option::Option::Some(1),
1998                Self::Float => std::option::Option::Some(2),
1999                Self::Int64 => std::option::Option::Some(3),
2000                Self::Uint64 => std::option::Option::Some(4),
2001                Self::Int32 => std::option::Option::Some(5),
2002                Self::Fixed64 => std::option::Option::Some(6),
2003                Self::Fixed32 => std::option::Option::Some(7),
2004                Self::Bool => std::option::Option::Some(8),
2005                Self::String => std::option::Option::Some(9),
2006                Self::Group => std::option::Option::Some(10),
2007                Self::Message => std::option::Option::Some(11),
2008                Self::Bytes => std::option::Option::Some(12),
2009                Self::Uint32 => std::option::Option::Some(13),
2010                Self::Enum => std::option::Option::Some(14),
2011                Self::Sfixed32 => std::option::Option::Some(15),
2012                Self::Sfixed64 => std::option::Option::Some(16),
2013                Self::Sint32 => std::option::Option::Some(17),
2014                Self::Sint64 => std::option::Option::Some(18),
2015                Self::UnknownValue(u) => u.0.value(),
2016            }
2017        }
2018
2019        /// Gets the enum value as a string.
2020        ///
2021        /// Returns `None` if the enum contains an unknown value deserialized from
2022        /// the integer representation of enums.
2023        pub fn name(&self) -> std::option::Option<&str> {
2024            match self {
2025                Self::Double => std::option::Option::Some("TYPE_DOUBLE"),
2026                Self::Float => std::option::Option::Some("TYPE_FLOAT"),
2027                Self::Int64 => std::option::Option::Some("TYPE_INT64"),
2028                Self::Uint64 => std::option::Option::Some("TYPE_UINT64"),
2029                Self::Int32 => std::option::Option::Some("TYPE_INT32"),
2030                Self::Fixed64 => std::option::Option::Some("TYPE_FIXED64"),
2031                Self::Fixed32 => std::option::Option::Some("TYPE_FIXED32"),
2032                Self::Bool => std::option::Option::Some("TYPE_BOOL"),
2033                Self::String => std::option::Option::Some("TYPE_STRING"),
2034                Self::Group => std::option::Option::Some("TYPE_GROUP"),
2035                Self::Message => std::option::Option::Some("TYPE_MESSAGE"),
2036                Self::Bytes => std::option::Option::Some("TYPE_BYTES"),
2037                Self::Uint32 => std::option::Option::Some("TYPE_UINT32"),
2038                Self::Enum => std::option::Option::Some("TYPE_ENUM"),
2039                Self::Sfixed32 => std::option::Option::Some("TYPE_SFIXED32"),
2040                Self::Sfixed64 => std::option::Option::Some("TYPE_SFIXED64"),
2041                Self::Sint32 => std::option::Option::Some("TYPE_SINT32"),
2042                Self::Sint64 => std::option::Option::Some("TYPE_SINT64"),
2043                Self::UnknownValue(u) => u.0.name(),
2044            }
2045        }
2046    }
2047
2048    impl std::default::Default for Type {
2049        fn default() -> Self {
2050            use std::convert::From;
2051            Self::from(0)
2052        }
2053    }
2054
2055    impl std::fmt::Display for Type {
2056        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2057            wkt::internal::display_enum(f, self.name(), self.value())
2058        }
2059    }
2060
2061    impl std::convert::From<i32> for Type {
2062        fn from(value: i32) -> Self {
2063            match value {
2064                1 => Self::Double,
2065                2 => Self::Float,
2066                3 => Self::Int64,
2067                4 => Self::Uint64,
2068                5 => Self::Int32,
2069                6 => Self::Fixed64,
2070                7 => Self::Fixed32,
2071                8 => Self::Bool,
2072                9 => Self::String,
2073                10 => Self::Group,
2074                11 => Self::Message,
2075                12 => Self::Bytes,
2076                13 => Self::Uint32,
2077                14 => Self::Enum,
2078                15 => Self::Sfixed32,
2079                16 => Self::Sfixed64,
2080                17 => Self::Sint32,
2081                18 => Self::Sint64,
2082                _ => Self::UnknownValue(r#type::UnknownValue(
2083                    wkt::internal::UnknownEnumValue::Integer(value),
2084                )),
2085            }
2086        }
2087    }
2088
2089    impl std::convert::From<&str> for Type {
2090        fn from(value: &str) -> Self {
2091            use std::string::ToString;
2092            match value {
2093                "TYPE_DOUBLE" => Self::Double,
2094                "TYPE_FLOAT" => Self::Float,
2095                "TYPE_INT64" => Self::Int64,
2096                "TYPE_UINT64" => Self::Uint64,
2097                "TYPE_INT32" => Self::Int32,
2098                "TYPE_FIXED64" => Self::Fixed64,
2099                "TYPE_FIXED32" => Self::Fixed32,
2100                "TYPE_BOOL" => Self::Bool,
2101                "TYPE_STRING" => Self::String,
2102                "TYPE_GROUP" => Self::Group,
2103                "TYPE_MESSAGE" => Self::Message,
2104                "TYPE_BYTES" => Self::Bytes,
2105                "TYPE_UINT32" => Self::Uint32,
2106                "TYPE_ENUM" => Self::Enum,
2107                "TYPE_SFIXED32" => Self::Sfixed32,
2108                "TYPE_SFIXED64" => Self::Sfixed64,
2109                "TYPE_SINT32" => Self::Sint32,
2110                "TYPE_SINT64" => Self::Sint64,
2111                _ => Self::UnknownValue(r#type::UnknownValue(
2112                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2113                )),
2114            }
2115        }
2116    }
2117
2118    impl serde::ser::Serialize for Type {
2119        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2120        where
2121            S: serde::Serializer,
2122        {
2123            match self {
2124                Self::Double => serializer.serialize_i32(1),
2125                Self::Float => serializer.serialize_i32(2),
2126                Self::Int64 => serializer.serialize_i32(3),
2127                Self::Uint64 => serializer.serialize_i32(4),
2128                Self::Int32 => serializer.serialize_i32(5),
2129                Self::Fixed64 => serializer.serialize_i32(6),
2130                Self::Fixed32 => serializer.serialize_i32(7),
2131                Self::Bool => serializer.serialize_i32(8),
2132                Self::String => serializer.serialize_i32(9),
2133                Self::Group => serializer.serialize_i32(10),
2134                Self::Message => serializer.serialize_i32(11),
2135                Self::Bytes => serializer.serialize_i32(12),
2136                Self::Uint32 => serializer.serialize_i32(13),
2137                Self::Enum => serializer.serialize_i32(14),
2138                Self::Sfixed32 => serializer.serialize_i32(15),
2139                Self::Sfixed64 => serializer.serialize_i32(16),
2140                Self::Sint32 => serializer.serialize_i32(17),
2141                Self::Sint64 => serializer.serialize_i32(18),
2142                Self::UnknownValue(u) => u.0.serialize(serializer),
2143            }
2144        }
2145    }
2146
2147    impl<'de> serde::de::Deserialize<'de> for Type {
2148        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2149        where
2150            D: serde::Deserializer<'de>,
2151        {
2152            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
2153                ".google.protobuf.FieldDescriptorProto.Type",
2154            ))
2155        }
2156    }
2157
2158    /// Enum for [Label].
2159    ///
2160    /// # Working with unknown values
2161    ///
2162    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2163    /// additional enum variants at any time. Adding new variants is not considered
2164    /// a breaking change. Applications should write their code in anticipation of:
2165    ///
2166    /// - New values appearing in future releases of the client library, **and**
2167    /// - New values received dynamically, without application changes.
2168    ///
2169    /// Please consult the [Working with enums] section in the user guide for some
2170    /// guidelines.
2171    ///
2172    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2173    #[derive(Clone, Debug, PartialEq)]
2174    #[non_exhaustive]
2175    pub enum Label {
2176        /// 0 is reserved for errors
2177        Optional,
2178        #[allow(missing_docs)]
2179        Repeated,
2180        /// The required label is only allowed in google.protobuf.  In proto3 and Editions
2181        /// it's explicitly prohibited.  In Editions, the `field_presence` feature
2182        /// can be used to get this behavior.
2183        Required,
2184        /// If set, the enum was initialized with an unknown value.
2185        ///
2186        /// Applications can examine the value using [Label::value] or
2187        /// [Label::name].
2188        UnknownValue(label::UnknownValue),
2189    }
2190
2191    #[doc(hidden)]
2192    pub mod label {
2193        #[allow(unused_imports)]
2194        use super::*;
2195        #[derive(Clone, Debug, PartialEq)]
2196        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2197    }
2198
2199    impl Label {
2200        /// Gets the enum value.
2201        ///
2202        /// Returns `None` if the enum contains an unknown value deserialized from
2203        /// the string representation of enums.
2204        pub fn value(&self) -> std::option::Option<i32> {
2205            match self {
2206                Self::Optional => std::option::Option::Some(1),
2207                Self::Repeated => std::option::Option::Some(3),
2208                Self::Required => std::option::Option::Some(2),
2209                Self::UnknownValue(u) => u.0.value(),
2210            }
2211        }
2212
2213        /// Gets the enum value as a string.
2214        ///
2215        /// Returns `None` if the enum contains an unknown value deserialized from
2216        /// the integer representation of enums.
2217        pub fn name(&self) -> std::option::Option<&str> {
2218            match self {
2219                Self::Optional => std::option::Option::Some("LABEL_OPTIONAL"),
2220                Self::Repeated => std::option::Option::Some("LABEL_REPEATED"),
2221                Self::Required => std::option::Option::Some("LABEL_REQUIRED"),
2222                Self::UnknownValue(u) => u.0.name(),
2223            }
2224        }
2225    }
2226
2227    impl std::default::Default for Label {
2228        fn default() -> Self {
2229            use std::convert::From;
2230            Self::from(0)
2231        }
2232    }
2233
2234    impl std::fmt::Display for Label {
2235        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2236            wkt::internal::display_enum(f, self.name(), self.value())
2237        }
2238    }
2239
2240    impl std::convert::From<i32> for Label {
2241        fn from(value: i32) -> Self {
2242            match value {
2243                1 => Self::Optional,
2244                2 => Self::Required,
2245                3 => Self::Repeated,
2246                _ => Self::UnknownValue(label::UnknownValue(
2247                    wkt::internal::UnknownEnumValue::Integer(value),
2248                )),
2249            }
2250        }
2251    }
2252
2253    impl std::convert::From<&str> for Label {
2254        fn from(value: &str) -> Self {
2255            use std::string::ToString;
2256            match value {
2257                "LABEL_OPTIONAL" => Self::Optional,
2258                "LABEL_REPEATED" => Self::Repeated,
2259                "LABEL_REQUIRED" => Self::Required,
2260                _ => Self::UnknownValue(label::UnknownValue(
2261                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2262                )),
2263            }
2264        }
2265    }
2266
2267    impl serde::ser::Serialize for Label {
2268        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2269        where
2270            S: serde::Serializer,
2271        {
2272            match self {
2273                Self::Optional => serializer.serialize_i32(1),
2274                Self::Repeated => serializer.serialize_i32(3),
2275                Self::Required => serializer.serialize_i32(2),
2276                Self::UnknownValue(u) => u.0.serialize(serializer),
2277            }
2278        }
2279    }
2280
2281    impl<'de> serde::de::Deserialize<'de> for Label {
2282        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2283        where
2284            D: serde::Deserializer<'de>,
2285        {
2286            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Label>::new(
2287                ".google.protobuf.FieldDescriptorProto.Label",
2288            ))
2289        }
2290    }
2291}
2292
2293/// Describes a oneof.
2294#[derive(Clone, Default, PartialEq)]
2295#[non_exhaustive]
2296pub struct OneofDescriptorProto {
2297    #[allow(missing_docs)]
2298    pub name: std::string::String,
2299
2300    #[allow(missing_docs)]
2301    pub options: std::option::Option<crate::OneofOptions>,
2302
2303    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2304}
2305
2306impl OneofDescriptorProto {
2307    /// Creates a new default instance.
2308    pub fn new() -> Self {
2309        std::default::Default::default()
2310    }
2311
2312    /// Sets the value of [name][crate::OneofDescriptorProto::name].
2313    ///
2314    /// # Example
2315    /// ```ignore,no_run
2316    /// # use google_cloud_wkt::OneofDescriptorProto;
2317    /// let x = OneofDescriptorProto::new().set_name("example");
2318    /// ```
2319    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2320        self.name = v.into();
2321        self
2322    }
2323
2324    /// Sets the value of [options][crate::OneofDescriptorProto::options].
2325    ///
2326    /// # Example
2327    /// ```ignore,no_run
2328    /// # use google_cloud_wkt::OneofDescriptorProto;
2329    /// use google_cloud_wkt::OneofOptions;
2330    /// let x = OneofDescriptorProto::new().set_options(OneofOptions::default()/* use setters */);
2331    /// ```
2332    pub fn set_options<T>(mut self, v: T) -> Self
2333    where
2334        T: std::convert::Into<crate::OneofOptions>,
2335    {
2336        self.options = std::option::Option::Some(v.into());
2337        self
2338    }
2339
2340    /// Sets or clears the value of [options][crate::OneofDescriptorProto::options].
2341    ///
2342    /// # Example
2343    /// ```ignore,no_run
2344    /// # use google_cloud_wkt::OneofDescriptorProto;
2345    /// use google_cloud_wkt::OneofOptions;
2346    /// let x = OneofDescriptorProto::new().set_or_clear_options(Some(OneofOptions::default()/* use setters */));
2347    /// let x = OneofDescriptorProto::new().set_or_clear_options(None::<OneofOptions>);
2348    /// ```
2349    pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
2350    where
2351        T: std::convert::Into<crate::OneofOptions>,
2352    {
2353        self.options = v.map(|x| x.into());
2354        self
2355    }
2356}
2357
2358impl wkt::message::Message for OneofDescriptorProto {
2359    fn typename() -> &'static str {
2360        "type.googleapis.com/google.protobuf.OneofDescriptorProto"
2361    }
2362}
2363
2364/// Describes an enum type.
2365#[derive(Clone, Default, PartialEq)]
2366#[non_exhaustive]
2367pub struct EnumDescriptorProto {
2368    #[allow(missing_docs)]
2369    pub name: std::string::String,
2370
2371    #[allow(missing_docs)]
2372    pub value: std::vec::Vec<crate::EnumValueDescriptorProto>,
2373
2374    #[allow(missing_docs)]
2375    pub options: std::option::Option<crate::EnumOptions>,
2376
2377    /// Range of reserved numeric values. Reserved numeric values may not be used
2378    /// by enum values in the same enum declaration. Reserved ranges may not
2379    /// overlap.
2380    pub reserved_range: std::vec::Vec<crate::enum_descriptor_proto::EnumReservedRange>,
2381
2382    /// Reserved enum value names, which may not be reused. A given name may only
2383    /// be reserved once.
2384    pub reserved_name: std::vec::Vec<std::string::String>,
2385
2386    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2387}
2388
2389impl EnumDescriptorProto {
2390    /// Creates a new default instance.
2391    pub fn new() -> Self {
2392        std::default::Default::default()
2393    }
2394
2395    /// Sets the value of [name][crate::EnumDescriptorProto::name].
2396    ///
2397    /// # Example
2398    /// ```ignore,no_run
2399    /// # use google_cloud_wkt::EnumDescriptorProto;
2400    /// let x = EnumDescriptorProto::new().set_name("example");
2401    /// ```
2402    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2403        self.name = v.into();
2404        self
2405    }
2406
2407    /// Sets the value of [value][crate::EnumDescriptorProto::value].
2408    ///
2409    /// # Example
2410    /// ```ignore,no_run
2411    /// # use google_cloud_wkt::EnumDescriptorProto;
2412    /// use google_cloud_wkt::EnumValueDescriptorProto;
2413    /// let x = EnumDescriptorProto::new()
2414    ///     .set_value([
2415    ///         EnumValueDescriptorProto::default()/* use setters */,
2416    ///         EnumValueDescriptorProto::default()/* use (different) setters */,
2417    ///     ]);
2418    /// ```
2419    pub fn set_value<T, V>(mut self, v: T) -> Self
2420    where
2421        T: std::iter::IntoIterator<Item = V>,
2422        V: std::convert::Into<crate::EnumValueDescriptorProto>,
2423    {
2424        use std::iter::Iterator;
2425        self.value = v.into_iter().map(|i| i.into()).collect();
2426        self
2427    }
2428
2429    /// Sets the value of [options][crate::EnumDescriptorProto::options].
2430    ///
2431    /// # Example
2432    /// ```ignore,no_run
2433    /// # use google_cloud_wkt::EnumDescriptorProto;
2434    /// use google_cloud_wkt::EnumOptions;
2435    /// let x = EnumDescriptorProto::new().set_options(EnumOptions::default()/* use setters */);
2436    /// ```
2437    pub fn set_options<T>(mut self, v: T) -> Self
2438    where
2439        T: std::convert::Into<crate::EnumOptions>,
2440    {
2441        self.options = std::option::Option::Some(v.into());
2442        self
2443    }
2444
2445    /// Sets or clears the value of [options][crate::EnumDescriptorProto::options].
2446    ///
2447    /// # Example
2448    /// ```ignore,no_run
2449    /// # use google_cloud_wkt::EnumDescriptorProto;
2450    /// use google_cloud_wkt::EnumOptions;
2451    /// let x = EnumDescriptorProto::new().set_or_clear_options(Some(EnumOptions::default()/* use setters */));
2452    /// let x = EnumDescriptorProto::new().set_or_clear_options(None::<EnumOptions>);
2453    /// ```
2454    pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
2455    where
2456        T: std::convert::Into<crate::EnumOptions>,
2457    {
2458        self.options = v.map(|x| x.into());
2459        self
2460    }
2461
2462    /// Sets the value of [reserved_range][crate::EnumDescriptorProto::reserved_range].
2463    ///
2464    /// # Example
2465    /// ```ignore,no_run
2466    /// # use google_cloud_wkt::EnumDescriptorProto;
2467    /// use google_cloud_wkt::enum_descriptor_proto::EnumReservedRange;
2468    /// let x = EnumDescriptorProto::new()
2469    ///     .set_reserved_range([
2470    ///         EnumReservedRange::default()/* use setters */,
2471    ///         EnumReservedRange::default()/* use (different) setters */,
2472    ///     ]);
2473    /// ```
2474    pub fn set_reserved_range<T, V>(mut self, v: T) -> Self
2475    where
2476        T: std::iter::IntoIterator<Item = V>,
2477        V: std::convert::Into<crate::enum_descriptor_proto::EnumReservedRange>,
2478    {
2479        use std::iter::Iterator;
2480        self.reserved_range = v.into_iter().map(|i| i.into()).collect();
2481        self
2482    }
2483
2484    /// Sets the value of [reserved_name][crate::EnumDescriptorProto::reserved_name].
2485    ///
2486    /// # Example
2487    /// ```ignore,no_run
2488    /// # use google_cloud_wkt::EnumDescriptorProto;
2489    /// let x = EnumDescriptorProto::new().set_reserved_name(["a", "b", "c"]);
2490    /// ```
2491    pub fn set_reserved_name<T, V>(mut self, v: T) -> Self
2492    where
2493        T: std::iter::IntoIterator<Item = V>,
2494        V: std::convert::Into<std::string::String>,
2495    {
2496        use std::iter::Iterator;
2497        self.reserved_name = v.into_iter().map(|i| i.into()).collect();
2498        self
2499    }
2500}
2501
2502impl wkt::message::Message for EnumDescriptorProto {
2503    fn typename() -> &'static str {
2504        "type.googleapis.com/google.protobuf.EnumDescriptorProto"
2505    }
2506}
2507
2508/// Defines additional types related to [EnumDescriptorProto].
2509pub mod enum_descriptor_proto {
2510    #[allow(unused_imports)]
2511    use super::*;
2512
2513    /// Range of reserved numeric values. Reserved values may not be used by
2514    /// entries in the same enum. Reserved ranges may not overlap.
2515    ///
2516    /// Note that this is distinct from DescriptorProto.ReservedRange in that it
2517    /// is inclusive such that it can appropriately represent the entire int32
2518    /// domain.
2519    #[derive(Clone, Default, PartialEq)]
2520    #[non_exhaustive]
2521    pub struct EnumReservedRange {
2522        #[allow(missing_docs)]
2523        pub start: i32,
2524
2525        #[allow(missing_docs)]
2526        pub end: i32,
2527
2528        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2529    }
2530
2531    impl EnumReservedRange {
2532        /// Creates a new default instance.
2533        pub fn new() -> Self {
2534            std::default::Default::default()
2535        }
2536
2537        /// Sets the value of [start][crate::enum_descriptor_proto::EnumReservedRange::start].
2538        ///
2539        /// # Example
2540        /// ```ignore,no_run
2541        /// # use google_cloud_wkt::enum_descriptor_proto::EnumReservedRange;
2542        /// let x = EnumReservedRange::new().set_start(42);
2543        /// ```
2544        pub fn set_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2545            self.start = v.into();
2546            self
2547        }
2548
2549        /// Sets the value of [end][crate::enum_descriptor_proto::EnumReservedRange::end].
2550        ///
2551        /// # Example
2552        /// ```ignore,no_run
2553        /// # use google_cloud_wkt::enum_descriptor_proto::EnumReservedRange;
2554        /// let x = EnumReservedRange::new().set_end(42);
2555        /// ```
2556        pub fn set_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2557            self.end = v.into();
2558            self
2559        }
2560    }
2561
2562    impl wkt::message::Message for EnumReservedRange {
2563        fn typename() -> &'static str {
2564            "type.googleapis.com/google.protobuf.EnumDescriptorProto.EnumReservedRange"
2565        }
2566    }
2567}
2568
2569/// Describes a value within an enum.
2570#[derive(Clone, Default, PartialEq)]
2571#[non_exhaustive]
2572pub struct EnumValueDescriptorProto {
2573    #[allow(missing_docs)]
2574    pub name: std::string::String,
2575
2576    #[allow(missing_docs)]
2577    pub number: i32,
2578
2579    #[allow(missing_docs)]
2580    pub options: std::option::Option<crate::EnumValueOptions>,
2581
2582    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2583}
2584
2585impl EnumValueDescriptorProto {
2586    /// Creates a new default instance.
2587    pub fn new() -> Self {
2588        std::default::Default::default()
2589    }
2590
2591    /// Sets the value of [name][crate::EnumValueDescriptorProto::name].
2592    ///
2593    /// # Example
2594    /// ```ignore,no_run
2595    /// # use google_cloud_wkt::EnumValueDescriptorProto;
2596    /// let x = EnumValueDescriptorProto::new().set_name("example");
2597    /// ```
2598    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2599        self.name = v.into();
2600        self
2601    }
2602
2603    /// Sets the value of [number][crate::EnumValueDescriptorProto::number].
2604    ///
2605    /// # Example
2606    /// ```ignore,no_run
2607    /// # use google_cloud_wkt::EnumValueDescriptorProto;
2608    /// let x = EnumValueDescriptorProto::new().set_number(42);
2609    /// ```
2610    pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2611        self.number = v.into();
2612        self
2613    }
2614
2615    /// Sets the value of [options][crate::EnumValueDescriptorProto::options].
2616    ///
2617    /// # Example
2618    /// ```ignore,no_run
2619    /// # use google_cloud_wkt::EnumValueDescriptorProto;
2620    /// use google_cloud_wkt::EnumValueOptions;
2621    /// let x = EnumValueDescriptorProto::new().set_options(EnumValueOptions::default()/* use setters */);
2622    /// ```
2623    pub fn set_options<T>(mut self, v: T) -> Self
2624    where
2625        T: std::convert::Into<crate::EnumValueOptions>,
2626    {
2627        self.options = std::option::Option::Some(v.into());
2628        self
2629    }
2630
2631    /// Sets or clears the value of [options][crate::EnumValueDescriptorProto::options].
2632    ///
2633    /// # Example
2634    /// ```ignore,no_run
2635    /// # use google_cloud_wkt::EnumValueDescriptorProto;
2636    /// use google_cloud_wkt::EnumValueOptions;
2637    /// let x = EnumValueDescriptorProto::new().set_or_clear_options(Some(EnumValueOptions::default()/* use setters */));
2638    /// let x = EnumValueDescriptorProto::new().set_or_clear_options(None::<EnumValueOptions>);
2639    /// ```
2640    pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
2641    where
2642        T: std::convert::Into<crate::EnumValueOptions>,
2643    {
2644        self.options = v.map(|x| x.into());
2645        self
2646    }
2647}
2648
2649impl wkt::message::Message for EnumValueDescriptorProto {
2650    fn typename() -> &'static str {
2651        "type.googleapis.com/google.protobuf.EnumValueDescriptorProto"
2652    }
2653}
2654
2655/// Describes a service.
2656#[derive(Clone, Default, PartialEq)]
2657#[non_exhaustive]
2658pub struct ServiceDescriptorProto {
2659    #[allow(missing_docs)]
2660    pub name: std::string::String,
2661
2662    #[allow(missing_docs)]
2663    pub method: std::vec::Vec<crate::MethodDescriptorProto>,
2664
2665    #[allow(missing_docs)]
2666    pub options: std::option::Option<crate::ServiceOptions>,
2667
2668    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2669}
2670
2671impl ServiceDescriptorProto {
2672    /// Creates a new default instance.
2673    pub fn new() -> Self {
2674        std::default::Default::default()
2675    }
2676
2677    /// Sets the value of [name][crate::ServiceDescriptorProto::name].
2678    ///
2679    /// # Example
2680    /// ```ignore,no_run
2681    /// # use google_cloud_wkt::ServiceDescriptorProto;
2682    /// let x = ServiceDescriptorProto::new().set_name("example");
2683    /// ```
2684    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2685        self.name = v.into();
2686        self
2687    }
2688
2689    /// Sets the value of [method][crate::ServiceDescriptorProto::method].
2690    ///
2691    /// # Example
2692    /// ```ignore,no_run
2693    /// # use google_cloud_wkt::ServiceDescriptorProto;
2694    /// use google_cloud_wkt::MethodDescriptorProto;
2695    /// let x = ServiceDescriptorProto::new()
2696    ///     .set_method([
2697    ///         MethodDescriptorProto::default()/* use setters */,
2698    ///         MethodDescriptorProto::default()/* use (different) setters */,
2699    ///     ]);
2700    /// ```
2701    pub fn set_method<T, V>(mut self, v: T) -> Self
2702    where
2703        T: std::iter::IntoIterator<Item = V>,
2704        V: std::convert::Into<crate::MethodDescriptorProto>,
2705    {
2706        use std::iter::Iterator;
2707        self.method = v.into_iter().map(|i| i.into()).collect();
2708        self
2709    }
2710
2711    /// Sets the value of [options][crate::ServiceDescriptorProto::options].
2712    ///
2713    /// # Example
2714    /// ```ignore,no_run
2715    /// # use google_cloud_wkt::ServiceDescriptorProto;
2716    /// use google_cloud_wkt::ServiceOptions;
2717    /// let x = ServiceDescriptorProto::new().set_options(ServiceOptions::default()/* use setters */);
2718    /// ```
2719    pub fn set_options<T>(mut self, v: T) -> Self
2720    where
2721        T: std::convert::Into<crate::ServiceOptions>,
2722    {
2723        self.options = std::option::Option::Some(v.into());
2724        self
2725    }
2726
2727    /// Sets or clears the value of [options][crate::ServiceDescriptorProto::options].
2728    ///
2729    /// # Example
2730    /// ```ignore,no_run
2731    /// # use google_cloud_wkt::ServiceDescriptorProto;
2732    /// use google_cloud_wkt::ServiceOptions;
2733    /// let x = ServiceDescriptorProto::new().set_or_clear_options(Some(ServiceOptions::default()/* use setters */));
2734    /// let x = ServiceDescriptorProto::new().set_or_clear_options(None::<ServiceOptions>);
2735    /// ```
2736    pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
2737    where
2738        T: std::convert::Into<crate::ServiceOptions>,
2739    {
2740        self.options = v.map(|x| x.into());
2741        self
2742    }
2743}
2744
2745impl wkt::message::Message for ServiceDescriptorProto {
2746    fn typename() -> &'static str {
2747        "type.googleapis.com/google.protobuf.ServiceDescriptorProto"
2748    }
2749}
2750
2751/// Describes a method of a service.
2752#[derive(Clone, Default, PartialEq)]
2753#[non_exhaustive]
2754pub struct MethodDescriptorProto {
2755    #[allow(missing_docs)]
2756    pub name: std::string::String,
2757
2758    /// Input and output type names.  These are resolved in the same way as
2759    /// FieldDescriptorProto.type_name, but must refer to a message type.
2760    pub input_type: std::string::String,
2761
2762    #[allow(missing_docs)]
2763    pub output_type: std::string::String,
2764
2765    #[allow(missing_docs)]
2766    pub options: std::option::Option<crate::MethodOptions>,
2767
2768    /// Identifies if client streams multiple client messages
2769    pub client_streaming: bool,
2770
2771    /// Identifies if server streams multiple server messages
2772    pub server_streaming: bool,
2773
2774    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2775}
2776
2777impl MethodDescriptorProto {
2778    /// Creates a new default instance.
2779    pub fn new() -> Self {
2780        std::default::Default::default()
2781    }
2782
2783    /// Sets the value of [name][crate::MethodDescriptorProto::name].
2784    ///
2785    /// # Example
2786    /// ```ignore,no_run
2787    /// # use google_cloud_wkt::MethodDescriptorProto;
2788    /// let x = MethodDescriptorProto::new().set_name("example");
2789    /// ```
2790    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2791        self.name = v.into();
2792        self
2793    }
2794
2795    /// Sets the value of [input_type][crate::MethodDescriptorProto::input_type].
2796    ///
2797    /// # Example
2798    /// ```ignore,no_run
2799    /// # use google_cloud_wkt::MethodDescriptorProto;
2800    /// let x = MethodDescriptorProto::new().set_input_type("example");
2801    /// ```
2802    pub fn set_input_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2803        self.input_type = v.into();
2804        self
2805    }
2806
2807    /// Sets the value of [output_type][crate::MethodDescriptorProto::output_type].
2808    ///
2809    /// # Example
2810    /// ```ignore,no_run
2811    /// # use google_cloud_wkt::MethodDescriptorProto;
2812    /// let x = MethodDescriptorProto::new().set_output_type("example");
2813    /// ```
2814    pub fn set_output_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2815        self.output_type = v.into();
2816        self
2817    }
2818
2819    /// Sets the value of [options][crate::MethodDescriptorProto::options].
2820    ///
2821    /// # Example
2822    /// ```ignore,no_run
2823    /// # use google_cloud_wkt::MethodDescriptorProto;
2824    /// use google_cloud_wkt::MethodOptions;
2825    /// let x = MethodDescriptorProto::new().set_options(MethodOptions::default()/* use setters */);
2826    /// ```
2827    pub fn set_options<T>(mut self, v: T) -> Self
2828    where
2829        T: std::convert::Into<crate::MethodOptions>,
2830    {
2831        self.options = std::option::Option::Some(v.into());
2832        self
2833    }
2834
2835    /// Sets or clears the value of [options][crate::MethodDescriptorProto::options].
2836    ///
2837    /// # Example
2838    /// ```ignore,no_run
2839    /// # use google_cloud_wkt::MethodDescriptorProto;
2840    /// use google_cloud_wkt::MethodOptions;
2841    /// let x = MethodDescriptorProto::new().set_or_clear_options(Some(MethodOptions::default()/* use setters */));
2842    /// let x = MethodDescriptorProto::new().set_or_clear_options(None::<MethodOptions>);
2843    /// ```
2844    pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
2845    where
2846        T: std::convert::Into<crate::MethodOptions>,
2847    {
2848        self.options = v.map(|x| x.into());
2849        self
2850    }
2851
2852    /// Sets the value of [client_streaming][crate::MethodDescriptorProto::client_streaming].
2853    ///
2854    /// # Example
2855    /// ```ignore,no_run
2856    /// # use google_cloud_wkt::MethodDescriptorProto;
2857    /// let x = MethodDescriptorProto::new().set_client_streaming(true);
2858    /// ```
2859    pub fn set_client_streaming<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2860        self.client_streaming = v.into();
2861        self
2862    }
2863
2864    /// Sets the value of [server_streaming][crate::MethodDescriptorProto::server_streaming].
2865    ///
2866    /// # Example
2867    /// ```ignore,no_run
2868    /// # use google_cloud_wkt::MethodDescriptorProto;
2869    /// let x = MethodDescriptorProto::new().set_server_streaming(true);
2870    /// ```
2871    pub fn set_server_streaming<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2872        self.server_streaming = v.into();
2873        self
2874    }
2875}
2876
2877impl wkt::message::Message for MethodDescriptorProto {
2878    fn typename() -> &'static str {
2879        "type.googleapis.com/google.protobuf.MethodDescriptorProto"
2880    }
2881}
2882
2883#[allow(missing_docs)]
2884#[derive(Clone, Default, PartialEq)]
2885#[non_exhaustive]
2886pub struct FileOptions {
2887    /// Sets the Java package where classes generated from this .proto will be
2888    /// placed.  By default, the proto package is used, but this is often
2889    /// inappropriate because proto packages do not normally start with backwards
2890    /// domain names.
2891    pub java_package: std::string::String,
2892
2893    /// Controls the name of the wrapper Java class generated for the .proto file.
2894    /// That class will always contain the .proto file's getDescriptor() method as
2895    /// well as any top-level extensions defined in the .proto file.
2896    /// If java_multiple_files is disabled, then all the other classes from the
2897    /// .proto file will be nested inside the single wrapper outer class.
2898    pub java_outer_classname: std::string::String,
2899
2900    /// If enabled, then the Java code generator will generate a separate .java
2901    /// file for each top-level message, enum, and service defined in the .proto
2902    /// file.  Thus, these types will *not* be nested inside the wrapper class
2903    /// named by java_outer_classname.  However, the wrapper class will still be
2904    /// generated to contain the file's getDescriptor() method as well as any
2905    /// top-level extensions defined in the file.
2906    pub java_multiple_files: bool,
2907
2908    /// This option does nothing.
2909    #[deprecated]
2910    pub java_generate_equals_and_hash: bool,
2911
2912    /// A proto2 file can set this to true to opt in to UTF-8 checking for Java,
2913    /// which will throw an exception if invalid UTF-8 is parsed from the wire or
2914    /// assigned to a string field.
2915    ///
2916    /// TODO: clarify exactly what kinds of field types this option
2917    /// applies to, and update these docs accordingly.
2918    ///
2919    /// Proto3 files already perform these checks. Setting the option explicitly to
2920    /// false has no effect: it cannot be used to opt proto3 files out of UTF-8
2921    /// checks.
2922    pub java_string_check_utf8: bool,
2923
2924    #[allow(missing_docs)]
2925    pub optimize_for: crate::file_options::OptimizeMode,
2926
2927    /// Sets the Go package where structs generated from this .proto will be
2928    /// placed. If omitted, the Go package will be derived from the following:
2929    ///
2930    /// - The basename of the package import path, if provided.
2931    /// - Otherwise, the package statement in the .proto file, if present.
2932    /// - Otherwise, the basename of the .proto file, without extension.
2933    pub go_package: std::string::String,
2934
2935    /// Should generic services be generated in each language?  "Generic" services
2936    /// are not specific to any particular RPC system.  They are generated by the
2937    /// main code generators in each language (without additional plugins).
2938    /// Generic services were the only kind of service generation supported by
2939    /// early versions of google.protobuf.
2940    ///
2941    /// Generic services are now considered deprecated in favor of using plugins
2942    /// that generate code specific to your particular RPC system.  Therefore,
2943    /// these default to false.  Old code which depends on generic services should
2944    /// explicitly set them to true.
2945    pub cc_generic_services: bool,
2946
2947    #[allow(missing_docs)]
2948    pub java_generic_services: bool,
2949
2950    #[allow(missing_docs)]
2951    pub py_generic_services: bool,
2952
2953    /// Is this file deprecated?
2954    /// Depending on the target platform, this can emit Deprecated annotations
2955    /// for everything in the file, or it will be completely ignored; in the very
2956    /// least, this is a formalization for deprecating files.
2957    pub deprecated: bool,
2958
2959    /// Enables the use of arenas for the proto messages in this file. This applies
2960    /// only to generated classes for C++.
2961    pub cc_enable_arenas: bool,
2962
2963    /// Sets the objective c class prefix which is prepended to all objective c
2964    /// generated classes from this .proto. There is no default.
2965    pub objc_class_prefix: std::string::String,
2966
2967    /// Namespace for generated classes; defaults to the package.
2968    pub csharp_namespace: std::string::String,
2969
2970    /// By default Swift generators will take the proto package and CamelCase it
2971    /// replacing '.' with underscore and use that to prefix the types/symbols
2972    /// defined. When this options is provided, they will use this value instead
2973    /// to prefix the types/symbols defined.
2974    pub swift_prefix: std::string::String,
2975
2976    /// Sets the php class prefix which is prepended to all php generated classes
2977    /// from this .proto. Default is empty.
2978    pub php_class_prefix: std::string::String,
2979
2980    /// Use this option to change the namespace of php generated classes. Default
2981    /// is empty. When this option is empty, the package name will be used for
2982    /// determining the namespace.
2983    pub php_namespace: std::string::String,
2984
2985    /// Use this option to change the namespace of php generated metadata classes.
2986    /// Default is empty. When this option is empty, the proto file name will be
2987    /// used for determining the namespace.
2988    pub php_metadata_namespace: std::string::String,
2989
2990    /// Use this option to change the package of ruby generated classes. Default
2991    /// is empty. When this option is not set, the package name will be used for
2992    /// determining the ruby package.
2993    pub ruby_package: std::string::String,
2994
2995    /// Any features defined in the specific edition.
2996    pub features: std::option::Option<crate::FeatureSet>,
2997
2998    /// The parser stores options it doesn't recognize here.
2999    /// See the documentation for the "Options" section above.
3000    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
3001
3002    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3003}
3004
3005impl FileOptions {
3006    /// Creates a new default instance.
3007    pub fn new() -> Self {
3008        std::default::Default::default()
3009    }
3010
3011    /// Sets the value of [java_package][crate::FileOptions::java_package].
3012    ///
3013    /// # Example
3014    /// ```ignore,no_run
3015    /// # use google_cloud_wkt::FileOptions;
3016    /// let x = FileOptions::new().set_java_package("example");
3017    /// ```
3018    pub fn set_java_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3019        self.java_package = v.into();
3020        self
3021    }
3022
3023    /// Sets the value of [java_outer_classname][crate::FileOptions::java_outer_classname].
3024    ///
3025    /// # Example
3026    /// ```ignore,no_run
3027    /// # use google_cloud_wkt::FileOptions;
3028    /// let x = FileOptions::new().set_java_outer_classname("example");
3029    /// ```
3030    pub fn set_java_outer_classname<T: std::convert::Into<std::string::String>>(
3031        mut self,
3032        v: T,
3033    ) -> Self {
3034        self.java_outer_classname = v.into();
3035        self
3036    }
3037
3038    /// Sets the value of [java_multiple_files][crate::FileOptions::java_multiple_files].
3039    ///
3040    /// # Example
3041    /// ```ignore,no_run
3042    /// # use google_cloud_wkt::FileOptions;
3043    /// let x = FileOptions::new().set_java_multiple_files(true);
3044    /// ```
3045    pub fn set_java_multiple_files<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3046        self.java_multiple_files = v.into();
3047        self
3048    }
3049
3050    /// Sets the value of [java_generate_equals_and_hash][crate::FileOptions::java_generate_equals_and_hash].
3051    ///
3052    /// # Example
3053    /// ```ignore,no_run
3054    /// # use google_cloud_wkt::FileOptions;
3055    /// let x = FileOptions::new().set_java_generate_equals_and_hash(true);
3056    /// ```
3057    #[deprecated]
3058    pub fn set_java_generate_equals_and_hash<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3059        self.java_generate_equals_and_hash = v.into();
3060        self
3061    }
3062
3063    /// Sets the value of [java_string_check_utf8][crate::FileOptions::java_string_check_utf8].
3064    ///
3065    /// # Example
3066    /// ```ignore,no_run
3067    /// # use google_cloud_wkt::FileOptions;
3068    /// let x = FileOptions::new().set_java_string_check_utf8(true);
3069    /// ```
3070    pub fn set_java_string_check_utf8<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3071        self.java_string_check_utf8 = v.into();
3072        self
3073    }
3074
3075    /// Sets the value of [optimize_for][crate::FileOptions::optimize_for].
3076    ///
3077    /// # Example
3078    /// ```ignore,no_run
3079    /// # use google_cloud_wkt::FileOptions;
3080    /// use google_cloud_wkt::file_options::OptimizeMode;
3081    /// let x0 = FileOptions::new().set_optimize_for(OptimizeMode::Speed);
3082    /// let x1 = FileOptions::new().set_optimize_for(OptimizeMode::CodeSize);
3083    /// let x2 = FileOptions::new().set_optimize_for(OptimizeMode::LiteRuntime);
3084    /// ```
3085    pub fn set_optimize_for<T: std::convert::Into<crate::file_options::OptimizeMode>>(
3086        mut self,
3087        v: T,
3088    ) -> Self {
3089        self.optimize_for = v.into();
3090        self
3091    }
3092
3093    /// Sets the value of [go_package][crate::FileOptions::go_package].
3094    ///
3095    /// # Example
3096    /// ```ignore,no_run
3097    /// # use google_cloud_wkt::FileOptions;
3098    /// let x = FileOptions::new().set_go_package("example");
3099    /// ```
3100    pub fn set_go_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3101        self.go_package = v.into();
3102        self
3103    }
3104
3105    /// Sets the value of [cc_generic_services][crate::FileOptions::cc_generic_services].
3106    ///
3107    /// # Example
3108    /// ```ignore,no_run
3109    /// # use google_cloud_wkt::FileOptions;
3110    /// let x = FileOptions::new().set_cc_generic_services(true);
3111    /// ```
3112    pub fn set_cc_generic_services<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3113        self.cc_generic_services = v.into();
3114        self
3115    }
3116
3117    /// Sets the value of [java_generic_services][crate::FileOptions::java_generic_services].
3118    ///
3119    /// # Example
3120    /// ```ignore,no_run
3121    /// # use google_cloud_wkt::FileOptions;
3122    /// let x = FileOptions::new().set_java_generic_services(true);
3123    /// ```
3124    pub fn set_java_generic_services<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3125        self.java_generic_services = v.into();
3126        self
3127    }
3128
3129    /// Sets the value of [py_generic_services][crate::FileOptions::py_generic_services].
3130    ///
3131    /// # Example
3132    /// ```ignore,no_run
3133    /// # use google_cloud_wkt::FileOptions;
3134    /// let x = FileOptions::new().set_py_generic_services(true);
3135    /// ```
3136    pub fn set_py_generic_services<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3137        self.py_generic_services = v.into();
3138        self
3139    }
3140
3141    /// Sets the value of [deprecated][crate::FileOptions::deprecated].
3142    ///
3143    /// # Example
3144    /// ```ignore,no_run
3145    /// # use google_cloud_wkt::FileOptions;
3146    /// let x = FileOptions::new().set_deprecated(true);
3147    /// ```
3148    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3149        self.deprecated = v.into();
3150        self
3151    }
3152
3153    /// Sets the value of [cc_enable_arenas][crate::FileOptions::cc_enable_arenas].
3154    ///
3155    /// # Example
3156    /// ```ignore,no_run
3157    /// # use google_cloud_wkt::FileOptions;
3158    /// let x = FileOptions::new().set_cc_enable_arenas(true);
3159    /// ```
3160    pub fn set_cc_enable_arenas<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3161        self.cc_enable_arenas = v.into();
3162        self
3163    }
3164
3165    /// Sets the value of [objc_class_prefix][crate::FileOptions::objc_class_prefix].
3166    ///
3167    /// # Example
3168    /// ```ignore,no_run
3169    /// # use google_cloud_wkt::FileOptions;
3170    /// let x = FileOptions::new().set_objc_class_prefix("example");
3171    /// ```
3172    pub fn set_objc_class_prefix<T: std::convert::Into<std::string::String>>(
3173        mut self,
3174        v: T,
3175    ) -> Self {
3176        self.objc_class_prefix = v.into();
3177        self
3178    }
3179
3180    /// Sets the value of [csharp_namespace][crate::FileOptions::csharp_namespace].
3181    ///
3182    /// # Example
3183    /// ```ignore,no_run
3184    /// # use google_cloud_wkt::FileOptions;
3185    /// let x = FileOptions::new().set_csharp_namespace("example");
3186    /// ```
3187    pub fn set_csharp_namespace<T: std::convert::Into<std::string::String>>(
3188        mut self,
3189        v: T,
3190    ) -> Self {
3191        self.csharp_namespace = v.into();
3192        self
3193    }
3194
3195    /// Sets the value of [swift_prefix][crate::FileOptions::swift_prefix].
3196    ///
3197    /// # Example
3198    /// ```ignore,no_run
3199    /// # use google_cloud_wkt::FileOptions;
3200    /// let x = FileOptions::new().set_swift_prefix("example");
3201    /// ```
3202    pub fn set_swift_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3203        self.swift_prefix = v.into();
3204        self
3205    }
3206
3207    /// Sets the value of [php_class_prefix][crate::FileOptions::php_class_prefix].
3208    ///
3209    /// # Example
3210    /// ```ignore,no_run
3211    /// # use google_cloud_wkt::FileOptions;
3212    /// let x = FileOptions::new().set_php_class_prefix("example");
3213    /// ```
3214    pub fn set_php_class_prefix<T: std::convert::Into<std::string::String>>(
3215        mut self,
3216        v: T,
3217    ) -> Self {
3218        self.php_class_prefix = v.into();
3219        self
3220    }
3221
3222    /// Sets the value of [php_namespace][crate::FileOptions::php_namespace].
3223    ///
3224    /// # Example
3225    /// ```ignore,no_run
3226    /// # use google_cloud_wkt::FileOptions;
3227    /// let x = FileOptions::new().set_php_namespace("example");
3228    /// ```
3229    pub fn set_php_namespace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3230        self.php_namespace = v.into();
3231        self
3232    }
3233
3234    /// Sets the value of [php_metadata_namespace][crate::FileOptions::php_metadata_namespace].
3235    ///
3236    /// # Example
3237    /// ```ignore,no_run
3238    /// # use google_cloud_wkt::FileOptions;
3239    /// let x = FileOptions::new().set_php_metadata_namespace("example");
3240    /// ```
3241    pub fn set_php_metadata_namespace<T: std::convert::Into<std::string::String>>(
3242        mut self,
3243        v: T,
3244    ) -> Self {
3245        self.php_metadata_namespace = v.into();
3246        self
3247    }
3248
3249    /// Sets the value of [ruby_package][crate::FileOptions::ruby_package].
3250    ///
3251    /// # Example
3252    /// ```ignore,no_run
3253    /// # use google_cloud_wkt::FileOptions;
3254    /// let x = FileOptions::new().set_ruby_package("example");
3255    /// ```
3256    pub fn set_ruby_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3257        self.ruby_package = v.into();
3258        self
3259    }
3260
3261    /// Sets the value of [features][crate::FileOptions::features].
3262    ///
3263    /// # Example
3264    /// ```ignore,no_run
3265    /// # use google_cloud_wkt::FileOptions;
3266    /// use google_cloud_wkt::FeatureSet;
3267    /// let x = FileOptions::new().set_features(FeatureSet::default()/* use setters */);
3268    /// ```
3269    pub fn set_features<T>(mut self, v: T) -> Self
3270    where
3271        T: std::convert::Into<crate::FeatureSet>,
3272    {
3273        self.features = std::option::Option::Some(v.into());
3274        self
3275    }
3276
3277    /// Sets or clears the value of [features][crate::FileOptions::features].
3278    ///
3279    /// # Example
3280    /// ```ignore,no_run
3281    /// # use google_cloud_wkt::FileOptions;
3282    /// use google_cloud_wkt::FeatureSet;
3283    /// let x = FileOptions::new().set_or_clear_features(Some(FeatureSet::default()/* use setters */));
3284    /// let x = FileOptions::new().set_or_clear_features(None::<FeatureSet>);
3285    /// ```
3286    pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
3287    where
3288        T: std::convert::Into<crate::FeatureSet>,
3289    {
3290        self.features = v.map(|x| x.into());
3291        self
3292    }
3293
3294    /// Sets the value of [uninterpreted_option][crate::FileOptions::uninterpreted_option].
3295    ///
3296    /// # Example
3297    /// ```ignore,no_run
3298    /// # use google_cloud_wkt::FileOptions;
3299    /// use google_cloud_wkt::UninterpretedOption;
3300    /// let x = FileOptions::new()
3301    ///     .set_uninterpreted_option([
3302    ///         UninterpretedOption::default()/* use setters */,
3303    ///         UninterpretedOption::default()/* use (different) setters */,
3304    ///     ]);
3305    /// ```
3306    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
3307    where
3308        T: std::iter::IntoIterator<Item = V>,
3309        V: std::convert::Into<crate::UninterpretedOption>,
3310    {
3311        use std::iter::Iterator;
3312        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
3313        self
3314    }
3315}
3316
3317impl wkt::message::Message for FileOptions {
3318    fn typename() -> &'static str {
3319        "type.googleapis.com/google.protobuf.FileOptions"
3320    }
3321}
3322
3323/// Defines additional types related to [FileOptions].
3324pub mod file_options {
3325    #[allow(unused_imports)]
3326    use super::*;
3327
3328    /// Generated classes can be optimized for speed or code size.
3329    ///
3330    /// # Working with unknown values
3331    ///
3332    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3333    /// additional enum variants at any time. Adding new variants is not considered
3334    /// a breaking change. Applications should write their code in anticipation of:
3335    ///
3336    /// - New values appearing in future releases of the client library, **and**
3337    /// - New values received dynamically, without application changes.
3338    ///
3339    /// Please consult the [Working with enums] section in the user guide for some
3340    /// guidelines.
3341    ///
3342    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3343    #[derive(Clone, Debug, PartialEq)]
3344    #[non_exhaustive]
3345    pub enum OptimizeMode {
3346        #[allow(missing_docs)]
3347        Speed,
3348        /// etc.
3349        CodeSize,
3350        #[allow(missing_docs)]
3351        LiteRuntime,
3352        /// If set, the enum was initialized with an unknown value.
3353        ///
3354        /// Applications can examine the value using [OptimizeMode::value] or
3355        /// [OptimizeMode::name].
3356        UnknownValue(optimize_mode::UnknownValue),
3357    }
3358
3359    #[doc(hidden)]
3360    pub mod optimize_mode {
3361        #[allow(unused_imports)]
3362        use super::*;
3363        #[derive(Clone, Debug, PartialEq)]
3364        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3365    }
3366
3367    impl OptimizeMode {
3368        /// Gets the enum value.
3369        ///
3370        /// Returns `None` if the enum contains an unknown value deserialized from
3371        /// the string representation of enums.
3372        pub fn value(&self) -> std::option::Option<i32> {
3373            match self {
3374                Self::Speed => std::option::Option::Some(1),
3375                Self::CodeSize => std::option::Option::Some(2),
3376                Self::LiteRuntime => std::option::Option::Some(3),
3377                Self::UnknownValue(u) => u.0.value(),
3378            }
3379        }
3380
3381        /// Gets the enum value as a string.
3382        ///
3383        /// Returns `None` if the enum contains an unknown value deserialized from
3384        /// the integer representation of enums.
3385        pub fn name(&self) -> std::option::Option<&str> {
3386            match self {
3387                Self::Speed => std::option::Option::Some("SPEED"),
3388                Self::CodeSize => std::option::Option::Some("CODE_SIZE"),
3389                Self::LiteRuntime => std::option::Option::Some("LITE_RUNTIME"),
3390                Self::UnknownValue(u) => u.0.name(),
3391            }
3392        }
3393    }
3394
3395    impl std::default::Default for OptimizeMode {
3396        fn default() -> Self {
3397            use std::convert::From;
3398            Self::from(0)
3399        }
3400    }
3401
3402    impl std::fmt::Display for OptimizeMode {
3403        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3404            wkt::internal::display_enum(f, self.name(), self.value())
3405        }
3406    }
3407
3408    impl std::convert::From<i32> for OptimizeMode {
3409        fn from(value: i32) -> Self {
3410            match value {
3411                1 => Self::Speed,
3412                2 => Self::CodeSize,
3413                3 => Self::LiteRuntime,
3414                _ => Self::UnknownValue(optimize_mode::UnknownValue(
3415                    wkt::internal::UnknownEnumValue::Integer(value),
3416                )),
3417            }
3418        }
3419    }
3420
3421    impl std::convert::From<&str> for OptimizeMode {
3422        fn from(value: &str) -> Self {
3423            use std::string::ToString;
3424            match value {
3425                "SPEED" => Self::Speed,
3426                "CODE_SIZE" => Self::CodeSize,
3427                "LITE_RUNTIME" => Self::LiteRuntime,
3428                _ => Self::UnknownValue(optimize_mode::UnknownValue(
3429                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3430                )),
3431            }
3432        }
3433    }
3434
3435    impl serde::ser::Serialize for OptimizeMode {
3436        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3437        where
3438            S: serde::Serializer,
3439        {
3440            match self {
3441                Self::Speed => serializer.serialize_i32(1),
3442                Self::CodeSize => serializer.serialize_i32(2),
3443                Self::LiteRuntime => serializer.serialize_i32(3),
3444                Self::UnknownValue(u) => u.0.serialize(serializer),
3445            }
3446        }
3447    }
3448
3449    impl<'de> serde::de::Deserialize<'de> for OptimizeMode {
3450        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3451        where
3452            D: serde::Deserializer<'de>,
3453        {
3454            deserializer.deserialize_any(wkt::internal::EnumVisitor::<OptimizeMode>::new(
3455                ".google.protobuf.FileOptions.OptimizeMode",
3456            ))
3457        }
3458    }
3459}
3460
3461#[allow(missing_docs)]
3462#[derive(Clone, Default, PartialEq)]
3463#[non_exhaustive]
3464pub struct MessageOptions {
3465    /// Set true to use the old proto1 MessageSet wire format for extensions.
3466    /// This is provided for backwards-compatibility with the MessageSet wire
3467    /// format.  You should not use this for any other reason:  It's less
3468    /// efficient, has fewer features, and is more complicated.
3469    ///
3470    /// The message must be defined exactly as follows:
3471    /// message Foo {
3472    /// option message_set_wire_format = true;
3473    /// extensions 4 to max;
3474    /// }
3475    /// Note that the message cannot have any defined fields; MessageSets only
3476    /// have extensions.
3477    ///
3478    /// All extensions of your type must be singular messages; e.g. they cannot
3479    /// be int32s, enums, or repeated messages.
3480    ///
3481    /// Because this is an option, the above two restrictions are not enforced by
3482    /// the protocol compiler.
3483    pub message_set_wire_format: bool,
3484
3485    /// Disables the generation of the standard "descriptor()" accessor, which can
3486    /// conflict with a field of the same name.  This is meant to make migration
3487    /// from proto1 easier; new code should avoid fields named "descriptor".
3488    pub no_standard_descriptor_accessor: bool,
3489
3490    /// Is this message deprecated?
3491    /// Depending on the target platform, this can emit Deprecated annotations
3492    /// for the message, or it will be completely ignored; in the very least,
3493    /// this is a formalization for deprecating messages.
3494    pub deprecated: bool,
3495
3496    /// Whether the message is an automatically generated map entry type for the
3497    /// maps field.
3498    ///
3499    /// For maps fields:
3500    /// map<KeyType, ValueType> map_field = 1;
3501    /// The parsed descriptor looks like:
3502    /// message MapFieldEntry {
3503    /// option map_entry = true;
3504    /// optional KeyType key = 1;
3505    /// optional ValueType value = 2;
3506    /// }
3507    /// repeated MapFieldEntry map_field = 1;
3508    ///
3509    /// Implementations may choose not to generate the map_entry=true message, but
3510    /// use a native map in the target language to hold the keys and values.
3511    /// The reflection APIs in such implementations still need to work as
3512    /// if the field is a repeated message field.
3513    ///
3514    /// NOTE: Do not set the option in .proto files. Always use the maps syntax
3515    /// instead. The option should only be implicitly set by the proto compiler
3516    /// parser.
3517    pub map_entry: bool,
3518
3519    /// Enable the legacy handling of JSON field name conflicts.  This lowercases
3520    /// and strips underscored from the fields before comparison in proto3 only.
3521    /// The new behavior takes `json_name` into account and applies to proto2 as
3522    /// well.
3523    ///
3524    /// This should only be used as a temporary measure against broken builds due
3525    /// to the change in behavior for JSON field name conflicts.
3526    ///
3527    /// TODO This is legacy behavior we plan to remove once downstream
3528    /// teams have had time to migrate.
3529    #[deprecated]
3530    pub deprecated_legacy_json_field_conflicts: bool,
3531
3532    /// Any features defined in the specific edition.
3533    pub features: std::option::Option<crate::FeatureSet>,
3534
3535    /// The parser stores options it doesn't recognize here. See above.
3536    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
3537
3538    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3539}
3540
3541impl MessageOptions {
3542    /// Creates a new default instance.
3543    pub fn new() -> Self {
3544        std::default::Default::default()
3545    }
3546
3547    /// Sets the value of [message_set_wire_format][crate::MessageOptions::message_set_wire_format].
3548    ///
3549    /// # Example
3550    /// ```ignore,no_run
3551    /// # use google_cloud_wkt::MessageOptions;
3552    /// let x = MessageOptions::new().set_message_set_wire_format(true);
3553    /// ```
3554    pub fn set_message_set_wire_format<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3555        self.message_set_wire_format = v.into();
3556        self
3557    }
3558
3559    /// Sets the value of [no_standard_descriptor_accessor][crate::MessageOptions::no_standard_descriptor_accessor].
3560    ///
3561    /// # Example
3562    /// ```ignore,no_run
3563    /// # use google_cloud_wkt::MessageOptions;
3564    /// let x = MessageOptions::new().set_no_standard_descriptor_accessor(true);
3565    /// ```
3566    pub fn set_no_standard_descriptor_accessor<T: std::convert::Into<bool>>(
3567        mut self,
3568        v: T,
3569    ) -> Self {
3570        self.no_standard_descriptor_accessor = v.into();
3571        self
3572    }
3573
3574    /// Sets the value of [deprecated][crate::MessageOptions::deprecated].
3575    ///
3576    /// # Example
3577    /// ```ignore,no_run
3578    /// # use google_cloud_wkt::MessageOptions;
3579    /// let x = MessageOptions::new().set_deprecated(true);
3580    /// ```
3581    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3582        self.deprecated = v.into();
3583        self
3584    }
3585
3586    /// Sets the value of [map_entry][crate::MessageOptions::map_entry].
3587    ///
3588    /// # Example
3589    /// ```ignore,no_run
3590    /// # use google_cloud_wkt::MessageOptions;
3591    /// let x = MessageOptions::new().set_map_entry(true);
3592    /// ```
3593    pub fn set_map_entry<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3594        self.map_entry = v.into();
3595        self
3596    }
3597
3598    /// Sets the value of [deprecated_legacy_json_field_conflicts][crate::MessageOptions::deprecated_legacy_json_field_conflicts].
3599    ///
3600    /// # Example
3601    /// ```ignore,no_run
3602    /// # use google_cloud_wkt::MessageOptions;
3603    /// let x = MessageOptions::new().set_deprecated_legacy_json_field_conflicts(true);
3604    /// ```
3605    #[deprecated]
3606    pub fn set_deprecated_legacy_json_field_conflicts<T: std::convert::Into<bool>>(
3607        mut self,
3608        v: T,
3609    ) -> Self {
3610        self.deprecated_legacy_json_field_conflicts = v.into();
3611        self
3612    }
3613
3614    /// Sets the value of [features][crate::MessageOptions::features].
3615    ///
3616    /// # Example
3617    /// ```ignore,no_run
3618    /// # use google_cloud_wkt::MessageOptions;
3619    /// use google_cloud_wkt::FeatureSet;
3620    /// let x = MessageOptions::new().set_features(FeatureSet::default()/* use setters */);
3621    /// ```
3622    pub fn set_features<T>(mut self, v: T) -> Self
3623    where
3624        T: std::convert::Into<crate::FeatureSet>,
3625    {
3626        self.features = std::option::Option::Some(v.into());
3627        self
3628    }
3629
3630    /// Sets or clears the value of [features][crate::MessageOptions::features].
3631    ///
3632    /// # Example
3633    /// ```ignore,no_run
3634    /// # use google_cloud_wkt::MessageOptions;
3635    /// use google_cloud_wkt::FeatureSet;
3636    /// let x = MessageOptions::new().set_or_clear_features(Some(FeatureSet::default()/* use setters */));
3637    /// let x = MessageOptions::new().set_or_clear_features(None::<FeatureSet>);
3638    /// ```
3639    pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
3640    where
3641        T: std::convert::Into<crate::FeatureSet>,
3642    {
3643        self.features = v.map(|x| x.into());
3644        self
3645    }
3646
3647    /// Sets the value of [uninterpreted_option][crate::MessageOptions::uninterpreted_option].
3648    ///
3649    /// # Example
3650    /// ```ignore,no_run
3651    /// # use google_cloud_wkt::MessageOptions;
3652    /// use google_cloud_wkt::UninterpretedOption;
3653    /// let x = MessageOptions::new()
3654    ///     .set_uninterpreted_option([
3655    ///         UninterpretedOption::default()/* use setters */,
3656    ///         UninterpretedOption::default()/* use (different) setters */,
3657    ///     ]);
3658    /// ```
3659    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
3660    where
3661        T: std::iter::IntoIterator<Item = V>,
3662        V: std::convert::Into<crate::UninterpretedOption>,
3663    {
3664        use std::iter::Iterator;
3665        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
3666        self
3667    }
3668}
3669
3670impl wkt::message::Message for MessageOptions {
3671    fn typename() -> &'static str {
3672        "type.googleapis.com/google.protobuf.MessageOptions"
3673    }
3674}
3675
3676#[allow(missing_docs)]
3677#[derive(Clone, Default, PartialEq)]
3678#[non_exhaustive]
3679pub struct FieldOptions {
3680    /// NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead.
3681    /// The ctype option instructs the C++ code generator to use a different
3682    /// representation of the field than it normally would.  See the specific
3683    /// options below.  This option is only implemented to support use of
3684    /// [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of
3685    /// type "bytes" in the open source release.
3686    /// TODO: make ctype actually deprecated.
3687    pub ctype: crate::field_options::CType,
3688
3689    /// The packed option can be enabled for repeated primitive fields to enable
3690    /// a more efficient representation on the wire. Rather than repeatedly
3691    /// writing the tag and type for each element, the entire array is encoded as
3692    /// a single length-delimited blob. In proto3, only explicit setting it to
3693    /// false will avoid using packed encoding.  This option is prohibited in
3694    /// Editions, but the `repeated_field_encoding` feature can be used to control
3695    /// the behavior.
3696    pub packed: bool,
3697
3698    /// The jstype option determines the JavaScript type used for values of the
3699    /// field.  The option is permitted only for 64 bit integral and fixed types
3700    /// (int64, uint64, sint64, fixed64, sfixed64).  A field with jstype JS_STRING
3701    /// is represented as JavaScript string, which avoids loss of precision that
3702    /// can happen when a large value is converted to a floating point JavaScript.
3703    /// Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
3704    /// use the JavaScript "number" type.  The behavior of the default option
3705    /// JS_NORMAL is implementation dependent.
3706    ///
3707    /// This option is an enum to permit additional types to be added, e.g.
3708    /// goog.math.Integer.
3709    pub jstype: crate::field_options::JSType,
3710
3711    /// Should this field be parsed lazily?  Lazy applies only to message-type
3712    /// fields.  It means that when the outer message is initially parsed, the
3713    /// inner message's contents will not be parsed but instead stored in encoded
3714    /// form.  The inner message will actually be parsed when it is first accessed.
3715    ///
3716    /// This is only a hint.  Implementations are free to choose whether to use
3717    /// eager or lazy parsing regardless of the value of this option.  However,
3718    /// setting this option true suggests that the protocol author believes that
3719    /// using lazy parsing on this field is worth the additional bookkeeping
3720    /// overhead typically needed to implement it.
3721    ///
3722    /// This option does not affect the public interface of any generated code;
3723    /// all method signatures remain the same.  Furthermore, thread-safety of the
3724    /// interface is not affected by this option; const methods remain safe to
3725    /// call from multiple threads concurrently, while non-const methods continue
3726    /// to require exclusive access.
3727    ///
3728    /// Note that lazy message fields are still eagerly verified to check
3729    /// ill-formed wireformat or missing required fields. Calling IsInitialized()
3730    /// on the outer message would fail if the inner message has missing required
3731    /// fields. Failed verification would result in parsing failure (except when
3732    /// uninitialized messages are acceptable).
3733    pub lazy: bool,
3734
3735    /// unverified_lazy does no correctness checks on the byte stream. This should
3736    /// only be used where lazy with verification is prohibitive for performance
3737    /// reasons.
3738    pub unverified_lazy: bool,
3739
3740    /// Is this field deprecated?
3741    /// Depending on the target platform, this can emit Deprecated annotations
3742    /// for accessors, or it will be completely ignored; in the very least, this
3743    /// is a formalization for deprecating fields.
3744    pub deprecated: bool,
3745
3746    /// For Google-internal migration only. Do not use.
3747    pub weak: bool,
3748
3749    /// Indicate that the field value should not be printed out when using debug
3750    /// formats, e.g. when the field contains sensitive credentials.
3751    pub debug_redact: bool,
3752
3753    #[allow(missing_docs)]
3754    pub retention: crate::field_options::OptionRetention,
3755
3756    #[allow(missing_docs)]
3757    pub targets: std::vec::Vec<crate::field_options::OptionTargetType>,
3758
3759    #[allow(missing_docs)]
3760    pub edition_defaults: std::vec::Vec<crate::field_options::EditionDefault>,
3761
3762    /// Any features defined in the specific edition.
3763    pub features: std::option::Option<crate::FeatureSet>,
3764
3765    #[allow(missing_docs)]
3766    pub feature_support: std::option::Option<crate::field_options::FeatureSupport>,
3767
3768    /// The parser stores options it doesn't recognize here. See above.
3769    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
3770
3771    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3772}
3773
3774impl FieldOptions {
3775    /// Creates a new default instance.
3776    pub fn new() -> Self {
3777        std::default::Default::default()
3778    }
3779
3780    /// Sets the value of [ctype][crate::FieldOptions::ctype].
3781    ///
3782    /// # Example
3783    /// ```ignore,no_run
3784    /// # use google_cloud_wkt::FieldOptions;
3785    /// use google_cloud_wkt::field_options::CType;
3786    /// let x0 = FieldOptions::new().set_ctype(CType::Cord);
3787    /// let x1 = FieldOptions::new().set_ctype(CType::StringPiece);
3788    /// ```
3789    pub fn set_ctype<T: std::convert::Into<crate::field_options::CType>>(mut self, v: T) -> Self {
3790        self.ctype = v.into();
3791        self
3792    }
3793
3794    /// Sets the value of [packed][crate::FieldOptions::packed].
3795    ///
3796    /// # Example
3797    /// ```ignore,no_run
3798    /// # use google_cloud_wkt::FieldOptions;
3799    /// let x = FieldOptions::new().set_packed(true);
3800    /// ```
3801    pub fn set_packed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3802        self.packed = v.into();
3803        self
3804    }
3805
3806    /// Sets the value of [jstype][crate::FieldOptions::jstype].
3807    ///
3808    /// # Example
3809    /// ```ignore,no_run
3810    /// # use google_cloud_wkt::FieldOptions;
3811    /// use google_cloud_wkt::field_options::JSType;
3812    /// let x0 = FieldOptions::new().set_jstype(JSType::JsString);
3813    /// let x1 = FieldOptions::new().set_jstype(JSType::JsNumber);
3814    /// ```
3815    pub fn set_jstype<T: std::convert::Into<crate::field_options::JSType>>(mut self, v: T) -> Self {
3816        self.jstype = v.into();
3817        self
3818    }
3819
3820    /// Sets the value of [lazy][crate::FieldOptions::lazy].
3821    ///
3822    /// # Example
3823    /// ```ignore,no_run
3824    /// # use google_cloud_wkt::FieldOptions;
3825    /// let x = FieldOptions::new().set_lazy(true);
3826    /// ```
3827    pub fn set_lazy<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3828        self.lazy = v.into();
3829        self
3830    }
3831
3832    /// Sets the value of [unverified_lazy][crate::FieldOptions::unverified_lazy].
3833    ///
3834    /// # Example
3835    /// ```ignore,no_run
3836    /// # use google_cloud_wkt::FieldOptions;
3837    /// let x = FieldOptions::new().set_unverified_lazy(true);
3838    /// ```
3839    pub fn set_unverified_lazy<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3840        self.unverified_lazy = v.into();
3841        self
3842    }
3843
3844    /// Sets the value of [deprecated][crate::FieldOptions::deprecated].
3845    ///
3846    /// # Example
3847    /// ```ignore,no_run
3848    /// # use google_cloud_wkt::FieldOptions;
3849    /// let x = FieldOptions::new().set_deprecated(true);
3850    /// ```
3851    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3852        self.deprecated = v.into();
3853        self
3854    }
3855
3856    /// Sets the value of [weak][crate::FieldOptions::weak].
3857    ///
3858    /// # Example
3859    /// ```ignore,no_run
3860    /// # use google_cloud_wkt::FieldOptions;
3861    /// let x = FieldOptions::new().set_weak(true);
3862    /// ```
3863    pub fn set_weak<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3864        self.weak = v.into();
3865        self
3866    }
3867
3868    /// Sets the value of [debug_redact][crate::FieldOptions::debug_redact].
3869    ///
3870    /// # Example
3871    /// ```ignore,no_run
3872    /// # use google_cloud_wkt::FieldOptions;
3873    /// let x = FieldOptions::new().set_debug_redact(true);
3874    /// ```
3875    pub fn set_debug_redact<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3876        self.debug_redact = v.into();
3877        self
3878    }
3879
3880    /// Sets the value of [retention][crate::FieldOptions::retention].
3881    ///
3882    /// # Example
3883    /// ```ignore,no_run
3884    /// # use google_cloud_wkt::FieldOptions;
3885    /// use google_cloud_wkt::field_options::OptionRetention;
3886    /// let x0 = FieldOptions::new().set_retention(OptionRetention::RetentionRuntime);
3887    /// let x1 = FieldOptions::new().set_retention(OptionRetention::RetentionSource);
3888    /// ```
3889    pub fn set_retention<T: std::convert::Into<crate::field_options::OptionRetention>>(
3890        mut self,
3891        v: T,
3892    ) -> Self {
3893        self.retention = v.into();
3894        self
3895    }
3896
3897    /// Sets the value of [targets][crate::FieldOptions::targets].
3898    ///
3899    /// # Example
3900    /// ```ignore,no_run
3901    /// # use google_cloud_wkt::FieldOptions;
3902    /// use google_cloud_wkt::field_options::OptionTargetType;
3903    /// let x = FieldOptions::new().set_targets([
3904    ///     OptionTargetType::TargetTypeFile,
3905    ///     OptionTargetType::TargetTypeExtensionRange,
3906    ///     OptionTargetType::TargetTypeMessage,
3907    /// ]);
3908    /// ```
3909    pub fn set_targets<T, V>(mut self, v: T) -> Self
3910    where
3911        T: std::iter::IntoIterator<Item = V>,
3912        V: std::convert::Into<crate::field_options::OptionTargetType>,
3913    {
3914        use std::iter::Iterator;
3915        self.targets = v.into_iter().map(|i| i.into()).collect();
3916        self
3917    }
3918
3919    /// Sets the value of [edition_defaults][crate::FieldOptions::edition_defaults].
3920    ///
3921    /// # Example
3922    /// ```ignore,no_run
3923    /// # use google_cloud_wkt::FieldOptions;
3924    /// use google_cloud_wkt::field_options::EditionDefault;
3925    /// let x = FieldOptions::new()
3926    ///     .set_edition_defaults([
3927    ///         EditionDefault::default()/* use setters */,
3928    ///         EditionDefault::default()/* use (different) setters */,
3929    ///     ]);
3930    /// ```
3931    pub fn set_edition_defaults<T, V>(mut self, v: T) -> Self
3932    where
3933        T: std::iter::IntoIterator<Item = V>,
3934        V: std::convert::Into<crate::field_options::EditionDefault>,
3935    {
3936        use std::iter::Iterator;
3937        self.edition_defaults = v.into_iter().map(|i| i.into()).collect();
3938        self
3939    }
3940
3941    /// Sets the value of [features][crate::FieldOptions::features].
3942    ///
3943    /// # Example
3944    /// ```ignore,no_run
3945    /// # use google_cloud_wkt::FieldOptions;
3946    /// use google_cloud_wkt::FeatureSet;
3947    /// let x = FieldOptions::new().set_features(FeatureSet::default()/* use setters */);
3948    /// ```
3949    pub fn set_features<T>(mut self, v: T) -> Self
3950    where
3951        T: std::convert::Into<crate::FeatureSet>,
3952    {
3953        self.features = std::option::Option::Some(v.into());
3954        self
3955    }
3956
3957    /// Sets or clears the value of [features][crate::FieldOptions::features].
3958    ///
3959    /// # Example
3960    /// ```ignore,no_run
3961    /// # use google_cloud_wkt::FieldOptions;
3962    /// use google_cloud_wkt::FeatureSet;
3963    /// let x = FieldOptions::new().set_or_clear_features(Some(FeatureSet::default()/* use setters */));
3964    /// let x = FieldOptions::new().set_or_clear_features(None::<FeatureSet>);
3965    /// ```
3966    pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
3967    where
3968        T: std::convert::Into<crate::FeatureSet>,
3969    {
3970        self.features = v.map(|x| x.into());
3971        self
3972    }
3973
3974    /// Sets the value of [feature_support][crate::FieldOptions::feature_support].
3975    ///
3976    /// # Example
3977    /// ```ignore,no_run
3978    /// # use google_cloud_wkt::FieldOptions;
3979    /// use google_cloud_wkt::field_options::FeatureSupport;
3980    /// let x = FieldOptions::new().set_feature_support(FeatureSupport::default()/* use setters */);
3981    /// ```
3982    pub fn set_feature_support<T>(mut self, v: T) -> Self
3983    where
3984        T: std::convert::Into<crate::field_options::FeatureSupport>,
3985    {
3986        self.feature_support = std::option::Option::Some(v.into());
3987        self
3988    }
3989
3990    /// Sets or clears the value of [feature_support][crate::FieldOptions::feature_support].
3991    ///
3992    /// # Example
3993    /// ```ignore,no_run
3994    /// # use google_cloud_wkt::FieldOptions;
3995    /// use google_cloud_wkt::field_options::FeatureSupport;
3996    /// let x = FieldOptions::new().set_or_clear_feature_support(Some(FeatureSupport::default()/* use setters */));
3997    /// let x = FieldOptions::new().set_or_clear_feature_support(None::<FeatureSupport>);
3998    /// ```
3999    pub fn set_or_clear_feature_support<T>(mut self, v: std::option::Option<T>) -> Self
4000    where
4001        T: std::convert::Into<crate::field_options::FeatureSupport>,
4002    {
4003        self.feature_support = v.map(|x| x.into());
4004        self
4005    }
4006
4007    /// Sets the value of [uninterpreted_option][crate::FieldOptions::uninterpreted_option].
4008    ///
4009    /// # Example
4010    /// ```ignore,no_run
4011    /// # use google_cloud_wkt::FieldOptions;
4012    /// use google_cloud_wkt::UninterpretedOption;
4013    /// let x = FieldOptions::new()
4014    ///     .set_uninterpreted_option([
4015    ///         UninterpretedOption::default()/* use setters */,
4016    ///         UninterpretedOption::default()/* use (different) setters */,
4017    ///     ]);
4018    /// ```
4019    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
4020    where
4021        T: std::iter::IntoIterator<Item = V>,
4022        V: std::convert::Into<crate::UninterpretedOption>,
4023    {
4024        use std::iter::Iterator;
4025        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
4026        self
4027    }
4028}
4029
4030impl wkt::message::Message for FieldOptions {
4031    fn typename() -> &'static str {
4032        "type.googleapis.com/google.protobuf.FieldOptions"
4033    }
4034}
4035
4036/// Defines additional types related to [FieldOptions].
4037pub mod field_options {
4038    #[allow(unused_imports)]
4039    use super::*;
4040
4041    #[allow(missing_docs)]
4042    #[derive(Clone, Default, PartialEq)]
4043    #[non_exhaustive]
4044    pub struct EditionDefault {
4045        #[allow(missing_docs)]
4046        pub edition: crate::Edition,
4047
4048        #[allow(missing_docs)]
4049        pub value: std::string::String,
4050
4051        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4052    }
4053
4054    impl EditionDefault {
4055        /// Creates a new default instance.
4056        pub fn new() -> Self {
4057            std::default::Default::default()
4058        }
4059
4060        /// Sets the value of [edition][crate::field_options::EditionDefault::edition].
4061        ///
4062        /// # Example
4063        /// ```ignore,no_run
4064        /// # use google_cloud_wkt::field_options::EditionDefault;
4065        /// use google_cloud_wkt::Edition;
4066        /// let x0 = EditionDefault::new().set_edition(Edition::Legacy);
4067        /// let x1 = EditionDefault::new().set_edition(Edition::Proto2);
4068        /// let x2 = EditionDefault::new().set_edition(Edition::Proto3);
4069        /// ```
4070        pub fn set_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
4071            self.edition = v.into();
4072            self
4073        }
4074
4075        /// Sets the value of [value][crate::field_options::EditionDefault::value].
4076        ///
4077        /// # Example
4078        /// ```ignore,no_run
4079        /// # use google_cloud_wkt::field_options::EditionDefault;
4080        /// let x = EditionDefault::new().set_value("example");
4081        /// ```
4082        pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4083            self.value = v.into();
4084            self
4085        }
4086    }
4087
4088    impl wkt::message::Message for EditionDefault {
4089        fn typename() -> &'static str {
4090            "type.googleapis.com/google.protobuf.FieldOptions.EditionDefault"
4091        }
4092    }
4093
4094    /// Information about the support window of a feature.
4095    #[derive(Clone, Default, PartialEq)]
4096    #[non_exhaustive]
4097    pub struct FeatureSupport {
4098        /// The edition that this feature was first available in.  In editions
4099        /// earlier than this one, the default assigned to EDITION_LEGACY will be
4100        /// used, and proto files will not be able to override it.
4101        pub edition_introduced: crate::Edition,
4102
4103        /// The edition this feature becomes deprecated in.  Using this after this
4104        /// edition may trigger warnings.
4105        pub edition_deprecated: crate::Edition,
4106
4107        /// The deprecation warning text if this feature is used after the edition it
4108        /// was marked deprecated in.
4109        pub deprecation_warning: std::string::String,
4110
4111        /// The edition this feature is no longer available in.  In editions after
4112        /// this one, the last default assigned will be used, and proto files will
4113        /// not be able to override it.
4114        pub edition_removed: crate::Edition,
4115
4116        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4117    }
4118
4119    impl FeatureSupport {
4120        /// Creates a new default instance.
4121        pub fn new() -> Self {
4122            std::default::Default::default()
4123        }
4124
4125        /// Sets the value of [edition_introduced][crate::field_options::FeatureSupport::edition_introduced].
4126        ///
4127        /// # Example
4128        /// ```ignore,no_run
4129        /// # use google_cloud_wkt::field_options::FeatureSupport;
4130        /// use google_cloud_wkt::Edition;
4131        /// let x0 = FeatureSupport::new().set_edition_introduced(Edition::Legacy);
4132        /// let x1 = FeatureSupport::new().set_edition_introduced(Edition::Proto2);
4133        /// let x2 = FeatureSupport::new().set_edition_introduced(Edition::Proto3);
4134        /// ```
4135        pub fn set_edition_introduced<T: std::convert::Into<crate::Edition>>(
4136            mut self,
4137            v: T,
4138        ) -> Self {
4139            self.edition_introduced = v.into();
4140            self
4141        }
4142
4143        /// Sets the value of [edition_deprecated][crate::field_options::FeatureSupport::edition_deprecated].
4144        ///
4145        /// # Example
4146        /// ```ignore,no_run
4147        /// # use google_cloud_wkt::field_options::FeatureSupport;
4148        /// use google_cloud_wkt::Edition;
4149        /// let x0 = FeatureSupport::new().set_edition_deprecated(Edition::Legacy);
4150        /// let x1 = FeatureSupport::new().set_edition_deprecated(Edition::Proto2);
4151        /// let x2 = FeatureSupport::new().set_edition_deprecated(Edition::Proto3);
4152        /// ```
4153        pub fn set_edition_deprecated<T: std::convert::Into<crate::Edition>>(
4154            mut self,
4155            v: T,
4156        ) -> Self {
4157            self.edition_deprecated = v.into();
4158            self
4159        }
4160
4161        /// Sets the value of [deprecation_warning][crate::field_options::FeatureSupport::deprecation_warning].
4162        ///
4163        /// # Example
4164        /// ```ignore,no_run
4165        /// # use google_cloud_wkt::field_options::FeatureSupport;
4166        /// let x = FeatureSupport::new().set_deprecation_warning("example");
4167        /// ```
4168        pub fn set_deprecation_warning<T: std::convert::Into<std::string::String>>(
4169            mut self,
4170            v: T,
4171        ) -> Self {
4172            self.deprecation_warning = v.into();
4173            self
4174        }
4175
4176        /// Sets the value of [edition_removed][crate::field_options::FeatureSupport::edition_removed].
4177        ///
4178        /// # Example
4179        /// ```ignore,no_run
4180        /// # use google_cloud_wkt::field_options::FeatureSupport;
4181        /// use google_cloud_wkt::Edition;
4182        /// let x0 = FeatureSupport::new().set_edition_removed(Edition::Legacy);
4183        /// let x1 = FeatureSupport::new().set_edition_removed(Edition::Proto2);
4184        /// let x2 = FeatureSupport::new().set_edition_removed(Edition::Proto3);
4185        /// ```
4186        pub fn set_edition_removed<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
4187            self.edition_removed = v.into();
4188            self
4189        }
4190    }
4191
4192    impl wkt::message::Message for FeatureSupport {
4193        fn typename() -> &'static str {
4194            "type.googleapis.com/google.protobuf.FieldOptions.FeatureSupport"
4195        }
4196    }
4197
4198    /// Enum for [CType].
4199    ///
4200    /// # Working with unknown values
4201    ///
4202    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4203    /// additional enum variants at any time. Adding new variants is not considered
4204    /// a breaking change. Applications should write their code in anticipation of:
4205    ///
4206    /// - New values appearing in future releases of the client library, **and**
4207    /// - New values received dynamically, without application changes.
4208    ///
4209    /// Please consult the [Working with enums] section in the user guide for some
4210    /// guidelines.
4211    ///
4212    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4213    #[derive(Clone, Debug, PartialEq)]
4214    #[non_exhaustive]
4215    pub enum CType {
4216        /// Default mode.
4217        String,
4218        /// The option [ctype=CORD] may be applied to a non-repeated field of type
4219        /// "bytes". It indicates that in C++, the data should be stored in a Cord
4220        /// instead of a string.  For very large strings, this may reduce memory
4221        /// fragmentation. It may also allow better performance when parsing from a
4222        /// Cord, or when parsing with aliasing enabled, as the parsed Cord may then
4223        /// alias the original buffer.
4224        Cord,
4225        #[allow(missing_docs)]
4226        StringPiece,
4227        /// If set, the enum was initialized with an unknown value.
4228        ///
4229        /// Applications can examine the value using [CType::value] or
4230        /// [CType::name].
4231        UnknownValue(c_type::UnknownValue),
4232    }
4233
4234    #[doc(hidden)]
4235    pub mod c_type {
4236        #[allow(unused_imports)]
4237        use super::*;
4238        #[derive(Clone, Debug, PartialEq)]
4239        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4240    }
4241
4242    impl CType {
4243        /// Gets the enum value.
4244        ///
4245        /// Returns `None` if the enum contains an unknown value deserialized from
4246        /// the string representation of enums.
4247        pub fn value(&self) -> std::option::Option<i32> {
4248            match self {
4249                Self::String => std::option::Option::Some(0),
4250                Self::Cord => std::option::Option::Some(1),
4251                Self::StringPiece => std::option::Option::Some(2),
4252                Self::UnknownValue(u) => u.0.value(),
4253            }
4254        }
4255
4256        /// Gets the enum value as a string.
4257        ///
4258        /// Returns `None` if the enum contains an unknown value deserialized from
4259        /// the integer representation of enums.
4260        pub fn name(&self) -> std::option::Option<&str> {
4261            match self {
4262                Self::String => std::option::Option::Some("STRING"),
4263                Self::Cord => std::option::Option::Some("CORD"),
4264                Self::StringPiece => std::option::Option::Some("STRING_PIECE"),
4265                Self::UnknownValue(u) => u.0.name(),
4266            }
4267        }
4268    }
4269
4270    impl std::default::Default for CType {
4271        fn default() -> Self {
4272            use std::convert::From;
4273            Self::from(0)
4274        }
4275    }
4276
4277    impl std::fmt::Display for CType {
4278        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4279            wkt::internal::display_enum(f, self.name(), self.value())
4280        }
4281    }
4282
4283    impl std::convert::From<i32> for CType {
4284        fn from(value: i32) -> Self {
4285            match value {
4286                0 => Self::String,
4287                1 => Self::Cord,
4288                2 => Self::StringPiece,
4289                _ => Self::UnknownValue(c_type::UnknownValue(
4290                    wkt::internal::UnknownEnumValue::Integer(value),
4291                )),
4292            }
4293        }
4294    }
4295
4296    impl std::convert::From<&str> for CType {
4297        fn from(value: &str) -> Self {
4298            use std::string::ToString;
4299            match value {
4300                "STRING" => Self::String,
4301                "CORD" => Self::Cord,
4302                "STRING_PIECE" => Self::StringPiece,
4303                _ => Self::UnknownValue(c_type::UnknownValue(
4304                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4305                )),
4306            }
4307        }
4308    }
4309
4310    impl serde::ser::Serialize for CType {
4311        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4312        where
4313            S: serde::Serializer,
4314        {
4315            match self {
4316                Self::String => serializer.serialize_i32(0),
4317                Self::Cord => serializer.serialize_i32(1),
4318                Self::StringPiece => serializer.serialize_i32(2),
4319                Self::UnknownValue(u) => u.0.serialize(serializer),
4320            }
4321        }
4322    }
4323
4324    impl<'de> serde::de::Deserialize<'de> for CType {
4325        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4326        where
4327            D: serde::Deserializer<'de>,
4328        {
4329            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CType>::new(
4330                ".google.protobuf.FieldOptions.CType",
4331            ))
4332        }
4333    }
4334
4335    /// Enum for [JSType].
4336    ///
4337    /// # Working with unknown values
4338    ///
4339    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4340    /// additional enum variants at any time. Adding new variants is not considered
4341    /// a breaking change. Applications should write their code in anticipation of:
4342    ///
4343    /// - New values appearing in future releases of the client library, **and**
4344    /// - New values received dynamically, without application changes.
4345    ///
4346    /// Please consult the [Working with enums] section in the user guide for some
4347    /// guidelines.
4348    ///
4349    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4350    #[derive(Clone, Debug, PartialEq)]
4351    #[non_exhaustive]
4352    pub enum JSType {
4353        /// Use the default type.
4354        JsNormal,
4355        /// Use JavaScript strings.
4356        JsString,
4357        /// Use JavaScript numbers.
4358        JsNumber,
4359        /// If set, the enum was initialized with an unknown value.
4360        ///
4361        /// Applications can examine the value using [JSType::value] or
4362        /// [JSType::name].
4363        UnknownValue(js_type::UnknownValue),
4364    }
4365
4366    #[doc(hidden)]
4367    pub mod js_type {
4368        #[allow(unused_imports)]
4369        use super::*;
4370        #[derive(Clone, Debug, PartialEq)]
4371        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4372    }
4373
4374    impl JSType {
4375        /// Gets the enum value.
4376        ///
4377        /// Returns `None` if the enum contains an unknown value deserialized from
4378        /// the string representation of enums.
4379        pub fn value(&self) -> std::option::Option<i32> {
4380            match self {
4381                Self::JsNormal => std::option::Option::Some(0),
4382                Self::JsString => std::option::Option::Some(1),
4383                Self::JsNumber => std::option::Option::Some(2),
4384                Self::UnknownValue(u) => u.0.value(),
4385            }
4386        }
4387
4388        /// Gets the enum value as a string.
4389        ///
4390        /// Returns `None` if the enum contains an unknown value deserialized from
4391        /// the integer representation of enums.
4392        pub fn name(&self) -> std::option::Option<&str> {
4393            match self {
4394                Self::JsNormal => std::option::Option::Some("JS_NORMAL"),
4395                Self::JsString => std::option::Option::Some("JS_STRING"),
4396                Self::JsNumber => std::option::Option::Some("JS_NUMBER"),
4397                Self::UnknownValue(u) => u.0.name(),
4398            }
4399        }
4400    }
4401
4402    impl std::default::Default for JSType {
4403        fn default() -> Self {
4404            use std::convert::From;
4405            Self::from(0)
4406        }
4407    }
4408
4409    impl std::fmt::Display for JSType {
4410        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4411            wkt::internal::display_enum(f, self.name(), self.value())
4412        }
4413    }
4414
4415    impl std::convert::From<i32> for JSType {
4416        fn from(value: i32) -> Self {
4417            match value {
4418                0 => Self::JsNormal,
4419                1 => Self::JsString,
4420                2 => Self::JsNumber,
4421                _ => Self::UnknownValue(js_type::UnknownValue(
4422                    wkt::internal::UnknownEnumValue::Integer(value),
4423                )),
4424            }
4425        }
4426    }
4427
4428    impl std::convert::From<&str> for JSType {
4429        fn from(value: &str) -> Self {
4430            use std::string::ToString;
4431            match value {
4432                "JS_NORMAL" => Self::JsNormal,
4433                "JS_STRING" => Self::JsString,
4434                "JS_NUMBER" => Self::JsNumber,
4435                _ => Self::UnknownValue(js_type::UnknownValue(
4436                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4437                )),
4438            }
4439        }
4440    }
4441
4442    impl serde::ser::Serialize for JSType {
4443        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4444        where
4445            S: serde::Serializer,
4446        {
4447            match self {
4448                Self::JsNormal => serializer.serialize_i32(0),
4449                Self::JsString => serializer.serialize_i32(1),
4450                Self::JsNumber => serializer.serialize_i32(2),
4451                Self::UnknownValue(u) => u.0.serialize(serializer),
4452            }
4453        }
4454    }
4455
4456    impl<'de> serde::de::Deserialize<'de> for JSType {
4457        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4458        where
4459            D: serde::Deserializer<'de>,
4460        {
4461            deserializer.deserialize_any(wkt::internal::EnumVisitor::<JSType>::new(
4462                ".google.protobuf.FieldOptions.JSType",
4463            ))
4464        }
4465    }
4466
4467    /// If set to RETENTION_SOURCE, the option will be omitted from the binary.
4468    ///
4469    /// # Working with unknown values
4470    ///
4471    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4472    /// additional enum variants at any time. Adding new variants is not considered
4473    /// a breaking change. Applications should write their code in anticipation of:
4474    ///
4475    /// - New values appearing in future releases of the client library, **and**
4476    /// - New values received dynamically, without application changes.
4477    ///
4478    /// Please consult the [Working with enums] section in the user guide for some
4479    /// guidelines.
4480    ///
4481    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4482    #[derive(Clone, Debug, PartialEq)]
4483    #[non_exhaustive]
4484    pub enum OptionRetention {
4485        #[allow(missing_docs)]
4486        RetentionUnknown,
4487        #[allow(missing_docs)]
4488        RetentionRuntime,
4489        #[allow(missing_docs)]
4490        RetentionSource,
4491        /// If set, the enum was initialized with an unknown value.
4492        ///
4493        /// Applications can examine the value using [OptionRetention::value] or
4494        /// [OptionRetention::name].
4495        UnknownValue(option_retention::UnknownValue),
4496    }
4497
4498    #[doc(hidden)]
4499    pub mod option_retention {
4500        #[allow(unused_imports)]
4501        use super::*;
4502        #[derive(Clone, Debug, PartialEq)]
4503        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4504    }
4505
4506    impl OptionRetention {
4507        /// Gets the enum value.
4508        ///
4509        /// Returns `None` if the enum contains an unknown value deserialized from
4510        /// the string representation of enums.
4511        pub fn value(&self) -> std::option::Option<i32> {
4512            match self {
4513                Self::RetentionUnknown => std::option::Option::Some(0),
4514                Self::RetentionRuntime => std::option::Option::Some(1),
4515                Self::RetentionSource => std::option::Option::Some(2),
4516                Self::UnknownValue(u) => u.0.value(),
4517            }
4518        }
4519
4520        /// Gets the enum value as a string.
4521        ///
4522        /// Returns `None` if the enum contains an unknown value deserialized from
4523        /// the integer representation of enums.
4524        pub fn name(&self) -> std::option::Option<&str> {
4525            match self {
4526                Self::RetentionUnknown => std::option::Option::Some("RETENTION_UNKNOWN"),
4527                Self::RetentionRuntime => std::option::Option::Some("RETENTION_RUNTIME"),
4528                Self::RetentionSource => std::option::Option::Some("RETENTION_SOURCE"),
4529                Self::UnknownValue(u) => u.0.name(),
4530            }
4531        }
4532    }
4533
4534    impl std::default::Default for OptionRetention {
4535        fn default() -> Self {
4536            use std::convert::From;
4537            Self::from(0)
4538        }
4539    }
4540
4541    impl std::fmt::Display for OptionRetention {
4542        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4543            wkt::internal::display_enum(f, self.name(), self.value())
4544        }
4545    }
4546
4547    impl std::convert::From<i32> for OptionRetention {
4548        fn from(value: i32) -> Self {
4549            match value {
4550                0 => Self::RetentionUnknown,
4551                1 => Self::RetentionRuntime,
4552                2 => Self::RetentionSource,
4553                _ => Self::UnknownValue(option_retention::UnknownValue(
4554                    wkt::internal::UnknownEnumValue::Integer(value),
4555                )),
4556            }
4557        }
4558    }
4559
4560    impl std::convert::From<&str> for OptionRetention {
4561        fn from(value: &str) -> Self {
4562            use std::string::ToString;
4563            match value {
4564                "RETENTION_UNKNOWN" => Self::RetentionUnknown,
4565                "RETENTION_RUNTIME" => Self::RetentionRuntime,
4566                "RETENTION_SOURCE" => Self::RetentionSource,
4567                _ => Self::UnknownValue(option_retention::UnknownValue(
4568                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4569                )),
4570            }
4571        }
4572    }
4573
4574    impl serde::ser::Serialize for OptionRetention {
4575        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4576        where
4577            S: serde::Serializer,
4578        {
4579            match self {
4580                Self::RetentionUnknown => serializer.serialize_i32(0),
4581                Self::RetentionRuntime => serializer.serialize_i32(1),
4582                Self::RetentionSource => serializer.serialize_i32(2),
4583                Self::UnknownValue(u) => u.0.serialize(serializer),
4584            }
4585        }
4586    }
4587
4588    impl<'de> serde::de::Deserialize<'de> for OptionRetention {
4589        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4590        where
4591            D: serde::Deserializer<'de>,
4592        {
4593            deserializer.deserialize_any(wkt::internal::EnumVisitor::<OptionRetention>::new(
4594                ".google.protobuf.FieldOptions.OptionRetention",
4595            ))
4596        }
4597    }
4598
4599    /// This indicates the types of entities that the field may apply to when used
4600    /// as an option. If it is unset, then the field may be freely used as an
4601    /// option on any kind of entity.
4602    ///
4603    /// # Working with unknown values
4604    ///
4605    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4606    /// additional enum variants at any time. Adding new variants is not considered
4607    /// a breaking change. Applications should write their code in anticipation of:
4608    ///
4609    /// - New values appearing in future releases of the client library, **and**
4610    /// - New values received dynamically, without application changes.
4611    ///
4612    /// Please consult the [Working with enums] section in the user guide for some
4613    /// guidelines.
4614    ///
4615    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4616    #[derive(Clone, Debug, PartialEq)]
4617    #[non_exhaustive]
4618    pub enum OptionTargetType {
4619        #[allow(missing_docs)]
4620        TargetTypeUnknown,
4621        #[allow(missing_docs)]
4622        TargetTypeFile,
4623        #[allow(missing_docs)]
4624        TargetTypeExtensionRange,
4625        #[allow(missing_docs)]
4626        TargetTypeMessage,
4627        #[allow(missing_docs)]
4628        TargetTypeField,
4629        #[allow(missing_docs)]
4630        TargetTypeOneof,
4631        #[allow(missing_docs)]
4632        TargetTypeEnum,
4633        #[allow(missing_docs)]
4634        TargetTypeEnumEntry,
4635        #[allow(missing_docs)]
4636        TargetTypeService,
4637        #[allow(missing_docs)]
4638        TargetTypeMethod,
4639        /// If set, the enum was initialized with an unknown value.
4640        ///
4641        /// Applications can examine the value using [OptionTargetType::value] or
4642        /// [OptionTargetType::name].
4643        UnknownValue(option_target_type::UnknownValue),
4644    }
4645
4646    #[doc(hidden)]
4647    pub mod option_target_type {
4648        #[allow(unused_imports)]
4649        use super::*;
4650        #[derive(Clone, Debug, PartialEq)]
4651        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4652    }
4653
4654    impl OptionTargetType {
4655        /// Gets the enum value.
4656        ///
4657        /// Returns `None` if the enum contains an unknown value deserialized from
4658        /// the string representation of enums.
4659        pub fn value(&self) -> std::option::Option<i32> {
4660            match self {
4661                Self::TargetTypeUnknown => std::option::Option::Some(0),
4662                Self::TargetTypeFile => std::option::Option::Some(1),
4663                Self::TargetTypeExtensionRange => std::option::Option::Some(2),
4664                Self::TargetTypeMessage => std::option::Option::Some(3),
4665                Self::TargetTypeField => std::option::Option::Some(4),
4666                Self::TargetTypeOneof => std::option::Option::Some(5),
4667                Self::TargetTypeEnum => std::option::Option::Some(6),
4668                Self::TargetTypeEnumEntry => std::option::Option::Some(7),
4669                Self::TargetTypeService => std::option::Option::Some(8),
4670                Self::TargetTypeMethod => std::option::Option::Some(9),
4671                Self::UnknownValue(u) => u.0.value(),
4672            }
4673        }
4674
4675        /// Gets the enum value as a string.
4676        ///
4677        /// Returns `None` if the enum contains an unknown value deserialized from
4678        /// the integer representation of enums.
4679        pub fn name(&self) -> std::option::Option<&str> {
4680            match self {
4681                Self::TargetTypeUnknown => std::option::Option::Some("TARGET_TYPE_UNKNOWN"),
4682                Self::TargetTypeFile => std::option::Option::Some("TARGET_TYPE_FILE"),
4683                Self::TargetTypeExtensionRange => {
4684                    std::option::Option::Some("TARGET_TYPE_EXTENSION_RANGE")
4685                }
4686                Self::TargetTypeMessage => std::option::Option::Some("TARGET_TYPE_MESSAGE"),
4687                Self::TargetTypeField => std::option::Option::Some("TARGET_TYPE_FIELD"),
4688                Self::TargetTypeOneof => std::option::Option::Some("TARGET_TYPE_ONEOF"),
4689                Self::TargetTypeEnum => std::option::Option::Some("TARGET_TYPE_ENUM"),
4690                Self::TargetTypeEnumEntry => std::option::Option::Some("TARGET_TYPE_ENUM_ENTRY"),
4691                Self::TargetTypeService => std::option::Option::Some("TARGET_TYPE_SERVICE"),
4692                Self::TargetTypeMethod => std::option::Option::Some("TARGET_TYPE_METHOD"),
4693                Self::UnknownValue(u) => u.0.name(),
4694            }
4695        }
4696    }
4697
4698    impl std::default::Default for OptionTargetType {
4699        fn default() -> Self {
4700            use std::convert::From;
4701            Self::from(0)
4702        }
4703    }
4704
4705    impl std::fmt::Display for OptionTargetType {
4706        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4707            wkt::internal::display_enum(f, self.name(), self.value())
4708        }
4709    }
4710
4711    impl std::convert::From<i32> for OptionTargetType {
4712        fn from(value: i32) -> Self {
4713            match value {
4714                0 => Self::TargetTypeUnknown,
4715                1 => Self::TargetTypeFile,
4716                2 => Self::TargetTypeExtensionRange,
4717                3 => Self::TargetTypeMessage,
4718                4 => Self::TargetTypeField,
4719                5 => Self::TargetTypeOneof,
4720                6 => Self::TargetTypeEnum,
4721                7 => Self::TargetTypeEnumEntry,
4722                8 => Self::TargetTypeService,
4723                9 => Self::TargetTypeMethod,
4724                _ => Self::UnknownValue(option_target_type::UnknownValue(
4725                    wkt::internal::UnknownEnumValue::Integer(value),
4726                )),
4727            }
4728        }
4729    }
4730
4731    impl std::convert::From<&str> for OptionTargetType {
4732        fn from(value: &str) -> Self {
4733            use std::string::ToString;
4734            match value {
4735                "TARGET_TYPE_UNKNOWN" => Self::TargetTypeUnknown,
4736                "TARGET_TYPE_FILE" => Self::TargetTypeFile,
4737                "TARGET_TYPE_EXTENSION_RANGE" => Self::TargetTypeExtensionRange,
4738                "TARGET_TYPE_MESSAGE" => Self::TargetTypeMessage,
4739                "TARGET_TYPE_FIELD" => Self::TargetTypeField,
4740                "TARGET_TYPE_ONEOF" => Self::TargetTypeOneof,
4741                "TARGET_TYPE_ENUM" => Self::TargetTypeEnum,
4742                "TARGET_TYPE_ENUM_ENTRY" => Self::TargetTypeEnumEntry,
4743                "TARGET_TYPE_SERVICE" => Self::TargetTypeService,
4744                "TARGET_TYPE_METHOD" => Self::TargetTypeMethod,
4745                _ => Self::UnknownValue(option_target_type::UnknownValue(
4746                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4747                )),
4748            }
4749        }
4750    }
4751
4752    impl serde::ser::Serialize for OptionTargetType {
4753        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4754        where
4755            S: serde::Serializer,
4756        {
4757            match self {
4758                Self::TargetTypeUnknown => serializer.serialize_i32(0),
4759                Self::TargetTypeFile => serializer.serialize_i32(1),
4760                Self::TargetTypeExtensionRange => serializer.serialize_i32(2),
4761                Self::TargetTypeMessage => serializer.serialize_i32(3),
4762                Self::TargetTypeField => serializer.serialize_i32(4),
4763                Self::TargetTypeOneof => serializer.serialize_i32(5),
4764                Self::TargetTypeEnum => serializer.serialize_i32(6),
4765                Self::TargetTypeEnumEntry => serializer.serialize_i32(7),
4766                Self::TargetTypeService => serializer.serialize_i32(8),
4767                Self::TargetTypeMethod => serializer.serialize_i32(9),
4768                Self::UnknownValue(u) => u.0.serialize(serializer),
4769            }
4770        }
4771    }
4772
4773    impl<'de> serde::de::Deserialize<'de> for OptionTargetType {
4774        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4775        where
4776            D: serde::Deserializer<'de>,
4777        {
4778            deserializer.deserialize_any(wkt::internal::EnumVisitor::<OptionTargetType>::new(
4779                ".google.protobuf.FieldOptions.OptionTargetType",
4780            ))
4781        }
4782    }
4783}
4784
4785#[allow(missing_docs)]
4786#[derive(Clone, Default, PartialEq)]
4787#[non_exhaustive]
4788pub struct OneofOptions {
4789    /// Any features defined in the specific edition.
4790    pub features: std::option::Option<crate::FeatureSet>,
4791
4792    /// The parser stores options it doesn't recognize here. See above.
4793    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
4794
4795    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4796}
4797
4798impl OneofOptions {
4799    /// Creates a new default instance.
4800    pub fn new() -> Self {
4801        std::default::Default::default()
4802    }
4803
4804    /// Sets the value of [features][crate::OneofOptions::features].
4805    ///
4806    /// # Example
4807    /// ```ignore,no_run
4808    /// # use google_cloud_wkt::OneofOptions;
4809    /// use google_cloud_wkt::FeatureSet;
4810    /// let x = OneofOptions::new().set_features(FeatureSet::default()/* use setters */);
4811    /// ```
4812    pub fn set_features<T>(mut self, v: T) -> Self
4813    where
4814        T: std::convert::Into<crate::FeatureSet>,
4815    {
4816        self.features = std::option::Option::Some(v.into());
4817        self
4818    }
4819
4820    /// Sets or clears the value of [features][crate::OneofOptions::features].
4821    ///
4822    /// # Example
4823    /// ```ignore,no_run
4824    /// # use google_cloud_wkt::OneofOptions;
4825    /// use google_cloud_wkt::FeatureSet;
4826    /// let x = OneofOptions::new().set_or_clear_features(Some(FeatureSet::default()/* use setters */));
4827    /// let x = OneofOptions::new().set_or_clear_features(None::<FeatureSet>);
4828    /// ```
4829    pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
4830    where
4831        T: std::convert::Into<crate::FeatureSet>,
4832    {
4833        self.features = v.map(|x| x.into());
4834        self
4835    }
4836
4837    /// Sets the value of [uninterpreted_option][crate::OneofOptions::uninterpreted_option].
4838    ///
4839    /// # Example
4840    /// ```ignore,no_run
4841    /// # use google_cloud_wkt::OneofOptions;
4842    /// use google_cloud_wkt::UninterpretedOption;
4843    /// let x = OneofOptions::new()
4844    ///     .set_uninterpreted_option([
4845    ///         UninterpretedOption::default()/* use setters */,
4846    ///         UninterpretedOption::default()/* use (different) setters */,
4847    ///     ]);
4848    /// ```
4849    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
4850    where
4851        T: std::iter::IntoIterator<Item = V>,
4852        V: std::convert::Into<crate::UninterpretedOption>,
4853    {
4854        use std::iter::Iterator;
4855        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
4856        self
4857    }
4858}
4859
4860impl wkt::message::Message for OneofOptions {
4861    fn typename() -> &'static str {
4862        "type.googleapis.com/google.protobuf.OneofOptions"
4863    }
4864}
4865
4866#[allow(missing_docs)]
4867#[derive(Clone, Default, PartialEq)]
4868#[non_exhaustive]
4869pub struct EnumOptions {
4870    /// Set this option to true to allow mapping different tag names to the same
4871    /// value.
4872    pub allow_alias: bool,
4873
4874    /// Is this enum deprecated?
4875    /// Depending on the target platform, this can emit Deprecated annotations
4876    /// for the enum, or it will be completely ignored; in the very least, this
4877    /// is a formalization for deprecating enums.
4878    pub deprecated: bool,
4879
4880    /// Enable the legacy handling of JSON field name conflicts.  This lowercases
4881    /// and strips underscored from the fields before comparison in proto3 only.
4882    /// The new behavior takes `json_name` into account and applies to proto2 as
4883    /// well.
4884    /// TODO Remove this legacy behavior once downstream teams have
4885    /// had time to migrate.
4886    #[deprecated]
4887    pub deprecated_legacy_json_field_conflicts: bool,
4888
4889    /// Any features defined in the specific edition.
4890    pub features: std::option::Option<crate::FeatureSet>,
4891
4892    /// The parser stores options it doesn't recognize here. See above.
4893    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
4894
4895    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4896}
4897
4898impl EnumOptions {
4899    /// Creates a new default instance.
4900    pub fn new() -> Self {
4901        std::default::Default::default()
4902    }
4903
4904    /// Sets the value of [allow_alias][crate::EnumOptions::allow_alias].
4905    ///
4906    /// # Example
4907    /// ```ignore,no_run
4908    /// # use google_cloud_wkt::EnumOptions;
4909    /// let x = EnumOptions::new().set_allow_alias(true);
4910    /// ```
4911    pub fn set_allow_alias<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4912        self.allow_alias = v.into();
4913        self
4914    }
4915
4916    /// Sets the value of [deprecated][crate::EnumOptions::deprecated].
4917    ///
4918    /// # Example
4919    /// ```ignore,no_run
4920    /// # use google_cloud_wkt::EnumOptions;
4921    /// let x = EnumOptions::new().set_deprecated(true);
4922    /// ```
4923    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4924        self.deprecated = v.into();
4925        self
4926    }
4927
4928    /// Sets the value of [deprecated_legacy_json_field_conflicts][crate::EnumOptions::deprecated_legacy_json_field_conflicts].
4929    ///
4930    /// # Example
4931    /// ```ignore,no_run
4932    /// # use google_cloud_wkt::EnumOptions;
4933    /// let x = EnumOptions::new().set_deprecated_legacy_json_field_conflicts(true);
4934    /// ```
4935    #[deprecated]
4936    pub fn set_deprecated_legacy_json_field_conflicts<T: std::convert::Into<bool>>(
4937        mut self,
4938        v: T,
4939    ) -> Self {
4940        self.deprecated_legacy_json_field_conflicts = v.into();
4941        self
4942    }
4943
4944    /// Sets the value of [features][crate::EnumOptions::features].
4945    ///
4946    /// # Example
4947    /// ```ignore,no_run
4948    /// # use google_cloud_wkt::EnumOptions;
4949    /// use google_cloud_wkt::FeatureSet;
4950    /// let x = EnumOptions::new().set_features(FeatureSet::default()/* use setters */);
4951    /// ```
4952    pub fn set_features<T>(mut self, v: T) -> Self
4953    where
4954        T: std::convert::Into<crate::FeatureSet>,
4955    {
4956        self.features = std::option::Option::Some(v.into());
4957        self
4958    }
4959
4960    /// Sets or clears the value of [features][crate::EnumOptions::features].
4961    ///
4962    /// # Example
4963    /// ```ignore,no_run
4964    /// # use google_cloud_wkt::EnumOptions;
4965    /// use google_cloud_wkt::FeatureSet;
4966    /// let x = EnumOptions::new().set_or_clear_features(Some(FeatureSet::default()/* use setters */));
4967    /// let x = EnumOptions::new().set_or_clear_features(None::<FeatureSet>);
4968    /// ```
4969    pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
4970    where
4971        T: std::convert::Into<crate::FeatureSet>,
4972    {
4973        self.features = v.map(|x| x.into());
4974        self
4975    }
4976
4977    /// Sets the value of [uninterpreted_option][crate::EnumOptions::uninterpreted_option].
4978    ///
4979    /// # Example
4980    /// ```ignore,no_run
4981    /// # use google_cloud_wkt::EnumOptions;
4982    /// use google_cloud_wkt::UninterpretedOption;
4983    /// let x = EnumOptions::new()
4984    ///     .set_uninterpreted_option([
4985    ///         UninterpretedOption::default()/* use setters */,
4986    ///         UninterpretedOption::default()/* use (different) setters */,
4987    ///     ]);
4988    /// ```
4989    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
4990    where
4991        T: std::iter::IntoIterator<Item = V>,
4992        V: std::convert::Into<crate::UninterpretedOption>,
4993    {
4994        use std::iter::Iterator;
4995        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
4996        self
4997    }
4998}
4999
5000impl wkt::message::Message for EnumOptions {
5001    fn typename() -> &'static str {
5002        "type.googleapis.com/google.protobuf.EnumOptions"
5003    }
5004}
5005
5006#[allow(missing_docs)]
5007#[derive(Clone, Default, PartialEq)]
5008#[non_exhaustive]
5009pub struct EnumValueOptions {
5010    /// Is this enum value deprecated?
5011    /// Depending on the target platform, this can emit Deprecated annotations
5012    /// for the enum value, or it will be completely ignored; in the very least,
5013    /// this is a formalization for deprecating enum values.
5014    pub deprecated: bool,
5015
5016    /// Any features defined in the specific edition.
5017    pub features: std::option::Option<crate::FeatureSet>,
5018
5019    /// Indicate that fields annotated with this enum value should not be printed
5020    /// out when using debug formats, e.g. when the field contains sensitive
5021    /// credentials.
5022    pub debug_redact: bool,
5023
5024    /// Information about the support window of a feature value.
5025    pub feature_support: std::option::Option<crate::field_options::FeatureSupport>,
5026
5027    /// The parser stores options it doesn't recognize here. See above.
5028    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
5029
5030    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5031}
5032
5033impl EnumValueOptions {
5034    /// Creates a new default instance.
5035    pub fn new() -> Self {
5036        std::default::Default::default()
5037    }
5038
5039    /// Sets the value of [deprecated][crate::EnumValueOptions::deprecated].
5040    ///
5041    /// # Example
5042    /// ```ignore,no_run
5043    /// # use google_cloud_wkt::EnumValueOptions;
5044    /// let x = EnumValueOptions::new().set_deprecated(true);
5045    /// ```
5046    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5047        self.deprecated = v.into();
5048        self
5049    }
5050
5051    /// Sets the value of [features][crate::EnumValueOptions::features].
5052    ///
5053    /// # Example
5054    /// ```ignore,no_run
5055    /// # use google_cloud_wkt::EnumValueOptions;
5056    /// use google_cloud_wkt::FeatureSet;
5057    /// let x = EnumValueOptions::new().set_features(FeatureSet::default()/* use setters */);
5058    /// ```
5059    pub fn set_features<T>(mut self, v: T) -> Self
5060    where
5061        T: std::convert::Into<crate::FeatureSet>,
5062    {
5063        self.features = std::option::Option::Some(v.into());
5064        self
5065    }
5066
5067    /// Sets or clears the value of [features][crate::EnumValueOptions::features].
5068    ///
5069    /// # Example
5070    /// ```ignore,no_run
5071    /// # use google_cloud_wkt::EnumValueOptions;
5072    /// use google_cloud_wkt::FeatureSet;
5073    /// let x = EnumValueOptions::new().set_or_clear_features(Some(FeatureSet::default()/* use setters */));
5074    /// let x = EnumValueOptions::new().set_or_clear_features(None::<FeatureSet>);
5075    /// ```
5076    pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
5077    where
5078        T: std::convert::Into<crate::FeatureSet>,
5079    {
5080        self.features = v.map(|x| x.into());
5081        self
5082    }
5083
5084    /// Sets the value of [debug_redact][crate::EnumValueOptions::debug_redact].
5085    ///
5086    /// # Example
5087    /// ```ignore,no_run
5088    /// # use google_cloud_wkt::EnumValueOptions;
5089    /// let x = EnumValueOptions::new().set_debug_redact(true);
5090    /// ```
5091    pub fn set_debug_redact<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5092        self.debug_redact = v.into();
5093        self
5094    }
5095
5096    /// Sets the value of [feature_support][crate::EnumValueOptions::feature_support].
5097    ///
5098    /// # Example
5099    /// ```ignore,no_run
5100    /// # use google_cloud_wkt::EnumValueOptions;
5101    /// use google_cloud_wkt::field_options::FeatureSupport;
5102    /// let x = EnumValueOptions::new().set_feature_support(FeatureSupport::default()/* use setters */);
5103    /// ```
5104    pub fn set_feature_support<T>(mut self, v: T) -> Self
5105    where
5106        T: std::convert::Into<crate::field_options::FeatureSupport>,
5107    {
5108        self.feature_support = std::option::Option::Some(v.into());
5109        self
5110    }
5111
5112    /// Sets or clears the value of [feature_support][crate::EnumValueOptions::feature_support].
5113    ///
5114    /// # Example
5115    /// ```ignore,no_run
5116    /// # use google_cloud_wkt::EnumValueOptions;
5117    /// use google_cloud_wkt::field_options::FeatureSupport;
5118    /// let x = EnumValueOptions::new().set_or_clear_feature_support(Some(FeatureSupport::default()/* use setters */));
5119    /// let x = EnumValueOptions::new().set_or_clear_feature_support(None::<FeatureSupport>);
5120    /// ```
5121    pub fn set_or_clear_feature_support<T>(mut self, v: std::option::Option<T>) -> Self
5122    where
5123        T: std::convert::Into<crate::field_options::FeatureSupport>,
5124    {
5125        self.feature_support = v.map(|x| x.into());
5126        self
5127    }
5128
5129    /// Sets the value of [uninterpreted_option][crate::EnumValueOptions::uninterpreted_option].
5130    ///
5131    /// # Example
5132    /// ```ignore,no_run
5133    /// # use google_cloud_wkt::EnumValueOptions;
5134    /// use google_cloud_wkt::UninterpretedOption;
5135    /// let x = EnumValueOptions::new()
5136    ///     .set_uninterpreted_option([
5137    ///         UninterpretedOption::default()/* use setters */,
5138    ///         UninterpretedOption::default()/* use (different) setters */,
5139    ///     ]);
5140    /// ```
5141    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
5142    where
5143        T: std::iter::IntoIterator<Item = V>,
5144        V: std::convert::Into<crate::UninterpretedOption>,
5145    {
5146        use std::iter::Iterator;
5147        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
5148        self
5149    }
5150}
5151
5152impl wkt::message::Message for EnumValueOptions {
5153    fn typename() -> &'static str {
5154        "type.googleapis.com/google.protobuf.EnumValueOptions"
5155    }
5156}
5157
5158#[allow(missing_docs)]
5159#[derive(Clone, Default, PartialEq)]
5160#[non_exhaustive]
5161pub struct ServiceOptions {
5162    /// Any features defined in the specific edition.
5163    pub features: std::option::Option<crate::FeatureSet>,
5164
5165    /// Is this service deprecated?
5166    /// Depending on the target platform, this can emit Deprecated annotations
5167    /// for the service, or it will be completely ignored; in the very least,
5168    /// this is a formalization for deprecating services.
5169    pub deprecated: bool,
5170
5171    /// The parser stores options it doesn't recognize here. See above.
5172    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
5173
5174    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5175}
5176
5177impl ServiceOptions {
5178    /// Creates a new default instance.
5179    pub fn new() -> Self {
5180        std::default::Default::default()
5181    }
5182
5183    /// Sets the value of [features][crate::ServiceOptions::features].
5184    ///
5185    /// # Example
5186    /// ```ignore,no_run
5187    /// # use google_cloud_wkt::ServiceOptions;
5188    /// use google_cloud_wkt::FeatureSet;
5189    /// let x = ServiceOptions::new().set_features(FeatureSet::default()/* use setters */);
5190    /// ```
5191    pub fn set_features<T>(mut self, v: T) -> Self
5192    where
5193        T: std::convert::Into<crate::FeatureSet>,
5194    {
5195        self.features = std::option::Option::Some(v.into());
5196        self
5197    }
5198
5199    /// Sets or clears the value of [features][crate::ServiceOptions::features].
5200    ///
5201    /// # Example
5202    /// ```ignore,no_run
5203    /// # use google_cloud_wkt::ServiceOptions;
5204    /// use google_cloud_wkt::FeatureSet;
5205    /// let x = ServiceOptions::new().set_or_clear_features(Some(FeatureSet::default()/* use setters */));
5206    /// let x = ServiceOptions::new().set_or_clear_features(None::<FeatureSet>);
5207    /// ```
5208    pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
5209    where
5210        T: std::convert::Into<crate::FeatureSet>,
5211    {
5212        self.features = v.map(|x| x.into());
5213        self
5214    }
5215
5216    /// Sets the value of [deprecated][crate::ServiceOptions::deprecated].
5217    ///
5218    /// # Example
5219    /// ```ignore,no_run
5220    /// # use google_cloud_wkt::ServiceOptions;
5221    /// let x = ServiceOptions::new().set_deprecated(true);
5222    /// ```
5223    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5224        self.deprecated = v.into();
5225        self
5226    }
5227
5228    /// Sets the value of [uninterpreted_option][crate::ServiceOptions::uninterpreted_option].
5229    ///
5230    /// # Example
5231    /// ```ignore,no_run
5232    /// # use google_cloud_wkt::ServiceOptions;
5233    /// use google_cloud_wkt::UninterpretedOption;
5234    /// let x = ServiceOptions::new()
5235    ///     .set_uninterpreted_option([
5236    ///         UninterpretedOption::default()/* use setters */,
5237    ///         UninterpretedOption::default()/* use (different) setters */,
5238    ///     ]);
5239    /// ```
5240    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
5241    where
5242        T: std::iter::IntoIterator<Item = V>,
5243        V: std::convert::Into<crate::UninterpretedOption>,
5244    {
5245        use std::iter::Iterator;
5246        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
5247        self
5248    }
5249}
5250
5251impl wkt::message::Message for ServiceOptions {
5252    fn typename() -> &'static str {
5253        "type.googleapis.com/google.protobuf.ServiceOptions"
5254    }
5255}
5256
5257#[allow(missing_docs)]
5258#[derive(Clone, Default, PartialEq)]
5259#[non_exhaustive]
5260pub struct MethodOptions {
5261    /// Is this method deprecated?
5262    /// Depending on the target platform, this can emit Deprecated annotations
5263    /// for the method, or it will be completely ignored; in the very least,
5264    /// this is a formalization for deprecating methods.
5265    pub deprecated: bool,
5266
5267    #[allow(missing_docs)]
5268    pub idempotency_level: crate::method_options::IdempotencyLevel,
5269
5270    /// Any features defined in the specific edition.
5271    pub features: std::option::Option<crate::FeatureSet>,
5272
5273    /// The parser stores options it doesn't recognize here. See above.
5274    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
5275
5276    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5277}
5278
5279impl MethodOptions {
5280    /// Creates a new default instance.
5281    pub fn new() -> Self {
5282        std::default::Default::default()
5283    }
5284
5285    /// Sets the value of [deprecated][crate::MethodOptions::deprecated].
5286    ///
5287    /// # Example
5288    /// ```ignore,no_run
5289    /// # use google_cloud_wkt::MethodOptions;
5290    /// let x = MethodOptions::new().set_deprecated(true);
5291    /// ```
5292    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5293        self.deprecated = v.into();
5294        self
5295    }
5296
5297    /// Sets the value of [idempotency_level][crate::MethodOptions::idempotency_level].
5298    ///
5299    /// # Example
5300    /// ```ignore,no_run
5301    /// # use google_cloud_wkt::MethodOptions;
5302    /// use google_cloud_wkt::method_options::IdempotencyLevel;
5303    /// let x0 = MethodOptions::new().set_idempotency_level(IdempotencyLevel::NoSideEffects);
5304    /// let x1 = MethodOptions::new().set_idempotency_level(IdempotencyLevel::Idempotent);
5305    /// ```
5306    pub fn set_idempotency_level<T: std::convert::Into<crate::method_options::IdempotencyLevel>>(
5307        mut self,
5308        v: T,
5309    ) -> Self {
5310        self.idempotency_level = v.into();
5311        self
5312    }
5313
5314    /// Sets the value of [features][crate::MethodOptions::features].
5315    ///
5316    /// # Example
5317    /// ```ignore,no_run
5318    /// # use google_cloud_wkt::MethodOptions;
5319    /// use google_cloud_wkt::FeatureSet;
5320    /// let x = MethodOptions::new().set_features(FeatureSet::default()/* use setters */);
5321    /// ```
5322    pub fn set_features<T>(mut self, v: T) -> Self
5323    where
5324        T: std::convert::Into<crate::FeatureSet>,
5325    {
5326        self.features = std::option::Option::Some(v.into());
5327        self
5328    }
5329
5330    /// Sets or clears the value of [features][crate::MethodOptions::features].
5331    ///
5332    /// # Example
5333    /// ```ignore,no_run
5334    /// # use google_cloud_wkt::MethodOptions;
5335    /// use google_cloud_wkt::FeatureSet;
5336    /// let x = MethodOptions::new().set_or_clear_features(Some(FeatureSet::default()/* use setters */));
5337    /// let x = MethodOptions::new().set_or_clear_features(None::<FeatureSet>);
5338    /// ```
5339    pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
5340    where
5341        T: std::convert::Into<crate::FeatureSet>,
5342    {
5343        self.features = v.map(|x| x.into());
5344        self
5345    }
5346
5347    /// Sets the value of [uninterpreted_option][crate::MethodOptions::uninterpreted_option].
5348    ///
5349    /// # Example
5350    /// ```ignore,no_run
5351    /// # use google_cloud_wkt::MethodOptions;
5352    /// use google_cloud_wkt::UninterpretedOption;
5353    /// let x = MethodOptions::new()
5354    ///     .set_uninterpreted_option([
5355    ///         UninterpretedOption::default()/* use setters */,
5356    ///         UninterpretedOption::default()/* use (different) setters */,
5357    ///     ]);
5358    /// ```
5359    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
5360    where
5361        T: std::iter::IntoIterator<Item = V>,
5362        V: std::convert::Into<crate::UninterpretedOption>,
5363    {
5364        use std::iter::Iterator;
5365        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
5366        self
5367    }
5368}
5369
5370impl wkt::message::Message for MethodOptions {
5371    fn typename() -> &'static str {
5372        "type.googleapis.com/google.protobuf.MethodOptions"
5373    }
5374}
5375
5376/// Defines additional types related to [MethodOptions].
5377pub mod method_options {
5378    #[allow(unused_imports)]
5379    use super::*;
5380
5381    /// Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
5382    /// or neither? HTTP based RPC implementation may choose GET verb for safe
5383    /// methods, and PUT verb for idempotent methods instead of the default POST.
5384    ///
5385    /// # Working with unknown values
5386    ///
5387    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5388    /// additional enum variants at any time. Adding new variants is not considered
5389    /// a breaking change. Applications should write their code in anticipation of:
5390    ///
5391    /// - New values appearing in future releases of the client library, **and**
5392    /// - New values received dynamically, without application changes.
5393    ///
5394    /// Please consult the [Working with enums] section in the user guide for some
5395    /// guidelines.
5396    ///
5397    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5398    #[derive(Clone, Debug, PartialEq)]
5399    #[non_exhaustive]
5400    pub enum IdempotencyLevel {
5401        #[allow(missing_docs)]
5402        IdempotencyUnknown,
5403        #[allow(missing_docs)]
5404        NoSideEffects,
5405        #[allow(missing_docs)]
5406        Idempotent,
5407        /// If set, the enum was initialized with an unknown value.
5408        ///
5409        /// Applications can examine the value using [IdempotencyLevel::value] or
5410        /// [IdempotencyLevel::name].
5411        UnknownValue(idempotency_level::UnknownValue),
5412    }
5413
5414    #[doc(hidden)]
5415    pub mod idempotency_level {
5416        #[allow(unused_imports)]
5417        use super::*;
5418        #[derive(Clone, Debug, PartialEq)]
5419        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5420    }
5421
5422    impl IdempotencyLevel {
5423        /// Gets the enum value.
5424        ///
5425        /// Returns `None` if the enum contains an unknown value deserialized from
5426        /// the string representation of enums.
5427        pub fn value(&self) -> std::option::Option<i32> {
5428            match self {
5429                Self::IdempotencyUnknown => std::option::Option::Some(0),
5430                Self::NoSideEffects => std::option::Option::Some(1),
5431                Self::Idempotent => std::option::Option::Some(2),
5432                Self::UnknownValue(u) => u.0.value(),
5433            }
5434        }
5435
5436        /// Gets the enum value as a string.
5437        ///
5438        /// Returns `None` if the enum contains an unknown value deserialized from
5439        /// the integer representation of enums.
5440        pub fn name(&self) -> std::option::Option<&str> {
5441            match self {
5442                Self::IdempotencyUnknown => std::option::Option::Some("IDEMPOTENCY_UNKNOWN"),
5443                Self::NoSideEffects => std::option::Option::Some("NO_SIDE_EFFECTS"),
5444                Self::Idempotent => std::option::Option::Some("IDEMPOTENT"),
5445                Self::UnknownValue(u) => u.0.name(),
5446            }
5447        }
5448    }
5449
5450    impl std::default::Default for IdempotencyLevel {
5451        fn default() -> Self {
5452            use std::convert::From;
5453            Self::from(0)
5454        }
5455    }
5456
5457    impl std::fmt::Display for IdempotencyLevel {
5458        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5459            wkt::internal::display_enum(f, self.name(), self.value())
5460        }
5461    }
5462
5463    impl std::convert::From<i32> for IdempotencyLevel {
5464        fn from(value: i32) -> Self {
5465            match value {
5466                0 => Self::IdempotencyUnknown,
5467                1 => Self::NoSideEffects,
5468                2 => Self::Idempotent,
5469                _ => Self::UnknownValue(idempotency_level::UnknownValue(
5470                    wkt::internal::UnknownEnumValue::Integer(value),
5471                )),
5472            }
5473        }
5474    }
5475
5476    impl std::convert::From<&str> for IdempotencyLevel {
5477        fn from(value: &str) -> Self {
5478            use std::string::ToString;
5479            match value {
5480                "IDEMPOTENCY_UNKNOWN" => Self::IdempotencyUnknown,
5481                "NO_SIDE_EFFECTS" => Self::NoSideEffects,
5482                "IDEMPOTENT" => Self::Idempotent,
5483                _ => Self::UnknownValue(idempotency_level::UnknownValue(
5484                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5485                )),
5486            }
5487        }
5488    }
5489
5490    impl serde::ser::Serialize for IdempotencyLevel {
5491        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5492        where
5493            S: serde::Serializer,
5494        {
5495            match self {
5496                Self::IdempotencyUnknown => serializer.serialize_i32(0),
5497                Self::NoSideEffects => serializer.serialize_i32(1),
5498                Self::Idempotent => serializer.serialize_i32(2),
5499                Self::UnknownValue(u) => u.0.serialize(serializer),
5500            }
5501        }
5502    }
5503
5504    impl<'de> serde::de::Deserialize<'de> for IdempotencyLevel {
5505        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5506        where
5507            D: serde::Deserializer<'de>,
5508        {
5509            deserializer.deserialize_any(wkt::internal::EnumVisitor::<IdempotencyLevel>::new(
5510                ".google.protobuf.MethodOptions.IdempotencyLevel",
5511            ))
5512        }
5513    }
5514}
5515
5516/// A message representing a option the parser does not recognize. This only
5517/// appears in options protos created by the compiler::Parser class.
5518/// DescriptorPool resolves these when building Descriptor objects. Therefore,
5519/// options protos in descriptor objects (e.g. returned by Descriptor::options(),
5520/// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
5521/// in them.
5522#[derive(Clone, Default, PartialEq)]
5523#[non_exhaustive]
5524pub struct UninterpretedOption {
5525    #[allow(missing_docs)]
5526    pub name: std::vec::Vec<crate::uninterpreted_option::NamePart>,
5527
5528    /// The value of the uninterpreted option, in whatever type the tokenizer
5529    /// identified it as during parsing. Exactly one of these should be set.
5530    pub identifier_value: std::string::String,
5531
5532    #[allow(missing_docs)]
5533    pub positive_int_value: u64,
5534
5535    #[allow(missing_docs)]
5536    pub negative_int_value: i64,
5537
5538    #[allow(missing_docs)]
5539    pub double_value: f64,
5540
5541    #[allow(missing_docs)]
5542    pub string_value: ::bytes::Bytes,
5543
5544    #[allow(missing_docs)]
5545    pub aggregate_value: std::string::String,
5546
5547    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5548}
5549
5550impl UninterpretedOption {
5551    /// Creates a new default instance.
5552    pub fn new() -> Self {
5553        std::default::Default::default()
5554    }
5555
5556    /// Sets the value of [name][crate::UninterpretedOption::name].
5557    ///
5558    /// # Example
5559    /// ```ignore,no_run
5560    /// # use google_cloud_wkt::UninterpretedOption;
5561    /// use google_cloud_wkt::uninterpreted_option::NamePart;
5562    /// let x = UninterpretedOption::new()
5563    ///     .set_name([
5564    ///         NamePart::default()/* use setters */,
5565    ///         NamePart::default()/* use (different) setters */,
5566    ///     ]);
5567    /// ```
5568    pub fn set_name<T, V>(mut self, v: T) -> Self
5569    where
5570        T: std::iter::IntoIterator<Item = V>,
5571        V: std::convert::Into<crate::uninterpreted_option::NamePart>,
5572    {
5573        use std::iter::Iterator;
5574        self.name = v.into_iter().map(|i| i.into()).collect();
5575        self
5576    }
5577
5578    /// Sets the value of [identifier_value][crate::UninterpretedOption::identifier_value].
5579    ///
5580    /// # Example
5581    /// ```ignore,no_run
5582    /// # use google_cloud_wkt::UninterpretedOption;
5583    /// let x = UninterpretedOption::new().set_identifier_value("example");
5584    /// ```
5585    pub fn set_identifier_value<T: std::convert::Into<std::string::String>>(
5586        mut self,
5587        v: T,
5588    ) -> Self {
5589        self.identifier_value = v.into();
5590        self
5591    }
5592
5593    /// Sets the value of [positive_int_value][crate::UninterpretedOption::positive_int_value].
5594    ///
5595    /// # Example
5596    /// ```ignore,no_run
5597    /// # use google_cloud_wkt::UninterpretedOption;
5598    /// let x = UninterpretedOption::new().set_positive_int_value(42_u32);
5599    /// ```
5600    pub fn set_positive_int_value<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
5601        self.positive_int_value = v.into();
5602        self
5603    }
5604
5605    /// Sets the value of [negative_int_value][crate::UninterpretedOption::negative_int_value].
5606    ///
5607    /// # Example
5608    /// ```ignore,no_run
5609    /// # use google_cloud_wkt::UninterpretedOption;
5610    /// let x = UninterpretedOption::new().set_negative_int_value(42);
5611    /// ```
5612    pub fn set_negative_int_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5613        self.negative_int_value = v.into();
5614        self
5615    }
5616
5617    /// Sets the value of [double_value][crate::UninterpretedOption::double_value].
5618    ///
5619    /// # Example
5620    /// ```ignore,no_run
5621    /// # use google_cloud_wkt::UninterpretedOption;
5622    /// let x = UninterpretedOption::new().set_double_value(42.0);
5623    /// ```
5624    pub fn set_double_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5625        self.double_value = v.into();
5626        self
5627    }
5628
5629    /// Sets the value of [string_value][crate::UninterpretedOption::string_value].
5630    ///
5631    /// # Example
5632    /// ```ignore,no_run
5633    /// # use google_cloud_wkt::UninterpretedOption;
5634    /// let x = UninterpretedOption::new().set_string_value(bytes::Bytes::from_static(b"example"));
5635    /// ```
5636    pub fn set_string_value<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5637        self.string_value = v.into();
5638        self
5639    }
5640
5641    /// Sets the value of [aggregate_value][crate::UninterpretedOption::aggregate_value].
5642    ///
5643    /// # Example
5644    /// ```ignore,no_run
5645    /// # use google_cloud_wkt::UninterpretedOption;
5646    /// let x = UninterpretedOption::new().set_aggregate_value("example");
5647    /// ```
5648    pub fn set_aggregate_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5649        self.aggregate_value = v.into();
5650        self
5651    }
5652}
5653
5654impl wkt::message::Message for UninterpretedOption {
5655    fn typename() -> &'static str {
5656        "type.googleapis.com/google.protobuf.UninterpretedOption"
5657    }
5658}
5659
5660/// Defines additional types related to [UninterpretedOption].
5661pub mod uninterpreted_option {
5662    #[allow(unused_imports)]
5663    use super::*;
5664
5665    /// The name of the uninterpreted option.  Each string represents a segment in
5666    /// a dot-separated name.  is_extension is true iff a segment represents an
5667    /// extension (denoted with parentheses in options specs in .proto files).
5668    /// E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents
5669    /// "foo.(bar.baz).moo".
5670    #[derive(Clone, Default, PartialEq)]
5671    #[non_exhaustive]
5672    pub struct NamePart {
5673        #[allow(missing_docs)]
5674        pub name_part: std::string::String,
5675
5676        #[allow(missing_docs)]
5677        pub is_extension: bool,
5678
5679        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5680    }
5681
5682    impl NamePart {
5683        /// Creates a new default instance.
5684        pub fn new() -> Self {
5685            std::default::Default::default()
5686        }
5687
5688        /// Sets the value of [name_part][crate::uninterpreted_option::NamePart::name_part].
5689        ///
5690        /// # Example
5691        /// ```ignore,no_run
5692        /// # use google_cloud_wkt::uninterpreted_option::NamePart;
5693        /// let x = NamePart::new().set_name_part("example");
5694        /// ```
5695        pub fn set_name_part<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5696            self.name_part = v.into();
5697            self
5698        }
5699
5700        /// Sets the value of [is_extension][crate::uninterpreted_option::NamePart::is_extension].
5701        ///
5702        /// # Example
5703        /// ```ignore,no_run
5704        /// # use google_cloud_wkt::uninterpreted_option::NamePart;
5705        /// let x = NamePart::new().set_is_extension(true);
5706        /// ```
5707        pub fn set_is_extension<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5708            self.is_extension = v.into();
5709            self
5710        }
5711    }
5712
5713    impl wkt::message::Message for NamePart {
5714        fn typename() -> &'static str {
5715            "type.googleapis.com/google.protobuf.UninterpretedOption.NamePart"
5716        }
5717    }
5718}
5719
5720/// TODO Enums in C++ gencode (and potentially other languages) are
5721/// not well scoped.  This means that each of the feature enums below can clash
5722/// with each other.  The short names we've chosen maximize call-site
5723/// readability, but leave us very open to this scenario.  A future feature will
5724/// be designed and implemented to handle this, hopefully before we ever hit a
5725/// conflict here.
5726#[derive(Clone, Default, PartialEq)]
5727#[non_exhaustive]
5728pub struct FeatureSet {
5729    #[allow(missing_docs)]
5730    pub field_presence: crate::feature_set::FieldPresence,
5731
5732    #[allow(missing_docs)]
5733    pub enum_type: crate::feature_set::EnumType,
5734
5735    #[allow(missing_docs)]
5736    pub repeated_field_encoding: crate::feature_set::RepeatedFieldEncoding,
5737
5738    #[allow(missing_docs)]
5739    pub utf8_validation: crate::feature_set::Utf8Validation,
5740
5741    #[allow(missing_docs)]
5742    pub message_encoding: crate::feature_set::MessageEncoding,
5743
5744    #[allow(missing_docs)]
5745    pub json_format: crate::feature_set::JsonFormat,
5746
5747    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5748}
5749
5750impl FeatureSet {
5751    /// Creates a new default instance.
5752    pub fn new() -> Self {
5753        std::default::Default::default()
5754    }
5755
5756    /// Sets the value of [field_presence][crate::FeatureSet::field_presence].
5757    ///
5758    /// # Example
5759    /// ```ignore,no_run
5760    /// # use google_cloud_wkt::FeatureSet;
5761    /// use google_cloud_wkt::feature_set::FieldPresence;
5762    /// let x0 = FeatureSet::new().set_field_presence(FieldPresence::Explicit);
5763    /// let x1 = FeatureSet::new().set_field_presence(FieldPresence::Implicit);
5764    /// let x2 = FeatureSet::new().set_field_presence(FieldPresence::LegacyRequired);
5765    /// ```
5766    pub fn set_field_presence<T: std::convert::Into<crate::feature_set::FieldPresence>>(
5767        mut self,
5768        v: T,
5769    ) -> Self {
5770        self.field_presence = v.into();
5771        self
5772    }
5773
5774    /// Sets the value of [enum_type][crate::FeatureSet::enum_type].
5775    ///
5776    /// # Example
5777    /// ```ignore,no_run
5778    /// # use google_cloud_wkt::FeatureSet;
5779    /// use google_cloud_wkt::feature_set::EnumType;
5780    /// let x0 = FeatureSet::new().set_enum_type(EnumType::Open);
5781    /// let x1 = FeatureSet::new().set_enum_type(EnumType::Closed);
5782    /// ```
5783    pub fn set_enum_type<T: std::convert::Into<crate::feature_set::EnumType>>(
5784        mut self,
5785        v: T,
5786    ) -> Self {
5787        self.enum_type = v.into();
5788        self
5789    }
5790
5791    /// Sets the value of [repeated_field_encoding][crate::FeatureSet::repeated_field_encoding].
5792    ///
5793    /// # Example
5794    /// ```ignore,no_run
5795    /// # use google_cloud_wkt::FeatureSet;
5796    /// use google_cloud_wkt::feature_set::RepeatedFieldEncoding;
5797    /// let x0 = FeatureSet::new().set_repeated_field_encoding(RepeatedFieldEncoding::Packed);
5798    /// let x1 = FeatureSet::new().set_repeated_field_encoding(RepeatedFieldEncoding::Expanded);
5799    /// ```
5800    pub fn set_repeated_field_encoding<
5801        T: std::convert::Into<crate::feature_set::RepeatedFieldEncoding>,
5802    >(
5803        mut self,
5804        v: T,
5805    ) -> Self {
5806        self.repeated_field_encoding = v.into();
5807        self
5808    }
5809
5810    /// Sets the value of [utf8_validation][crate::FeatureSet::utf8_validation].
5811    ///
5812    /// # Example
5813    /// ```ignore,no_run
5814    /// # use google_cloud_wkt::FeatureSet;
5815    /// use google_cloud_wkt::feature_set::Utf8Validation;
5816    /// let x0 = FeatureSet::new().set_utf8_validation(Utf8Validation::Verify);
5817    /// let x1 = FeatureSet::new().set_utf8_validation(Utf8Validation::None);
5818    /// ```
5819    pub fn set_utf8_validation<T: std::convert::Into<crate::feature_set::Utf8Validation>>(
5820        mut self,
5821        v: T,
5822    ) -> Self {
5823        self.utf8_validation = v.into();
5824        self
5825    }
5826
5827    /// Sets the value of [message_encoding][crate::FeatureSet::message_encoding].
5828    ///
5829    /// # Example
5830    /// ```ignore,no_run
5831    /// # use google_cloud_wkt::FeatureSet;
5832    /// use google_cloud_wkt::feature_set::MessageEncoding;
5833    /// let x0 = FeatureSet::new().set_message_encoding(MessageEncoding::LengthPrefixed);
5834    /// let x1 = FeatureSet::new().set_message_encoding(MessageEncoding::Delimited);
5835    /// ```
5836    pub fn set_message_encoding<T: std::convert::Into<crate::feature_set::MessageEncoding>>(
5837        mut self,
5838        v: T,
5839    ) -> Self {
5840        self.message_encoding = v.into();
5841        self
5842    }
5843
5844    /// Sets the value of [json_format][crate::FeatureSet::json_format].
5845    ///
5846    /// # Example
5847    /// ```ignore,no_run
5848    /// # use google_cloud_wkt::FeatureSet;
5849    /// use google_cloud_wkt::feature_set::JsonFormat;
5850    /// let x0 = FeatureSet::new().set_json_format(JsonFormat::Allow);
5851    /// let x1 = FeatureSet::new().set_json_format(JsonFormat::LegacyBestEffort);
5852    /// ```
5853    pub fn set_json_format<T: std::convert::Into<crate::feature_set::JsonFormat>>(
5854        mut self,
5855        v: T,
5856    ) -> Self {
5857        self.json_format = v.into();
5858        self
5859    }
5860}
5861
5862impl wkt::message::Message for FeatureSet {
5863    fn typename() -> &'static str {
5864        "type.googleapis.com/google.protobuf.FeatureSet"
5865    }
5866}
5867
5868/// Defines additional types related to [FeatureSet].
5869pub mod feature_set {
5870    #[allow(unused_imports)]
5871    use super::*;
5872
5873    /// Enum for [FieldPresence].
5874    ///
5875    /// # Working with unknown values
5876    ///
5877    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5878    /// additional enum variants at any time. Adding new variants is not considered
5879    /// a breaking change. Applications should write their code in anticipation of:
5880    ///
5881    /// - New values appearing in future releases of the client library, **and**
5882    /// - New values received dynamically, without application changes.
5883    ///
5884    /// Please consult the [Working with enums] section in the user guide for some
5885    /// guidelines.
5886    ///
5887    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5888    #[derive(Clone, Debug, PartialEq)]
5889    #[non_exhaustive]
5890    pub enum FieldPresence {
5891        #[allow(missing_docs)]
5892        Unknown,
5893        #[allow(missing_docs)]
5894        Explicit,
5895        #[allow(missing_docs)]
5896        Implicit,
5897        #[allow(missing_docs)]
5898        LegacyRequired,
5899        /// If set, the enum was initialized with an unknown value.
5900        ///
5901        /// Applications can examine the value using [FieldPresence::value] or
5902        /// [FieldPresence::name].
5903        UnknownValue(field_presence::UnknownValue),
5904    }
5905
5906    #[doc(hidden)]
5907    pub mod field_presence {
5908        #[allow(unused_imports)]
5909        use super::*;
5910        #[derive(Clone, Debug, PartialEq)]
5911        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5912    }
5913
5914    impl FieldPresence {
5915        /// Gets the enum value.
5916        ///
5917        /// Returns `None` if the enum contains an unknown value deserialized from
5918        /// the string representation of enums.
5919        pub fn value(&self) -> std::option::Option<i32> {
5920            match self {
5921                Self::Unknown => std::option::Option::Some(0),
5922                Self::Explicit => std::option::Option::Some(1),
5923                Self::Implicit => std::option::Option::Some(2),
5924                Self::LegacyRequired => std::option::Option::Some(3),
5925                Self::UnknownValue(u) => u.0.value(),
5926            }
5927        }
5928
5929        /// Gets the enum value as a string.
5930        ///
5931        /// Returns `None` if the enum contains an unknown value deserialized from
5932        /// the integer representation of enums.
5933        pub fn name(&self) -> std::option::Option<&str> {
5934            match self {
5935                Self::Unknown => std::option::Option::Some("FIELD_PRESENCE_UNKNOWN"),
5936                Self::Explicit => std::option::Option::Some("EXPLICIT"),
5937                Self::Implicit => std::option::Option::Some("IMPLICIT"),
5938                Self::LegacyRequired => std::option::Option::Some("LEGACY_REQUIRED"),
5939                Self::UnknownValue(u) => u.0.name(),
5940            }
5941        }
5942    }
5943
5944    impl std::default::Default for FieldPresence {
5945        fn default() -> Self {
5946            use std::convert::From;
5947            Self::from(0)
5948        }
5949    }
5950
5951    impl std::fmt::Display for FieldPresence {
5952        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5953            wkt::internal::display_enum(f, self.name(), self.value())
5954        }
5955    }
5956
5957    impl std::convert::From<i32> for FieldPresence {
5958        fn from(value: i32) -> Self {
5959            match value {
5960                0 => Self::Unknown,
5961                1 => Self::Explicit,
5962                2 => Self::Implicit,
5963                3 => Self::LegacyRequired,
5964                _ => Self::UnknownValue(field_presence::UnknownValue(
5965                    wkt::internal::UnknownEnumValue::Integer(value),
5966                )),
5967            }
5968        }
5969    }
5970
5971    impl std::convert::From<&str> for FieldPresence {
5972        fn from(value: &str) -> Self {
5973            use std::string::ToString;
5974            match value {
5975                "FIELD_PRESENCE_UNKNOWN" => Self::Unknown,
5976                "EXPLICIT" => Self::Explicit,
5977                "IMPLICIT" => Self::Implicit,
5978                "LEGACY_REQUIRED" => Self::LegacyRequired,
5979                _ => Self::UnknownValue(field_presence::UnknownValue(
5980                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5981                )),
5982            }
5983        }
5984    }
5985
5986    impl serde::ser::Serialize for FieldPresence {
5987        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5988        where
5989            S: serde::Serializer,
5990        {
5991            match self {
5992                Self::Unknown => serializer.serialize_i32(0),
5993                Self::Explicit => serializer.serialize_i32(1),
5994                Self::Implicit => serializer.serialize_i32(2),
5995                Self::LegacyRequired => serializer.serialize_i32(3),
5996                Self::UnknownValue(u) => u.0.serialize(serializer),
5997            }
5998        }
5999    }
6000
6001    impl<'de> serde::de::Deserialize<'de> for FieldPresence {
6002        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6003        where
6004            D: serde::Deserializer<'de>,
6005        {
6006            deserializer.deserialize_any(wkt::internal::EnumVisitor::<FieldPresence>::new(
6007                ".google.protobuf.FeatureSet.FieldPresence",
6008            ))
6009        }
6010    }
6011
6012    /// Enum for [EnumType].
6013    ///
6014    /// # Working with unknown values
6015    ///
6016    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6017    /// additional enum variants at any time. Adding new variants is not considered
6018    /// a breaking change. Applications should write their code in anticipation of:
6019    ///
6020    /// - New values appearing in future releases of the client library, **and**
6021    /// - New values received dynamically, without application changes.
6022    ///
6023    /// Please consult the [Working with enums] section in the user guide for some
6024    /// guidelines.
6025    ///
6026    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6027    #[derive(Clone, Debug, PartialEq)]
6028    #[non_exhaustive]
6029    pub enum EnumType {
6030        #[allow(missing_docs)]
6031        Unknown,
6032        #[allow(missing_docs)]
6033        Open,
6034        #[allow(missing_docs)]
6035        Closed,
6036        /// If set, the enum was initialized with an unknown value.
6037        ///
6038        /// Applications can examine the value using [EnumType::value] or
6039        /// [EnumType::name].
6040        UnknownValue(enum_type::UnknownValue),
6041    }
6042
6043    #[doc(hidden)]
6044    pub mod enum_type {
6045        #[allow(unused_imports)]
6046        use super::*;
6047        #[derive(Clone, Debug, PartialEq)]
6048        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6049    }
6050
6051    impl EnumType {
6052        /// Gets the enum value.
6053        ///
6054        /// Returns `None` if the enum contains an unknown value deserialized from
6055        /// the string representation of enums.
6056        pub fn value(&self) -> std::option::Option<i32> {
6057            match self {
6058                Self::Unknown => std::option::Option::Some(0),
6059                Self::Open => std::option::Option::Some(1),
6060                Self::Closed => std::option::Option::Some(2),
6061                Self::UnknownValue(u) => u.0.value(),
6062            }
6063        }
6064
6065        /// Gets the enum value as a string.
6066        ///
6067        /// Returns `None` if the enum contains an unknown value deserialized from
6068        /// the integer representation of enums.
6069        pub fn name(&self) -> std::option::Option<&str> {
6070            match self {
6071                Self::Unknown => std::option::Option::Some("ENUM_TYPE_UNKNOWN"),
6072                Self::Open => std::option::Option::Some("OPEN"),
6073                Self::Closed => std::option::Option::Some("CLOSED"),
6074                Self::UnknownValue(u) => u.0.name(),
6075            }
6076        }
6077    }
6078
6079    impl std::default::Default for EnumType {
6080        fn default() -> Self {
6081            use std::convert::From;
6082            Self::from(0)
6083        }
6084    }
6085
6086    impl std::fmt::Display for EnumType {
6087        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6088            wkt::internal::display_enum(f, self.name(), self.value())
6089        }
6090    }
6091
6092    impl std::convert::From<i32> for EnumType {
6093        fn from(value: i32) -> Self {
6094            match value {
6095                0 => Self::Unknown,
6096                1 => Self::Open,
6097                2 => Self::Closed,
6098                _ => Self::UnknownValue(enum_type::UnknownValue(
6099                    wkt::internal::UnknownEnumValue::Integer(value),
6100                )),
6101            }
6102        }
6103    }
6104
6105    impl std::convert::From<&str> for EnumType {
6106        fn from(value: &str) -> Self {
6107            use std::string::ToString;
6108            match value {
6109                "ENUM_TYPE_UNKNOWN" => Self::Unknown,
6110                "OPEN" => Self::Open,
6111                "CLOSED" => Self::Closed,
6112                _ => Self::UnknownValue(enum_type::UnknownValue(
6113                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6114                )),
6115            }
6116        }
6117    }
6118
6119    impl serde::ser::Serialize for EnumType {
6120        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6121        where
6122            S: serde::Serializer,
6123        {
6124            match self {
6125                Self::Unknown => serializer.serialize_i32(0),
6126                Self::Open => serializer.serialize_i32(1),
6127                Self::Closed => serializer.serialize_i32(2),
6128                Self::UnknownValue(u) => u.0.serialize(serializer),
6129            }
6130        }
6131    }
6132
6133    impl<'de> serde::de::Deserialize<'de> for EnumType {
6134        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6135        where
6136            D: serde::Deserializer<'de>,
6137        {
6138            deserializer.deserialize_any(wkt::internal::EnumVisitor::<EnumType>::new(
6139                ".google.protobuf.FeatureSet.EnumType",
6140            ))
6141        }
6142    }
6143
6144    /// Enum for [RepeatedFieldEncoding].
6145    ///
6146    /// # Working with unknown values
6147    ///
6148    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6149    /// additional enum variants at any time. Adding new variants is not considered
6150    /// a breaking change. Applications should write their code in anticipation of:
6151    ///
6152    /// - New values appearing in future releases of the client library, **and**
6153    /// - New values received dynamically, without application changes.
6154    ///
6155    /// Please consult the [Working with enums] section in the user guide for some
6156    /// guidelines.
6157    ///
6158    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6159    #[derive(Clone, Debug, PartialEq)]
6160    #[non_exhaustive]
6161    pub enum RepeatedFieldEncoding {
6162        #[allow(missing_docs)]
6163        Unknown,
6164        #[allow(missing_docs)]
6165        Packed,
6166        #[allow(missing_docs)]
6167        Expanded,
6168        /// If set, the enum was initialized with an unknown value.
6169        ///
6170        /// Applications can examine the value using [RepeatedFieldEncoding::value] or
6171        /// [RepeatedFieldEncoding::name].
6172        UnknownValue(repeated_field_encoding::UnknownValue),
6173    }
6174
6175    #[doc(hidden)]
6176    pub mod repeated_field_encoding {
6177        #[allow(unused_imports)]
6178        use super::*;
6179        #[derive(Clone, Debug, PartialEq)]
6180        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6181    }
6182
6183    impl RepeatedFieldEncoding {
6184        /// Gets the enum value.
6185        ///
6186        /// Returns `None` if the enum contains an unknown value deserialized from
6187        /// the string representation of enums.
6188        pub fn value(&self) -> std::option::Option<i32> {
6189            match self {
6190                Self::Unknown => std::option::Option::Some(0),
6191                Self::Packed => std::option::Option::Some(1),
6192                Self::Expanded => std::option::Option::Some(2),
6193                Self::UnknownValue(u) => u.0.value(),
6194            }
6195        }
6196
6197        /// Gets the enum value as a string.
6198        ///
6199        /// Returns `None` if the enum contains an unknown value deserialized from
6200        /// the integer representation of enums.
6201        pub fn name(&self) -> std::option::Option<&str> {
6202            match self {
6203                Self::Unknown => std::option::Option::Some("REPEATED_FIELD_ENCODING_UNKNOWN"),
6204                Self::Packed => std::option::Option::Some("PACKED"),
6205                Self::Expanded => std::option::Option::Some("EXPANDED"),
6206                Self::UnknownValue(u) => u.0.name(),
6207            }
6208        }
6209    }
6210
6211    impl std::default::Default for RepeatedFieldEncoding {
6212        fn default() -> Self {
6213            use std::convert::From;
6214            Self::from(0)
6215        }
6216    }
6217
6218    impl std::fmt::Display for RepeatedFieldEncoding {
6219        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6220            wkt::internal::display_enum(f, self.name(), self.value())
6221        }
6222    }
6223
6224    impl std::convert::From<i32> for RepeatedFieldEncoding {
6225        fn from(value: i32) -> Self {
6226            match value {
6227                0 => Self::Unknown,
6228                1 => Self::Packed,
6229                2 => Self::Expanded,
6230                _ => Self::UnknownValue(repeated_field_encoding::UnknownValue(
6231                    wkt::internal::UnknownEnumValue::Integer(value),
6232                )),
6233            }
6234        }
6235    }
6236
6237    impl std::convert::From<&str> for RepeatedFieldEncoding {
6238        fn from(value: &str) -> Self {
6239            use std::string::ToString;
6240            match value {
6241                "REPEATED_FIELD_ENCODING_UNKNOWN" => Self::Unknown,
6242                "PACKED" => Self::Packed,
6243                "EXPANDED" => Self::Expanded,
6244                _ => Self::UnknownValue(repeated_field_encoding::UnknownValue(
6245                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6246                )),
6247            }
6248        }
6249    }
6250
6251    impl serde::ser::Serialize for RepeatedFieldEncoding {
6252        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6253        where
6254            S: serde::Serializer,
6255        {
6256            match self {
6257                Self::Unknown => serializer.serialize_i32(0),
6258                Self::Packed => serializer.serialize_i32(1),
6259                Self::Expanded => serializer.serialize_i32(2),
6260                Self::UnknownValue(u) => u.0.serialize(serializer),
6261            }
6262        }
6263    }
6264
6265    impl<'de> serde::de::Deserialize<'de> for RepeatedFieldEncoding {
6266        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6267        where
6268            D: serde::Deserializer<'de>,
6269        {
6270            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RepeatedFieldEncoding>::new(
6271                ".google.protobuf.FeatureSet.RepeatedFieldEncoding",
6272            ))
6273        }
6274    }
6275
6276    /// Enum for [Utf8Validation].
6277    ///
6278    /// # Working with unknown values
6279    ///
6280    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6281    /// additional enum variants at any time. Adding new variants is not considered
6282    /// a breaking change. Applications should write their code in anticipation of:
6283    ///
6284    /// - New values appearing in future releases of the client library, **and**
6285    /// - New values received dynamically, without application changes.
6286    ///
6287    /// Please consult the [Working with enums] section in the user guide for some
6288    /// guidelines.
6289    ///
6290    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6291    #[derive(Clone, Debug, PartialEq)]
6292    #[non_exhaustive]
6293    pub enum Utf8Validation {
6294        #[allow(missing_docs)]
6295        Unknown,
6296        #[allow(missing_docs)]
6297        Verify,
6298        #[allow(missing_docs)]
6299        None,
6300        /// If set, the enum was initialized with an unknown value.
6301        ///
6302        /// Applications can examine the value using [Utf8Validation::value] or
6303        /// [Utf8Validation::name].
6304        UnknownValue(utf_8_validation::UnknownValue),
6305    }
6306
6307    #[doc(hidden)]
6308    pub mod utf_8_validation {
6309        #[allow(unused_imports)]
6310        use super::*;
6311        #[derive(Clone, Debug, PartialEq)]
6312        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6313    }
6314
6315    impl Utf8Validation {
6316        /// Gets the enum value.
6317        ///
6318        /// Returns `None` if the enum contains an unknown value deserialized from
6319        /// the string representation of enums.
6320        pub fn value(&self) -> std::option::Option<i32> {
6321            match self {
6322                Self::Unknown => std::option::Option::Some(0),
6323                Self::Verify => std::option::Option::Some(2),
6324                Self::None => std::option::Option::Some(3),
6325                Self::UnknownValue(u) => u.0.value(),
6326            }
6327        }
6328
6329        /// Gets the enum value as a string.
6330        ///
6331        /// Returns `None` if the enum contains an unknown value deserialized from
6332        /// the integer representation of enums.
6333        pub fn name(&self) -> std::option::Option<&str> {
6334            match self {
6335                Self::Unknown => std::option::Option::Some("UTF8_VALIDATION_UNKNOWN"),
6336                Self::Verify => std::option::Option::Some("VERIFY"),
6337                Self::None => std::option::Option::Some("NONE"),
6338                Self::UnknownValue(u) => u.0.name(),
6339            }
6340        }
6341    }
6342
6343    impl std::default::Default for Utf8Validation {
6344        fn default() -> Self {
6345            use std::convert::From;
6346            Self::from(0)
6347        }
6348    }
6349
6350    impl std::fmt::Display for Utf8Validation {
6351        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6352            wkt::internal::display_enum(f, self.name(), self.value())
6353        }
6354    }
6355
6356    impl std::convert::From<i32> for Utf8Validation {
6357        fn from(value: i32) -> Self {
6358            match value {
6359                0 => Self::Unknown,
6360                2 => Self::Verify,
6361                3 => Self::None,
6362                _ => Self::UnknownValue(utf_8_validation::UnknownValue(
6363                    wkt::internal::UnknownEnumValue::Integer(value),
6364                )),
6365            }
6366        }
6367    }
6368
6369    impl std::convert::From<&str> for Utf8Validation {
6370        fn from(value: &str) -> Self {
6371            use std::string::ToString;
6372            match value {
6373                "UTF8_VALIDATION_UNKNOWN" => Self::Unknown,
6374                "VERIFY" => Self::Verify,
6375                "NONE" => Self::None,
6376                _ => Self::UnknownValue(utf_8_validation::UnknownValue(
6377                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6378                )),
6379            }
6380        }
6381    }
6382
6383    impl serde::ser::Serialize for Utf8Validation {
6384        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6385        where
6386            S: serde::Serializer,
6387        {
6388            match self {
6389                Self::Unknown => serializer.serialize_i32(0),
6390                Self::Verify => serializer.serialize_i32(2),
6391                Self::None => serializer.serialize_i32(3),
6392                Self::UnknownValue(u) => u.0.serialize(serializer),
6393            }
6394        }
6395    }
6396
6397    impl<'de> serde::de::Deserialize<'de> for Utf8Validation {
6398        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6399        where
6400            D: serde::Deserializer<'de>,
6401        {
6402            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Utf8Validation>::new(
6403                ".google.protobuf.FeatureSet.Utf8Validation",
6404            ))
6405        }
6406    }
6407
6408    /// Enum for [MessageEncoding].
6409    ///
6410    /// # Working with unknown values
6411    ///
6412    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6413    /// additional enum variants at any time. Adding new variants is not considered
6414    /// a breaking change. Applications should write their code in anticipation of:
6415    ///
6416    /// - New values appearing in future releases of the client library, **and**
6417    /// - New values received dynamically, without application changes.
6418    ///
6419    /// Please consult the [Working with enums] section in the user guide for some
6420    /// guidelines.
6421    ///
6422    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6423    #[derive(Clone, Debug, PartialEq)]
6424    #[non_exhaustive]
6425    pub enum MessageEncoding {
6426        #[allow(missing_docs)]
6427        Unknown,
6428        #[allow(missing_docs)]
6429        LengthPrefixed,
6430        #[allow(missing_docs)]
6431        Delimited,
6432        /// If set, the enum was initialized with an unknown value.
6433        ///
6434        /// Applications can examine the value using [MessageEncoding::value] or
6435        /// [MessageEncoding::name].
6436        UnknownValue(message_encoding::UnknownValue),
6437    }
6438
6439    #[doc(hidden)]
6440    pub mod message_encoding {
6441        #[allow(unused_imports)]
6442        use super::*;
6443        #[derive(Clone, Debug, PartialEq)]
6444        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6445    }
6446
6447    impl MessageEncoding {
6448        /// Gets the enum value.
6449        ///
6450        /// Returns `None` if the enum contains an unknown value deserialized from
6451        /// the string representation of enums.
6452        pub fn value(&self) -> std::option::Option<i32> {
6453            match self {
6454                Self::Unknown => std::option::Option::Some(0),
6455                Self::LengthPrefixed => std::option::Option::Some(1),
6456                Self::Delimited => std::option::Option::Some(2),
6457                Self::UnknownValue(u) => u.0.value(),
6458            }
6459        }
6460
6461        /// Gets the enum value as a string.
6462        ///
6463        /// Returns `None` if the enum contains an unknown value deserialized from
6464        /// the integer representation of enums.
6465        pub fn name(&self) -> std::option::Option<&str> {
6466            match self {
6467                Self::Unknown => std::option::Option::Some("MESSAGE_ENCODING_UNKNOWN"),
6468                Self::LengthPrefixed => std::option::Option::Some("LENGTH_PREFIXED"),
6469                Self::Delimited => std::option::Option::Some("DELIMITED"),
6470                Self::UnknownValue(u) => u.0.name(),
6471            }
6472        }
6473    }
6474
6475    impl std::default::Default for MessageEncoding {
6476        fn default() -> Self {
6477            use std::convert::From;
6478            Self::from(0)
6479        }
6480    }
6481
6482    impl std::fmt::Display for MessageEncoding {
6483        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6484            wkt::internal::display_enum(f, self.name(), self.value())
6485        }
6486    }
6487
6488    impl std::convert::From<i32> for MessageEncoding {
6489        fn from(value: i32) -> Self {
6490            match value {
6491                0 => Self::Unknown,
6492                1 => Self::LengthPrefixed,
6493                2 => Self::Delimited,
6494                _ => Self::UnknownValue(message_encoding::UnknownValue(
6495                    wkt::internal::UnknownEnumValue::Integer(value),
6496                )),
6497            }
6498        }
6499    }
6500
6501    impl std::convert::From<&str> for MessageEncoding {
6502        fn from(value: &str) -> Self {
6503            use std::string::ToString;
6504            match value {
6505                "MESSAGE_ENCODING_UNKNOWN" => Self::Unknown,
6506                "LENGTH_PREFIXED" => Self::LengthPrefixed,
6507                "DELIMITED" => Self::Delimited,
6508                _ => Self::UnknownValue(message_encoding::UnknownValue(
6509                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6510                )),
6511            }
6512        }
6513    }
6514
6515    impl serde::ser::Serialize for MessageEncoding {
6516        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6517        where
6518            S: serde::Serializer,
6519        {
6520            match self {
6521                Self::Unknown => serializer.serialize_i32(0),
6522                Self::LengthPrefixed => serializer.serialize_i32(1),
6523                Self::Delimited => serializer.serialize_i32(2),
6524                Self::UnknownValue(u) => u.0.serialize(serializer),
6525            }
6526        }
6527    }
6528
6529    impl<'de> serde::de::Deserialize<'de> for MessageEncoding {
6530        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6531        where
6532            D: serde::Deserializer<'de>,
6533        {
6534            deserializer.deserialize_any(wkt::internal::EnumVisitor::<MessageEncoding>::new(
6535                ".google.protobuf.FeatureSet.MessageEncoding",
6536            ))
6537        }
6538    }
6539
6540    /// Enum for [JsonFormat].
6541    ///
6542    /// # Working with unknown values
6543    ///
6544    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6545    /// additional enum variants at any time. Adding new variants is not considered
6546    /// a breaking change. Applications should write their code in anticipation of:
6547    ///
6548    /// - New values appearing in future releases of the client library, **and**
6549    /// - New values received dynamically, without application changes.
6550    ///
6551    /// Please consult the [Working with enums] section in the user guide for some
6552    /// guidelines.
6553    ///
6554    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6555    #[derive(Clone, Debug, PartialEq)]
6556    #[non_exhaustive]
6557    pub enum JsonFormat {
6558        #[allow(missing_docs)]
6559        Unknown,
6560        #[allow(missing_docs)]
6561        Allow,
6562        #[allow(missing_docs)]
6563        LegacyBestEffort,
6564        /// If set, the enum was initialized with an unknown value.
6565        ///
6566        /// Applications can examine the value using [JsonFormat::value] or
6567        /// [JsonFormat::name].
6568        UnknownValue(json_format::UnknownValue),
6569    }
6570
6571    #[doc(hidden)]
6572    pub mod json_format {
6573        #[allow(unused_imports)]
6574        use super::*;
6575        #[derive(Clone, Debug, PartialEq)]
6576        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6577    }
6578
6579    impl JsonFormat {
6580        /// Gets the enum value.
6581        ///
6582        /// Returns `None` if the enum contains an unknown value deserialized from
6583        /// the string representation of enums.
6584        pub fn value(&self) -> std::option::Option<i32> {
6585            match self {
6586                Self::Unknown => std::option::Option::Some(0),
6587                Self::Allow => std::option::Option::Some(1),
6588                Self::LegacyBestEffort => std::option::Option::Some(2),
6589                Self::UnknownValue(u) => u.0.value(),
6590            }
6591        }
6592
6593        /// Gets the enum value as a string.
6594        ///
6595        /// Returns `None` if the enum contains an unknown value deserialized from
6596        /// the integer representation of enums.
6597        pub fn name(&self) -> std::option::Option<&str> {
6598            match self {
6599                Self::Unknown => std::option::Option::Some("JSON_FORMAT_UNKNOWN"),
6600                Self::Allow => std::option::Option::Some("ALLOW"),
6601                Self::LegacyBestEffort => std::option::Option::Some("LEGACY_BEST_EFFORT"),
6602                Self::UnknownValue(u) => u.0.name(),
6603            }
6604        }
6605    }
6606
6607    impl std::default::Default for JsonFormat {
6608        fn default() -> Self {
6609            use std::convert::From;
6610            Self::from(0)
6611        }
6612    }
6613
6614    impl std::fmt::Display for JsonFormat {
6615        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6616            wkt::internal::display_enum(f, self.name(), self.value())
6617        }
6618    }
6619
6620    impl std::convert::From<i32> for JsonFormat {
6621        fn from(value: i32) -> Self {
6622            match value {
6623                0 => Self::Unknown,
6624                1 => Self::Allow,
6625                2 => Self::LegacyBestEffort,
6626                _ => Self::UnknownValue(json_format::UnknownValue(
6627                    wkt::internal::UnknownEnumValue::Integer(value),
6628                )),
6629            }
6630        }
6631    }
6632
6633    impl std::convert::From<&str> for JsonFormat {
6634        fn from(value: &str) -> Self {
6635            use std::string::ToString;
6636            match value {
6637                "JSON_FORMAT_UNKNOWN" => Self::Unknown,
6638                "ALLOW" => Self::Allow,
6639                "LEGACY_BEST_EFFORT" => Self::LegacyBestEffort,
6640                _ => Self::UnknownValue(json_format::UnknownValue(
6641                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6642                )),
6643            }
6644        }
6645    }
6646
6647    impl serde::ser::Serialize for JsonFormat {
6648        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6649        where
6650            S: serde::Serializer,
6651        {
6652            match self {
6653                Self::Unknown => serializer.serialize_i32(0),
6654                Self::Allow => serializer.serialize_i32(1),
6655                Self::LegacyBestEffort => serializer.serialize_i32(2),
6656                Self::UnknownValue(u) => u.0.serialize(serializer),
6657            }
6658        }
6659    }
6660
6661    impl<'de> serde::de::Deserialize<'de> for JsonFormat {
6662        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6663        where
6664            D: serde::Deserializer<'de>,
6665        {
6666            deserializer.deserialize_any(wkt::internal::EnumVisitor::<JsonFormat>::new(
6667                ".google.protobuf.FeatureSet.JsonFormat",
6668            ))
6669        }
6670    }
6671}
6672
6673/// A compiled specification for the defaults of a set of features.  These
6674/// messages are generated from FeatureSet extensions and can be used to seed
6675/// feature resolution. The resolution with this object becomes a simple search
6676/// for the closest matching edition, followed by proto merges.
6677#[derive(Clone, Default, PartialEq)]
6678#[non_exhaustive]
6679pub struct FeatureSetDefaults {
6680    #[allow(missing_docs)]
6681    pub defaults: std::vec::Vec<crate::feature_set_defaults::FeatureSetEditionDefault>,
6682
6683    /// The minimum supported edition (inclusive) when this was constructed.
6684    /// Editions before this will not have defaults.
6685    pub minimum_edition: crate::Edition,
6686
6687    /// The maximum known edition (inclusive) when this was constructed. Editions
6688    /// after this will not have reliable defaults.
6689    pub maximum_edition: crate::Edition,
6690
6691    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6692}
6693
6694impl FeatureSetDefaults {
6695    /// Creates a new default instance.
6696    pub fn new() -> Self {
6697        std::default::Default::default()
6698    }
6699
6700    /// Sets the value of [defaults][crate::FeatureSetDefaults::defaults].
6701    ///
6702    /// # Example
6703    /// ```ignore,no_run
6704    /// # use google_cloud_wkt::FeatureSetDefaults;
6705    /// use google_cloud_wkt::feature_set_defaults::FeatureSetEditionDefault;
6706    /// let x = FeatureSetDefaults::new()
6707    ///     .set_defaults([
6708    ///         FeatureSetEditionDefault::default()/* use setters */,
6709    ///         FeatureSetEditionDefault::default()/* use (different) setters */,
6710    ///     ]);
6711    /// ```
6712    pub fn set_defaults<T, V>(mut self, v: T) -> Self
6713    where
6714        T: std::iter::IntoIterator<Item = V>,
6715        V: std::convert::Into<crate::feature_set_defaults::FeatureSetEditionDefault>,
6716    {
6717        use std::iter::Iterator;
6718        self.defaults = v.into_iter().map(|i| i.into()).collect();
6719        self
6720    }
6721
6722    /// Sets the value of [minimum_edition][crate::FeatureSetDefaults::minimum_edition].
6723    ///
6724    /// # Example
6725    /// ```ignore,no_run
6726    /// # use google_cloud_wkt::FeatureSetDefaults;
6727    /// use google_cloud_wkt::Edition;
6728    /// let x0 = FeatureSetDefaults::new().set_minimum_edition(Edition::Legacy);
6729    /// let x1 = FeatureSetDefaults::new().set_minimum_edition(Edition::Proto2);
6730    /// let x2 = FeatureSetDefaults::new().set_minimum_edition(Edition::Proto3);
6731    /// ```
6732    pub fn set_minimum_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
6733        self.minimum_edition = v.into();
6734        self
6735    }
6736
6737    /// Sets the value of [maximum_edition][crate::FeatureSetDefaults::maximum_edition].
6738    ///
6739    /// # Example
6740    /// ```ignore,no_run
6741    /// # use google_cloud_wkt::FeatureSetDefaults;
6742    /// use google_cloud_wkt::Edition;
6743    /// let x0 = FeatureSetDefaults::new().set_maximum_edition(Edition::Legacy);
6744    /// let x1 = FeatureSetDefaults::new().set_maximum_edition(Edition::Proto2);
6745    /// let x2 = FeatureSetDefaults::new().set_maximum_edition(Edition::Proto3);
6746    /// ```
6747    pub fn set_maximum_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
6748        self.maximum_edition = v.into();
6749        self
6750    }
6751}
6752
6753impl wkt::message::Message for FeatureSetDefaults {
6754    fn typename() -> &'static str {
6755        "type.googleapis.com/google.protobuf.FeatureSetDefaults"
6756    }
6757}
6758
6759/// Defines additional types related to [FeatureSetDefaults].
6760pub mod feature_set_defaults {
6761    #[allow(unused_imports)]
6762    use super::*;
6763
6764    /// A map from every known edition with a unique set of defaults to its
6765    /// defaults. Not all editions may be contained here.  For a given edition,
6766    /// the defaults at the closest matching edition ordered at or before it should
6767    /// be used.  This field must be in strict ascending order by edition.
6768    #[derive(Clone, Default, PartialEq)]
6769    #[non_exhaustive]
6770    pub struct FeatureSetEditionDefault {
6771        #[allow(missing_docs)]
6772        pub edition: crate::Edition,
6773
6774        /// Defaults of features that can be overridden in this edition.
6775        pub overridable_features: std::option::Option<crate::FeatureSet>,
6776
6777        /// Defaults of features that can't be overridden in this edition.
6778        pub fixed_features: std::option::Option<crate::FeatureSet>,
6779
6780        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6781    }
6782
6783    impl FeatureSetEditionDefault {
6784        /// Creates a new default instance.
6785        pub fn new() -> Self {
6786            std::default::Default::default()
6787        }
6788
6789        /// Sets the value of [edition][crate::feature_set_defaults::FeatureSetEditionDefault::edition].
6790        ///
6791        /// # Example
6792        /// ```ignore,no_run
6793        /// # use google_cloud_wkt::feature_set_defaults::FeatureSetEditionDefault;
6794        /// use google_cloud_wkt::Edition;
6795        /// let x0 = FeatureSetEditionDefault::new().set_edition(Edition::Legacy);
6796        /// let x1 = FeatureSetEditionDefault::new().set_edition(Edition::Proto2);
6797        /// let x2 = FeatureSetEditionDefault::new().set_edition(Edition::Proto3);
6798        /// ```
6799        pub fn set_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
6800            self.edition = v.into();
6801            self
6802        }
6803
6804        /// Sets the value of [overridable_features][crate::feature_set_defaults::FeatureSetEditionDefault::overridable_features].
6805        ///
6806        /// # Example
6807        /// ```ignore,no_run
6808        /// # use google_cloud_wkt::feature_set_defaults::FeatureSetEditionDefault;
6809        /// use google_cloud_wkt::FeatureSet;
6810        /// let x = FeatureSetEditionDefault::new().set_overridable_features(FeatureSet::default()/* use setters */);
6811        /// ```
6812        pub fn set_overridable_features<T>(mut self, v: T) -> Self
6813        where
6814            T: std::convert::Into<crate::FeatureSet>,
6815        {
6816            self.overridable_features = std::option::Option::Some(v.into());
6817            self
6818        }
6819
6820        /// Sets or clears the value of [overridable_features][crate::feature_set_defaults::FeatureSetEditionDefault::overridable_features].
6821        ///
6822        /// # Example
6823        /// ```ignore,no_run
6824        /// # use google_cloud_wkt::feature_set_defaults::FeatureSetEditionDefault;
6825        /// use google_cloud_wkt::FeatureSet;
6826        /// let x = FeatureSetEditionDefault::new().set_or_clear_overridable_features(Some(FeatureSet::default()/* use setters */));
6827        /// let x = FeatureSetEditionDefault::new().set_or_clear_overridable_features(None::<FeatureSet>);
6828        /// ```
6829        pub fn set_or_clear_overridable_features<T>(mut self, v: std::option::Option<T>) -> Self
6830        where
6831            T: std::convert::Into<crate::FeatureSet>,
6832        {
6833            self.overridable_features = v.map(|x| x.into());
6834            self
6835        }
6836
6837        /// Sets the value of [fixed_features][crate::feature_set_defaults::FeatureSetEditionDefault::fixed_features].
6838        ///
6839        /// # Example
6840        /// ```ignore,no_run
6841        /// # use google_cloud_wkt::feature_set_defaults::FeatureSetEditionDefault;
6842        /// use google_cloud_wkt::FeatureSet;
6843        /// let x = FeatureSetEditionDefault::new().set_fixed_features(FeatureSet::default()/* use setters */);
6844        /// ```
6845        pub fn set_fixed_features<T>(mut self, v: T) -> Self
6846        where
6847            T: std::convert::Into<crate::FeatureSet>,
6848        {
6849            self.fixed_features = std::option::Option::Some(v.into());
6850            self
6851        }
6852
6853        /// Sets or clears the value of [fixed_features][crate::feature_set_defaults::FeatureSetEditionDefault::fixed_features].
6854        ///
6855        /// # Example
6856        /// ```ignore,no_run
6857        /// # use google_cloud_wkt::feature_set_defaults::FeatureSetEditionDefault;
6858        /// use google_cloud_wkt::FeatureSet;
6859        /// let x = FeatureSetEditionDefault::new().set_or_clear_fixed_features(Some(FeatureSet::default()/* use setters */));
6860        /// let x = FeatureSetEditionDefault::new().set_or_clear_fixed_features(None::<FeatureSet>);
6861        /// ```
6862        pub fn set_or_clear_fixed_features<T>(mut self, v: std::option::Option<T>) -> Self
6863        where
6864            T: std::convert::Into<crate::FeatureSet>,
6865        {
6866            self.fixed_features = v.map(|x| x.into());
6867            self
6868        }
6869    }
6870
6871    impl wkt::message::Message for FeatureSetEditionDefault {
6872        fn typename() -> &'static str {
6873            "type.googleapis.com/google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"
6874        }
6875    }
6876}
6877
6878/// Encapsulates information about the original source file from which a
6879/// FileDescriptorProto was generated.
6880#[derive(Clone, Default, PartialEq)]
6881#[non_exhaustive]
6882pub struct SourceCodeInfo {
6883    /// A Location identifies a piece of source code in a .proto file which
6884    /// corresponds to a particular definition.  This information is intended
6885    /// to be useful to IDEs, code indexers, documentation generators, and similar
6886    /// tools.
6887    ///
6888    /// For example, say we have a file like:
6889    /// message Foo {
6890    /// optional string foo = 1;
6891    /// }
6892    /// Let's look at just the field definition:
6893    /// optional string foo = 1;
6894    /// ^       ^^     ^^  ^  ^^^
6895    /// a       bc     de  f  ghi
6896    /// We have the following locations:
6897    /// span   path               represents
6898    /// [a,i)  [ 4, 0, 2, 0 ]     The whole field definition.
6899    /// [a,b)  [ 4, 0, 2, 0, 4 ]  The label (optional).
6900    /// [c,d)  [ 4, 0, 2, 0, 5 ]  The type (string).
6901    /// [e,f)  [ 4, 0, 2, 0, 1 ]  The name (foo).
6902    /// [g,h)  [ 4, 0, 2, 0, 3 ]  The number (1).
6903    ///
6904    /// Notes:
6905    ///
6906    /// - A location may refer to a repeated field itself (i.e. not to any
6907    ///   particular index within it).  This is used whenever a set of elements are
6908    ///   logically enclosed in a single code segment.  For example, an entire
6909    ///   extend block (possibly containing multiple extension definitions) will
6910    ///   have an outer location whose path refers to the "extensions" repeated
6911    ///   field without an index.
6912    /// - Multiple locations may have the same path.  This happens when a single
6913    ///   logical declaration is spread out across multiple places.  The most
6914    ///   obvious example is the "extend" block again -- there may be multiple
6915    ///   extend blocks in the same scope, each of which will have the same path.
6916    /// - A location's span is not always a subset of its parent's span.  For
6917    ///   example, the "extendee" of an extension declaration appears at the
6918    ///   beginning of the "extend" block and is shared by all extensions within
6919    ///   the block.
6920    /// - Just because a location's span is a subset of some other location's span
6921    ///   does not mean that it is a descendant.  For example, a "group" defines
6922    ///   both a type and a field in a single declaration.  Thus, the locations
6923    ///   corresponding to the type and field and their components will overlap.
6924    /// - Code which tries to interpret locations should probably be designed to
6925    ///   ignore those that it doesn't understand, as more types of locations could
6926    ///   be recorded in the future.
6927    pub location: std::vec::Vec<crate::source_code_info::Location>,
6928
6929    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6930}
6931
6932impl SourceCodeInfo {
6933    /// Creates a new default instance.
6934    pub fn new() -> Self {
6935        std::default::Default::default()
6936    }
6937
6938    /// Sets the value of [location][crate::SourceCodeInfo::location].
6939    ///
6940    /// # Example
6941    /// ```ignore,no_run
6942    /// # use google_cloud_wkt::SourceCodeInfo;
6943    /// use google_cloud_wkt::source_code_info::Location;
6944    /// let x = SourceCodeInfo::new()
6945    ///     .set_location([
6946    ///         Location::default()/* use setters */,
6947    ///         Location::default()/* use (different) setters */,
6948    ///     ]);
6949    /// ```
6950    pub fn set_location<T, V>(mut self, v: T) -> Self
6951    where
6952        T: std::iter::IntoIterator<Item = V>,
6953        V: std::convert::Into<crate::source_code_info::Location>,
6954    {
6955        use std::iter::Iterator;
6956        self.location = v.into_iter().map(|i| i.into()).collect();
6957        self
6958    }
6959}
6960
6961impl wkt::message::Message for SourceCodeInfo {
6962    fn typename() -> &'static str {
6963        "type.googleapis.com/google.protobuf.SourceCodeInfo"
6964    }
6965}
6966
6967/// Defines additional types related to [SourceCodeInfo].
6968pub mod source_code_info {
6969    #[allow(unused_imports)]
6970    use super::*;
6971
6972    #[allow(missing_docs)]
6973    #[derive(Clone, Default, PartialEq)]
6974    #[non_exhaustive]
6975    pub struct Location {
6976        /// Identifies which part of the FileDescriptorProto was defined at this
6977        /// location.
6978        ///
6979        /// Each element is a field number or an index.  They form a path from
6980        /// the root FileDescriptorProto to the place where the definition appears.
6981        /// For example, this path:
6982        /// [ 4, 3, 2, 7, 1 ]
6983        /// refers to:
6984        /// file.message_type(3)  // 4, 3
6985        /// .field(7)         // 2, 7
6986        /// .name()           // 1
6987        /// This is because FileDescriptorProto.message_type has field number 4:
6988        /// repeated DescriptorProto message_type = 4;
6989        /// and DescriptorProto.field has field number 2:
6990        /// repeated FieldDescriptorProto field = 2;
6991        /// and FieldDescriptorProto.name has field number 1:
6992        /// optional string name = 1;
6993        ///
6994        /// Thus, the above path gives the location of a field name.  If we removed
6995        /// the last element:
6996        /// [ 4, 3, 2, 7 ]
6997        /// this path refers to the whole field declaration (from the beginning
6998        /// of the label to the terminating semicolon).
6999        pub path: std::vec::Vec<i32>,
7000
7001        /// Always has exactly three or four elements: start line, start column,
7002        /// end line (optional, otherwise assumed same as start line), end column.
7003        /// These are packed into a single field for efficiency.  Note that line
7004        /// and column numbers are zero-based -- typically you will want to add
7005        /// 1 to each before displaying to a user.
7006        pub span: std::vec::Vec<i32>,
7007
7008        /// If this SourceCodeInfo represents a complete declaration, these are any
7009        /// comments appearing before and after the declaration which appear to be
7010        /// attached to the declaration.
7011        ///
7012        /// A series of line comments appearing on consecutive lines, with no other
7013        /// tokens appearing on those lines, will be treated as a single comment.
7014        ///
7015        /// leading_detached_comments will keep paragraphs of comments that appear
7016        /// before (but not connected to) the current element. Each paragraph,
7017        /// separated by empty lines, will be one comment element in the repeated
7018        /// field.
7019        ///
7020        /// Only the comment content is provided; comment markers (e.g. //) are
7021        /// stripped out.  For block comments, leading whitespace and an asterisk
7022        /// will be stripped from the beginning of each line other than the first.
7023        /// Newlines are included in the output.
7024        ///
7025        /// Examples:
7026        ///
7027        /// optional int32 foo = 1;  // Comment attached to foo.
7028        /// // Comment attached to bar.
7029        /// optional int32 bar = 2;
7030        ///
7031        /// optional string baz = 3;
7032        /// // Comment attached to baz.
7033        /// // Another line attached to baz.
7034        ///
7035        /// // Comment attached to moo.
7036        /// //
7037        /// // Another line attached to moo.
7038        /// optional double moo = 4;
7039        ///
7040        /// // Detached comment for corge. This is not leading or trailing comments
7041        /// // to moo or corge because there are blank lines separating it from
7042        /// // both.
7043        ///
7044        /// // Detached comment for corge paragraph 2.
7045        ///
7046        /// optional string corge = 5;
7047        /// /* Block comment attached
7048        ///
7049        /// * to corge.  Leading asterisks
7050        /// * will be removed. */
7051        ///   /* Block comment attached to
7052        /// * grault. */
7053        ///   optional int32 grault = 6;
7054        ///
7055        /// // ignored detached comments.
7056        pub leading_comments: std::string::String,
7057
7058        #[allow(missing_docs)]
7059        pub trailing_comments: std::string::String,
7060
7061        #[allow(missing_docs)]
7062        pub leading_detached_comments: std::vec::Vec<std::string::String>,
7063
7064        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7065    }
7066
7067    impl Location {
7068        /// Creates a new default instance.
7069        pub fn new() -> Self {
7070            std::default::Default::default()
7071        }
7072
7073        /// Sets the value of [path][crate::source_code_info::Location::path].
7074        ///
7075        /// # Example
7076        /// ```ignore,no_run
7077        /// # use google_cloud_wkt::source_code_info::Location;
7078        /// let x = Location::new().set_path([1, 2, 3]);
7079        /// ```
7080        pub fn set_path<T, V>(mut self, v: T) -> Self
7081        where
7082            T: std::iter::IntoIterator<Item = V>,
7083            V: std::convert::Into<i32>,
7084        {
7085            use std::iter::Iterator;
7086            self.path = v.into_iter().map(|i| i.into()).collect();
7087            self
7088        }
7089
7090        /// Sets the value of [span][crate::source_code_info::Location::span].
7091        ///
7092        /// # Example
7093        /// ```ignore,no_run
7094        /// # use google_cloud_wkt::source_code_info::Location;
7095        /// let x = Location::new().set_span([1, 2, 3]);
7096        /// ```
7097        pub fn set_span<T, V>(mut self, v: T) -> Self
7098        where
7099            T: std::iter::IntoIterator<Item = V>,
7100            V: std::convert::Into<i32>,
7101        {
7102            use std::iter::Iterator;
7103            self.span = v.into_iter().map(|i| i.into()).collect();
7104            self
7105        }
7106
7107        /// Sets the value of [leading_comments][crate::source_code_info::Location::leading_comments].
7108        ///
7109        /// # Example
7110        /// ```ignore,no_run
7111        /// # use google_cloud_wkt::source_code_info::Location;
7112        /// let x = Location::new().set_leading_comments("example");
7113        /// ```
7114        pub fn set_leading_comments<T: std::convert::Into<std::string::String>>(
7115            mut self,
7116            v: T,
7117        ) -> Self {
7118            self.leading_comments = v.into();
7119            self
7120        }
7121
7122        /// Sets the value of [trailing_comments][crate::source_code_info::Location::trailing_comments].
7123        ///
7124        /// # Example
7125        /// ```ignore,no_run
7126        /// # use google_cloud_wkt::source_code_info::Location;
7127        /// let x = Location::new().set_trailing_comments("example");
7128        /// ```
7129        pub fn set_trailing_comments<T: std::convert::Into<std::string::String>>(
7130            mut self,
7131            v: T,
7132        ) -> Self {
7133            self.trailing_comments = v.into();
7134            self
7135        }
7136
7137        /// Sets the value of [leading_detached_comments][crate::source_code_info::Location::leading_detached_comments].
7138        ///
7139        /// # Example
7140        /// ```ignore,no_run
7141        /// # use google_cloud_wkt::source_code_info::Location;
7142        /// let x = Location::new().set_leading_detached_comments(["a", "b", "c"]);
7143        /// ```
7144        pub fn set_leading_detached_comments<T, V>(mut self, v: T) -> Self
7145        where
7146            T: std::iter::IntoIterator<Item = V>,
7147            V: std::convert::Into<std::string::String>,
7148        {
7149            use std::iter::Iterator;
7150            self.leading_detached_comments = v.into_iter().map(|i| i.into()).collect();
7151            self
7152        }
7153    }
7154
7155    impl wkt::message::Message for Location {
7156        fn typename() -> &'static str {
7157            "type.googleapis.com/google.protobuf.SourceCodeInfo.Location"
7158        }
7159    }
7160}
7161
7162/// Describes the relationship between generated code and its original source
7163/// file. A GeneratedCodeInfo message is associated with only one generated
7164/// source file, but may contain references to different source .proto files.
7165#[derive(Clone, Default, PartialEq)]
7166#[non_exhaustive]
7167pub struct GeneratedCodeInfo {
7168    /// An Annotation connects some span of text in generated code to an element
7169    /// of its generating .proto file.
7170    pub annotation: std::vec::Vec<crate::generated_code_info::Annotation>,
7171
7172    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7173}
7174
7175impl GeneratedCodeInfo {
7176    /// Creates a new default instance.
7177    pub fn new() -> Self {
7178        std::default::Default::default()
7179    }
7180
7181    /// Sets the value of [annotation][crate::GeneratedCodeInfo::annotation].
7182    ///
7183    /// # Example
7184    /// ```ignore,no_run
7185    /// # use google_cloud_wkt::GeneratedCodeInfo;
7186    /// use google_cloud_wkt::generated_code_info::Annotation;
7187    /// let x = GeneratedCodeInfo::new()
7188    ///     .set_annotation([
7189    ///         Annotation::default()/* use setters */,
7190    ///         Annotation::default()/* use (different) setters */,
7191    ///     ]);
7192    /// ```
7193    pub fn set_annotation<T, V>(mut self, v: T) -> Self
7194    where
7195        T: std::iter::IntoIterator<Item = V>,
7196        V: std::convert::Into<crate::generated_code_info::Annotation>,
7197    {
7198        use std::iter::Iterator;
7199        self.annotation = v.into_iter().map(|i| i.into()).collect();
7200        self
7201    }
7202}
7203
7204impl wkt::message::Message for GeneratedCodeInfo {
7205    fn typename() -> &'static str {
7206        "type.googleapis.com/google.protobuf.GeneratedCodeInfo"
7207    }
7208}
7209
7210/// Defines additional types related to [GeneratedCodeInfo].
7211pub mod generated_code_info {
7212    #[allow(unused_imports)]
7213    use super::*;
7214
7215    #[allow(missing_docs)]
7216    #[derive(Clone, Default, PartialEq)]
7217    #[non_exhaustive]
7218    pub struct Annotation {
7219        /// Identifies the element in the original source .proto file. This field
7220        /// is formatted the same as SourceCodeInfo.Location.path.
7221        pub path: std::vec::Vec<i32>,
7222
7223        /// Identifies the filesystem path to the original source .proto.
7224        pub source_file: std::string::String,
7225
7226        /// Identifies the starting offset in bytes in the generated code
7227        /// that relates to the identified object.
7228        pub begin: i32,
7229
7230        /// Identifies the ending offset in bytes in the generated code that
7231        /// relates to the identified object. The end offset should be one past
7232        /// the last relevant byte (so the length of the text = end - begin).
7233        pub end: i32,
7234
7235        #[allow(missing_docs)]
7236        pub semantic: crate::generated_code_info::annotation::Semantic,
7237
7238        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7239    }
7240
7241    impl Annotation {
7242        /// Creates a new default instance.
7243        pub fn new() -> Self {
7244            std::default::Default::default()
7245        }
7246
7247        /// Sets the value of [path][crate::generated_code_info::Annotation::path].
7248        ///
7249        /// # Example
7250        /// ```ignore,no_run
7251        /// # use google_cloud_wkt::generated_code_info::Annotation;
7252        /// let x = Annotation::new().set_path([1, 2, 3]);
7253        /// ```
7254        pub fn set_path<T, V>(mut self, v: T) -> Self
7255        where
7256            T: std::iter::IntoIterator<Item = V>,
7257            V: std::convert::Into<i32>,
7258        {
7259            use std::iter::Iterator;
7260            self.path = v.into_iter().map(|i| i.into()).collect();
7261            self
7262        }
7263
7264        /// Sets the value of [source_file][crate::generated_code_info::Annotation::source_file].
7265        ///
7266        /// # Example
7267        /// ```ignore,no_run
7268        /// # use google_cloud_wkt::generated_code_info::Annotation;
7269        /// let x = Annotation::new().set_source_file("example");
7270        /// ```
7271        pub fn set_source_file<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7272            self.source_file = v.into();
7273            self
7274        }
7275
7276        /// Sets the value of [begin][crate::generated_code_info::Annotation::begin].
7277        ///
7278        /// # Example
7279        /// ```ignore,no_run
7280        /// # use google_cloud_wkt::generated_code_info::Annotation;
7281        /// let x = Annotation::new().set_begin(42);
7282        /// ```
7283        pub fn set_begin<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7284            self.begin = v.into();
7285            self
7286        }
7287
7288        /// Sets the value of [end][crate::generated_code_info::Annotation::end].
7289        ///
7290        /// # Example
7291        /// ```ignore,no_run
7292        /// # use google_cloud_wkt::generated_code_info::Annotation;
7293        /// let x = Annotation::new().set_end(42);
7294        /// ```
7295        pub fn set_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7296            self.end = v.into();
7297            self
7298        }
7299
7300        /// Sets the value of [semantic][crate::generated_code_info::Annotation::semantic].
7301        ///
7302        /// # Example
7303        /// ```ignore,no_run
7304        /// # use google_cloud_wkt::generated_code_info::Annotation;
7305        /// use google_cloud_wkt::generated_code_info::annotation::Semantic;
7306        /// let x0 = Annotation::new().set_semantic(Semantic::Set);
7307        /// let x1 = Annotation::new().set_semantic(Semantic::Alias);
7308        /// ```
7309        pub fn set_semantic<
7310            T: std::convert::Into<crate::generated_code_info::annotation::Semantic>,
7311        >(
7312            mut self,
7313            v: T,
7314        ) -> Self {
7315            self.semantic = v.into();
7316            self
7317        }
7318    }
7319
7320    impl wkt::message::Message for Annotation {
7321        fn typename() -> &'static str {
7322            "type.googleapis.com/google.protobuf.GeneratedCodeInfo.Annotation"
7323        }
7324    }
7325
7326    /// Defines additional types related to [Annotation].
7327    pub mod annotation {
7328        #[allow(unused_imports)]
7329        use super::*;
7330
7331        /// Represents the identified object's effect on the element in the original
7332        /// .proto file.
7333        ///
7334        /// # Working with unknown values
7335        ///
7336        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7337        /// additional enum variants at any time. Adding new variants is not considered
7338        /// a breaking change. Applications should write their code in anticipation of:
7339        ///
7340        /// - New values appearing in future releases of the client library, **and**
7341        /// - New values received dynamically, without application changes.
7342        ///
7343        /// Please consult the [Working with enums] section in the user guide for some
7344        /// guidelines.
7345        ///
7346        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7347        #[derive(Clone, Debug, PartialEq)]
7348        #[non_exhaustive]
7349        pub enum Semantic {
7350            /// There is no effect or the effect is indescribable.
7351            None,
7352            /// The element is set or otherwise mutated.
7353            Set,
7354            /// An alias to the element is returned.
7355            Alias,
7356            /// If set, the enum was initialized with an unknown value.
7357            ///
7358            /// Applications can examine the value using [Semantic::value] or
7359            /// [Semantic::name].
7360            UnknownValue(semantic::UnknownValue),
7361        }
7362
7363        #[doc(hidden)]
7364        pub mod semantic {
7365            #[allow(unused_imports)]
7366            use super::*;
7367            #[derive(Clone, Debug, PartialEq)]
7368            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7369        }
7370
7371        impl Semantic {
7372            /// Gets the enum value.
7373            ///
7374            /// Returns `None` if the enum contains an unknown value deserialized from
7375            /// the string representation of enums.
7376            pub fn value(&self) -> std::option::Option<i32> {
7377                match self {
7378                    Self::None => std::option::Option::Some(0),
7379                    Self::Set => std::option::Option::Some(1),
7380                    Self::Alias => std::option::Option::Some(2),
7381                    Self::UnknownValue(u) => u.0.value(),
7382                }
7383            }
7384
7385            /// Gets the enum value as a string.
7386            ///
7387            /// Returns `None` if the enum contains an unknown value deserialized from
7388            /// the integer representation of enums.
7389            pub fn name(&self) -> std::option::Option<&str> {
7390                match self {
7391                    Self::None => std::option::Option::Some("NONE"),
7392                    Self::Set => std::option::Option::Some("SET"),
7393                    Self::Alias => std::option::Option::Some("ALIAS"),
7394                    Self::UnknownValue(u) => u.0.name(),
7395                }
7396            }
7397        }
7398
7399        impl std::default::Default for Semantic {
7400            fn default() -> Self {
7401                use std::convert::From;
7402                Self::from(0)
7403            }
7404        }
7405
7406        impl std::fmt::Display for Semantic {
7407            fn fmt(
7408                &self,
7409                f: &mut std::fmt::Formatter<'_>,
7410            ) -> std::result::Result<(), std::fmt::Error> {
7411                wkt::internal::display_enum(f, self.name(), self.value())
7412            }
7413        }
7414
7415        impl std::convert::From<i32> for Semantic {
7416            fn from(value: i32) -> Self {
7417                match value {
7418                    0 => Self::None,
7419                    1 => Self::Set,
7420                    2 => Self::Alias,
7421                    _ => Self::UnknownValue(semantic::UnknownValue(
7422                        wkt::internal::UnknownEnumValue::Integer(value),
7423                    )),
7424                }
7425            }
7426        }
7427
7428        impl std::convert::From<&str> for Semantic {
7429            fn from(value: &str) -> Self {
7430                use std::string::ToString;
7431                match value {
7432                    "NONE" => Self::None,
7433                    "SET" => Self::Set,
7434                    "ALIAS" => Self::Alias,
7435                    _ => Self::UnknownValue(semantic::UnknownValue(
7436                        wkt::internal::UnknownEnumValue::String(value.to_string()),
7437                    )),
7438                }
7439            }
7440        }
7441
7442        impl serde::ser::Serialize for Semantic {
7443            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7444            where
7445                S: serde::Serializer,
7446            {
7447                match self {
7448                    Self::None => serializer.serialize_i32(0),
7449                    Self::Set => serializer.serialize_i32(1),
7450                    Self::Alias => serializer.serialize_i32(2),
7451                    Self::UnknownValue(u) => u.0.serialize(serializer),
7452                }
7453            }
7454        }
7455
7456        impl<'de> serde::de::Deserialize<'de> for Semantic {
7457            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7458            where
7459                D: serde::Deserializer<'de>,
7460            {
7461                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Semantic>::new(
7462                    ".google.protobuf.GeneratedCodeInfo.Annotation.Semantic",
7463                ))
7464            }
7465        }
7466    }
7467}
7468
7469/// `SourceContext` represents information about the source of a
7470/// protobuf element, like the file in which it is defined.
7471#[derive(Clone, Default, PartialEq)]
7472#[non_exhaustive]
7473pub struct SourceContext {
7474    /// The path-qualified name of the .proto file that contained the associated
7475    /// protobuf element.  For example: `"google/protobuf/source_context.proto"`.
7476    pub file_name: std::string::String,
7477
7478    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7479}
7480
7481impl SourceContext {
7482    /// Creates a new default instance.
7483    pub fn new() -> Self {
7484        std::default::Default::default()
7485    }
7486
7487    /// Sets the value of [file_name][crate::SourceContext::file_name].
7488    ///
7489    /// # Example
7490    /// ```ignore,no_run
7491    /// # use google_cloud_wkt::SourceContext;
7492    /// let x = SourceContext::new().set_file_name("example");
7493    /// ```
7494    pub fn set_file_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7495        self.file_name = v.into();
7496        self
7497    }
7498}
7499
7500impl wkt::message::Message for SourceContext {
7501    fn typename() -> &'static str {
7502        "type.googleapis.com/google.protobuf.SourceContext"
7503    }
7504}
7505
7506/// A protocol buffer message type.
7507#[derive(Clone, Default, PartialEq)]
7508#[non_exhaustive]
7509pub struct Type {
7510    /// The fully qualified message name.
7511    pub name: std::string::String,
7512
7513    /// The list of fields.
7514    pub fields: std::vec::Vec<crate::Field>,
7515
7516    /// The list of types appearing in `oneof` definitions in this type.
7517    pub oneofs: std::vec::Vec<std::string::String>,
7518
7519    /// The protocol buffer options.
7520    pub options: std::vec::Vec<crate::Option>,
7521
7522    /// The source context.
7523    pub source_context: std::option::Option<crate::SourceContext>,
7524
7525    /// The source syntax.
7526    pub syntax: crate::Syntax,
7527
7528    /// The source edition string, only valid when syntax is SYNTAX_EDITIONS.
7529    pub edition: std::string::String,
7530
7531    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7532}
7533
7534impl Type {
7535    /// Creates a new default instance.
7536    pub fn new() -> Self {
7537        std::default::Default::default()
7538    }
7539
7540    /// Sets the value of [name][crate::Type::name].
7541    ///
7542    /// # Example
7543    /// ```ignore,no_run
7544    /// # use google_cloud_wkt::Type;
7545    /// let x = Type::new().set_name("example");
7546    /// ```
7547    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7548        self.name = v.into();
7549        self
7550    }
7551
7552    /// Sets the value of [fields][crate::Type::fields].
7553    ///
7554    /// # Example
7555    /// ```ignore,no_run
7556    /// # use google_cloud_wkt::Type;
7557    /// use google_cloud_wkt::Field;
7558    /// let x = Type::new()
7559    ///     .set_fields([
7560    ///         Field::default()/* use setters */,
7561    ///         Field::default()/* use (different) setters */,
7562    ///     ]);
7563    /// ```
7564    pub fn set_fields<T, V>(mut self, v: T) -> Self
7565    where
7566        T: std::iter::IntoIterator<Item = V>,
7567        V: std::convert::Into<crate::Field>,
7568    {
7569        use std::iter::Iterator;
7570        self.fields = v.into_iter().map(|i| i.into()).collect();
7571        self
7572    }
7573
7574    /// Sets the value of [oneofs][crate::Type::oneofs].
7575    ///
7576    /// # Example
7577    /// ```ignore,no_run
7578    /// # use google_cloud_wkt::Type;
7579    /// let x = Type::new().set_oneofs(["a", "b", "c"]);
7580    /// ```
7581    pub fn set_oneofs<T, V>(mut self, v: T) -> Self
7582    where
7583        T: std::iter::IntoIterator<Item = V>,
7584        V: std::convert::Into<std::string::String>,
7585    {
7586        use std::iter::Iterator;
7587        self.oneofs = v.into_iter().map(|i| i.into()).collect();
7588        self
7589    }
7590
7591    /// Sets the value of [options][crate::Type::options].
7592    ///
7593    /// # Example
7594    /// ```ignore,no_run
7595    /// # use google_cloud_wkt::Type;
7596    /// use google_cloud_wkt::Option;
7597    /// let x = Type::new()
7598    ///     .set_options([
7599    ///         Option::default()/* use setters */,
7600    ///         Option::default()/* use (different) setters */,
7601    ///     ]);
7602    /// ```
7603    pub fn set_options<T, V>(mut self, v: T) -> Self
7604    where
7605        T: std::iter::IntoIterator<Item = V>,
7606        V: std::convert::Into<crate::Option>,
7607    {
7608        use std::iter::Iterator;
7609        self.options = v.into_iter().map(|i| i.into()).collect();
7610        self
7611    }
7612
7613    /// Sets the value of [source_context][crate::Type::source_context].
7614    ///
7615    /// # Example
7616    /// ```ignore,no_run
7617    /// # use google_cloud_wkt::Type;
7618    /// use google_cloud_wkt::SourceContext;
7619    /// let x = Type::new().set_source_context(SourceContext::default()/* use setters */);
7620    /// ```
7621    pub fn set_source_context<T>(mut self, v: T) -> Self
7622    where
7623        T: std::convert::Into<crate::SourceContext>,
7624    {
7625        self.source_context = std::option::Option::Some(v.into());
7626        self
7627    }
7628
7629    /// Sets or clears the value of [source_context][crate::Type::source_context].
7630    ///
7631    /// # Example
7632    /// ```ignore,no_run
7633    /// # use google_cloud_wkt::Type;
7634    /// use google_cloud_wkt::SourceContext;
7635    /// let x = Type::new().set_or_clear_source_context(Some(SourceContext::default()/* use setters */));
7636    /// let x = Type::new().set_or_clear_source_context(None::<SourceContext>);
7637    /// ```
7638    pub fn set_or_clear_source_context<T>(mut self, v: std::option::Option<T>) -> Self
7639    where
7640        T: std::convert::Into<crate::SourceContext>,
7641    {
7642        self.source_context = v.map(|x| x.into());
7643        self
7644    }
7645
7646    /// Sets the value of [syntax][crate::Type::syntax].
7647    ///
7648    /// # Example
7649    /// ```ignore,no_run
7650    /// # use google_cloud_wkt::Type;
7651    /// use google_cloud_wkt::Syntax;
7652    /// let x0 = Type::new().set_syntax(Syntax::Proto3);
7653    /// let x1 = Type::new().set_syntax(Syntax::Editions);
7654    /// ```
7655    pub fn set_syntax<T: std::convert::Into<crate::Syntax>>(mut self, v: T) -> Self {
7656        self.syntax = v.into();
7657        self
7658    }
7659
7660    /// Sets the value of [edition][crate::Type::edition].
7661    ///
7662    /// # Example
7663    /// ```ignore,no_run
7664    /// # use google_cloud_wkt::Type;
7665    /// let x = Type::new().set_edition("example");
7666    /// ```
7667    pub fn set_edition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7668        self.edition = v.into();
7669        self
7670    }
7671}
7672
7673impl wkt::message::Message for Type {
7674    fn typename() -> &'static str {
7675        "type.googleapis.com/google.protobuf.Type"
7676    }
7677}
7678
7679/// A single field of a message type.
7680#[derive(Clone, Default, PartialEq)]
7681#[non_exhaustive]
7682pub struct Field {
7683    /// The field type.
7684    pub kind: crate::field::Kind,
7685
7686    /// The field cardinality.
7687    pub cardinality: crate::field::Cardinality,
7688
7689    /// The field number.
7690    pub number: i32,
7691
7692    /// The field name.
7693    pub name: std::string::String,
7694
7695    /// The field type URL, without the scheme, for message or enumeration
7696    /// types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
7697    pub type_url: std::string::String,
7698
7699    /// The index of the field type in `Type.oneofs`, for message or enumeration
7700    /// types. The first type has index 1; zero means the type is not in the list.
7701    pub oneof_index: i32,
7702
7703    /// Whether to use alternative packed wire representation.
7704    pub packed: bool,
7705
7706    /// The protocol buffer options.
7707    pub options: std::vec::Vec<crate::Option>,
7708
7709    /// The field JSON name.
7710    pub json_name: std::string::String,
7711
7712    /// The string value of the default value of this field. Proto2 syntax only.
7713    pub default_value: std::string::String,
7714
7715    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7716}
7717
7718impl Field {
7719    /// Creates a new default instance.
7720    pub fn new() -> Self {
7721        std::default::Default::default()
7722    }
7723
7724    /// Sets the value of [kind][crate::Field::kind].
7725    ///
7726    /// # Example
7727    /// ```ignore,no_run
7728    /// # use google_cloud_wkt::Field;
7729    /// use google_cloud_wkt::field::Kind;
7730    /// let x0 = Field::new().set_kind(Kind::TypeDouble);
7731    /// let x1 = Field::new().set_kind(Kind::TypeFloat);
7732    /// let x2 = Field::new().set_kind(Kind::TypeInt64);
7733    /// ```
7734    pub fn set_kind<T: std::convert::Into<crate::field::Kind>>(mut self, v: T) -> Self {
7735        self.kind = v.into();
7736        self
7737    }
7738
7739    /// Sets the value of [cardinality][crate::Field::cardinality].
7740    ///
7741    /// # Example
7742    /// ```ignore,no_run
7743    /// # use google_cloud_wkt::Field;
7744    /// use google_cloud_wkt::field::Cardinality;
7745    /// let x0 = Field::new().set_cardinality(Cardinality::Optional);
7746    /// let x1 = Field::new().set_cardinality(Cardinality::Required);
7747    /// let x2 = Field::new().set_cardinality(Cardinality::Repeated);
7748    /// ```
7749    pub fn set_cardinality<T: std::convert::Into<crate::field::Cardinality>>(
7750        mut self,
7751        v: T,
7752    ) -> Self {
7753        self.cardinality = v.into();
7754        self
7755    }
7756
7757    /// Sets the value of [number][crate::Field::number].
7758    ///
7759    /// # Example
7760    /// ```ignore,no_run
7761    /// # use google_cloud_wkt::Field;
7762    /// let x = Field::new().set_number(42);
7763    /// ```
7764    pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7765        self.number = v.into();
7766        self
7767    }
7768
7769    /// Sets the value of [name][crate::Field::name].
7770    ///
7771    /// # Example
7772    /// ```ignore,no_run
7773    /// # use google_cloud_wkt::Field;
7774    /// let x = Field::new().set_name("example");
7775    /// ```
7776    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7777        self.name = v.into();
7778        self
7779    }
7780
7781    /// Sets the value of [type_url][crate::Field::type_url].
7782    ///
7783    /// # Example
7784    /// ```ignore,no_run
7785    /// # use google_cloud_wkt::Field;
7786    /// let x = Field::new().set_type_url("example");
7787    /// ```
7788    pub fn set_type_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7789        self.type_url = v.into();
7790        self
7791    }
7792
7793    /// Sets the value of [oneof_index][crate::Field::oneof_index].
7794    ///
7795    /// # Example
7796    /// ```ignore,no_run
7797    /// # use google_cloud_wkt::Field;
7798    /// let x = Field::new().set_oneof_index(42);
7799    /// ```
7800    pub fn set_oneof_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7801        self.oneof_index = v.into();
7802        self
7803    }
7804
7805    /// Sets the value of [packed][crate::Field::packed].
7806    ///
7807    /// # Example
7808    /// ```ignore,no_run
7809    /// # use google_cloud_wkt::Field;
7810    /// let x = Field::new().set_packed(true);
7811    /// ```
7812    pub fn set_packed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7813        self.packed = v.into();
7814        self
7815    }
7816
7817    /// Sets the value of [options][crate::Field::options].
7818    ///
7819    /// # Example
7820    /// ```ignore,no_run
7821    /// # use google_cloud_wkt::Field;
7822    /// use google_cloud_wkt::Option;
7823    /// let x = Field::new()
7824    ///     .set_options([
7825    ///         Option::default()/* use setters */,
7826    ///         Option::default()/* use (different) setters */,
7827    ///     ]);
7828    /// ```
7829    pub fn set_options<T, V>(mut self, v: T) -> Self
7830    where
7831        T: std::iter::IntoIterator<Item = V>,
7832        V: std::convert::Into<crate::Option>,
7833    {
7834        use std::iter::Iterator;
7835        self.options = v.into_iter().map(|i| i.into()).collect();
7836        self
7837    }
7838
7839    /// Sets the value of [json_name][crate::Field::json_name].
7840    ///
7841    /// # Example
7842    /// ```ignore,no_run
7843    /// # use google_cloud_wkt::Field;
7844    /// let x = Field::new().set_json_name("example");
7845    /// ```
7846    pub fn set_json_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7847        self.json_name = v.into();
7848        self
7849    }
7850
7851    /// Sets the value of [default_value][crate::Field::default_value].
7852    ///
7853    /// # Example
7854    /// ```ignore,no_run
7855    /// # use google_cloud_wkt::Field;
7856    /// let x = Field::new().set_default_value("example");
7857    /// ```
7858    pub fn set_default_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7859        self.default_value = v.into();
7860        self
7861    }
7862}
7863
7864impl wkt::message::Message for Field {
7865    fn typename() -> &'static str {
7866        "type.googleapis.com/google.protobuf.Field"
7867    }
7868}
7869
7870/// Defines additional types related to [Field].
7871pub mod field {
7872    #[allow(unused_imports)]
7873    use super::*;
7874
7875    /// Basic field types.
7876    ///
7877    /// # Working with unknown values
7878    ///
7879    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7880    /// additional enum variants at any time. Adding new variants is not considered
7881    /// a breaking change. Applications should write their code in anticipation of:
7882    ///
7883    /// - New values appearing in future releases of the client library, **and**
7884    /// - New values received dynamically, without application changes.
7885    ///
7886    /// Please consult the [Working with enums] section in the user guide for some
7887    /// guidelines.
7888    ///
7889    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7890    #[derive(Clone, Debug, PartialEq)]
7891    #[non_exhaustive]
7892    pub enum Kind {
7893        /// Field type unknown.
7894        TypeUnknown,
7895        /// Field type double.
7896        TypeDouble,
7897        /// Field type float.
7898        TypeFloat,
7899        /// Field type int64.
7900        TypeInt64,
7901        /// Field type uint64.
7902        TypeUint64,
7903        /// Field type int32.
7904        TypeInt32,
7905        /// Field type fixed64.
7906        TypeFixed64,
7907        /// Field type fixed32.
7908        TypeFixed32,
7909        /// Field type bool.
7910        TypeBool,
7911        /// Field type string.
7912        TypeString,
7913        /// Field type group. Proto2 syntax only, and deprecated.
7914        TypeGroup,
7915        /// Field type message.
7916        TypeMessage,
7917        /// Field type bytes.
7918        TypeBytes,
7919        /// Field type uint32.
7920        TypeUint32,
7921        /// Field type enum.
7922        TypeEnum,
7923        /// Field type sfixed32.
7924        TypeSfixed32,
7925        /// Field type sfixed64.
7926        TypeSfixed64,
7927        /// Field type sint32.
7928        TypeSint32,
7929        /// Field type sint64.
7930        TypeSint64,
7931        /// If set, the enum was initialized with an unknown value.
7932        ///
7933        /// Applications can examine the value using [Kind::value] or
7934        /// [Kind::name].
7935        UnknownValue(kind::UnknownValue),
7936    }
7937
7938    #[doc(hidden)]
7939    pub mod kind {
7940        #[allow(unused_imports)]
7941        use super::*;
7942        #[derive(Clone, Debug, PartialEq)]
7943        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7944    }
7945
7946    impl Kind {
7947        /// Gets the enum value.
7948        ///
7949        /// Returns `None` if the enum contains an unknown value deserialized from
7950        /// the string representation of enums.
7951        pub fn value(&self) -> std::option::Option<i32> {
7952            match self {
7953                Self::TypeUnknown => std::option::Option::Some(0),
7954                Self::TypeDouble => std::option::Option::Some(1),
7955                Self::TypeFloat => std::option::Option::Some(2),
7956                Self::TypeInt64 => std::option::Option::Some(3),
7957                Self::TypeUint64 => std::option::Option::Some(4),
7958                Self::TypeInt32 => std::option::Option::Some(5),
7959                Self::TypeFixed64 => std::option::Option::Some(6),
7960                Self::TypeFixed32 => std::option::Option::Some(7),
7961                Self::TypeBool => std::option::Option::Some(8),
7962                Self::TypeString => std::option::Option::Some(9),
7963                Self::TypeGroup => std::option::Option::Some(10),
7964                Self::TypeMessage => std::option::Option::Some(11),
7965                Self::TypeBytes => std::option::Option::Some(12),
7966                Self::TypeUint32 => std::option::Option::Some(13),
7967                Self::TypeEnum => std::option::Option::Some(14),
7968                Self::TypeSfixed32 => std::option::Option::Some(15),
7969                Self::TypeSfixed64 => std::option::Option::Some(16),
7970                Self::TypeSint32 => std::option::Option::Some(17),
7971                Self::TypeSint64 => std::option::Option::Some(18),
7972                Self::UnknownValue(u) => u.0.value(),
7973            }
7974        }
7975
7976        /// Gets the enum value as a string.
7977        ///
7978        /// Returns `None` if the enum contains an unknown value deserialized from
7979        /// the integer representation of enums.
7980        pub fn name(&self) -> std::option::Option<&str> {
7981            match self {
7982                Self::TypeUnknown => std::option::Option::Some("TYPE_UNKNOWN"),
7983                Self::TypeDouble => std::option::Option::Some("TYPE_DOUBLE"),
7984                Self::TypeFloat => std::option::Option::Some("TYPE_FLOAT"),
7985                Self::TypeInt64 => std::option::Option::Some("TYPE_INT64"),
7986                Self::TypeUint64 => std::option::Option::Some("TYPE_UINT64"),
7987                Self::TypeInt32 => std::option::Option::Some("TYPE_INT32"),
7988                Self::TypeFixed64 => std::option::Option::Some("TYPE_FIXED64"),
7989                Self::TypeFixed32 => std::option::Option::Some("TYPE_FIXED32"),
7990                Self::TypeBool => std::option::Option::Some("TYPE_BOOL"),
7991                Self::TypeString => std::option::Option::Some("TYPE_STRING"),
7992                Self::TypeGroup => std::option::Option::Some("TYPE_GROUP"),
7993                Self::TypeMessage => std::option::Option::Some("TYPE_MESSAGE"),
7994                Self::TypeBytes => std::option::Option::Some("TYPE_BYTES"),
7995                Self::TypeUint32 => std::option::Option::Some("TYPE_UINT32"),
7996                Self::TypeEnum => std::option::Option::Some("TYPE_ENUM"),
7997                Self::TypeSfixed32 => std::option::Option::Some("TYPE_SFIXED32"),
7998                Self::TypeSfixed64 => std::option::Option::Some("TYPE_SFIXED64"),
7999                Self::TypeSint32 => std::option::Option::Some("TYPE_SINT32"),
8000                Self::TypeSint64 => std::option::Option::Some("TYPE_SINT64"),
8001                Self::UnknownValue(u) => u.0.name(),
8002            }
8003        }
8004    }
8005
8006    impl std::default::Default for Kind {
8007        fn default() -> Self {
8008            use std::convert::From;
8009            Self::from(0)
8010        }
8011    }
8012
8013    impl std::fmt::Display for Kind {
8014        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8015            wkt::internal::display_enum(f, self.name(), self.value())
8016        }
8017    }
8018
8019    impl std::convert::From<i32> for Kind {
8020        fn from(value: i32) -> Self {
8021            match value {
8022                0 => Self::TypeUnknown,
8023                1 => Self::TypeDouble,
8024                2 => Self::TypeFloat,
8025                3 => Self::TypeInt64,
8026                4 => Self::TypeUint64,
8027                5 => Self::TypeInt32,
8028                6 => Self::TypeFixed64,
8029                7 => Self::TypeFixed32,
8030                8 => Self::TypeBool,
8031                9 => Self::TypeString,
8032                10 => Self::TypeGroup,
8033                11 => Self::TypeMessage,
8034                12 => Self::TypeBytes,
8035                13 => Self::TypeUint32,
8036                14 => Self::TypeEnum,
8037                15 => Self::TypeSfixed32,
8038                16 => Self::TypeSfixed64,
8039                17 => Self::TypeSint32,
8040                18 => Self::TypeSint64,
8041                _ => Self::UnknownValue(kind::UnknownValue(
8042                    wkt::internal::UnknownEnumValue::Integer(value),
8043                )),
8044            }
8045        }
8046    }
8047
8048    impl std::convert::From<&str> for Kind {
8049        fn from(value: &str) -> Self {
8050            use std::string::ToString;
8051            match value {
8052                "TYPE_UNKNOWN" => Self::TypeUnknown,
8053                "TYPE_DOUBLE" => Self::TypeDouble,
8054                "TYPE_FLOAT" => Self::TypeFloat,
8055                "TYPE_INT64" => Self::TypeInt64,
8056                "TYPE_UINT64" => Self::TypeUint64,
8057                "TYPE_INT32" => Self::TypeInt32,
8058                "TYPE_FIXED64" => Self::TypeFixed64,
8059                "TYPE_FIXED32" => Self::TypeFixed32,
8060                "TYPE_BOOL" => Self::TypeBool,
8061                "TYPE_STRING" => Self::TypeString,
8062                "TYPE_GROUP" => Self::TypeGroup,
8063                "TYPE_MESSAGE" => Self::TypeMessage,
8064                "TYPE_BYTES" => Self::TypeBytes,
8065                "TYPE_UINT32" => Self::TypeUint32,
8066                "TYPE_ENUM" => Self::TypeEnum,
8067                "TYPE_SFIXED32" => Self::TypeSfixed32,
8068                "TYPE_SFIXED64" => Self::TypeSfixed64,
8069                "TYPE_SINT32" => Self::TypeSint32,
8070                "TYPE_SINT64" => Self::TypeSint64,
8071                _ => Self::UnknownValue(kind::UnknownValue(
8072                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8073                )),
8074            }
8075        }
8076    }
8077
8078    impl serde::ser::Serialize for Kind {
8079        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8080        where
8081            S: serde::Serializer,
8082        {
8083            match self {
8084                Self::TypeUnknown => serializer.serialize_i32(0),
8085                Self::TypeDouble => serializer.serialize_i32(1),
8086                Self::TypeFloat => serializer.serialize_i32(2),
8087                Self::TypeInt64 => serializer.serialize_i32(3),
8088                Self::TypeUint64 => serializer.serialize_i32(4),
8089                Self::TypeInt32 => serializer.serialize_i32(5),
8090                Self::TypeFixed64 => serializer.serialize_i32(6),
8091                Self::TypeFixed32 => serializer.serialize_i32(7),
8092                Self::TypeBool => serializer.serialize_i32(8),
8093                Self::TypeString => serializer.serialize_i32(9),
8094                Self::TypeGroup => serializer.serialize_i32(10),
8095                Self::TypeMessage => serializer.serialize_i32(11),
8096                Self::TypeBytes => serializer.serialize_i32(12),
8097                Self::TypeUint32 => serializer.serialize_i32(13),
8098                Self::TypeEnum => serializer.serialize_i32(14),
8099                Self::TypeSfixed32 => serializer.serialize_i32(15),
8100                Self::TypeSfixed64 => serializer.serialize_i32(16),
8101                Self::TypeSint32 => serializer.serialize_i32(17),
8102                Self::TypeSint64 => serializer.serialize_i32(18),
8103                Self::UnknownValue(u) => u.0.serialize(serializer),
8104            }
8105        }
8106    }
8107
8108    impl<'de> serde::de::Deserialize<'de> for Kind {
8109        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8110        where
8111            D: serde::Deserializer<'de>,
8112        {
8113            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Kind>::new(
8114                ".google.protobuf.Field.Kind",
8115            ))
8116        }
8117    }
8118
8119    /// Whether a field is optional, required, or repeated.
8120    ///
8121    /// # Working with unknown values
8122    ///
8123    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8124    /// additional enum variants at any time. Adding new variants is not considered
8125    /// a breaking change. Applications should write their code in anticipation of:
8126    ///
8127    /// - New values appearing in future releases of the client library, **and**
8128    /// - New values received dynamically, without application changes.
8129    ///
8130    /// Please consult the [Working with enums] section in the user guide for some
8131    /// guidelines.
8132    ///
8133    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8134    #[derive(Clone, Debug, PartialEq)]
8135    #[non_exhaustive]
8136    pub enum Cardinality {
8137        /// For fields with unknown cardinality.
8138        Unknown,
8139        /// For optional fields.
8140        Optional,
8141        /// For required fields. Proto2 syntax only.
8142        Required,
8143        /// For repeated fields.
8144        Repeated,
8145        /// If set, the enum was initialized with an unknown value.
8146        ///
8147        /// Applications can examine the value using [Cardinality::value] or
8148        /// [Cardinality::name].
8149        UnknownValue(cardinality::UnknownValue),
8150    }
8151
8152    #[doc(hidden)]
8153    pub mod cardinality {
8154        #[allow(unused_imports)]
8155        use super::*;
8156        #[derive(Clone, Debug, PartialEq)]
8157        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8158    }
8159
8160    impl Cardinality {
8161        /// Gets the enum value.
8162        ///
8163        /// Returns `None` if the enum contains an unknown value deserialized from
8164        /// the string representation of enums.
8165        pub fn value(&self) -> std::option::Option<i32> {
8166            match self {
8167                Self::Unknown => std::option::Option::Some(0),
8168                Self::Optional => std::option::Option::Some(1),
8169                Self::Required => std::option::Option::Some(2),
8170                Self::Repeated => std::option::Option::Some(3),
8171                Self::UnknownValue(u) => u.0.value(),
8172            }
8173        }
8174
8175        /// Gets the enum value as a string.
8176        ///
8177        /// Returns `None` if the enum contains an unknown value deserialized from
8178        /// the integer representation of enums.
8179        pub fn name(&self) -> std::option::Option<&str> {
8180            match self {
8181                Self::Unknown => std::option::Option::Some("CARDINALITY_UNKNOWN"),
8182                Self::Optional => std::option::Option::Some("CARDINALITY_OPTIONAL"),
8183                Self::Required => std::option::Option::Some("CARDINALITY_REQUIRED"),
8184                Self::Repeated => std::option::Option::Some("CARDINALITY_REPEATED"),
8185                Self::UnknownValue(u) => u.0.name(),
8186            }
8187        }
8188    }
8189
8190    impl std::default::Default for Cardinality {
8191        fn default() -> Self {
8192            use std::convert::From;
8193            Self::from(0)
8194        }
8195    }
8196
8197    impl std::fmt::Display for Cardinality {
8198        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8199            wkt::internal::display_enum(f, self.name(), self.value())
8200        }
8201    }
8202
8203    impl std::convert::From<i32> for Cardinality {
8204        fn from(value: i32) -> Self {
8205            match value {
8206                0 => Self::Unknown,
8207                1 => Self::Optional,
8208                2 => Self::Required,
8209                3 => Self::Repeated,
8210                _ => Self::UnknownValue(cardinality::UnknownValue(
8211                    wkt::internal::UnknownEnumValue::Integer(value),
8212                )),
8213            }
8214        }
8215    }
8216
8217    impl std::convert::From<&str> for Cardinality {
8218        fn from(value: &str) -> Self {
8219            use std::string::ToString;
8220            match value {
8221                "CARDINALITY_UNKNOWN" => Self::Unknown,
8222                "CARDINALITY_OPTIONAL" => Self::Optional,
8223                "CARDINALITY_REQUIRED" => Self::Required,
8224                "CARDINALITY_REPEATED" => Self::Repeated,
8225                _ => Self::UnknownValue(cardinality::UnknownValue(
8226                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8227                )),
8228            }
8229        }
8230    }
8231
8232    impl serde::ser::Serialize for Cardinality {
8233        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8234        where
8235            S: serde::Serializer,
8236        {
8237            match self {
8238                Self::Unknown => serializer.serialize_i32(0),
8239                Self::Optional => serializer.serialize_i32(1),
8240                Self::Required => serializer.serialize_i32(2),
8241                Self::Repeated => serializer.serialize_i32(3),
8242                Self::UnknownValue(u) => u.0.serialize(serializer),
8243            }
8244        }
8245    }
8246
8247    impl<'de> serde::de::Deserialize<'de> for Cardinality {
8248        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8249        where
8250            D: serde::Deserializer<'de>,
8251        {
8252            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Cardinality>::new(
8253                ".google.protobuf.Field.Cardinality",
8254            ))
8255        }
8256    }
8257}
8258
8259/// Enum type definition.
8260#[derive(Clone, Default, PartialEq)]
8261#[non_exhaustive]
8262pub struct Enum {
8263    /// Enum type name.
8264    pub name: std::string::String,
8265
8266    /// Enum value definitions.
8267    pub enumvalue: std::vec::Vec<crate::EnumValue>,
8268
8269    /// Protocol buffer options.
8270    pub options: std::vec::Vec<crate::Option>,
8271
8272    /// The source context.
8273    pub source_context: std::option::Option<crate::SourceContext>,
8274
8275    /// The source syntax.
8276    pub syntax: crate::Syntax,
8277
8278    /// The source edition string, only valid when syntax is SYNTAX_EDITIONS.
8279    pub edition: std::string::String,
8280
8281    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8282}
8283
8284impl Enum {
8285    /// Creates a new default instance.
8286    pub fn new() -> Self {
8287        std::default::Default::default()
8288    }
8289
8290    /// Sets the value of [name][crate::Enum::name].
8291    ///
8292    /// # Example
8293    /// ```ignore,no_run
8294    /// # use google_cloud_wkt::Enum;
8295    /// let x = Enum::new().set_name("example");
8296    /// ```
8297    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8298        self.name = v.into();
8299        self
8300    }
8301
8302    /// Sets the value of [enumvalue][crate::Enum::enumvalue].
8303    ///
8304    /// # Example
8305    /// ```ignore,no_run
8306    /// # use google_cloud_wkt::Enum;
8307    /// use google_cloud_wkt::EnumValue;
8308    /// let x = Enum::new()
8309    ///     .set_enumvalue([
8310    ///         EnumValue::default()/* use setters */,
8311    ///         EnumValue::default()/* use (different) setters */,
8312    ///     ]);
8313    /// ```
8314    pub fn set_enumvalue<T, V>(mut self, v: T) -> Self
8315    where
8316        T: std::iter::IntoIterator<Item = V>,
8317        V: std::convert::Into<crate::EnumValue>,
8318    {
8319        use std::iter::Iterator;
8320        self.enumvalue = v.into_iter().map(|i| i.into()).collect();
8321        self
8322    }
8323
8324    /// Sets the value of [options][crate::Enum::options].
8325    ///
8326    /// # Example
8327    /// ```ignore,no_run
8328    /// # use google_cloud_wkt::Enum;
8329    /// use google_cloud_wkt::Option;
8330    /// let x = Enum::new()
8331    ///     .set_options([
8332    ///         Option::default()/* use setters */,
8333    ///         Option::default()/* use (different) setters */,
8334    ///     ]);
8335    /// ```
8336    pub fn set_options<T, V>(mut self, v: T) -> Self
8337    where
8338        T: std::iter::IntoIterator<Item = V>,
8339        V: std::convert::Into<crate::Option>,
8340    {
8341        use std::iter::Iterator;
8342        self.options = v.into_iter().map(|i| i.into()).collect();
8343        self
8344    }
8345
8346    /// Sets the value of [source_context][crate::Enum::source_context].
8347    ///
8348    /// # Example
8349    /// ```ignore,no_run
8350    /// # use google_cloud_wkt::Enum;
8351    /// use google_cloud_wkt::SourceContext;
8352    /// let x = Enum::new().set_source_context(SourceContext::default()/* use setters */);
8353    /// ```
8354    pub fn set_source_context<T>(mut self, v: T) -> Self
8355    where
8356        T: std::convert::Into<crate::SourceContext>,
8357    {
8358        self.source_context = std::option::Option::Some(v.into());
8359        self
8360    }
8361
8362    /// Sets or clears the value of [source_context][crate::Enum::source_context].
8363    ///
8364    /// # Example
8365    /// ```ignore,no_run
8366    /// # use google_cloud_wkt::Enum;
8367    /// use google_cloud_wkt::SourceContext;
8368    /// let x = Enum::new().set_or_clear_source_context(Some(SourceContext::default()/* use setters */));
8369    /// let x = Enum::new().set_or_clear_source_context(None::<SourceContext>);
8370    /// ```
8371    pub fn set_or_clear_source_context<T>(mut self, v: std::option::Option<T>) -> Self
8372    where
8373        T: std::convert::Into<crate::SourceContext>,
8374    {
8375        self.source_context = v.map(|x| x.into());
8376        self
8377    }
8378
8379    /// Sets the value of [syntax][crate::Enum::syntax].
8380    ///
8381    /// # Example
8382    /// ```ignore,no_run
8383    /// # use google_cloud_wkt::Enum;
8384    /// use google_cloud_wkt::Syntax;
8385    /// let x0 = Enum::new().set_syntax(Syntax::Proto3);
8386    /// let x1 = Enum::new().set_syntax(Syntax::Editions);
8387    /// ```
8388    pub fn set_syntax<T: std::convert::Into<crate::Syntax>>(mut self, v: T) -> Self {
8389        self.syntax = v.into();
8390        self
8391    }
8392
8393    /// Sets the value of [edition][crate::Enum::edition].
8394    ///
8395    /// # Example
8396    /// ```ignore,no_run
8397    /// # use google_cloud_wkt::Enum;
8398    /// let x = Enum::new().set_edition("example");
8399    /// ```
8400    pub fn set_edition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8401        self.edition = v.into();
8402        self
8403    }
8404}
8405
8406impl wkt::message::Message for Enum {
8407    fn typename() -> &'static str {
8408        "type.googleapis.com/google.protobuf.Enum"
8409    }
8410}
8411
8412/// Enum value definition.
8413#[derive(Clone, Default, PartialEq)]
8414#[non_exhaustive]
8415pub struct EnumValue {
8416    /// Enum value name.
8417    pub name: std::string::String,
8418
8419    /// Enum value number.
8420    pub number: i32,
8421
8422    /// Protocol buffer options.
8423    pub options: std::vec::Vec<crate::Option>,
8424
8425    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8426}
8427
8428impl EnumValue {
8429    /// Creates a new default instance.
8430    pub fn new() -> Self {
8431        std::default::Default::default()
8432    }
8433
8434    /// Sets the value of [name][crate::EnumValue::name].
8435    ///
8436    /// # Example
8437    /// ```ignore,no_run
8438    /// # use google_cloud_wkt::EnumValue;
8439    /// let x = EnumValue::new().set_name("example");
8440    /// ```
8441    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8442        self.name = v.into();
8443        self
8444    }
8445
8446    /// Sets the value of [number][crate::EnumValue::number].
8447    ///
8448    /// # Example
8449    /// ```ignore,no_run
8450    /// # use google_cloud_wkt::EnumValue;
8451    /// let x = EnumValue::new().set_number(42);
8452    /// ```
8453    pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8454        self.number = v.into();
8455        self
8456    }
8457
8458    /// Sets the value of [options][crate::EnumValue::options].
8459    ///
8460    /// # Example
8461    /// ```ignore,no_run
8462    /// # use google_cloud_wkt::EnumValue;
8463    /// use google_cloud_wkt::Option;
8464    /// let x = EnumValue::new()
8465    ///     .set_options([
8466    ///         Option::default()/* use setters */,
8467    ///         Option::default()/* use (different) setters */,
8468    ///     ]);
8469    /// ```
8470    pub fn set_options<T, V>(mut self, v: T) -> Self
8471    where
8472        T: std::iter::IntoIterator<Item = V>,
8473        V: std::convert::Into<crate::Option>,
8474    {
8475        use std::iter::Iterator;
8476        self.options = v.into_iter().map(|i| i.into()).collect();
8477        self
8478    }
8479}
8480
8481impl wkt::message::Message for EnumValue {
8482    fn typename() -> &'static str {
8483        "type.googleapis.com/google.protobuf.EnumValue"
8484    }
8485}
8486
8487/// A protocol buffer option, which can be attached to a message, field,
8488/// enumeration, etc.
8489#[derive(Clone, Default, PartialEq)]
8490#[non_exhaustive]
8491pub struct Option {
8492    /// The option's name. For protobuf built-in options (options defined in
8493    /// descriptor.proto), this is the short name. For example, `"map_entry"`.
8494    /// For custom options, it should be the fully-qualified name. For example,
8495    /// `"google.api.http"`.
8496    pub name: std::string::String,
8497
8498    /// The option's value packed in an Any message. If the value is a primitive,
8499    /// the corresponding wrapper type defined in google/protobuf/wrappers.proto
8500    /// should be used. If the value is an enum, it should be stored as an int32
8501    /// value using the google.protobuf.Int32Value type.
8502    pub value: std::option::Option<crate::Any>,
8503
8504    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8505}
8506
8507impl Option {
8508    /// Creates a new default instance.
8509    pub fn new() -> Self {
8510        std::default::Default::default()
8511    }
8512
8513    /// Sets the value of [name][crate::Option::name].
8514    ///
8515    /// # Example
8516    /// ```ignore,no_run
8517    /// # use google_cloud_wkt::Option;
8518    /// let x = Option::new().set_name("example");
8519    /// ```
8520    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8521        self.name = v.into();
8522        self
8523    }
8524
8525    /// Sets the value of [value][crate::Option::value].
8526    ///
8527    /// # Example
8528    /// ```ignore,no_run
8529    /// # use google_cloud_wkt::Option;
8530    /// use google_cloud_wkt::Any;
8531    /// let x = Option::new().set_value(Any::default()/* use setters */);
8532    /// ```
8533    pub fn set_value<T>(mut self, v: T) -> Self
8534    where
8535        T: std::convert::Into<crate::Any>,
8536    {
8537        self.value = std::option::Option::Some(v.into());
8538        self
8539    }
8540
8541    /// Sets or clears the value of [value][crate::Option::value].
8542    ///
8543    /// # Example
8544    /// ```ignore,no_run
8545    /// # use google_cloud_wkt::Option;
8546    /// use google_cloud_wkt::Any;
8547    /// let x = Option::new().set_or_clear_value(Some(Any::default()/* use setters */));
8548    /// let x = Option::new().set_or_clear_value(None::<Any>);
8549    /// ```
8550    pub fn set_or_clear_value<T>(mut self, v: std::option::Option<T>) -> Self
8551    where
8552        T: std::convert::Into<crate::Any>,
8553    {
8554        self.value = v.map(|x| x.into());
8555        self
8556    }
8557}
8558
8559impl wkt::message::Message for Option {
8560    fn typename() -> &'static str {
8561        "type.googleapis.com/google.protobuf.Option"
8562    }
8563}
8564
8565/// The full set of known editions.
8566///
8567/// # Working with unknown values
8568///
8569/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8570/// additional enum variants at any time. Adding new variants is not considered
8571/// a breaking change. Applications should write their code in anticipation of:
8572///
8573/// - New values appearing in future releases of the client library, **and**
8574/// - New values received dynamically, without application changes.
8575///
8576/// Please consult the [Working with enums] section in the user guide for some
8577/// guidelines.
8578///
8579/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8580#[derive(Clone, Debug, PartialEq)]
8581#[non_exhaustive]
8582pub enum Edition {
8583    /// A placeholder for an unknown edition value.
8584    Unknown,
8585    /// A placeholder edition for specifying default behaviors *before* a feature
8586    /// was first introduced.  This is effectively an "infinite past".
8587    Legacy,
8588    /// Legacy syntax "editions".  These pre-date editions, but behave much like
8589    /// distinct editions.  These can't be used to specify the edition of proto
8590    /// files, but feature definitions must supply proto2/proto3 defaults for
8591    /// backwards compatibility.
8592    Proto2,
8593    #[allow(missing_docs)]
8594    Proto3,
8595    /// Editions that have been released.  The specific values are arbitrary and
8596    /// should not be depended on, but they will always be time-ordered for easy
8597    /// comparison.
8598    Edition2023,
8599    #[allow(missing_docs)]
8600    Edition2024,
8601    /// Placeholder editions for testing feature resolution.  These should not be
8602    /// used or relied on outside of tests.
8603    Edition1TestOnly,
8604    #[allow(missing_docs)]
8605    Edition2TestOnly,
8606    #[allow(missing_docs)]
8607    Edition99997TestOnly,
8608    #[allow(missing_docs)]
8609    Edition99998TestOnly,
8610    #[allow(missing_docs)]
8611    Edition99999TestOnly,
8612    /// Placeholder for specifying unbounded edition support.  This should only
8613    /// ever be used by plugins that can expect to never require any changes to
8614    /// support a new edition.
8615    Max,
8616    /// If set, the enum was initialized with an unknown value.
8617    ///
8618    /// Applications can examine the value using [Edition::value] or
8619    /// [Edition::name].
8620    UnknownValue(edition::UnknownValue),
8621}
8622
8623#[doc(hidden)]
8624pub mod edition {
8625    #[allow(unused_imports)]
8626    use super::*;
8627    #[derive(Clone, Debug, PartialEq)]
8628    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8629}
8630
8631impl Edition {
8632    /// Gets the enum value.
8633    ///
8634    /// Returns `None` if the enum contains an unknown value deserialized from
8635    /// the string representation of enums.
8636    pub fn value(&self) -> std::option::Option<i32> {
8637        match self {
8638            Self::Unknown => std::option::Option::Some(0),
8639            Self::Legacy => std::option::Option::Some(900),
8640            Self::Proto2 => std::option::Option::Some(998),
8641            Self::Proto3 => std::option::Option::Some(999),
8642            Self::Edition2023 => std::option::Option::Some(1000),
8643            Self::Edition2024 => std::option::Option::Some(1001),
8644            Self::Edition1TestOnly => std::option::Option::Some(1),
8645            Self::Edition2TestOnly => std::option::Option::Some(2),
8646            Self::Edition99997TestOnly => std::option::Option::Some(99997),
8647            Self::Edition99998TestOnly => std::option::Option::Some(99998),
8648            Self::Edition99999TestOnly => std::option::Option::Some(99999),
8649            Self::Max => std::option::Option::Some(2147483647),
8650            Self::UnknownValue(u) => u.0.value(),
8651        }
8652    }
8653
8654    /// Gets the enum value as a string.
8655    ///
8656    /// Returns `None` if the enum contains an unknown value deserialized from
8657    /// the integer representation of enums.
8658    pub fn name(&self) -> std::option::Option<&str> {
8659        match self {
8660            Self::Unknown => std::option::Option::Some("EDITION_UNKNOWN"),
8661            Self::Legacy => std::option::Option::Some("EDITION_LEGACY"),
8662            Self::Proto2 => std::option::Option::Some("EDITION_PROTO2"),
8663            Self::Proto3 => std::option::Option::Some("EDITION_PROTO3"),
8664            Self::Edition2023 => std::option::Option::Some("EDITION_2023"),
8665            Self::Edition2024 => std::option::Option::Some("EDITION_2024"),
8666            Self::Edition1TestOnly => std::option::Option::Some("EDITION_1_TEST_ONLY"),
8667            Self::Edition2TestOnly => std::option::Option::Some("EDITION_2_TEST_ONLY"),
8668            Self::Edition99997TestOnly => std::option::Option::Some("EDITION_99997_TEST_ONLY"),
8669            Self::Edition99998TestOnly => std::option::Option::Some("EDITION_99998_TEST_ONLY"),
8670            Self::Edition99999TestOnly => std::option::Option::Some("EDITION_99999_TEST_ONLY"),
8671            Self::Max => std::option::Option::Some("EDITION_MAX"),
8672            Self::UnknownValue(u) => u.0.name(),
8673        }
8674    }
8675}
8676
8677impl std::default::Default for Edition {
8678    fn default() -> Self {
8679        use std::convert::From;
8680        Self::from(0)
8681    }
8682}
8683
8684impl std::fmt::Display for Edition {
8685    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8686        wkt::internal::display_enum(f, self.name(), self.value())
8687    }
8688}
8689
8690impl std::convert::From<i32> for Edition {
8691    fn from(value: i32) -> Self {
8692        match value {
8693            0 => Self::Unknown,
8694            1 => Self::Edition1TestOnly,
8695            2 => Self::Edition2TestOnly,
8696            900 => Self::Legacy,
8697            998 => Self::Proto2,
8698            999 => Self::Proto3,
8699            1000 => Self::Edition2023,
8700            1001 => Self::Edition2024,
8701            99997 => Self::Edition99997TestOnly,
8702            99998 => Self::Edition99998TestOnly,
8703            99999 => Self::Edition99999TestOnly,
8704            2147483647 => Self::Max,
8705            _ => Self::UnknownValue(edition::UnknownValue(
8706                wkt::internal::UnknownEnumValue::Integer(value),
8707            )),
8708        }
8709    }
8710}
8711
8712impl std::convert::From<&str> for Edition {
8713    fn from(value: &str) -> Self {
8714        use std::string::ToString;
8715        match value {
8716            "EDITION_UNKNOWN" => Self::Unknown,
8717            "EDITION_LEGACY" => Self::Legacy,
8718            "EDITION_PROTO2" => Self::Proto2,
8719            "EDITION_PROTO3" => Self::Proto3,
8720            "EDITION_2023" => Self::Edition2023,
8721            "EDITION_2024" => Self::Edition2024,
8722            "EDITION_1_TEST_ONLY" => Self::Edition1TestOnly,
8723            "EDITION_2_TEST_ONLY" => Self::Edition2TestOnly,
8724            "EDITION_99997_TEST_ONLY" => Self::Edition99997TestOnly,
8725            "EDITION_99998_TEST_ONLY" => Self::Edition99998TestOnly,
8726            "EDITION_99999_TEST_ONLY" => Self::Edition99999TestOnly,
8727            "EDITION_MAX" => Self::Max,
8728            _ => Self::UnknownValue(edition::UnknownValue(
8729                wkt::internal::UnknownEnumValue::String(value.to_string()),
8730            )),
8731        }
8732    }
8733}
8734
8735impl serde::ser::Serialize for Edition {
8736    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8737    where
8738        S: serde::Serializer,
8739    {
8740        match self {
8741            Self::Unknown => serializer.serialize_i32(0),
8742            Self::Legacy => serializer.serialize_i32(900),
8743            Self::Proto2 => serializer.serialize_i32(998),
8744            Self::Proto3 => serializer.serialize_i32(999),
8745            Self::Edition2023 => serializer.serialize_i32(1000),
8746            Self::Edition2024 => serializer.serialize_i32(1001),
8747            Self::Edition1TestOnly => serializer.serialize_i32(1),
8748            Self::Edition2TestOnly => serializer.serialize_i32(2),
8749            Self::Edition99997TestOnly => serializer.serialize_i32(99997),
8750            Self::Edition99998TestOnly => serializer.serialize_i32(99998),
8751            Self::Edition99999TestOnly => serializer.serialize_i32(99999),
8752            Self::Max => serializer.serialize_i32(2147483647),
8753            Self::UnknownValue(u) => u.0.serialize(serializer),
8754        }
8755    }
8756}
8757
8758impl<'de> serde::de::Deserialize<'de> for Edition {
8759    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8760    where
8761        D: serde::Deserializer<'de>,
8762    {
8763        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Edition>::new(
8764            ".google.protobuf.Edition",
8765        ))
8766    }
8767}
8768
8769/// The syntax in which a protocol buffer element is defined.
8770///
8771/// # Working with unknown values
8772///
8773/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8774/// additional enum variants at any time. Adding new variants is not considered
8775/// a breaking change. Applications should write their code in anticipation of:
8776///
8777/// - New values appearing in future releases of the client library, **and**
8778/// - New values received dynamically, without application changes.
8779///
8780/// Please consult the [Working with enums] section in the user guide for some
8781/// guidelines.
8782///
8783/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8784#[derive(Clone, Debug, PartialEq)]
8785#[non_exhaustive]
8786pub enum Syntax {
8787    /// Syntax `proto2`.
8788    Proto2,
8789    /// Syntax `proto3`.
8790    Proto3,
8791    /// Syntax `editions`.
8792    Editions,
8793    /// If set, the enum was initialized with an unknown value.
8794    ///
8795    /// Applications can examine the value using [Syntax::value] or
8796    /// [Syntax::name].
8797    UnknownValue(syntax::UnknownValue),
8798}
8799
8800#[doc(hidden)]
8801pub mod syntax {
8802    #[allow(unused_imports)]
8803    use super::*;
8804    #[derive(Clone, Debug, PartialEq)]
8805    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8806}
8807
8808impl Syntax {
8809    /// Gets the enum value.
8810    ///
8811    /// Returns `None` if the enum contains an unknown value deserialized from
8812    /// the string representation of enums.
8813    pub fn value(&self) -> std::option::Option<i32> {
8814        match self {
8815            Self::Proto2 => std::option::Option::Some(0),
8816            Self::Proto3 => std::option::Option::Some(1),
8817            Self::Editions => std::option::Option::Some(2),
8818            Self::UnknownValue(u) => u.0.value(),
8819        }
8820    }
8821
8822    /// Gets the enum value as a string.
8823    ///
8824    /// Returns `None` if the enum contains an unknown value deserialized from
8825    /// the integer representation of enums.
8826    pub fn name(&self) -> std::option::Option<&str> {
8827        match self {
8828            Self::Proto2 => std::option::Option::Some("SYNTAX_PROTO2"),
8829            Self::Proto3 => std::option::Option::Some("SYNTAX_PROTO3"),
8830            Self::Editions => std::option::Option::Some("SYNTAX_EDITIONS"),
8831            Self::UnknownValue(u) => u.0.name(),
8832        }
8833    }
8834}
8835
8836impl std::default::Default for Syntax {
8837    fn default() -> Self {
8838        use std::convert::From;
8839        Self::from(0)
8840    }
8841}
8842
8843impl std::fmt::Display for Syntax {
8844    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8845        wkt::internal::display_enum(f, self.name(), self.value())
8846    }
8847}
8848
8849impl std::convert::From<i32> for Syntax {
8850    fn from(value: i32) -> Self {
8851        match value {
8852            0 => Self::Proto2,
8853            1 => Self::Proto3,
8854            2 => Self::Editions,
8855            _ => Self::UnknownValue(syntax::UnknownValue(
8856                wkt::internal::UnknownEnumValue::Integer(value),
8857            )),
8858        }
8859    }
8860}
8861
8862impl std::convert::From<&str> for Syntax {
8863    fn from(value: &str) -> Self {
8864        use std::string::ToString;
8865        match value {
8866            "SYNTAX_PROTO2" => Self::Proto2,
8867            "SYNTAX_PROTO3" => Self::Proto3,
8868            "SYNTAX_EDITIONS" => Self::Editions,
8869            _ => Self::UnknownValue(syntax::UnknownValue(
8870                wkt::internal::UnknownEnumValue::String(value.to_string()),
8871            )),
8872        }
8873    }
8874}
8875
8876impl serde::ser::Serialize for Syntax {
8877    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8878    where
8879        S: serde::Serializer,
8880    {
8881        match self {
8882            Self::Proto2 => serializer.serialize_i32(0),
8883            Self::Proto3 => serializer.serialize_i32(1),
8884            Self::Editions => serializer.serialize_i32(2),
8885            Self::UnknownValue(u) => u.0.serialize(serializer),
8886        }
8887    }
8888}
8889
8890impl<'de> serde::de::Deserialize<'de> for Syntax {
8891    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8892    where
8893        D: serde::Deserializer<'de>,
8894    {
8895        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Syntax>::new(
8896            ".google.protobuf.Syntax",
8897        ))
8898    }
8899}