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