google_cloud_wkt/generated/
mod.rs

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