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
21/// Api is a light-weight descriptor for an API Interface.
22///
23/// Interfaces are also described as "protocol buffer services" in some contexts,
24/// such as by the "service" keyword in a .proto file, but they are different
25/// from API Services, which represent a concrete implementation of an interface
26/// as opposed to simply a description of methods and bindings. They are also
27/// sometimes simply referred to as "APIs" in other contexts, such as the name of
28/// this message itself. See <https://cloud.google.com/apis/design/glossary> for
29/// detailed terminology.
30#[derive(Clone, Debug, Default, PartialEq)]
31#[non_exhaustive]
32pub struct Api {
33    /// The fully qualified name of this interface, including package name
34    /// followed by the interface's simple name.
35    pub name: std::string::String,
36
37    /// The methods of this interface, in unspecified order.
38    pub methods: std::vec::Vec<crate::Method>,
39
40    /// Any metadata attached to the interface.
41    pub options: std::vec::Vec<crate::Option>,
42
43    /// A version string for this interface. If specified, must have the form
44    /// `major-version.minor-version`, as in `1.10`. If the minor version is
45    /// omitted, it defaults to zero. If the entire version field is empty, the
46    /// major version is derived from the package name, as outlined below. If the
47    /// field is not empty, the version in the package name will be verified to be
48    /// consistent with what is provided here.
49    ///
50    /// The versioning schema uses [semantic
51    /// versioning](http://semver.org) where the major version number
52    /// indicates a breaking change and the minor version an additive,
53    /// non-breaking change. Both version numbers are signals to users
54    /// what to expect from different versions, and should be carefully
55    /// chosen based on the product plan.
56    ///
57    /// The major version is also reflected in the package name of the
58    /// interface, which must end in `v<major-version>`, as in
59    /// `google.feature.v1`. For major versions 0 and 1, the suffix can
60    /// be omitted. Zero major versions must only be used for
61    /// experimental, non-GA interfaces.
62    pub version: std::string::String,
63
64    /// Source context for the protocol buffer service represented by this
65    /// message.
66    pub source_context: std::option::Option<crate::SourceContext>,
67
68    /// Included interfaces. See [Mixin][].
69    ///
70    /// [Mixin]: crate::Mixin
71    pub mixins: std::vec::Vec<crate::Mixin>,
72
73    /// The source syntax of the service.
74    pub syntax: crate::Syntax,
75
76    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
77}
78
79impl Api {
80    pub fn new() -> Self {
81        std::default::Default::default()
82    }
83
84    /// Sets the value of [name][crate::Api::name].
85    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
86        self.name = v.into();
87        self
88    }
89
90    /// Sets the value of [methods][crate::Api::methods].
91    pub fn set_methods<T, V>(mut self, v: T) -> Self
92    where
93        T: std::iter::IntoIterator<Item = V>,
94        V: std::convert::Into<crate::Method>,
95    {
96        use std::iter::Iterator;
97        self.methods = v.into_iter().map(|i| i.into()).collect();
98        self
99    }
100
101    /// Sets the value of [options][crate::Api::options].
102    pub fn set_options<T, V>(mut self, v: T) -> Self
103    where
104        T: std::iter::IntoIterator<Item = V>,
105        V: std::convert::Into<crate::Option>,
106    {
107        use std::iter::Iterator;
108        self.options = v.into_iter().map(|i| i.into()).collect();
109        self
110    }
111
112    /// Sets the value of [version][crate::Api::version].
113    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
114        self.version = v.into();
115        self
116    }
117
118    /// Sets the value of [source_context][crate::Api::source_context].
119    pub fn set_source_context<T>(mut self, v: T) -> Self
120    where
121        T: std::convert::Into<crate::SourceContext>,
122    {
123        self.source_context = std::option::Option::Some(v.into());
124        self
125    }
126
127    /// Sets or clears the value of [source_context][crate::Api::source_context].
128    pub fn set_or_clear_source_context<T>(mut self, v: std::option::Option<T>) -> Self
129    where
130        T: std::convert::Into<crate::SourceContext>,
131    {
132        self.source_context = v.map(|x| x.into());
133        self
134    }
135
136    /// Sets the value of [mixins][crate::Api::mixins].
137    pub fn set_mixins<T, V>(mut self, v: T) -> Self
138    where
139        T: std::iter::IntoIterator<Item = V>,
140        V: std::convert::Into<crate::Mixin>,
141    {
142        use std::iter::Iterator;
143        self.mixins = v.into_iter().map(|i| i.into()).collect();
144        self
145    }
146
147    /// Sets the value of [syntax][crate::Api::syntax].
148    pub fn set_syntax<T: std::convert::Into<crate::Syntax>>(mut self, v: T) -> Self {
149        self.syntax = v.into();
150        self
151    }
152}
153
154impl wkt::message::Message for Api {
155    fn typename() -> &'static str {
156        "type.googleapis.com/google.protobuf.Api"
157    }
158}
159
160#[doc(hidden)]
161impl<'de> serde::de::Deserialize<'de> for Api {
162    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
163    where
164        D: serde::Deserializer<'de>,
165    {
166        #[allow(non_camel_case_types)]
167        #[doc(hidden)]
168        #[derive(PartialEq, Eq, Hash)]
169        enum __FieldTag {
170            __name,
171            __methods,
172            __options,
173            __version,
174            __source_context,
175            __mixins,
176            __syntax,
177            Unknown(std::string::String),
178        }
179        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
180            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
181            where
182                D: serde::Deserializer<'de>,
183            {
184                struct Visitor;
185                impl<'de> serde::de::Visitor<'de> for Visitor {
186                    type Value = __FieldTag;
187                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
188                        formatter.write_str("a field name for Api")
189                    }
190                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
191                    where
192                        E: serde::de::Error,
193                    {
194                        use std::result::Result::Ok;
195                        use std::string::ToString;
196                        match value {
197                            "name" => Ok(__FieldTag::__name),
198                            "methods" => Ok(__FieldTag::__methods),
199                            "options" => Ok(__FieldTag::__options),
200                            "version" => Ok(__FieldTag::__version),
201                            "sourceContext" => Ok(__FieldTag::__source_context),
202                            "source_context" => Ok(__FieldTag::__source_context),
203                            "mixins" => Ok(__FieldTag::__mixins),
204                            "syntax" => Ok(__FieldTag::__syntax),
205                            _ => Ok(__FieldTag::Unknown(value.to_string())),
206                        }
207                    }
208                }
209                deserializer.deserialize_identifier(Visitor)
210            }
211        }
212        struct Visitor;
213        impl<'de> serde::de::Visitor<'de> for Visitor {
214            type Value = Api;
215            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
216                formatter.write_str("struct Api")
217            }
218            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
219            where
220                A: serde::de::MapAccess<'de>,
221            {
222                #[allow(unused_imports)]
223                use serde::de::Error;
224                use std::option::Option::Some;
225                let mut fields = std::collections::HashSet::new();
226                let mut result = Self::Value::new();
227                while let Some(tag) = map.next_key::<__FieldTag>()? {
228                    #[allow(clippy::match_single_binding)]
229                    match tag {
230                        __FieldTag::__name => {
231                            if !fields.insert(__FieldTag::__name) {
232                                return std::result::Result::Err(A::Error::duplicate_field(
233                                    "multiple values for name",
234                                ));
235                            }
236                            result.name = map
237                                .next_value::<std::option::Option<std::string::String>>()?
238                                .unwrap_or_default();
239                        }
240                        __FieldTag::__methods => {
241                            if !fields.insert(__FieldTag::__methods) {
242                                return std::result::Result::Err(A::Error::duplicate_field(
243                                    "multiple values for methods",
244                                ));
245                            }
246                            result.methods = map
247                                .next_value::<std::option::Option<std::vec::Vec<crate::Method>>>()?
248                                .unwrap_or_default();
249                        }
250                        __FieldTag::__options => {
251                            if !fields.insert(__FieldTag::__options) {
252                                return std::result::Result::Err(A::Error::duplicate_field(
253                                    "multiple values for options",
254                                ));
255                            }
256                            result.options = map
257                                .next_value::<std::option::Option<std::vec::Vec<crate::Option>>>()?
258                                .unwrap_or_default();
259                        }
260                        __FieldTag::__version => {
261                            if !fields.insert(__FieldTag::__version) {
262                                return std::result::Result::Err(A::Error::duplicate_field(
263                                    "multiple values for version",
264                                ));
265                            }
266                            result.version = map
267                                .next_value::<std::option::Option<std::string::String>>()?
268                                .unwrap_or_default();
269                        }
270                        __FieldTag::__source_context => {
271                            if !fields.insert(__FieldTag::__source_context) {
272                                return std::result::Result::Err(A::Error::duplicate_field(
273                                    "multiple values for source_context",
274                                ));
275                            }
276                            result.source_context =
277                                map.next_value::<std::option::Option<crate::SourceContext>>()?;
278                        }
279                        __FieldTag::__mixins => {
280                            if !fields.insert(__FieldTag::__mixins) {
281                                return std::result::Result::Err(A::Error::duplicate_field(
282                                    "multiple values for mixins",
283                                ));
284                            }
285                            result.mixins = map
286                                .next_value::<std::option::Option<std::vec::Vec<crate::Mixin>>>()?
287                                .unwrap_or_default();
288                        }
289                        __FieldTag::__syntax => {
290                            if !fields.insert(__FieldTag::__syntax) {
291                                return std::result::Result::Err(A::Error::duplicate_field(
292                                    "multiple values for syntax",
293                                ));
294                            }
295                            result.syntax = map
296                                .next_value::<std::option::Option<crate::Syntax>>()?
297                                .unwrap_or_default();
298                        }
299                        __FieldTag::Unknown(key) => {
300                            let value = map.next_value::<serde_json::Value>()?;
301                            result._unknown_fields.insert(key, value);
302                        }
303                    }
304                }
305                std::result::Result::Ok(result)
306            }
307        }
308        deserializer.deserialize_any(Visitor)
309    }
310}
311
312#[doc(hidden)]
313impl serde::ser::Serialize for Api {
314    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
315    where
316        S: serde::ser::Serializer,
317    {
318        use serde::ser::SerializeMap;
319        #[allow(unused_imports)]
320        use std::option::Option::Some;
321        let mut state = serializer.serialize_map(std::option::Option::None)?;
322        if !self.name.is_empty() {
323            state.serialize_entry("name", &self.name)?;
324        }
325        if !self.methods.is_empty() {
326            state.serialize_entry("methods", &self.methods)?;
327        }
328        if !self.options.is_empty() {
329            state.serialize_entry("options", &self.options)?;
330        }
331        if !self.version.is_empty() {
332            state.serialize_entry("version", &self.version)?;
333        }
334        if self.source_context.is_some() {
335            state.serialize_entry("sourceContext", &self.source_context)?;
336        }
337        if !self.mixins.is_empty() {
338            state.serialize_entry("mixins", &self.mixins)?;
339        }
340        if !wkt::internal::is_default(&self.syntax) {
341            state.serialize_entry("syntax", &self.syntax)?;
342        }
343        if !self._unknown_fields.is_empty() {
344            for (key, value) in self._unknown_fields.iter() {
345                state.serialize_entry(key, &value)?;
346            }
347        }
348        state.end()
349    }
350}
351
352/// Method represents a method of an API interface.
353#[derive(Clone, Debug, Default, PartialEq)]
354#[non_exhaustive]
355pub struct Method {
356    /// The simple name of this method.
357    pub name: std::string::String,
358
359    /// A URL of the input message type.
360    pub request_type_url: std::string::String,
361
362    /// If true, the request is streamed.
363    pub request_streaming: bool,
364
365    /// The URL of the output message type.
366    pub response_type_url: std::string::String,
367
368    /// If true, the response is streamed.
369    pub response_streaming: bool,
370
371    /// Any metadata attached to the method.
372    pub options: std::vec::Vec<crate::Option>,
373
374    /// The source syntax of this method.
375    pub syntax: crate::Syntax,
376
377    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
378}
379
380impl Method {
381    pub fn new() -> Self {
382        std::default::Default::default()
383    }
384
385    /// Sets the value of [name][crate::Method::name].
386    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
387        self.name = v.into();
388        self
389    }
390
391    /// Sets the value of [request_type_url][crate::Method::request_type_url].
392    pub fn set_request_type_url<T: std::convert::Into<std::string::String>>(
393        mut self,
394        v: T,
395    ) -> Self {
396        self.request_type_url = v.into();
397        self
398    }
399
400    /// Sets the value of [request_streaming][crate::Method::request_streaming].
401    pub fn set_request_streaming<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
402        self.request_streaming = v.into();
403        self
404    }
405
406    /// Sets the value of [response_type_url][crate::Method::response_type_url].
407    pub fn set_response_type_url<T: std::convert::Into<std::string::String>>(
408        mut self,
409        v: T,
410    ) -> Self {
411        self.response_type_url = v.into();
412        self
413    }
414
415    /// Sets the value of [response_streaming][crate::Method::response_streaming].
416    pub fn set_response_streaming<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
417        self.response_streaming = v.into();
418        self
419    }
420
421    /// Sets the value of [options][crate::Method::options].
422    pub fn set_options<T, V>(mut self, v: T) -> Self
423    where
424        T: std::iter::IntoIterator<Item = V>,
425        V: std::convert::Into<crate::Option>,
426    {
427        use std::iter::Iterator;
428        self.options = v.into_iter().map(|i| i.into()).collect();
429        self
430    }
431
432    /// Sets the value of [syntax][crate::Method::syntax].
433    pub fn set_syntax<T: std::convert::Into<crate::Syntax>>(mut self, v: T) -> Self {
434        self.syntax = v.into();
435        self
436    }
437}
438
439impl wkt::message::Message for Method {
440    fn typename() -> &'static str {
441        "type.googleapis.com/google.protobuf.Method"
442    }
443}
444
445#[doc(hidden)]
446impl<'de> serde::de::Deserialize<'de> for Method {
447    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
448    where
449        D: serde::Deserializer<'de>,
450    {
451        #[allow(non_camel_case_types)]
452        #[doc(hidden)]
453        #[derive(PartialEq, Eq, Hash)]
454        enum __FieldTag {
455            __name,
456            __request_type_url,
457            __request_streaming,
458            __response_type_url,
459            __response_streaming,
460            __options,
461            __syntax,
462            Unknown(std::string::String),
463        }
464        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
465            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
466            where
467                D: serde::Deserializer<'de>,
468            {
469                struct Visitor;
470                impl<'de> serde::de::Visitor<'de> for Visitor {
471                    type Value = __FieldTag;
472                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
473                        formatter.write_str("a field name for Method")
474                    }
475                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
476                    where
477                        E: serde::de::Error,
478                    {
479                        use std::result::Result::Ok;
480                        use std::string::ToString;
481                        match value {
482                            "name" => Ok(__FieldTag::__name),
483                            "requestTypeUrl" => Ok(__FieldTag::__request_type_url),
484                            "request_type_url" => Ok(__FieldTag::__request_type_url),
485                            "requestStreaming" => Ok(__FieldTag::__request_streaming),
486                            "request_streaming" => Ok(__FieldTag::__request_streaming),
487                            "responseTypeUrl" => Ok(__FieldTag::__response_type_url),
488                            "response_type_url" => Ok(__FieldTag::__response_type_url),
489                            "responseStreaming" => Ok(__FieldTag::__response_streaming),
490                            "response_streaming" => Ok(__FieldTag::__response_streaming),
491                            "options" => Ok(__FieldTag::__options),
492                            "syntax" => Ok(__FieldTag::__syntax),
493                            _ => Ok(__FieldTag::Unknown(value.to_string())),
494                        }
495                    }
496                }
497                deserializer.deserialize_identifier(Visitor)
498            }
499        }
500        struct Visitor;
501        impl<'de> serde::de::Visitor<'de> for Visitor {
502            type Value = Method;
503            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
504                formatter.write_str("struct Method")
505            }
506            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
507            where
508                A: serde::de::MapAccess<'de>,
509            {
510                #[allow(unused_imports)]
511                use serde::de::Error;
512                use std::option::Option::Some;
513                let mut fields = std::collections::HashSet::new();
514                let mut result = Self::Value::new();
515                while let Some(tag) = map.next_key::<__FieldTag>()? {
516                    #[allow(clippy::match_single_binding)]
517                    match tag {
518                        __FieldTag::__name => {
519                            if !fields.insert(__FieldTag::__name) {
520                                return std::result::Result::Err(A::Error::duplicate_field(
521                                    "multiple values for name",
522                                ));
523                            }
524                            result.name = map
525                                .next_value::<std::option::Option<std::string::String>>()?
526                                .unwrap_or_default();
527                        }
528                        __FieldTag::__request_type_url => {
529                            if !fields.insert(__FieldTag::__request_type_url) {
530                                return std::result::Result::Err(A::Error::duplicate_field(
531                                    "multiple values for request_type_url",
532                                ));
533                            }
534                            result.request_type_url = map
535                                .next_value::<std::option::Option<std::string::String>>()?
536                                .unwrap_or_default();
537                        }
538                        __FieldTag::__request_streaming => {
539                            if !fields.insert(__FieldTag::__request_streaming) {
540                                return std::result::Result::Err(A::Error::duplicate_field(
541                                    "multiple values for request_streaming",
542                                ));
543                            }
544                            result.request_streaming = map
545                                .next_value::<std::option::Option<bool>>()?
546                                .unwrap_or_default();
547                        }
548                        __FieldTag::__response_type_url => {
549                            if !fields.insert(__FieldTag::__response_type_url) {
550                                return std::result::Result::Err(A::Error::duplicate_field(
551                                    "multiple values for response_type_url",
552                                ));
553                            }
554                            result.response_type_url = map
555                                .next_value::<std::option::Option<std::string::String>>()?
556                                .unwrap_or_default();
557                        }
558                        __FieldTag::__response_streaming => {
559                            if !fields.insert(__FieldTag::__response_streaming) {
560                                return std::result::Result::Err(A::Error::duplicate_field(
561                                    "multiple values for response_streaming",
562                                ));
563                            }
564                            result.response_streaming = map
565                                .next_value::<std::option::Option<bool>>()?
566                                .unwrap_or_default();
567                        }
568                        __FieldTag::__options => {
569                            if !fields.insert(__FieldTag::__options) {
570                                return std::result::Result::Err(A::Error::duplicate_field(
571                                    "multiple values for options",
572                                ));
573                            }
574                            result.options = map
575                                .next_value::<std::option::Option<std::vec::Vec<crate::Option>>>()?
576                                .unwrap_or_default();
577                        }
578                        __FieldTag::__syntax => {
579                            if !fields.insert(__FieldTag::__syntax) {
580                                return std::result::Result::Err(A::Error::duplicate_field(
581                                    "multiple values for syntax",
582                                ));
583                            }
584                            result.syntax = map
585                                .next_value::<std::option::Option<crate::Syntax>>()?
586                                .unwrap_or_default();
587                        }
588                        __FieldTag::Unknown(key) => {
589                            let value = map.next_value::<serde_json::Value>()?;
590                            result._unknown_fields.insert(key, value);
591                        }
592                    }
593                }
594                std::result::Result::Ok(result)
595            }
596        }
597        deserializer.deserialize_any(Visitor)
598    }
599}
600
601#[doc(hidden)]
602impl serde::ser::Serialize for Method {
603    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
604    where
605        S: serde::ser::Serializer,
606    {
607        use serde::ser::SerializeMap;
608        #[allow(unused_imports)]
609        use std::option::Option::Some;
610        let mut state = serializer.serialize_map(std::option::Option::None)?;
611        if !self.name.is_empty() {
612            state.serialize_entry("name", &self.name)?;
613        }
614        if !self.request_type_url.is_empty() {
615            state.serialize_entry("requestTypeUrl", &self.request_type_url)?;
616        }
617        if !wkt::internal::is_default(&self.request_streaming) {
618            state.serialize_entry("requestStreaming", &self.request_streaming)?;
619        }
620        if !self.response_type_url.is_empty() {
621            state.serialize_entry("responseTypeUrl", &self.response_type_url)?;
622        }
623        if !wkt::internal::is_default(&self.response_streaming) {
624            state.serialize_entry("responseStreaming", &self.response_streaming)?;
625        }
626        if !self.options.is_empty() {
627            state.serialize_entry("options", &self.options)?;
628        }
629        if !wkt::internal::is_default(&self.syntax) {
630            state.serialize_entry("syntax", &self.syntax)?;
631        }
632        if !self._unknown_fields.is_empty() {
633            for (key, value) in self._unknown_fields.iter() {
634                state.serialize_entry(key, &value)?;
635            }
636        }
637        state.end()
638    }
639}
640
641/// Declares an API Interface to be included in this interface. The including
642/// interface must redeclare all the methods from the included interface, but
643/// documentation and options are inherited as follows:
644///
645/// - If after comment and whitespace stripping, the documentation
646///   string of the redeclared method is empty, it will be inherited
647///   from the original method.
648///
649/// - Each annotation belonging to the service config (http,
650///   visibility) which is not set in the redeclared method will be
651///   inherited.
652///
653/// - If an http annotation is inherited, the path pattern will be
654///   modified as follows. Any version prefix will be replaced by the
655///   version of the including interface plus the [root][] path if
656///   specified.
657///
658///
659/// Example of a simple mixin:
660///
661/// ```norust
662/// package google.acl.v1;
663/// service AccessControl {
664///   // Get the underlying ACL object.
665///   rpc GetAcl(GetAclRequest) returns (Acl) {
666///     option (google.api.http).get = "/v1/{resource=**}:getAcl";
667///   }
668/// }
669///
670/// package google.storage.v2;
671/// service Storage {
672///   rpc GetAcl(GetAclRequest) returns (Acl);
673///
674///   // Get a data record.
675///   rpc GetData(GetDataRequest) returns (Data) {
676///     option (google.api.http).get = "/v2/{resource=**}";
677///   }
678/// }
679/// ```
680///
681/// Example of a mixin configuration:
682///
683/// ```norust
684/// apis:
685/// - name: google.storage.v2.Storage
686///   mixins:
687///   - name: google.acl.v1.AccessControl
688/// ```
689///
690/// The mixin construct implies that all methods in `AccessControl` are
691/// also declared with same name and request/response types in
692/// `Storage`. A documentation generator or annotation processor will
693/// see the effective `Storage.GetAcl` method after inheriting
694/// documentation and annotations as follows:
695///
696/// ```norust
697/// service Storage {
698///   // Get the underlying ACL object.
699///   rpc GetAcl(GetAclRequest) returns (Acl) {
700///     option (google.api.http).get = "/v2/{resource=**}:getAcl";
701///   }
702///   ...
703/// }
704/// ```
705///
706/// Note how the version in the path pattern changed from `v1` to `v2`.
707///
708/// If the `root` field in the mixin is specified, it should be a
709/// relative path under which inherited HTTP paths are placed. Example:
710///
711/// ```norust
712/// apis:
713/// - name: google.storage.v2.Storage
714///   mixins:
715///   - name: google.acl.v1.AccessControl
716///     root: acls
717/// ```
718///
719/// This implies the following inherited HTTP annotation:
720///
721/// ```norust
722/// service Storage {
723///   // Get the underlying ACL object.
724///   rpc GetAcl(GetAclRequest) returns (Acl) {
725///     option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
726///   }
727///   ...
728/// }
729/// ```
730///
731/// [root]: wkt::Mixin::root
732#[derive(Clone, Debug, Default, PartialEq)]
733#[non_exhaustive]
734pub struct Mixin {
735    /// The fully qualified name of the interface which is included.
736    pub name: std::string::String,
737
738    /// If non-empty specifies a path under which inherited HTTP paths
739    /// are rooted.
740    pub root: std::string::String,
741
742    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
743}
744
745impl Mixin {
746    pub fn new() -> Self {
747        std::default::Default::default()
748    }
749
750    /// Sets the value of [name][crate::Mixin::name].
751    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
752        self.name = v.into();
753        self
754    }
755
756    /// Sets the value of [root][crate::Mixin::root].
757    pub fn set_root<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
758        self.root = v.into();
759        self
760    }
761}
762
763impl wkt::message::Message for Mixin {
764    fn typename() -> &'static str {
765        "type.googleapis.com/google.protobuf.Mixin"
766    }
767}
768
769#[doc(hidden)]
770impl<'de> serde::de::Deserialize<'de> for Mixin {
771    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
772    where
773        D: serde::Deserializer<'de>,
774    {
775        #[allow(non_camel_case_types)]
776        #[doc(hidden)]
777        #[derive(PartialEq, Eq, Hash)]
778        enum __FieldTag {
779            __name,
780            __root,
781            Unknown(std::string::String),
782        }
783        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
784            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
785            where
786                D: serde::Deserializer<'de>,
787            {
788                struct Visitor;
789                impl<'de> serde::de::Visitor<'de> for Visitor {
790                    type Value = __FieldTag;
791                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
792                        formatter.write_str("a field name for Mixin")
793                    }
794                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
795                    where
796                        E: serde::de::Error,
797                    {
798                        use std::result::Result::Ok;
799                        use std::string::ToString;
800                        match value {
801                            "name" => Ok(__FieldTag::__name),
802                            "root" => Ok(__FieldTag::__root),
803                            _ => Ok(__FieldTag::Unknown(value.to_string())),
804                        }
805                    }
806                }
807                deserializer.deserialize_identifier(Visitor)
808            }
809        }
810        struct Visitor;
811        impl<'de> serde::de::Visitor<'de> for Visitor {
812            type Value = Mixin;
813            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
814                formatter.write_str("struct Mixin")
815            }
816            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
817            where
818                A: serde::de::MapAccess<'de>,
819            {
820                #[allow(unused_imports)]
821                use serde::de::Error;
822                use std::option::Option::Some;
823                let mut fields = std::collections::HashSet::new();
824                let mut result = Self::Value::new();
825                while let Some(tag) = map.next_key::<__FieldTag>()? {
826                    #[allow(clippy::match_single_binding)]
827                    match tag {
828                        __FieldTag::__name => {
829                            if !fields.insert(__FieldTag::__name) {
830                                return std::result::Result::Err(A::Error::duplicate_field(
831                                    "multiple values for name",
832                                ));
833                            }
834                            result.name = map
835                                .next_value::<std::option::Option<std::string::String>>()?
836                                .unwrap_or_default();
837                        }
838                        __FieldTag::__root => {
839                            if !fields.insert(__FieldTag::__root) {
840                                return std::result::Result::Err(A::Error::duplicate_field(
841                                    "multiple values for root",
842                                ));
843                            }
844                            result.root = map
845                                .next_value::<std::option::Option<std::string::String>>()?
846                                .unwrap_or_default();
847                        }
848                        __FieldTag::Unknown(key) => {
849                            let value = map.next_value::<serde_json::Value>()?;
850                            result._unknown_fields.insert(key, value);
851                        }
852                    }
853                }
854                std::result::Result::Ok(result)
855            }
856        }
857        deserializer.deserialize_any(Visitor)
858    }
859}
860
861#[doc(hidden)]
862impl serde::ser::Serialize for Mixin {
863    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
864    where
865        S: serde::ser::Serializer,
866    {
867        use serde::ser::SerializeMap;
868        #[allow(unused_imports)]
869        use std::option::Option::Some;
870        let mut state = serializer.serialize_map(std::option::Option::None)?;
871        if !self.name.is_empty() {
872            state.serialize_entry("name", &self.name)?;
873        }
874        if !self.root.is_empty() {
875            state.serialize_entry("root", &self.root)?;
876        }
877        if !self._unknown_fields.is_empty() {
878            for (key, value) in self._unknown_fields.iter() {
879                state.serialize_entry(key, &value)?;
880            }
881        }
882        state.end()
883    }
884}
885
886/// The protocol compiler can output a FileDescriptorSet containing the .proto
887/// files it parses.
888#[derive(Clone, Debug, Default, PartialEq)]
889#[non_exhaustive]
890pub struct FileDescriptorSet {
891    pub file: std::vec::Vec<crate::FileDescriptorProto>,
892
893    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
894}
895
896impl FileDescriptorSet {
897    pub fn new() -> Self {
898        std::default::Default::default()
899    }
900
901    /// Sets the value of [file][crate::FileDescriptorSet::file].
902    pub fn set_file<T, V>(mut self, v: T) -> Self
903    where
904        T: std::iter::IntoIterator<Item = V>,
905        V: std::convert::Into<crate::FileDescriptorProto>,
906    {
907        use std::iter::Iterator;
908        self.file = v.into_iter().map(|i| i.into()).collect();
909        self
910    }
911}
912
913impl wkt::message::Message for FileDescriptorSet {
914    fn typename() -> &'static str {
915        "type.googleapis.com/google.protobuf.FileDescriptorSet"
916    }
917}
918
919#[doc(hidden)]
920impl<'de> serde::de::Deserialize<'de> for FileDescriptorSet {
921    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
922    where
923        D: serde::Deserializer<'de>,
924    {
925        #[allow(non_camel_case_types)]
926        #[doc(hidden)]
927        #[derive(PartialEq, Eq, Hash)]
928        enum __FieldTag {
929            __file,
930            Unknown(std::string::String),
931        }
932        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
933            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
934            where
935                D: serde::Deserializer<'de>,
936            {
937                struct Visitor;
938                impl<'de> serde::de::Visitor<'de> for Visitor {
939                    type Value = __FieldTag;
940                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
941                        formatter.write_str("a field name for FileDescriptorSet")
942                    }
943                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
944                    where
945                        E: serde::de::Error,
946                    {
947                        use std::result::Result::Ok;
948                        use std::string::ToString;
949                        match value {
950                            "file" => Ok(__FieldTag::__file),
951                            _ => Ok(__FieldTag::Unknown(value.to_string())),
952                        }
953                    }
954                }
955                deserializer.deserialize_identifier(Visitor)
956            }
957        }
958        struct Visitor;
959        impl<'de> serde::de::Visitor<'de> for Visitor {
960            type Value = FileDescriptorSet;
961            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
962                formatter.write_str("struct FileDescriptorSet")
963            }
964            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
965            where
966                A: serde::de::MapAccess<'de>,
967            {
968                #[allow(unused_imports)]
969                use serde::de::Error;
970                use std::option::Option::Some;
971                let mut fields = std::collections::HashSet::new();
972                let mut result = Self::Value::new();
973                while let Some(tag) = map.next_key::<__FieldTag>()? {
974                    #[allow(clippy::match_single_binding)]
975                    match tag {
976                        __FieldTag::__file => {
977                            if !fields.insert(__FieldTag::__file) {
978                                return std::result::Result::Err(A::Error::duplicate_field(
979                                    "multiple values for file",
980                                ));
981                            }
982                            result.file = map.next_value::<std::option::Option<std::vec::Vec<crate::FileDescriptorProto>>>()?.unwrap_or_default();
983                        }
984                        __FieldTag::Unknown(key) => {
985                            let value = map.next_value::<serde_json::Value>()?;
986                            result._unknown_fields.insert(key, value);
987                        }
988                    }
989                }
990                std::result::Result::Ok(result)
991            }
992        }
993        deserializer.deserialize_any(Visitor)
994    }
995}
996
997#[doc(hidden)]
998impl serde::ser::Serialize for FileDescriptorSet {
999    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1000    where
1001        S: serde::ser::Serializer,
1002    {
1003        use serde::ser::SerializeMap;
1004        #[allow(unused_imports)]
1005        use std::option::Option::Some;
1006        let mut state = serializer.serialize_map(std::option::Option::None)?;
1007        if !self.file.is_empty() {
1008            state.serialize_entry("file", &self.file)?;
1009        }
1010        if !self._unknown_fields.is_empty() {
1011            for (key, value) in self._unknown_fields.iter() {
1012                state.serialize_entry(key, &value)?;
1013            }
1014        }
1015        state.end()
1016    }
1017}
1018
1019/// Describes a complete .proto file.
1020#[derive(Clone, Debug, Default, PartialEq)]
1021#[non_exhaustive]
1022pub struct FileDescriptorProto {
1023    pub name: std::string::String,
1024
1025    pub package: std::string::String,
1026
1027    /// Names of files imported by this file.
1028    pub dependency: std::vec::Vec<std::string::String>,
1029
1030    /// Indexes of the public imported files in the dependency list above.
1031    pub public_dependency: std::vec::Vec<i32>,
1032
1033    /// Indexes of the weak imported files in the dependency list.
1034    /// For Google-internal migration only. Do not use.
1035    pub weak_dependency: std::vec::Vec<i32>,
1036
1037    /// All top-level definitions in this file.
1038    pub message_type: std::vec::Vec<crate::DescriptorProto>,
1039
1040    pub enum_type: std::vec::Vec<crate::EnumDescriptorProto>,
1041
1042    pub service: std::vec::Vec<crate::ServiceDescriptorProto>,
1043
1044    pub extension: std::vec::Vec<crate::FieldDescriptorProto>,
1045
1046    pub options: std::option::Option<crate::FileOptions>,
1047
1048    /// This field contains optional information about the original source code.
1049    /// You may safely remove this entire field without harming runtime
1050    /// functionality of the descriptors -- the information is needed only by
1051    /// development tools.
1052    pub source_code_info: std::option::Option<crate::SourceCodeInfo>,
1053
1054    /// The syntax of the proto file.
1055    /// The supported values are "proto2", "proto3", and "editions".
1056    ///
1057    /// If `edition` is present, this value must be "editions".
1058    pub syntax: std::string::String,
1059
1060    /// The edition of the proto file.
1061    pub edition: crate::Edition,
1062
1063    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1064}
1065
1066impl FileDescriptorProto {
1067    pub fn new() -> Self {
1068        std::default::Default::default()
1069    }
1070
1071    /// Sets the value of [name][crate::FileDescriptorProto::name].
1072    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1073        self.name = v.into();
1074        self
1075    }
1076
1077    /// Sets the value of [package][crate::FileDescriptorProto::package].
1078    pub fn set_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1079        self.package = v.into();
1080        self
1081    }
1082
1083    /// Sets the value of [dependency][crate::FileDescriptorProto::dependency].
1084    pub fn set_dependency<T, V>(mut self, v: T) -> Self
1085    where
1086        T: std::iter::IntoIterator<Item = V>,
1087        V: std::convert::Into<std::string::String>,
1088    {
1089        use std::iter::Iterator;
1090        self.dependency = v.into_iter().map(|i| i.into()).collect();
1091        self
1092    }
1093
1094    /// Sets the value of [public_dependency][crate::FileDescriptorProto::public_dependency].
1095    pub fn set_public_dependency<T, V>(mut self, v: T) -> Self
1096    where
1097        T: std::iter::IntoIterator<Item = V>,
1098        V: std::convert::Into<i32>,
1099    {
1100        use std::iter::Iterator;
1101        self.public_dependency = v.into_iter().map(|i| i.into()).collect();
1102        self
1103    }
1104
1105    /// Sets the value of [weak_dependency][crate::FileDescriptorProto::weak_dependency].
1106    pub fn set_weak_dependency<T, V>(mut self, v: T) -> Self
1107    where
1108        T: std::iter::IntoIterator<Item = V>,
1109        V: std::convert::Into<i32>,
1110    {
1111        use std::iter::Iterator;
1112        self.weak_dependency = v.into_iter().map(|i| i.into()).collect();
1113        self
1114    }
1115
1116    /// Sets the value of [message_type][crate::FileDescriptorProto::message_type].
1117    pub fn set_message_type<T, V>(mut self, v: T) -> Self
1118    where
1119        T: std::iter::IntoIterator<Item = V>,
1120        V: std::convert::Into<crate::DescriptorProto>,
1121    {
1122        use std::iter::Iterator;
1123        self.message_type = v.into_iter().map(|i| i.into()).collect();
1124        self
1125    }
1126
1127    /// Sets the value of [enum_type][crate::FileDescriptorProto::enum_type].
1128    pub fn set_enum_type<T, V>(mut self, v: T) -> Self
1129    where
1130        T: std::iter::IntoIterator<Item = V>,
1131        V: std::convert::Into<crate::EnumDescriptorProto>,
1132    {
1133        use std::iter::Iterator;
1134        self.enum_type = v.into_iter().map(|i| i.into()).collect();
1135        self
1136    }
1137
1138    /// Sets the value of [service][crate::FileDescriptorProto::service].
1139    pub fn set_service<T, V>(mut self, v: T) -> Self
1140    where
1141        T: std::iter::IntoIterator<Item = V>,
1142        V: std::convert::Into<crate::ServiceDescriptorProto>,
1143    {
1144        use std::iter::Iterator;
1145        self.service = v.into_iter().map(|i| i.into()).collect();
1146        self
1147    }
1148
1149    /// Sets the value of [extension][crate::FileDescriptorProto::extension].
1150    pub fn set_extension<T, V>(mut self, v: T) -> Self
1151    where
1152        T: std::iter::IntoIterator<Item = V>,
1153        V: std::convert::Into<crate::FieldDescriptorProto>,
1154    {
1155        use std::iter::Iterator;
1156        self.extension = v.into_iter().map(|i| i.into()).collect();
1157        self
1158    }
1159
1160    /// Sets the value of [options][crate::FileDescriptorProto::options].
1161    pub fn set_options<T>(mut self, v: T) -> Self
1162    where
1163        T: std::convert::Into<crate::FileOptions>,
1164    {
1165        self.options = std::option::Option::Some(v.into());
1166        self
1167    }
1168
1169    /// Sets or clears the value of [options][crate::FileDescriptorProto::options].
1170    pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1171    where
1172        T: std::convert::Into<crate::FileOptions>,
1173    {
1174        self.options = v.map(|x| x.into());
1175        self
1176    }
1177
1178    /// Sets the value of [source_code_info][crate::FileDescriptorProto::source_code_info].
1179    pub fn set_source_code_info<T>(mut self, v: T) -> Self
1180    where
1181        T: std::convert::Into<crate::SourceCodeInfo>,
1182    {
1183        self.source_code_info = std::option::Option::Some(v.into());
1184        self
1185    }
1186
1187    /// Sets or clears the value of [source_code_info][crate::FileDescriptorProto::source_code_info].
1188    pub fn set_or_clear_source_code_info<T>(mut self, v: std::option::Option<T>) -> Self
1189    where
1190        T: std::convert::Into<crate::SourceCodeInfo>,
1191    {
1192        self.source_code_info = v.map(|x| x.into());
1193        self
1194    }
1195
1196    /// Sets the value of [syntax][crate::FileDescriptorProto::syntax].
1197    pub fn set_syntax<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1198        self.syntax = v.into();
1199        self
1200    }
1201
1202    /// Sets the value of [edition][crate::FileDescriptorProto::edition].
1203    pub fn set_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
1204        self.edition = v.into();
1205        self
1206    }
1207}
1208
1209impl wkt::message::Message for FileDescriptorProto {
1210    fn typename() -> &'static str {
1211        "type.googleapis.com/google.protobuf.FileDescriptorProto"
1212    }
1213}
1214
1215#[doc(hidden)]
1216impl<'de> serde::de::Deserialize<'de> for FileDescriptorProto {
1217    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1218    where
1219        D: serde::Deserializer<'de>,
1220    {
1221        #[allow(non_camel_case_types)]
1222        #[doc(hidden)]
1223        #[derive(PartialEq, Eq, Hash)]
1224        enum __FieldTag {
1225            __name,
1226            __package,
1227            __dependency,
1228            __public_dependency,
1229            __weak_dependency,
1230            __message_type,
1231            __enum_type,
1232            __service,
1233            __extension,
1234            __options,
1235            __source_code_info,
1236            __syntax,
1237            __edition,
1238            Unknown(std::string::String),
1239        }
1240        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1241            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1242            where
1243                D: serde::Deserializer<'de>,
1244            {
1245                struct Visitor;
1246                impl<'de> serde::de::Visitor<'de> for Visitor {
1247                    type Value = __FieldTag;
1248                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1249                        formatter.write_str("a field name for FileDescriptorProto")
1250                    }
1251                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1252                    where
1253                        E: serde::de::Error,
1254                    {
1255                        use std::result::Result::Ok;
1256                        use std::string::ToString;
1257                        match value {
1258                            "name" => Ok(__FieldTag::__name),
1259                            "package" => Ok(__FieldTag::__package),
1260                            "dependency" => Ok(__FieldTag::__dependency),
1261                            "publicDependency" => Ok(__FieldTag::__public_dependency),
1262                            "public_dependency" => Ok(__FieldTag::__public_dependency),
1263                            "weakDependency" => Ok(__FieldTag::__weak_dependency),
1264                            "weak_dependency" => Ok(__FieldTag::__weak_dependency),
1265                            "messageType" => Ok(__FieldTag::__message_type),
1266                            "message_type" => Ok(__FieldTag::__message_type),
1267                            "enumType" => Ok(__FieldTag::__enum_type),
1268                            "enum_type" => Ok(__FieldTag::__enum_type),
1269                            "service" => Ok(__FieldTag::__service),
1270                            "extension" => Ok(__FieldTag::__extension),
1271                            "options" => Ok(__FieldTag::__options),
1272                            "sourceCodeInfo" => Ok(__FieldTag::__source_code_info),
1273                            "source_code_info" => Ok(__FieldTag::__source_code_info),
1274                            "syntax" => Ok(__FieldTag::__syntax),
1275                            "edition" => Ok(__FieldTag::__edition),
1276                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1277                        }
1278                    }
1279                }
1280                deserializer.deserialize_identifier(Visitor)
1281            }
1282        }
1283        struct Visitor;
1284        impl<'de> serde::de::Visitor<'de> for Visitor {
1285            type Value = FileDescriptorProto;
1286            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1287                formatter.write_str("struct FileDescriptorProto")
1288            }
1289            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1290            where
1291                A: serde::de::MapAccess<'de>,
1292            {
1293                #[allow(unused_imports)]
1294                use serde::de::Error;
1295                use std::option::Option::Some;
1296                let mut fields = std::collections::HashSet::new();
1297                let mut result = Self::Value::new();
1298                while let Some(tag) = map.next_key::<__FieldTag>()? {
1299                    #[allow(clippy::match_single_binding)]
1300                    match tag {
1301                        __FieldTag::__name => {
1302                            if !fields.insert(__FieldTag::__name) {
1303                                return std::result::Result::Err(A::Error::duplicate_field(
1304                                    "multiple values for name",
1305                                ));
1306                            }
1307                            result.name = map
1308                                .next_value::<std::option::Option<std::string::String>>()?
1309                                .unwrap_or_default();
1310                        }
1311                        __FieldTag::__package => {
1312                            if !fields.insert(__FieldTag::__package) {
1313                                return std::result::Result::Err(A::Error::duplicate_field(
1314                                    "multiple values for package",
1315                                ));
1316                            }
1317                            result.package = map
1318                                .next_value::<std::option::Option<std::string::String>>()?
1319                                .unwrap_or_default();
1320                        }
1321                        __FieldTag::__dependency => {
1322                            if !fields.insert(__FieldTag::__dependency) {
1323                                return std::result::Result::Err(A::Error::duplicate_field(
1324                                    "multiple values for dependency",
1325                                ));
1326                            }
1327                            result.dependency = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
1328                        }
1329                        __FieldTag::__public_dependency => {
1330                            if !fields.insert(__FieldTag::__public_dependency) {
1331                                return std::result::Result::Err(A::Error::duplicate_field(
1332                                    "multiple values for public_dependency",
1333                                ));
1334                            }
1335                            struct __With(std::option::Option<std::vec::Vec<i32>>);
1336                            impl<'de> serde::de::Deserialize<'de> for __With {
1337                                fn deserialize<D>(
1338                                    deserializer: D,
1339                                ) -> std::result::Result<Self, D::Error>
1340                                where
1341                                    D: serde::de::Deserializer<'de>,
1342                                {
1343                                    serde_with::As::<
1344                                        std::option::Option<std::vec::Vec<wkt::internal::I32>>,
1345                                    >::deserialize(deserializer)
1346                                    .map(__With)
1347                                }
1348                            }
1349                            result.public_dependency =
1350                                map.next_value::<__With>()?.0.unwrap_or_default();
1351                        }
1352                        __FieldTag::__weak_dependency => {
1353                            if !fields.insert(__FieldTag::__weak_dependency) {
1354                                return std::result::Result::Err(A::Error::duplicate_field(
1355                                    "multiple values for weak_dependency",
1356                                ));
1357                            }
1358                            struct __With(std::option::Option<std::vec::Vec<i32>>);
1359                            impl<'de> serde::de::Deserialize<'de> for __With {
1360                                fn deserialize<D>(
1361                                    deserializer: D,
1362                                ) -> std::result::Result<Self, D::Error>
1363                                where
1364                                    D: serde::de::Deserializer<'de>,
1365                                {
1366                                    serde_with::As::<
1367                                        std::option::Option<std::vec::Vec<wkt::internal::I32>>,
1368                                    >::deserialize(deserializer)
1369                                    .map(__With)
1370                                }
1371                            }
1372                            result.weak_dependency =
1373                                map.next_value::<__With>()?.0.unwrap_or_default();
1374                        }
1375                        __FieldTag::__message_type => {
1376                            if !fields.insert(__FieldTag::__message_type) {
1377                                return std::result::Result::Err(A::Error::duplicate_field(
1378                                    "multiple values for message_type",
1379                                ));
1380                            }
1381                            result.message_type = map.next_value::<std::option::Option<std::vec::Vec<crate::DescriptorProto>>>()?.unwrap_or_default();
1382                        }
1383                        __FieldTag::__enum_type => {
1384                            if !fields.insert(__FieldTag::__enum_type) {
1385                                return std::result::Result::Err(A::Error::duplicate_field(
1386                                    "multiple values for enum_type",
1387                                ));
1388                            }
1389                            result.enum_type = map.next_value::<std::option::Option<std::vec::Vec<crate::EnumDescriptorProto>>>()?.unwrap_or_default();
1390                        }
1391                        __FieldTag::__service => {
1392                            if !fields.insert(__FieldTag::__service) {
1393                                return std::result::Result::Err(A::Error::duplicate_field(
1394                                    "multiple values for service",
1395                                ));
1396                            }
1397                            result.service =
1398                                map.next_value::<std::option::Option<
1399                                    std::vec::Vec<crate::ServiceDescriptorProto>,
1400                                >>()?
1401                                .unwrap_or_default();
1402                        }
1403                        __FieldTag::__extension => {
1404                            if !fields.insert(__FieldTag::__extension) {
1405                                return std::result::Result::Err(A::Error::duplicate_field(
1406                                    "multiple values for extension",
1407                                ));
1408                            }
1409                            result.extension = map.next_value::<std::option::Option<std::vec::Vec<crate::FieldDescriptorProto>>>()?.unwrap_or_default();
1410                        }
1411                        __FieldTag::__options => {
1412                            if !fields.insert(__FieldTag::__options) {
1413                                return std::result::Result::Err(A::Error::duplicate_field(
1414                                    "multiple values for options",
1415                                ));
1416                            }
1417                            result.options =
1418                                map.next_value::<std::option::Option<crate::FileOptions>>()?;
1419                        }
1420                        __FieldTag::__source_code_info => {
1421                            if !fields.insert(__FieldTag::__source_code_info) {
1422                                return std::result::Result::Err(A::Error::duplicate_field(
1423                                    "multiple values for source_code_info",
1424                                ));
1425                            }
1426                            result.source_code_info =
1427                                map.next_value::<std::option::Option<crate::SourceCodeInfo>>()?;
1428                        }
1429                        __FieldTag::__syntax => {
1430                            if !fields.insert(__FieldTag::__syntax) {
1431                                return std::result::Result::Err(A::Error::duplicate_field(
1432                                    "multiple values for syntax",
1433                                ));
1434                            }
1435                            result.syntax = map
1436                                .next_value::<std::option::Option<std::string::String>>()?
1437                                .unwrap_or_default();
1438                        }
1439                        __FieldTag::__edition => {
1440                            if !fields.insert(__FieldTag::__edition) {
1441                                return std::result::Result::Err(A::Error::duplicate_field(
1442                                    "multiple values for edition",
1443                                ));
1444                            }
1445                            result.edition = map
1446                                .next_value::<std::option::Option<crate::Edition>>()?
1447                                .unwrap_or_default();
1448                        }
1449                        __FieldTag::Unknown(key) => {
1450                            let value = map.next_value::<serde_json::Value>()?;
1451                            result._unknown_fields.insert(key, value);
1452                        }
1453                    }
1454                }
1455                std::result::Result::Ok(result)
1456            }
1457        }
1458        deserializer.deserialize_any(Visitor)
1459    }
1460}
1461
1462#[doc(hidden)]
1463impl serde::ser::Serialize for FileDescriptorProto {
1464    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1465    where
1466        S: serde::ser::Serializer,
1467    {
1468        use serde::ser::SerializeMap;
1469        #[allow(unused_imports)]
1470        use std::option::Option::Some;
1471        let mut state = serializer.serialize_map(std::option::Option::None)?;
1472        if !self.name.is_empty() {
1473            state.serialize_entry("name", &self.name)?;
1474        }
1475        if !self.package.is_empty() {
1476            state.serialize_entry("package", &self.package)?;
1477        }
1478        if !self.dependency.is_empty() {
1479            state.serialize_entry("dependency", &self.dependency)?;
1480        }
1481        if !self.public_dependency.is_empty() {
1482            struct __With<'a>(&'a std::vec::Vec<i32>);
1483            impl<'a> serde::ser::Serialize for __With<'a> {
1484                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1485                where
1486                    S: serde::ser::Serializer,
1487                {
1488                    serde_with::As::<std::vec::Vec<wkt::internal::I32>>::serialize(
1489                        self.0, serializer,
1490                    )
1491                }
1492            }
1493            state.serialize_entry("publicDependency", &__With(&self.public_dependency))?;
1494        }
1495        if !self.weak_dependency.is_empty() {
1496            struct __With<'a>(&'a std::vec::Vec<i32>);
1497            impl<'a> serde::ser::Serialize for __With<'a> {
1498                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1499                where
1500                    S: serde::ser::Serializer,
1501                {
1502                    serde_with::As::<std::vec::Vec<wkt::internal::I32>>::serialize(
1503                        self.0, serializer,
1504                    )
1505                }
1506            }
1507            state.serialize_entry("weakDependency", &__With(&self.weak_dependency))?;
1508        }
1509        if !self.message_type.is_empty() {
1510            state.serialize_entry("messageType", &self.message_type)?;
1511        }
1512        if !self.enum_type.is_empty() {
1513            state.serialize_entry("enumType", &self.enum_type)?;
1514        }
1515        if !self.service.is_empty() {
1516            state.serialize_entry("service", &self.service)?;
1517        }
1518        if !self.extension.is_empty() {
1519            state.serialize_entry("extension", &self.extension)?;
1520        }
1521        if self.options.is_some() {
1522            state.serialize_entry("options", &self.options)?;
1523        }
1524        if self.source_code_info.is_some() {
1525            state.serialize_entry("sourceCodeInfo", &self.source_code_info)?;
1526        }
1527        if !self.syntax.is_empty() {
1528            state.serialize_entry("syntax", &self.syntax)?;
1529        }
1530        if !wkt::internal::is_default(&self.edition) {
1531            state.serialize_entry("edition", &self.edition)?;
1532        }
1533        if !self._unknown_fields.is_empty() {
1534            for (key, value) in self._unknown_fields.iter() {
1535                state.serialize_entry(key, &value)?;
1536            }
1537        }
1538        state.end()
1539    }
1540}
1541
1542/// Describes a message type.
1543#[derive(Clone, Debug, Default, PartialEq)]
1544#[non_exhaustive]
1545pub struct DescriptorProto {
1546    pub name: std::string::String,
1547
1548    pub field: std::vec::Vec<crate::FieldDescriptorProto>,
1549
1550    pub extension: std::vec::Vec<crate::FieldDescriptorProto>,
1551
1552    pub nested_type: std::vec::Vec<crate::DescriptorProto>,
1553
1554    pub enum_type: std::vec::Vec<crate::EnumDescriptorProto>,
1555
1556    pub extension_range: std::vec::Vec<crate::descriptor_proto::ExtensionRange>,
1557
1558    pub oneof_decl: std::vec::Vec<crate::OneofDescriptorProto>,
1559
1560    pub options: std::option::Option<crate::MessageOptions>,
1561
1562    pub reserved_range: std::vec::Vec<crate::descriptor_proto::ReservedRange>,
1563
1564    /// Reserved field names, which may not be used by fields in the same message.
1565    /// A given name may only be reserved once.
1566    pub reserved_name: std::vec::Vec<std::string::String>,
1567
1568    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1569}
1570
1571impl DescriptorProto {
1572    pub fn new() -> Self {
1573        std::default::Default::default()
1574    }
1575
1576    /// Sets the value of [name][crate::DescriptorProto::name].
1577    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1578        self.name = v.into();
1579        self
1580    }
1581
1582    /// Sets the value of [field][crate::DescriptorProto::field].
1583    pub fn set_field<T, V>(mut self, v: T) -> Self
1584    where
1585        T: std::iter::IntoIterator<Item = V>,
1586        V: std::convert::Into<crate::FieldDescriptorProto>,
1587    {
1588        use std::iter::Iterator;
1589        self.field = v.into_iter().map(|i| i.into()).collect();
1590        self
1591    }
1592
1593    /// Sets the value of [extension][crate::DescriptorProto::extension].
1594    pub fn set_extension<T, V>(mut self, v: T) -> Self
1595    where
1596        T: std::iter::IntoIterator<Item = V>,
1597        V: std::convert::Into<crate::FieldDescriptorProto>,
1598    {
1599        use std::iter::Iterator;
1600        self.extension = v.into_iter().map(|i| i.into()).collect();
1601        self
1602    }
1603
1604    /// Sets the value of [nested_type][crate::DescriptorProto::nested_type].
1605    pub fn set_nested_type<T, V>(mut self, v: T) -> Self
1606    where
1607        T: std::iter::IntoIterator<Item = V>,
1608        V: std::convert::Into<crate::DescriptorProto>,
1609    {
1610        use std::iter::Iterator;
1611        self.nested_type = v.into_iter().map(|i| i.into()).collect();
1612        self
1613    }
1614
1615    /// Sets the value of [enum_type][crate::DescriptorProto::enum_type].
1616    pub fn set_enum_type<T, V>(mut self, v: T) -> Self
1617    where
1618        T: std::iter::IntoIterator<Item = V>,
1619        V: std::convert::Into<crate::EnumDescriptorProto>,
1620    {
1621        use std::iter::Iterator;
1622        self.enum_type = v.into_iter().map(|i| i.into()).collect();
1623        self
1624    }
1625
1626    /// Sets the value of [extension_range][crate::DescriptorProto::extension_range].
1627    pub fn set_extension_range<T, V>(mut self, v: T) -> Self
1628    where
1629        T: std::iter::IntoIterator<Item = V>,
1630        V: std::convert::Into<crate::descriptor_proto::ExtensionRange>,
1631    {
1632        use std::iter::Iterator;
1633        self.extension_range = v.into_iter().map(|i| i.into()).collect();
1634        self
1635    }
1636
1637    /// Sets the value of [oneof_decl][crate::DescriptorProto::oneof_decl].
1638    pub fn set_oneof_decl<T, V>(mut self, v: T) -> Self
1639    where
1640        T: std::iter::IntoIterator<Item = V>,
1641        V: std::convert::Into<crate::OneofDescriptorProto>,
1642    {
1643        use std::iter::Iterator;
1644        self.oneof_decl = v.into_iter().map(|i| i.into()).collect();
1645        self
1646    }
1647
1648    /// Sets the value of [options][crate::DescriptorProto::options].
1649    pub fn set_options<T>(mut self, v: T) -> Self
1650    where
1651        T: std::convert::Into<crate::MessageOptions>,
1652    {
1653        self.options = std::option::Option::Some(v.into());
1654        self
1655    }
1656
1657    /// Sets or clears the value of [options][crate::DescriptorProto::options].
1658    pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1659    where
1660        T: std::convert::Into<crate::MessageOptions>,
1661    {
1662        self.options = v.map(|x| x.into());
1663        self
1664    }
1665
1666    /// Sets the value of [reserved_range][crate::DescriptorProto::reserved_range].
1667    pub fn set_reserved_range<T, V>(mut self, v: T) -> Self
1668    where
1669        T: std::iter::IntoIterator<Item = V>,
1670        V: std::convert::Into<crate::descriptor_proto::ReservedRange>,
1671    {
1672        use std::iter::Iterator;
1673        self.reserved_range = v.into_iter().map(|i| i.into()).collect();
1674        self
1675    }
1676
1677    /// Sets the value of [reserved_name][crate::DescriptorProto::reserved_name].
1678    pub fn set_reserved_name<T, V>(mut self, v: T) -> Self
1679    where
1680        T: std::iter::IntoIterator<Item = V>,
1681        V: std::convert::Into<std::string::String>,
1682    {
1683        use std::iter::Iterator;
1684        self.reserved_name = v.into_iter().map(|i| i.into()).collect();
1685        self
1686    }
1687}
1688
1689impl wkt::message::Message for DescriptorProto {
1690    fn typename() -> &'static str {
1691        "type.googleapis.com/google.protobuf.DescriptorProto"
1692    }
1693}
1694
1695#[doc(hidden)]
1696impl<'de> serde::de::Deserialize<'de> for DescriptorProto {
1697    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1698    where
1699        D: serde::Deserializer<'de>,
1700    {
1701        #[allow(non_camel_case_types)]
1702        #[doc(hidden)]
1703        #[derive(PartialEq, Eq, Hash)]
1704        enum __FieldTag {
1705            __name,
1706            __field,
1707            __extension,
1708            __nested_type,
1709            __enum_type,
1710            __extension_range,
1711            __oneof_decl,
1712            __options,
1713            __reserved_range,
1714            __reserved_name,
1715            Unknown(std::string::String),
1716        }
1717        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1718            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1719            where
1720                D: serde::Deserializer<'de>,
1721            {
1722                struct Visitor;
1723                impl<'de> serde::de::Visitor<'de> for Visitor {
1724                    type Value = __FieldTag;
1725                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1726                        formatter.write_str("a field name for DescriptorProto")
1727                    }
1728                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1729                    where
1730                        E: serde::de::Error,
1731                    {
1732                        use std::result::Result::Ok;
1733                        use std::string::ToString;
1734                        match value {
1735                            "name" => Ok(__FieldTag::__name),
1736                            "field" => Ok(__FieldTag::__field),
1737                            "extension" => Ok(__FieldTag::__extension),
1738                            "nestedType" => Ok(__FieldTag::__nested_type),
1739                            "nested_type" => Ok(__FieldTag::__nested_type),
1740                            "enumType" => Ok(__FieldTag::__enum_type),
1741                            "enum_type" => Ok(__FieldTag::__enum_type),
1742                            "extensionRange" => Ok(__FieldTag::__extension_range),
1743                            "extension_range" => Ok(__FieldTag::__extension_range),
1744                            "oneofDecl" => Ok(__FieldTag::__oneof_decl),
1745                            "oneof_decl" => Ok(__FieldTag::__oneof_decl),
1746                            "options" => Ok(__FieldTag::__options),
1747                            "reservedRange" => Ok(__FieldTag::__reserved_range),
1748                            "reserved_range" => Ok(__FieldTag::__reserved_range),
1749                            "reservedName" => Ok(__FieldTag::__reserved_name),
1750                            "reserved_name" => Ok(__FieldTag::__reserved_name),
1751                            _ => Ok(__FieldTag::Unknown(value.to_string())),
1752                        }
1753                    }
1754                }
1755                deserializer.deserialize_identifier(Visitor)
1756            }
1757        }
1758        struct Visitor;
1759        impl<'de> serde::de::Visitor<'de> for Visitor {
1760            type Value = DescriptorProto;
1761            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1762                formatter.write_str("struct DescriptorProto")
1763            }
1764            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1765            where
1766                A: serde::de::MapAccess<'de>,
1767            {
1768                #[allow(unused_imports)]
1769                use serde::de::Error;
1770                use std::option::Option::Some;
1771                let mut fields = std::collections::HashSet::new();
1772                let mut result = Self::Value::new();
1773                while let Some(tag) = map.next_key::<__FieldTag>()? {
1774                    #[allow(clippy::match_single_binding)]
1775                    match tag {
1776                        __FieldTag::__name => {
1777                            if !fields.insert(__FieldTag::__name) {
1778                                return std::result::Result::Err(A::Error::duplicate_field(
1779                                    "multiple values for name",
1780                                ));
1781                            }
1782                            result.name = map
1783                                .next_value::<std::option::Option<std::string::String>>()?
1784                                .unwrap_or_default();
1785                        }
1786                        __FieldTag::__field => {
1787                            if !fields.insert(__FieldTag::__field) {
1788                                return std::result::Result::Err(A::Error::duplicate_field(
1789                                    "multiple values for field",
1790                                ));
1791                            }
1792                            result.field = map.next_value::<std::option::Option<std::vec::Vec<crate::FieldDescriptorProto>>>()?.unwrap_or_default();
1793                        }
1794                        __FieldTag::__extension => {
1795                            if !fields.insert(__FieldTag::__extension) {
1796                                return std::result::Result::Err(A::Error::duplicate_field(
1797                                    "multiple values for extension",
1798                                ));
1799                            }
1800                            result.extension = map.next_value::<std::option::Option<std::vec::Vec<crate::FieldDescriptorProto>>>()?.unwrap_or_default();
1801                        }
1802                        __FieldTag::__nested_type => {
1803                            if !fields.insert(__FieldTag::__nested_type) {
1804                                return std::result::Result::Err(A::Error::duplicate_field(
1805                                    "multiple values for nested_type",
1806                                ));
1807                            }
1808                            result.nested_type = map.next_value::<std::option::Option<std::vec::Vec<crate::DescriptorProto>>>()?.unwrap_or_default();
1809                        }
1810                        __FieldTag::__enum_type => {
1811                            if !fields.insert(__FieldTag::__enum_type) {
1812                                return std::result::Result::Err(A::Error::duplicate_field(
1813                                    "multiple values for enum_type",
1814                                ));
1815                            }
1816                            result.enum_type = map.next_value::<std::option::Option<std::vec::Vec<crate::EnumDescriptorProto>>>()?.unwrap_or_default();
1817                        }
1818                        __FieldTag::__extension_range => {
1819                            if !fields.insert(__FieldTag::__extension_range) {
1820                                return std::result::Result::Err(A::Error::duplicate_field(
1821                                    "multiple values for extension_range",
1822                                ));
1823                            }
1824                            result.extension_range = map
1825                                .next_value::<std::option::Option<
1826                                    std::vec::Vec<crate::descriptor_proto::ExtensionRange>,
1827                                >>()?
1828                                .unwrap_or_default();
1829                        }
1830                        __FieldTag::__oneof_decl => {
1831                            if !fields.insert(__FieldTag::__oneof_decl) {
1832                                return std::result::Result::Err(A::Error::duplicate_field(
1833                                    "multiple values for oneof_decl",
1834                                ));
1835                            }
1836                            result.oneof_decl = map.next_value::<std::option::Option<std::vec::Vec<crate::OneofDescriptorProto>>>()?.unwrap_or_default();
1837                        }
1838                        __FieldTag::__options => {
1839                            if !fields.insert(__FieldTag::__options) {
1840                                return std::result::Result::Err(A::Error::duplicate_field(
1841                                    "multiple values for options",
1842                                ));
1843                            }
1844                            result.options =
1845                                map.next_value::<std::option::Option<crate::MessageOptions>>()?;
1846                        }
1847                        __FieldTag::__reserved_range => {
1848                            if !fields.insert(__FieldTag::__reserved_range) {
1849                                return std::result::Result::Err(A::Error::duplicate_field(
1850                                    "multiple values for reserved_range",
1851                                ));
1852                            }
1853                            result.reserved_range = map
1854                                .next_value::<std::option::Option<
1855                                    std::vec::Vec<crate::descriptor_proto::ReservedRange>,
1856                                >>()?
1857                                .unwrap_or_default();
1858                        }
1859                        __FieldTag::__reserved_name => {
1860                            if !fields.insert(__FieldTag::__reserved_name) {
1861                                return std::result::Result::Err(A::Error::duplicate_field(
1862                                    "multiple values for reserved_name",
1863                                ));
1864                            }
1865                            result.reserved_name = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
1866                        }
1867                        __FieldTag::Unknown(key) => {
1868                            let value = map.next_value::<serde_json::Value>()?;
1869                            result._unknown_fields.insert(key, value);
1870                        }
1871                    }
1872                }
1873                std::result::Result::Ok(result)
1874            }
1875        }
1876        deserializer.deserialize_any(Visitor)
1877    }
1878}
1879
1880#[doc(hidden)]
1881impl serde::ser::Serialize for DescriptorProto {
1882    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1883    where
1884        S: serde::ser::Serializer,
1885    {
1886        use serde::ser::SerializeMap;
1887        #[allow(unused_imports)]
1888        use std::option::Option::Some;
1889        let mut state = serializer.serialize_map(std::option::Option::None)?;
1890        if !self.name.is_empty() {
1891            state.serialize_entry("name", &self.name)?;
1892        }
1893        if !self.field.is_empty() {
1894            state.serialize_entry("field", &self.field)?;
1895        }
1896        if !self.extension.is_empty() {
1897            state.serialize_entry("extension", &self.extension)?;
1898        }
1899        if !self.nested_type.is_empty() {
1900            state.serialize_entry("nestedType", &self.nested_type)?;
1901        }
1902        if !self.enum_type.is_empty() {
1903            state.serialize_entry("enumType", &self.enum_type)?;
1904        }
1905        if !self.extension_range.is_empty() {
1906            state.serialize_entry("extensionRange", &self.extension_range)?;
1907        }
1908        if !self.oneof_decl.is_empty() {
1909            state.serialize_entry("oneofDecl", &self.oneof_decl)?;
1910        }
1911        if self.options.is_some() {
1912            state.serialize_entry("options", &self.options)?;
1913        }
1914        if !self.reserved_range.is_empty() {
1915            state.serialize_entry("reservedRange", &self.reserved_range)?;
1916        }
1917        if !self.reserved_name.is_empty() {
1918            state.serialize_entry("reservedName", &self.reserved_name)?;
1919        }
1920        if !self._unknown_fields.is_empty() {
1921            for (key, value) in self._unknown_fields.iter() {
1922                state.serialize_entry(key, &value)?;
1923            }
1924        }
1925        state.end()
1926    }
1927}
1928
1929/// Defines additional types related to [DescriptorProto].
1930pub mod descriptor_proto {
1931    #[allow(unused_imports)]
1932    use super::*;
1933
1934    #[derive(Clone, Debug, Default, PartialEq)]
1935    #[non_exhaustive]
1936    pub struct ExtensionRange {
1937        pub start: i32,
1938
1939        pub end: i32,
1940
1941        pub options: std::option::Option<crate::ExtensionRangeOptions>,
1942
1943        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1944    }
1945
1946    impl ExtensionRange {
1947        pub fn new() -> Self {
1948            std::default::Default::default()
1949        }
1950
1951        /// Sets the value of [start][crate::descriptor_proto::ExtensionRange::start].
1952        pub fn set_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1953            self.start = v.into();
1954            self
1955        }
1956
1957        /// Sets the value of [end][crate::descriptor_proto::ExtensionRange::end].
1958        pub fn set_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1959            self.end = v.into();
1960            self
1961        }
1962
1963        /// Sets the value of [options][crate::descriptor_proto::ExtensionRange::options].
1964        pub fn set_options<T>(mut self, v: T) -> Self
1965        where
1966            T: std::convert::Into<crate::ExtensionRangeOptions>,
1967        {
1968            self.options = std::option::Option::Some(v.into());
1969            self
1970        }
1971
1972        /// Sets or clears the value of [options][crate::descriptor_proto::ExtensionRange::options].
1973        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1974        where
1975            T: std::convert::Into<crate::ExtensionRangeOptions>,
1976        {
1977            self.options = v.map(|x| x.into());
1978            self
1979        }
1980    }
1981
1982    impl wkt::message::Message for ExtensionRange {
1983        fn typename() -> &'static str {
1984            "type.googleapis.com/google.protobuf.DescriptorProto.ExtensionRange"
1985        }
1986    }
1987
1988    #[doc(hidden)]
1989    impl<'de> serde::de::Deserialize<'de> for ExtensionRange {
1990        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1991        where
1992            D: serde::Deserializer<'de>,
1993        {
1994            #[allow(non_camel_case_types)]
1995            #[doc(hidden)]
1996            #[derive(PartialEq, Eq, Hash)]
1997            enum __FieldTag {
1998                __start,
1999                __end,
2000                __options,
2001                Unknown(std::string::String),
2002            }
2003            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2004                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2005                where
2006                    D: serde::Deserializer<'de>,
2007                {
2008                    struct Visitor;
2009                    impl<'de> serde::de::Visitor<'de> for Visitor {
2010                        type Value = __FieldTag;
2011                        fn expecting(
2012                            &self,
2013                            formatter: &mut std::fmt::Formatter,
2014                        ) -> std::fmt::Result {
2015                            formatter.write_str("a field name for ExtensionRange")
2016                        }
2017                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2018                        where
2019                            E: serde::de::Error,
2020                        {
2021                            use std::result::Result::Ok;
2022                            use std::string::ToString;
2023                            match value {
2024                                "start" => Ok(__FieldTag::__start),
2025                                "end" => Ok(__FieldTag::__end),
2026                                "options" => Ok(__FieldTag::__options),
2027                                _ => Ok(__FieldTag::Unknown(value.to_string())),
2028                            }
2029                        }
2030                    }
2031                    deserializer.deserialize_identifier(Visitor)
2032                }
2033            }
2034            struct Visitor;
2035            impl<'de> serde::de::Visitor<'de> for Visitor {
2036                type Value = ExtensionRange;
2037                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2038                    formatter.write_str("struct ExtensionRange")
2039                }
2040                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2041                where
2042                    A: serde::de::MapAccess<'de>,
2043                {
2044                    #[allow(unused_imports)]
2045                    use serde::de::Error;
2046                    use std::option::Option::Some;
2047                    let mut fields = std::collections::HashSet::new();
2048                    let mut result = Self::Value::new();
2049                    while let Some(tag) = map.next_key::<__FieldTag>()? {
2050                        #[allow(clippy::match_single_binding)]
2051                        match tag {
2052                            __FieldTag::__start => {
2053                                if !fields.insert(__FieldTag::__start) {
2054                                    return std::result::Result::Err(A::Error::duplicate_field(
2055                                        "multiple values for start",
2056                                    ));
2057                                }
2058                                struct __With(std::option::Option<i32>);
2059                                impl<'de> serde::de::Deserialize<'de> for __With {
2060                                    fn deserialize<D>(
2061                                        deserializer: D,
2062                                    ) -> std::result::Result<Self, D::Error>
2063                                    where
2064                                        D: serde::de::Deserializer<'de>,
2065                                    {
2066                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2067                                    }
2068                                }
2069                                result.start = map.next_value::<__With>()?.0.unwrap_or_default();
2070                            }
2071                            __FieldTag::__end => {
2072                                if !fields.insert(__FieldTag::__end) {
2073                                    return std::result::Result::Err(A::Error::duplicate_field(
2074                                        "multiple values for end",
2075                                    ));
2076                                }
2077                                struct __With(std::option::Option<i32>);
2078                                impl<'de> serde::de::Deserialize<'de> for __With {
2079                                    fn deserialize<D>(
2080                                        deserializer: D,
2081                                    ) -> std::result::Result<Self, D::Error>
2082                                    where
2083                                        D: serde::de::Deserializer<'de>,
2084                                    {
2085                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2086                                    }
2087                                }
2088                                result.end = map.next_value::<__With>()?.0.unwrap_or_default();
2089                            }
2090                            __FieldTag::__options => {
2091                                if !fields.insert(__FieldTag::__options) {
2092                                    return std::result::Result::Err(A::Error::duplicate_field(
2093                                        "multiple values for options",
2094                                    ));
2095                                }
2096                                result.options = map.next_value::<std::option::Option<crate::ExtensionRangeOptions>>()?
2097                                    ;
2098                            }
2099                            __FieldTag::Unknown(key) => {
2100                                let value = map.next_value::<serde_json::Value>()?;
2101                                result._unknown_fields.insert(key, value);
2102                            }
2103                        }
2104                    }
2105                    std::result::Result::Ok(result)
2106                }
2107            }
2108            deserializer.deserialize_any(Visitor)
2109        }
2110    }
2111
2112    #[doc(hidden)]
2113    impl serde::ser::Serialize for ExtensionRange {
2114        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2115        where
2116            S: serde::ser::Serializer,
2117        {
2118            use serde::ser::SerializeMap;
2119            #[allow(unused_imports)]
2120            use std::option::Option::Some;
2121            let mut state = serializer.serialize_map(std::option::Option::None)?;
2122            if !wkt::internal::is_default(&self.start) {
2123                struct __With<'a>(&'a i32);
2124                impl<'a> serde::ser::Serialize for __With<'a> {
2125                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2126                    where
2127                        S: serde::ser::Serializer,
2128                    {
2129                        serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2130                    }
2131                }
2132                state.serialize_entry("start", &__With(&self.start))?;
2133            }
2134            if !wkt::internal::is_default(&self.end) {
2135                struct __With<'a>(&'a i32);
2136                impl<'a> serde::ser::Serialize for __With<'a> {
2137                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2138                    where
2139                        S: serde::ser::Serializer,
2140                    {
2141                        serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2142                    }
2143                }
2144                state.serialize_entry("end", &__With(&self.end))?;
2145            }
2146            if self.options.is_some() {
2147                state.serialize_entry("options", &self.options)?;
2148            }
2149            if !self._unknown_fields.is_empty() {
2150                for (key, value) in self._unknown_fields.iter() {
2151                    state.serialize_entry(key, &value)?;
2152                }
2153            }
2154            state.end()
2155        }
2156    }
2157
2158    /// Range of reserved tag numbers. Reserved tag numbers may not be used by
2159    /// fields or extension ranges in the same message. Reserved ranges may
2160    /// not overlap.
2161    #[derive(Clone, Debug, Default, PartialEq)]
2162    #[non_exhaustive]
2163    pub struct ReservedRange {
2164        pub start: i32,
2165
2166        pub end: i32,
2167
2168        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2169    }
2170
2171    impl ReservedRange {
2172        pub fn new() -> Self {
2173            std::default::Default::default()
2174        }
2175
2176        /// Sets the value of [start][crate::descriptor_proto::ReservedRange::start].
2177        pub fn set_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2178            self.start = v.into();
2179            self
2180        }
2181
2182        /// Sets the value of [end][crate::descriptor_proto::ReservedRange::end].
2183        pub fn set_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2184            self.end = v.into();
2185            self
2186        }
2187    }
2188
2189    impl wkt::message::Message for ReservedRange {
2190        fn typename() -> &'static str {
2191            "type.googleapis.com/google.protobuf.DescriptorProto.ReservedRange"
2192        }
2193    }
2194
2195    #[doc(hidden)]
2196    impl<'de> serde::de::Deserialize<'de> for ReservedRange {
2197        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2198        where
2199            D: serde::Deserializer<'de>,
2200        {
2201            #[allow(non_camel_case_types)]
2202            #[doc(hidden)]
2203            #[derive(PartialEq, Eq, Hash)]
2204            enum __FieldTag {
2205                __start,
2206                __end,
2207                Unknown(std::string::String),
2208            }
2209            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2210                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2211                where
2212                    D: serde::Deserializer<'de>,
2213                {
2214                    struct Visitor;
2215                    impl<'de> serde::de::Visitor<'de> for Visitor {
2216                        type Value = __FieldTag;
2217                        fn expecting(
2218                            &self,
2219                            formatter: &mut std::fmt::Formatter,
2220                        ) -> std::fmt::Result {
2221                            formatter.write_str("a field name for ReservedRange")
2222                        }
2223                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2224                        where
2225                            E: serde::de::Error,
2226                        {
2227                            use std::result::Result::Ok;
2228                            use std::string::ToString;
2229                            match value {
2230                                "start" => Ok(__FieldTag::__start),
2231                                "end" => Ok(__FieldTag::__end),
2232                                _ => Ok(__FieldTag::Unknown(value.to_string())),
2233                            }
2234                        }
2235                    }
2236                    deserializer.deserialize_identifier(Visitor)
2237                }
2238            }
2239            struct Visitor;
2240            impl<'de> serde::de::Visitor<'de> for Visitor {
2241                type Value = ReservedRange;
2242                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2243                    formatter.write_str("struct ReservedRange")
2244                }
2245                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2246                where
2247                    A: serde::de::MapAccess<'de>,
2248                {
2249                    #[allow(unused_imports)]
2250                    use serde::de::Error;
2251                    use std::option::Option::Some;
2252                    let mut fields = std::collections::HashSet::new();
2253                    let mut result = Self::Value::new();
2254                    while let Some(tag) = map.next_key::<__FieldTag>()? {
2255                        #[allow(clippy::match_single_binding)]
2256                        match tag {
2257                            __FieldTag::__start => {
2258                                if !fields.insert(__FieldTag::__start) {
2259                                    return std::result::Result::Err(A::Error::duplicate_field(
2260                                        "multiple values for start",
2261                                    ));
2262                                }
2263                                struct __With(std::option::Option<i32>);
2264                                impl<'de> serde::de::Deserialize<'de> for __With {
2265                                    fn deserialize<D>(
2266                                        deserializer: D,
2267                                    ) -> std::result::Result<Self, D::Error>
2268                                    where
2269                                        D: serde::de::Deserializer<'de>,
2270                                    {
2271                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2272                                    }
2273                                }
2274                                result.start = map.next_value::<__With>()?.0.unwrap_or_default();
2275                            }
2276                            __FieldTag::__end => {
2277                                if !fields.insert(__FieldTag::__end) {
2278                                    return std::result::Result::Err(A::Error::duplicate_field(
2279                                        "multiple values for end",
2280                                    ));
2281                                }
2282                                struct __With(std::option::Option<i32>);
2283                                impl<'de> serde::de::Deserialize<'de> for __With {
2284                                    fn deserialize<D>(
2285                                        deserializer: D,
2286                                    ) -> std::result::Result<Self, D::Error>
2287                                    where
2288                                        D: serde::de::Deserializer<'de>,
2289                                    {
2290                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2291                                    }
2292                                }
2293                                result.end = map.next_value::<__With>()?.0.unwrap_or_default();
2294                            }
2295                            __FieldTag::Unknown(key) => {
2296                                let value = map.next_value::<serde_json::Value>()?;
2297                                result._unknown_fields.insert(key, value);
2298                            }
2299                        }
2300                    }
2301                    std::result::Result::Ok(result)
2302                }
2303            }
2304            deserializer.deserialize_any(Visitor)
2305        }
2306    }
2307
2308    #[doc(hidden)]
2309    impl serde::ser::Serialize for ReservedRange {
2310        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2311        where
2312            S: serde::ser::Serializer,
2313        {
2314            use serde::ser::SerializeMap;
2315            #[allow(unused_imports)]
2316            use std::option::Option::Some;
2317            let mut state = serializer.serialize_map(std::option::Option::None)?;
2318            if !wkt::internal::is_default(&self.start) {
2319                struct __With<'a>(&'a i32);
2320                impl<'a> serde::ser::Serialize for __With<'a> {
2321                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2322                    where
2323                        S: serde::ser::Serializer,
2324                    {
2325                        serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2326                    }
2327                }
2328                state.serialize_entry("start", &__With(&self.start))?;
2329            }
2330            if !wkt::internal::is_default(&self.end) {
2331                struct __With<'a>(&'a i32);
2332                impl<'a> serde::ser::Serialize for __With<'a> {
2333                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2334                    where
2335                        S: serde::ser::Serializer,
2336                    {
2337                        serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2338                    }
2339                }
2340                state.serialize_entry("end", &__With(&self.end))?;
2341            }
2342            if !self._unknown_fields.is_empty() {
2343                for (key, value) in self._unknown_fields.iter() {
2344                    state.serialize_entry(key, &value)?;
2345                }
2346            }
2347            state.end()
2348        }
2349    }
2350}
2351
2352#[derive(Clone, Debug, Default, PartialEq)]
2353#[non_exhaustive]
2354pub struct ExtensionRangeOptions {
2355    /// The parser stores options it doesn't recognize here. See above.
2356    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
2357
2358    /// For external users: DO NOT USE. We are in the process of open sourcing
2359    /// extension declaration and executing internal cleanups before it can be
2360    /// used externally.
2361    pub declaration: std::vec::Vec<crate::extension_range_options::Declaration>,
2362
2363    /// Any features defined in the specific edition.
2364    pub features: std::option::Option<crate::FeatureSet>,
2365
2366    /// The verification state of the range.
2367    /// TODO: flip the default to DECLARATION once all empty ranges
2368    /// are marked as UNVERIFIED.
2369    pub verification: crate::extension_range_options::VerificationState,
2370
2371    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2372}
2373
2374impl ExtensionRangeOptions {
2375    pub fn new() -> Self {
2376        std::default::Default::default()
2377    }
2378
2379    /// Sets the value of [uninterpreted_option][crate::ExtensionRangeOptions::uninterpreted_option].
2380    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
2381    where
2382        T: std::iter::IntoIterator<Item = V>,
2383        V: std::convert::Into<crate::UninterpretedOption>,
2384    {
2385        use std::iter::Iterator;
2386        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
2387        self
2388    }
2389
2390    /// Sets the value of [declaration][crate::ExtensionRangeOptions::declaration].
2391    pub fn set_declaration<T, V>(mut self, v: T) -> Self
2392    where
2393        T: std::iter::IntoIterator<Item = V>,
2394        V: std::convert::Into<crate::extension_range_options::Declaration>,
2395    {
2396        use std::iter::Iterator;
2397        self.declaration = v.into_iter().map(|i| i.into()).collect();
2398        self
2399    }
2400
2401    /// Sets the value of [features][crate::ExtensionRangeOptions::features].
2402    pub fn set_features<T>(mut self, v: T) -> Self
2403    where
2404        T: std::convert::Into<crate::FeatureSet>,
2405    {
2406        self.features = std::option::Option::Some(v.into());
2407        self
2408    }
2409
2410    /// Sets or clears the value of [features][crate::ExtensionRangeOptions::features].
2411    pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
2412    where
2413        T: std::convert::Into<crate::FeatureSet>,
2414    {
2415        self.features = v.map(|x| x.into());
2416        self
2417    }
2418
2419    /// Sets the value of [verification][crate::ExtensionRangeOptions::verification].
2420    pub fn set_verification<
2421        T: std::convert::Into<crate::extension_range_options::VerificationState>,
2422    >(
2423        mut self,
2424        v: T,
2425    ) -> Self {
2426        self.verification = v.into();
2427        self
2428    }
2429}
2430
2431impl wkt::message::Message for ExtensionRangeOptions {
2432    fn typename() -> &'static str {
2433        "type.googleapis.com/google.protobuf.ExtensionRangeOptions"
2434    }
2435}
2436
2437#[doc(hidden)]
2438impl<'de> serde::de::Deserialize<'de> for ExtensionRangeOptions {
2439    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2440    where
2441        D: serde::Deserializer<'de>,
2442    {
2443        #[allow(non_camel_case_types)]
2444        #[doc(hidden)]
2445        #[derive(PartialEq, Eq, Hash)]
2446        enum __FieldTag {
2447            __uninterpreted_option,
2448            __declaration,
2449            __features,
2450            __verification,
2451            Unknown(std::string::String),
2452        }
2453        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2454            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2455            where
2456                D: serde::Deserializer<'de>,
2457            {
2458                struct Visitor;
2459                impl<'de> serde::de::Visitor<'de> for Visitor {
2460                    type Value = __FieldTag;
2461                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2462                        formatter.write_str("a field name for ExtensionRangeOptions")
2463                    }
2464                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2465                    where
2466                        E: serde::de::Error,
2467                    {
2468                        use std::result::Result::Ok;
2469                        use std::string::ToString;
2470                        match value {
2471                            "uninterpretedOption" => Ok(__FieldTag::__uninterpreted_option),
2472                            "uninterpreted_option" => Ok(__FieldTag::__uninterpreted_option),
2473                            "declaration" => Ok(__FieldTag::__declaration),
2474                            "features" => Ok(__FieldTag::__features),
2475                            "verification" => Ok(__FieldTag::__verification),
2476                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2477                        }
2478                    }
2479                }
2480                deserializer.deserialize_identifier(Visitor)
2481            }
2482        }
2483        struct Visitor;
2484        impl<'de> serde::de::Visitor<'de> for Visitor {
2485            type Value = ExtensionRangeOptions;
2486            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2487                formatter.write_str("struct ExtensionRangeOptions")
2488            }
2489            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2490            where
2491                A: serde::de::MapAccess<'de>,
2492            {
2493                #[allow(unused_imports)]
2494                use serde::de::Error;
2495                use std::option::Option::Some;
2496                let mut fields = std::collections::HashSet::new();
2497                let mut result = Self::Value::new();
2498                while let Some(tag) = map.next_key::<__FieldTag>()? {
2499                    #[allow(clippy::match_single_binding)]
2500                    match tag {
2501                        __FieldTag::__uninterpreted_option => {
2502                            if !fields.insert(__FieldTag::__uninterpreted_option) {
2503                                return std::result::Result::Err(A::Error::duplicate_field(
2504                                    "multiple values for uninterpreted_option",
2505                                ));
2506                            }
2507                            result.uninterpreted_option = map.next_value::<std::option::Option<std::vec::Vec<crate::UninterpretedOption>>>()?.unwrap_or_default();
2508                        }
2509                        __FieldTag::__declaration => {
2510                            if !fields.insert(__FieldTag::__declaration) {
2511                                return std::result::Result::Err(A::Error::duplicate_field(
2512                                    "multiple values for declaration",
2513                                ));
2514                            }
2515                            result.declaration = map
2516                                .next_value::<std::option::Option<
2517                                    std::vec::Vec<crate::extension_range_options::Declaration>,
2518                                >>()?
2519                                .unwrap_or_default();
2520                        }
2521                        __FieldTag::__features => {
2522                            if !fields.insert(__FieldTag::__features) {
2523                                return std::result::Result::Err(A::Error::duplicate_field(
2524                                    "multiple values for features",
2525                                ));
2526                            }
2527                            result.features =
2528                                map.next_value::<std::option::Option<crate::FeatureSet>>()?;
2529                        }
2530                        __FieldTag::__verification => {
2531                            if !fields.insert(__FieldTag::__verification) {
2532                                return std::result::Result::Err(A::Error::duplicate_field(
2533                                    "multiple values for verification",
2534                                ));
2535                            }
2536                            result.verification = map
2537                                .next_value::<std::option::Option<
2538                                    crate::extension_range_options::VerificationState,
2539                                >>()?
2540                                .unwrap_or_default();
2541                        }
2542                        __FieldTag::Unknown(key) => {
2543                            let value = map.next_value::<serde_json::Value>()?;
2544                            result._unknown_fields.insert(key, value);
2545                        }
2546                    }
2547                }
2548                std::result::Result::Ok(result)
2549            }
2550        }
2551        deserializer.deserialize_any(Visitor)
2552    }
2553}
2554
2555#[doc(hidden)]
2556impl serde::ser::Serialize for ExtensionRangeOptions {
2557    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2558    where
2559        S: serde::ser::Serializer,
2560    {
2561        use serde::ser::SerializeMap;
2562        #[allow(unused_imports)]
2563        use std::option::Option::Some;
2564        let mut state = serializer.serialize_map(std::option::Option::None)?;
2565        if !self.uninterpreted_option.is_empty() {
2566            state.serialize_entry("uninterpretedOption", &self.uninterpreted_option)?;
2567        }
2568        if !self.declaration.is_empty() {
2569            state.serialize_entry("declaration", &self.declaration)?;
2570        }
2571        if self.features.is_some() {
2572            state.serialize_entry("features", &self.features)?;
2573        }
2574        if !wkt::internal::is_default(&self.verification) {
2575            state.serialize_entry("verification", &self.verification)?;
2576        }
2577        if !self._unknown_fields.is_empty() {
2578            for (key, value) in self._unknown_fields.iter() {
2579                state.serialize_entry(key, &value)?;
2580            }
2581        }
2582        state.end()
2583    }
2584}
2585
2586/// Defines additional types related to [ExtensionRangeOptions].
2587pub mod extension_range_options {
2588    #[allow(unused_imports)]
2589    use super::*;
2590
2591    #[derive(Clone, Debug, Default, PartialEq)]
2592    #[non_exhaustive]
2593    pub struct Declaration {
2594        /// The extension number declared within the extension range.
2595        pub number: i32,
2596
2597        /// The fully-qualified name of the extension field. There must be a leading
2598        /// dot in front of the full name.
2599        pub full_name: std::string::String,
2600
2601        /// The fully-qualified type name of the extension field. Unlike
2602        /// Metadata.type, Declaration.type must have a leading dot for messages
2603        /// and enums.
2604        pub r#type: std::string::String,
2605
2606        /// If true, indicates that the number is reserved in the extension range,
2607        /// and any extension field with the number will fail to compile. Set this
2608        /// when a declared extension field is deleted.
2609        pub reserved: bool,
2610
2611        /// If true, indicates that the extension must be defined as repeated.
2612        /// Otherwise the extension must be defined as optional.
2613        pub repeated: bool,
2614
2615        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2616    }
2617
2618    impl Declaration {
2619        pub fn new() -> Self {
2620            std::default::Default::default()
2621        }
2622
2623        /// Sets the value of [number][crate::extension_range_options::Declaration::number].
2624        pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2625            self.number = v.into();
2626            self
2627        }
2628
2629        /// Sets the value of [full_name][crate::extension_range_options::Declaration::full_name].
2630        pub fn set_full_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2631            self.full_name = v.into();
2632            self
2633        }
2634
2635        /// Sets the value of [r#type][crate::extension_range_options::Declaration::type].
2636        pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2637            self.r#type = v.into();
2638            self
2639        }
2640
2641        /// Sets the value of [reserved][crate::extension_range_options::Declaration::reserved].
2642        pub fn set_reserved<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2643            self.reserved = v.into();
2644            self
2645        }
2646
2647        /// Sets the value of [repeated][crate::extension_range_options::Declaration::repeated].
2648        pub fn set_repeated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2649            self.repeated = v.into();
2650            self
2651        }
2652    }
2653
2654    impl wkt::message::Message for Declaration {
2655        fn typename() -> &'static str {
2656            "type.googleapis.com/google.protobuf.ExtensionRangeOptions.Declaration"
2657        }
2658    }
2659
2660    #[doc(hidden)]
2661    impl<'de> serde::de::Deserialize<'de> for Declaration {
2662        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2663        where
2664            D: serde::Deserializer<'de>,
2665        {
2666            #[allow(non_camel_case_types)]
2667            #[doc(hidden)]
2668            #[derive(PartialEq, Eq, Hash)]
2669            enum __FieldTag {
2670                __number,
2671                __full_name,
2672                __type,
2673                __reserved,
2674                __repeated,
2675                Unknown(std::string::String),
2676            }
2677            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2678                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2679                where
2680                    D: serde::Deserializer<'de>,
2681                {
2682                    struct Visitor;
2683                    impl<'de> serde::de::Visitor<'de> for Visitor {
2684                        type Value = __FieldTag;
2685                        fn expecting(
2686                            &self,
2687                            formatter: &mut std::fmt::Formatter,
2688                        ) -> std::fmt::Result {
2689                            formatter.write_str("a field name for Declaration")
2690                        }
2691                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2692                        where
2693                            E: serde::de::Error,
2694                        {
2695                            use std::result::Result::Ok;
2696                            use std::string::ToString;
2697                            match value {
2698                                "number" => Ok(__FieldTag::__number),
2699                                "fullName" => Ok(__FieldTag::__full_name),
2700                                "full_name" => Ok(__FieldTag::__full_name),
2701                                "type" => Ok(__FieldTag::__type),
2702                                "reserved" => Ok(__FieldTag::__reserved),
2703                                "repeated" => Ok(__FieldTag::__repeated),
2704                                _ => Ok(__FieldTag::Unknown(value.to_string())),
2705                            }
2706                        }
2707                    }
2708                    deserializer.deserialize_identifier(Visitor)
2709                }
2710            }
2711            struct Visitor;
2712            impl<'de> serde::de::Visitor<'de> for Visitor {
2713                type Value = Declaration;
2714                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2715                    formatter.write_str("struct Declaration")
2716                }
2717                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2718                where
2719                    A: serde::de::MapAccess<'de>,
2720                {
2721                    #[allow(unused_imports)]
2722                    use serde::de::Error;
2723                    use std::option::Option::Some;
2724                    let mut fields = std::collections::HashSet::new();
2725                    let mut result = Self::Value::new();
2726                    while let Some(tag) = map.next_key::<__FieldTag>()? {
2727                        #[allow(clippy::match_single_binding)]
2728                        match tag {
2729                            __FieldTag::__number => {
2730                                if !fields.insert(__FieldTag::__number) {
2731                                    return std::result::Result::Err(A::Error::duplicate_field(
2732                                        "multiple values for number",
2733                                    ));
2734                                }
2735                                struct __With(std::option::Option<i32>);
2736                                impl<'de> serde::de::Deserialize<'de> for __With {
2737                                    fn deserialize<D>(
2738                                        deserializer: D,
2739                                    ) -> std::result::Result<Self, D::Error>
2740                                    where
2741                                        D: serde::de::Deserializer<'de>,
2742                                    {
2743                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2744                                    }
2745                                }
2746                                result.number = map.next_value::<__With>()?.0.unwrap_or_default();
2747                            }
2748                            __FieldTag::__full_name => {
2749                                if !fields.insert(__FieldTag::__full_name) {
2750                                    return std::result::Result::Err(A::Error::duplicate_field(
2751                                        "multiple values for full_name",
2752                                    ));
2753                                }
2754                                result.full_name = map
2755                                    .next_value::<std::option::Option<std::string::String>>()?
2756                                    .unwrap_or_default();
2757                            }
2758                            __FieldTag::__type => {
2759                                if !fields.insert(__FieldTag::__type) {
2760                                    return std::result::Result::Err(A::Error::duplicate_field(
2761                                        "multiple values for type",
2762                                    ));
2763                                }
2764                                result.r#type = map
2765                                    .next_value::<std::option::Option<std::string::String>>()?
2766                                    .unwrap_or_default();
2767                            }
2768                            __FieldTag::__reserved => {
2769                                if !fields.insert(__FieldTag::__reserved) {
2770                                    return std::result::Result::Err(A::Error::duplicate_field(
2771                                        "multiple values for reserved",
2772                                    ));
2773                                }
2774                                result.reserved = map
2775                                    .next_value::<std::option::Option<bool>>()?
2776                                    .unwrap_or_default();
2777                            }
2778                            __FieldTag::__repeated => {
2779                                if !fields.insert(__FieldTag::__repeated) {
2780                                    return std::result::Result::Err(A::Error::duplicate_field(
2781                                        "multiple values for repeated",
2782                                    ));
2783                                }
2784                                result.repeated = map
2785                                    .next_value::<std::option::Option<bool>>()?
2786                                    .unwrap_or_default();
2787                            }
2788                            __FieldTag::Unknown(key) => {
2789                                let value = map.next_value::<serde_json::Value>()?;
2790                                result._unknown_fields.insert(key, value);
2791                            }
2792                        }
2793                    }
2794                    std::result::Result::Ok(result)
2795                }
2796            }
2797            deserializer.deserialize_any(Visitor)
2798        }
2799    }
2800
2801    #[doc(hidden)]
2802    impl serde::ser::Serialize for Declaration {
2803        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2804        where
2805            S: serde::ser::Serializer,
2806        {
2807            use serde::ser::SerializeMap;
2808            #[allow(unused_imports)]
2809            use std::option::Option::Some;
2810            let mut state = serializer.serialize_map(std::option::Option::None)?;
2811            if !wkt::internal::is_default(&self.number) {
2812                struct __With<'a>(&'a i32);
2813                impl<'a> serde::ser::Serialize for __With<'a> {
2814                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2815                    where
2816                        S: serde::ser::Serializer,
2817                    {
2818                        serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2819                    }
2820                }
2821                state.serialize_entry("number", &__With(&self.number))?;
2822            }
2823            if !self.full_name.is_empty() {
2824                state.serialize_entry("fullName", &self.full_name)?;
2825            }
2826            if !self.r#type.is_empty() {
2827                state.serialize_entry("type", &self.r#type)?;
2828            }
2829            if !wkt::internal::is_default(&self.reserved) {
2830                state.serialize_entry("reserved", &self.reserved)?;
2831            }
2832            if !wkt::internal::is_default(&self.repeated) {
2833                state.serialize_entry("repeated", &self.repeated)?;
2834            }
2835            if !self._unknown_fields.is_empty() {
2836                for (key, value) in self._unknown_fields.iter() {
2837                    state.serialize_entry(key, &value)?;
2838                }
2839            }
2840            state.end()
2841        }
2842    }
2843
2844    /// The verification state of the extension range.
2845    ///
2846    /// # Working with unknown values
2847    ///
2848    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2849    /// additional enum variants at any time. Adding new variants is not considered
2850    /// a breaking change. Applications should write their code in anticipation of:
2851    ///
2852    /// - New values appearing in future releases of the client library, **and**
2853    /// - New values received dynamically, without application changes.
2854    ///
2855    /// Please consult the [Working with enums] section in the user guide for some
2856    /// guidelines.
2857    ///
2858    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2859    #[derive(Clone, Debug, PartialEq)]
2860    #[non_exhaustive]
2861    pub enum VerificationState {
2862        /// All the extensions of the range must be declared.
2863        Declaration,
2864        Unverified,
2865        /// If set, the enum was initialized with an unknown value.
2866        ///
2867        /// Applications can examine the value using [VerificationState::value] or
2868        /// [VerificationState::name].
2869        UnknownValue(verification_state::UnknownValue),
2870    }
2871
2872    #[doc(hidden)]
2873    pub mod verification_state {
2874        #[allow(unused_imports)]
2875        use super::*;
2876        #[derive(Clone, Debug, PartialEq)]
2877        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2878    }
2879
2880    impl VerificationState {
2881        /// Gets the enum value.
2882        ///
2883        /// Returns `None` if the enum contains an unknown value deserialized from
2884        /// the string representation of enums.
2885        pub fn value(&self) -> std::option::Option<i32> {
2886            match self {
2887                Self::Declaration => std::option::Option::Some(0),
2888                Self::Unverified => std::option::Option::Some(1),
2889                Self::UnknownValue(u) => u.0.value(),
2890            }
2891        }
2892
2893        /// Gets the enum value as a string.
2894        ///
2895        /// Returns `None` if the enum contains an unknown value deserialized from
2896        /// the integer representation of enums.
2897        pub fn name(&self) -> std::option::Option<&str> {
2898            match self {
2899                Self::Declaration => std::option::Option::Some("DECLARATION"),
2900                Self::Unverified => std::option::Option::Some("UNVERIFIED"),
2901                Self::UnknownValue(u) => u.0.name(),
2902            }
2903        }
2904    }
2905
2906    impl std::default::Default for VerificationState {
2907        fn default() -> Self {
2908            use std::convert::From;
2909            Self::from(0)
2910        }
2911    }
2912
2913    impl std::fmt::Display for VerificationState {
2914        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2915            wkt::internal::display_enum(f, self.name(), self.value())
2916        }
2917    }
2918
2919    impl std::convert::From<i32> for VerificationState {
2920        fn from(value: i32) -> Self {
2921            match value {
2922                0 => Self::Declaration,
2923                1 => Self::Unverified,
2924                _ => Self::UnknownValue(verification_state::UnknownValue(
2925                    wkt::internal::UnknownEnumValue::Integer(value),
2926                )),
2927            }
2928        }
2929    }
2930
2931    impl std::convert::From<&str> for VerificationState {
2932        fn from(value: &str) -> Self {
2933            use std::string::ToString;
2934            match value {
2935                "DECLARATION" => Self::Declaration,
2936                "UNVERIFIED" => Self::Unverified,
2937                _ => Self::UnknownValue(verification_state::UnknownValue(
2938                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2939                )),
2940            }
2941        }
2942    }
2943
2944    impl serde::ser::Serialize for VerificationState {
2945        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2946        where
2947            S: serde::Serializer,
2948        {
2949            match self {
2950                Self::Declaration => serializer.serialize_i32(0),
2951                Self::Unverified => serializer.serialize_i32(1),
2952                Self::UnknownValue(u) => u.0.serialize(serializer),
2953            }
2954        }
2955    }
2956
2957    impl<'de> serde::de::Deserialize<'de> for VerificationState {
2958        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2959        where
2960            D: serde::Deserializer<'de>,
2961        {
2962            deserializer.deserialize_any(wkt::internal::EnumVisitor::<VerificationState>::new(
2963                ".google.protobuf.ExtensionRangeOptions.VerificationState",
2964            ))
2965        }
2966    }
2967}
2968
2969/// Describes a field within a message.
2970#[derive(Clone, Debug, Default, PartialEq)]
2971#[non_exhaustive]
2972pub struct FieldDescriptorProto {
2973    pub name: std::string::String,
2974
2975    pub number: i32,
2976
2977    pub label: crate::field_descriptor_proto::Label,
2978
2979    /// If type_name is set, this need not be set.  If both this and type_name
2980    /// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
2981    pub r#type: crate::field_descriptor_proto::Type,
2982
2983    /// For message and enum types, this is the name of the type.  If the name
2984    /// starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
2985    /// rules are used to find the type (i.e. first the nested types within this
2986    /// message are searched, then within the parent, on up to the root
2987    /// namespace).
2988    pub type_name: std::string::String,
2989
2990    /// For extensions, this is the name of the type being extended.  It is
2991    /// resolved in the same manner as type_name.
2992    pub extendee: std::string::String,
2993
2994    /// For numeric types, contains the original text representation of the value.
2995    /// For booleans, "true" or "false".
2996    /// For strings, contains the default text contents (not escaped in any way).
2997    /// For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
2998    pub default_value: std::string::String,
2999
3000    /// If set, gives the index of a oneof in the containing type's oneof_decl
3001    /// list.  This field is a member of that oneof.
3002    pub oneof_index: i32,
3003
3004    /// JSON name of this field. The value is set by protocol compiler. If the
3005    /// user has set a "json_name" option on this field, that option's value
3006    /// will be used. Otherwise, it's deduced from the field's name by converting
3007    /// it to camelCase.
3008    pub json_name: std::string::String,
3009
3010    pub options: std::option::Option<crate::FieldOptions>,
3011
3012    /// If true, this is a proto3 "optional". When a proto3 field is optional, it
3013    /// tracks presence regardless of field type.
3014    ///
3015    /// When proto3_optional is true, this field must belong to a oneof to signal
3016    /// to old proto3 clients that presence is tracked for this field. This oneof
3017    /// is known as a "synthetic" oneof, and this field must be its sole member
3018    /// (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs
3019    /// exist in the descriptor only, and do not generate any API. Synthetic oneofs
3020    /// must be ordered after all "real" oneofs.
3021    ///
3022    /// For message fields, proto3_optional doesn't create any semantic change,
3023    /// since non-repeated message fields always track presence. However it still
3024    /// indicates the semantic detail of whether the user wrote "optional" or not.
3025    /// This can be useful for round-tripping the .proto file. For consistency we
3026    /// give message fields a synthetic oneof also, even though it is not required
3027    /// to track presence. This is especially important because the parser can't
3028    /// tell if a field is a message or an enum, so it must always create a
3029    /// synthetic oneof.
3030    ///
3031    /// Proto2 optional fields do not set this flag, because they already indicate
3032    /// optional with `LABEL_OPTIONAL`.
3033    pub proto3_optional: bool,
3034
3035    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3036}
3037
3038impl FieldDescriptorProto {
3039    pub fn new() -> Self {
3040        std::default::Default::default()
3041    }
3042
3043    /// Sets the value of [name][crate::FieldDescriptorProto::name].
3044    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3045        self.name = v.into();
3046        self
3047    }
3048
3049    /// Sets the value of [number][crate::FieldDescriptorProto::number].
3050    pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3051        self.number = v.into();
3052        self
3053    }
3054
3055    /// Sets the value of [label][crate::FieldDescriptorProto::label].
3056    pub fn set_label<T: std::convert::Into<crate::field_descriptor_proto::Label>>(
3057        mut self,
3058        v: T,
3059    ) -> Self {
3060        self.label = v.into();
3061        self
3062    }
3063
3064    /// Sets the value of [r#type][crate::FieldDescriptorProto::type].
3065    pub fn set_type<T: std::convert::Into<crate::field_descriptor_proto::Type>>(
3066        mut self,
3067        v: T,
3068    ) -> Self {
3069        self.r#type = v.into();
3070        self
3071    }
3072
3073    /// Sets the value of [type_name][crate::FieldDescriptorProto::type_name].
3074    pub fn set_type_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3075        self.type_name = v.into();
3076        self
3077    }
3078
3079    /// Sets the value of [extendee][crate::FieldDescriptorProto::extendee].
3080    pub fn set_extendee<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3081        self.extendee = v.into();
3082        self
3083    }
3084
3085    /// Sets the value of [default_value][crate::FieldDescriptorProto::default_value].
3086    pub fn set_default_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3087        self.default_value = v.into();
3088        self
3089    }
3090
3091    /// Sets the value of [oneof_index][crate::FieldDescriptorProto::oneof_index].
3092    pub fn set_oneof_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3093        self.oneof_index = v.into();
3094        self
3095    }
3096
3097    /// Sets the value of [json_name][crate::FieldDescriptorProto::json_name].
3098    pub fn set_json_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3099        self.json_name = v.into();
3100        self
3101    }
3102
3103    /// Sets the value of [options][crate::FieldDescriptorProto::options].
3104    pub fn set_options<T>(mut self, v: T) -> Self
3105    where
3106        T: std::convert::Into<crate::FieldOptions>,
3107    {
3108        self.options = std::option::Option::Some(v.into());
3109        self
3110    }
3111
3112    /// Sets or clears the value of [options][crate::FieldDescriptorProto::options].
3113    pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3114    where
3115        T: std::convert::Into<crate::FieldOptions>,
3116    {
3117        self.options = v.map(|x| x.into());
3118        self
3119    }
3120
3121    /// Sets the value of [proto3_optional][crate::FieldDescriptorProto::proto3_optional].
3122    pub fn set_proto3_optional<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3123        self.proto3_optional = v.into();
3124        self
3125    }
3126}
3127
3128impl wkt::message::Message for FieldDescriptorProto {
3129    fn typename() -> &'static str {
3130        "type.googleapis.com/google.protobuf.FieldDescriptorProto"
3131    }
3132}
3133
3134#[doc(hidden)]
3135impl<'de> serde::de::Deserialize<'de> for FieldDescriptorProto {
3136    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3137    where
3138        D: serde::Deserializer<'de>,
3139    {
3140        #[allow(non_camel_case_types)]
3141        #[doc(hidden)]
3142        #[derive(PartialEq, Eq, Hash)]
3143        enum __FieldTag {
3144            __name,
3145            __number,
3146            __label,
3147            __type,
3148            __type_name,
3149            __extendee,
3150            __default_value,
3151            __oneof_index,
3152            __json_name,
3153            __options,
3154            __proto3_optional,
3155            Unknown(std::string::String),
3156        }
3157        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3158            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3159            where
3160                D: serde::Deserializer<'de>,
3161            {
3162                struct Visitor;
3163                impl<'de> serde::de::Visitor<'de> for Visitor {
3164                    type Value = __FieldTag;
3165                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3166                        formatter.write_str("a field name for FieldDescriptorProto")
3167                    }
3168                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3169                    where
3170                        E: serde::de::Error,
3171                    {
3172                        use std::result::Result::Ok;
3173                        use std::string::ToString;
3174                        match value {
3175                            "name" => Ok(__FieldTag::__name),
3176                            "number" => Ok(__FieldTag::__number),
3177                            "label" => Ok(__FieldTag::__label),
3178                            "type" => Ok(__FieldTag::__type),
3179                            "typeName" => Ok(__FieldTag::__type_name),
3180                            "type_name" => Ok(__FieldTag::__type_name),
3181                            "extendee" => Ok(__FieldTag::__extendee),
3182                            "defaultValue" => Ok(__FieldTag::__default_value),
3183                            "default_value" => Ok(__FieldTag::__default_value),
3184                            "oneofIndex" => Ok(__FieldTag::__oneof_index),
3185                            "oneof_index" => Ok(__FieldTag::__oneof_index),
3186                            "jsonName" => Ok(__FieldTag::__json_name),
3187                            "json_name" => Ok(__FieldTag::__json_name),
3188                            "options" => Ok(__FieldTag::__options),
3189                            "proto3Optional" => Ok(__FieldTag::__proto3_optional),
3190                            "proto3_optional" => Ok(__FieldTag::__proto3_optional),
3191                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3192                        }
3193                    }
3194                }
3195                deserializer.deserialize_identifier(Visitor)
3196            }
3197        }
3198        struct Visitor;
3199        impl<'de> serde::de::Visitor<'de> for Visitor {
3200            type Value = FieldDescriptorProto;
3201            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3202                formatter.write_str("struct FieldDescriptorProto")
3203            }
3204            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3205            where
3206                A: serde::de::MapAccess<'de>,
3207            {
3208                #[allow(unused_imports)]
3209                use serde::de::Error;
3210                use std::option::Option::Some;
3211                let mut fields = std::collections::HashSet::new();
3212                let mut result = Self::Value::new();
3213                while let Some(tag) = map.next_key::<__FieldTag>()? {
3214                    #[allow(clippy::match_single_binding)]
3215                    match tag {
3216                        __FieldTag::__name => {
3217                            if !fields.insert(__FieldTag::__name) {
3218                                return std::result::Result::Err(A::Error::duplicate_field(
3219                                    "multiple values for name",
3220                                ));
3221                            }
3222                            result.name = map
3223                                .next_value::<std::option::Option<std::string::String>>()?
3224                                .unwrap_or_default();
3225                        }
3226                        __FieldTag::__number => {
3227                            if !fields.insert(__FieldTag::__number) {
3228                                return std::result::Result::Err(A::Error::duplicate_field(
3229                                    "multiple values for number",
3230                                ));
3231                            }
3232                            struct __With(std::option::Option<i32>);
3233                            impl<'de> serde::de::Deserialize<'de> for __With {
3234                                fn deserialize<D>(
3235                                    deserializer: D,
3236                                ) -> std::result::Result<Self, D::Error>
3237                                where
3238                                    D: serde::de::Deserializer<'de>,
3239                                {
3240                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3241                                }
3242                            }
3243                            result.number = map.next_value::<__With>()?.0.unwrap_or_default();
3244                        }
3245                        __FieldTag::__label => {
3246                            if !fields.insert(__FieldTag::__label) {
3247                                return std::result::Result::Err(A::Error::duplicate_field(
3248                                    "multiple values for label",
3249                                ));
3250                            }
3251                            result.label = map.next_value::<std::option::Option<crate::field_descriptor_proto::Label>>()?.unwrap_or_default();
3252                        }
3253                        __FieldTag::__type => {
3254                            if !fields.insert(__FieldTag::__type) {
3255                                return std::result::Result::Err(A::Error::duplicate_field(
3256                                    "multiple values for type",
3257                                ));
3258                            }
3259                            result.r#type = map.next_value::<std::option::Option<crate::field_descriptor_proto::Type>>()?.unwrap_or_default();
3260                        }
3261                        __FieldTag::__type_name => {
3262                            if !fields.insert(__FieldTag::__type_name) {
3263                                return std::result::Result::Err(A::Error::duplicate_field(
3264                                    "multiple values for type_name",
3265                                ));
3266                            }
3267                            result.type_name = map
3268                                .next_value::<std::option::Option<std::string::String>>()?
3269                                .unwrap_or_default();
3270                        }
3271                        __FieldTag::__extendee => {
3272                            if !fields.insert(__FieldTag::__extendee) {
3273                                return std::result::Result::Err(A::Error::duplicate_field(
3274                                    "multiple values for extendee",
3275                                ));
3276                            }
3277                            result.extendee = map
3278                                .next_value::<std::option::Option<std::string::String>>()?
3279                                .unwrap_or_default();
3280                        }
3281                        __FieldTag::__default_value => {
3282                            if !fields.insert(__FieldTag::__default_value) {
3283                                return std::result::Result::Err(A::Error::duplicate_field(
3284                                    "multiple values for default_value",
3285                                ));
3286                            }
3287                            result.default_value = map
3288                                .next_value::<std::option::Option<std::string::String>>()?
3289                                .unwrap_or_default();
3290                        }
3291                        __FieldTag::__oneof_index => {
3292                            if !fields.insert(__FieldTag::__oneof_index) {
3293                                return std::result::Result::Err(A::Error::duplicate_field(
3294                                    "multiple values for oneof_index",
3295                                ));
3296                            }
3297                            struct __With(std::option::Option<i32>);
3298                            impl<'de> serde::de::Deserialize<'de> for __With {
3299                                fn deserialize<D>(
3300                                    deserializer: D,
3301                                ) -> std::result::Result<Self, D::Error>
3302                                where
3303                                    D: serde::de::Deserializer<'de>,
3304                                {
3305                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3306                                }
3307                            }
3308                            result.oneof_index = map.next_value::<__With>()?.0.unwrap_or_default();
3309                        }
3310                        __FieldTag::__json_name => {
3311                            if !fields.insert(__FieldTag::__json_name) {
3312                                return std::result::Result::Err(A::Error::duplicate_field(
3313                                    "multiple values for json_name",
3314                                ));
3315                            }
3316                            result.json_name = map
3317                                .next_value::<std::option::Option<std::string::String>>()?
3318                                .unwrap_or_default();
3319                        }
3320                        __FieldTag::__options => {
3321                            if !fields.insert(__FieldTag::__options) {
3322                                return std::result::Result::Err(A::Error::duplicate_field(
3323                                    "multiple values for options",
3324                                ));
3325                            }
3326                            result.options =
3327                                map.next_value::<std::option::Option<crate::FieldOptions>>()?;
3328                        }
3329                        __FieldTag::__proto3_optional => {
3330                            if !fields.insert(__FieldTag::__proto3_optional) {
3331                                return std::result::Result::Err(A::Error::duplicate_field(
3332                                    "multiple values for proto3_optional",
3333                                ));
3334                            }
3335                            result.proto3_optional = map
3336                                .next_value::<std::option::Option<bool>>()?
3337                                .unwrap_or_default();
3338                        }
3339                        __FieldTag::Unknown(key) => {
3340                            let value = map.next_value::<serde_json::Value>()?;
3341                            result._unknown_fields.insert(key, value);
3342                        }
3343                    }
3344                }
3345                std::result::Result::Ok(result)
3346            }
3347        }
3348        deserializer.deserialize_any(Visitor)
3349    }
3350}
3351
3352#[doc(hidden)]
3353impl serde::ser::Serialize for FieldDescriptorProto {
3354    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3355    where
3356        S: serde::ser::Serializer,
3357    {
3358        use serde::ser::SerializeMap;
3359        #[allow(unused_imports)]
3360        use std::option::Option::Some;
3361        let mut state = serializer.serialize_map(std::option::Option::None)?;
3362        if !self.name.is_empty() {
3363            state.serialize_entry("name", &self.name)?;
3364        }
3365        if !wkt::internal::is_default(&self.number) {
3366            struct __With<'a>(&'a i32);
3367            impl<'a> serde::ser::Serialize for __With<'a> {
3368                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3369                where
3370                    S: serde::ser::Serializer,
3371                {
3372                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3373                }
3374            }
3375            state.serialize_entry("number", &__With(&self.number))?;
3376        }
3377        if !wkt::internal::is_default(&self.label) {
3378            state.serialize_entry("label", &self.label)?;
3379        }
3380        if !wkt::internal::is_default(&self.r#type) {
3381            state.serialize_entry("type", &self.r#type)?;
3382        }
3383        if !self.type_name.is_empty() {
3384            state.serialize_entry("typeName", &self.type_name)?;
3385        }
3386        if !self.extendee.is_empty() {
3387            state.serialize_entry("extendee", &self.extendee)?;
3388        }
3389        if !self.default_value.is_empty() {
3390            state.serialize_entry("defaultValue", &self.default_value)?;
3391        }
3392        if !wkt::internal::is_default(&self.oneof_index) {
3393            struct __With<'a>(&'a i32);
3394            impl<'a> serde::ser::Serialize for __With<'a> {
3395                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3396                where
3397                    S: serde::ser::Serializer,
3398                {
3399                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3400                }
3401            }
3402            state.serialize_entry("oneofIndex", &__With(&self.oneof_index))?;
3403        }
3404        if !self.json_name.is_empty() {
3405            state.serialize_entry("jsonName", &self.json_name)?;
3406        }
3407        if self.options.is_some() {
3408            state.serialize_entry("options", &self.options)?;
3409        }
3410        if !wkt::internal::is_default(&self.proto3_optional) {
3411            state.serialize_entry("proto3Optional", &self.proto3_optional)?;
3412        }
3413        if !self._unknown_fields.is_empty() {
3414            for (key, value) in self._unknown_fields.iter() {
3415                state.serialize_entry(key, &value)?;
3416            }
3417        }
3418        state.end()
3419    }
3420}
3421
3422/// Defines additional types related to [FieldDescriptorProto].
3423pub mod field_descriptor_proto {
3424    #[allow(unused_imports)]
3425    use super::*;
3426
3427    ///
3428    /// # Working with unknown values
3429    ///
3430    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3431    /// additional enum variants at any time. Adding new variants is not considered
3432    /// a breaking change. Applications should write their code in anticipation of:
3433    ///
3434    /// - New values appearing in future releases of the client library, **and**
3435    /// - New values received dynamically, without application changes.
3436    ///
3437    /// Please consult the [Working with enums] section in the user guide for some
3438    /// guidelines.
3439    ///
3440    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3441    #[derive(Clone, Debug, PartialEq)]
3442    #[non_exhaustive]
3443    pub enum Type {
3444        /// 0 is reserved for errors.
3445        /// Order is weird for historical reasons.
3446        Double,
3447        Float,
3448        /// Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if
3449        /// negative values are likely.
3450        Int64,
3451        Uint64,
3452        /// Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if
3453        /// negative values are likely.
3454        Int32,
3455        Fixed64,
3456        Fixed32,
3457        Bool,
3458        String,
3459        /// Tag-delimited aggregate.
3460        /// Group type is deprecated and not supported after google.protobuf. However, Proto3
3461        /// implementations should still be able to parse the group wire format and
3462        /// treat group fields as unknown fields.  In Editions, the group wire format
3463        /// can be enabled via the `message_encoding` feature.
3464        Group,
3465        Message,
3466        /// New in version 2.
3467        Bytes,
3468        Uint32,
3469        Enum,
3470        Sfixed32,
3471        Sfixed64,
3472        Sint32,
3473        Sint64,
3474        /// If set, the enum was initialized with an unknown value.
3475        ///
3476        /// Applications can examine the value using [Type::value] or
3477        /// [Type::name].
3478        UnknownValue(r#type::UnknownValue),
3479    }
3480
3481    #[doc(hidden)]
3482    pub mod r#type {
3483        #[allow(unused_imports)]
3484        use super::*;
3485        #[derive(Clone, Debug, PartialEq)]
3486        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3487    }
3488
3489    impl Type {
3490        /// Gets the enum value.
3491        ///
3492        /// Returns `None` if the enum contains an unknown value deserialized from
3493        /// the string representation of enums.
3494        pub fn value(&self) -> std::option::Option<i32> {
3495            match self {
3496                Self::Double => std::option::Option::Some(1),
3497                Self::Float => std::option::Option::Some(2),
3498                Self::Int64 => std::option::Option::Some(3),
3499                Self::Uint64 => std::option::Option::Some(4),
3500                Self::Int32 => std::option::Option::Some(5),
3501                Self::Fixed64 => std::option::Option::Some(6),
3502                Self::Fixed32 => std::option::Option::Some(7),
3503                Self::Bool => std::option::Option::Some(8),
3504                Self::String => std::option::Option::Some(9),
3505                Self::Group => std::option::Option::Some(10),
3506                Self::Message => std::option::Option::Some(11),
3507                Self::Bytes => std::option::Option::Some(12),
3508                Self::Uint32 => std::option::Option::Some(13),
3509                Self::Enum => std::option::Option::Some(14),
3510                Self::Sfixed32 => std::option::Option::Some(15),
3511                Self::Sfixed64 => std::option::Option::Some(16),
3512                Self::Sint32 => std::option::Option::Some(17),
3513                Self::Sint64 => std::option::Option::Some(18),
3514                Self::UnknownValue(u) => u.0.value(),
3515            }
3516        }
3517
3518        /// Gets the enum value as a string.
3519        ///
3520        /// Returns `None` if the enum contains an unknown value deserialized from
3521        /// the integer representation of enums.
3522        pub fn name(&self) -> std::option::Option<&str> {
3523            match self {
3524                Self::Double => std::option::Option::Some("TYPE_DOUBLE"),
3525                Self::Float => std::option::Option::Some("TYPE_FLOAT"),
3526                Self::Int64 => std::option::Option::Some("TYPE_INT64"),
3527                Self::Uint64 => std::option::Option::Some("TYPE_UINT64"),
3528                Self::Int32 => std::option::Option::Some("TYPE_INT32"),
3529                Self::Fixed64 => std::option::Option::Some("TYPE_FIXED64"),
3530                Self::Fixed32 => std::option::Option::Some("TYPE_FIXED32"),
3531                Self::Bool => std::option::Option::Some("TYPE_BOOL"),
3532                Self::String => std::option::Option::Some("TYPE_STRING"),
3533                Self::Group => std::option::Option::Some("TYPE_GROUP"),
3534                Self::Message => std::option::Option::Some("TYPE_MESSAGE"),
3535                Self::Bytes => std::option::Option::Some("TYPE_BYTES"),
3536                Self::Uint32 => std::option::Option::Some("TYPE_UINT32"),
3537                Self::Enum => std::option::Option::Some("TYPE_ENUM"),
3538                Self::Sfixed32 => std::option::Option::Some("TYPE_SFIXED32"),
3539                Self::Sfixed64 => std::option::Option::Some("TYPE_SFIXED64"),
3540                Self::Sint32 => std::option::Option::Some("TYPE_SINT32"),
3541                Self::Sint64 => std::option::Option::Some("TYPE_SINT64"),
3542                Self::UnknownValue(u) => u.0.name(),
3543            }
3544        }
3545    }
3546
3547    impl std::default::Default for Type {
3548        fn default() -> Self {
3549            use std::convert::From;
3550            Self::from(0)
3551        }
3552    }
3553
3554    impl std::fmt::Display for Type {
3555        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3556            wkt::internal::display_enum(f, self.name(), self.value())
3557        }
3558    }
3559
3560    impl std::convert::From<i32> for Type {
3561        fn from(value: i32) -> Self {
3562            match value {
3563                1 => Self::Double,
3564                2 => Self::Float,
3565                3 => Self::Int64,
3566                4 => Self::Uint64,
3567                5 => Self::Int32,
3568                6 => Self::Fixed64,
3569                7 => Self::Fixed32,
3570                8 => Self::Bool,
3571                9 => Self::String,
3572                10 => Self::Group,
3573                11 => Self::Message,
3574                12 => Self::Bytes,
3575                13 => Self::Uint32,
3576                14 => Self::Enum,
3577                15 => Self::Sfixed32,
3578                16 => Self::Sfixed64,
3579                17 => Self::Sint32,
3580                18 => Self::Sint64,
3581                _ => Self::UnknownValue(r#type::UnknownValue(
3582                    wkt::internal::UnknownEnumValue::Integer(value),
3583                )),
3584            }
3585        }
3586    }
3587
3588    impl std::convert::From<&str> for Type {
3589        fn from(value: &str) -> Self {
3590            use std::string::ToString;
3591            match value {
3592                "TYPE_DOUBLE" => Self::Double,
3593                "TYPE_FLOAT" => Self::Float,
3594                "TYPE_INT64" => Self::Int64,
3595                "TYPE_UINT64" => Self::Uint64,
3596                "TYPE_INT32" => Self::Int32,
3597                "TYPE_FIXED64" => Self::Fixed64,
3598                "TYPE_FIXED32" => Self::Fixed32,
3599                "TYPE_BOOL" => Self::Bool,
3600                "TYPE_STRING" => Self::String,
3601                "TYPE_GROUP" => Self::Group,
3602                "TYPE_MESSAGE" => Self::Message,
3603                "TYPE_BYTES" => Self::Bytes,
3604                "TYPE_UINT32" => Self::Uint32,
3605                "TYPE_ENUM" => Self::Enum,
3606                "TYPE_SFIXED32" => Self::Sfixed32,
3607                "TYPE_SFIXED64" => Self::Sfixed64,
3608                "TYPE_SINT32" => Self::Sint32,
3609                "TYPE_SINT64" => Self::Sint64,
3610                _ => Self::UnknownValue(r#type::UnknownValue(
3611                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3612                )),
3613            }
3614        }
3615    }
3616
3617    impl serde::ser::Serialize for Type {
3618        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3619        where
3620            S: serde::Serializer,
3621        {
3622            match self {
3623                Self::Double => serializer.serialize_i32(1),
3624                Self::Float => serializer.serialize_i32(2),
3625                Self::Int64 => serializer.serialize_i32(3),
3626                Self::Uint64 => serializer.serialize_i32(4),
3627                Self::Int32 => serializer.serialize_i32(5),
3628                Self::Fixed64 => serializer.serialize_i32(6),
3629                Self::Fixed32 => serializer.serialize_i32(7),
3630                Self::Bool => serializer.serialize_i32(8),
3631                Self::String => serializer.serialize_i32(9),
3632                Self::Group => serializer.serialize_i32(10),
3633                Self::Message => serializer.serialize_i32(11),
3634                Self::Bytes => serializer.serialize_i32(12),
3635                Self::Uint32 => serializer.serialize_i32(13),
3636                Self::Enum => serializer.serialize_i32(14),
3637                Self::Sfixed32 => serializer.serialize_i32(15),
3638                Self::Sfixed64 => serializer.serialize_i32(16),
3639                Self::Sint32 => serializer.serialize_i32(17),
3640                Self::Sint64 => serializer.serialize_i32(18),
3641                Self::UnknownValue(u) => u.0.serialize(serializer),
3642            }
3643        }
3644    }
3645
3646    impl<'de> serde::de::Deserialize<'de> for Type {
3647        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3648        where
3649            D: serde::Deserializer<'de>,
3650        {
3651            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
3652                ".google.protobuf.FieldDescriptorProto.Type",
3653            ))
3654        }
3655    }
3656
3657    ///
3658    /// # Working with unknown values
3659    ///
3660    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3661    /// additional enum variants at any time. Adding new variants is not considered
3662    /// a breaking change. Applications should write their code in anticipation of:
3663    ///
3664    /// - New values appearing in future releases of the client library, **and**
3665    /// - New values received dynamically, without application changes.
3666    ///
3667    /// Please consult the [Working with enums] section in the user guide for some
3668    /// guidelines.
3669    ///
3670    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3671    #[derive(Clone, Debug, PartialEq)]
3672    #[non_exhaustive]
3673    pub enum Label {
3674        /// 0 is reserved for errors
3675        Optional,
3676        Repeated,
3677        /// The required label is only allowed in google.protobuf.  In proto3 and Editions
3678        /// it's explicitly prohibited.  In Editions, the `field_presence` feature
3679        /// can be used to get this behavior.
3680        Required,
3681        /// If set, the enum was initialized with an unknown value.
3682        ///
3683        /// Applications can examine the value using [Label::value] or
3684        /// [Label::name].
3685        UnknownValue(label::UnknownValue),
3686    }
3687
3688    #[doc(hidden)]
3689    pub mod label {
3690        #[allow(unused_imports)]
3691        use super::*;
3692        #[derive(Clone, Debug, PartialEq)]
3693        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3694    }
3695
3696    impl Label {
3697        /// Gets the enum value.
3698        ///
3699        /// Returns `None` if the enum contains an unknown value deserialized from
3700        /// the string representation of enums.
3701        pub fn value(&self) -> std::option::Option<i32> {
3702            match self {
3703                Self::Optional => std::option::Option::Some(1),
3704                Self::Repeated => std::option::Option::Some(3),
3705                Self::Required => std::option::Option::Some(2),
3706                Self::UnknownValue(u) => u.0.value(),
3707            }
3708        }
3709
3710        /// Gets the enum value as a string.
3711        ///
3712        /// Returns `None` if the enum contains an unknown value deserialized from
3713        /// the integer representation of enums.
3714        pub fn name(&self) -> std::option::Option<&str> {
3715            match self {
3716                Self::Optional => std::option::Option::Some("LABEL_OPTIONAL"),
3717                Self::Repeated => std::option::Option::Some("LABEL_REPEATED"),
3718                Self::Required => std::option::Option::Some("LABEL_REQUIRED"),
3719                Self::UnknownValue(u) => u.0.name(),
3720            }
3721        }
3722    }
3723
3724    impl std::default::Default for Label {
3725        fn default() -> Self {
3726            use std::convert::From;
3727            Self::from(0)
3728        }
3729    }
3730
3731    impl std::fmt::Display for Label {
3732        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3733            wkt::internal::display_enum(f, self.name(), self.value())
3734        }
3735    }
3736
3737    impl std::convert::From<i32> for Label {
3738        fn from(value: i32) -> Self {
3739            match value {
3740                1 => Self::Optional,
3741                2 => Self::Required,
3742                3 => Self::Repeated,
3743                _ => Self::UnknownValue(label::UnknownValue(
3744                    wkt::internal::UnknownEnumValue::Integer(value),
3745                )),
3746            }
3747        }
3748    }
3749
3750    impl std::convert::From<&str> for Label {
3751        fn from(value: &str) -> Self {
3752            use std::string::ToString;
3753            match value {
3754                "LABEL_OPTIONAL" => Self::Optional,
3755                "LABEL_REPEATED" => Self::Repeated,
3756                "LABEL_REQUIRED" => Self::Required,
3757                _ => Self::UnknownValue(label::UnknownValue(
3758                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3759                )),
3760            }
3761        }
3762    }
3763
3764    impl serde::ser::Serialize for Label {
3765        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3766        where
3767            S: serde::Serializer,
3768        {
3769            match self {
3770                Self::Optional => serializer.serialize_i32(1),
3771                Self::Repeated => serializer.serialize_i32(3),
3772                Self::Required => serializer.serialize_i32(2),
3773                Self::UnknownValue(u) => u.0.serialize(serializer),
3774            }
3775        }
3776    }
3777
3778    impl<'de> serde::de::Deserialize<'de> for Label {
3779        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3780        where
3781            D: serde::Deserializer<'de>,
3782        {
3783            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Label>::new(
3784                ".google.protobuf.FieldDescriptorProto.Label",
3785            ))
3786        }
3787    }
3788}
3789
3790/// Describes a oneof.
3791#[derive(Clone, Debug, Default, PartialEq)]
3792#[non_exhaustive]
3793pub struct OneofDescriptorProto {
3794    pub name: std::string::String,
3795
3796    pub options: std::option::Option<crate::OneofOptions>,
3797
3798    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3799}
3800
3801impl OneofDescriptorProto {
3802    pub fn new() -> Self {
3803        std::default::Default::default()
3804    }
3805
3806    /// Sets the value of [name][crate::OneofDescriptorProto::name].
3807    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3808        self.name = v.into();
3809        self
3810    }
3811
3812    /// Sets the value of [options][crate::OneofDescriptorProto::options].
3813    pub fn set_options<T>(mut self, v: T) -> Self
3814    where
3815        T: std::convert::Into<crate::OneofOptions>,
3816    {
3817        self.options = std::option::Option::Some(v.into());
3818        self
3819    }
3820
3821    /// Sets or clears the value of [options][crate::OneofDescriptorProto::options].
3822    pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3823    where
3824        T: std::convert::Into<crate::OneofOptions>,
3825    {
3826        self.options = v.map(|x| x.into());
3827        self
3828    }
3829}
3830
3831impl wkt::message::Message for OneofDescriptorProto {
3832    fn typename() -> &'static str {
3833        "type.googleapis.com/google.protobuf.OneofDescriptorProto"
3834    }
3835}
3836
3837#[doc(hidden)]
3838impl<'de> serde::de::Deserialize<'de> for OneofDescriptorProto {
3839    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3840    where
3841        D: serde::Deserializer<'de>,
3842    {
3843        #[allow(non_camel_case_types)]
3844        #[doc(hidden)]
3845        #[derive(PartialEq, Eq, Hash)]
3846        enum __FieldTag {
3847            __name,
3848            __options,
3849            Unknown(std::string::String),
3850        }
3851        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3852            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3853            where
3854                D: serde::Deserializer<'de>,
3855            {
3856                struct Visitor;
3857                impl<'de> serde::de::Visitor<'de> for Visitor {
3858                    type Value = __FieldTag;
3859                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3860                        formatter.write_str("a field name for OneofDescriptorProto")
3861                    }
3862                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3863                    where
3864                        E: serde::de::Error,
3865                    {
3866                        use std::result::Result::Ok;
3867                        use std::string::ToString;
3868                        match value {
3869                            "name" => Ok(__FieldTag::__name),
3870                            "options" => Ok(__FieldTag::__options),
3871                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3872                        }
3873                    }
3874                }
3875                deserializer.deserialize_identifier(Visitor)
3876            }
3877        }
3878        struct Visitor;
3879        impl<'de> serde::de::Visitor<'de> for Visitor {
3880            type Value = OneofDescriptorProto;
3881            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3882                formatter.write_str("struct OneofDescriptorProto")
3883            }
3884            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3885            where
3886                A: serde::de::MapAccess<'de>,
3887            {
3888                #[allow(unused_imports)]
3889                use serde::de::Error;
3890                use std::option::Option::Some;
3891                let mut fields = std::collections::HashSet::new();
3892                let mut result = Self::Value::new();
3893                while let Some(tag) = map.next_key::<__FieldTag>()? {
3894                    #[allow(clippy::match_single_binding)]
3895                    match tag {
3896                        __FieldTag::__name => {
3897                            if !fields.insert(__FieldTag::__name) {
3898                                return std::result::Result::Err(A::Error::duplicate_field(
3899                                    "multiple values for name",
3900                                ));
3901                            }
3902                            result.name = map
3903                                .next_value::<std::option::Option<std::string::String>>()?
3904                                .unwrap_or_default();
3905                        }
3906                        __FieldTag::__options => {
3907                            if !fields.insert(__FieldTag::__options) {
3908                                return std::result::Result::Err(A::Error::duplicate_field(
3909                                    "multiple values for options",
3910                                ));
3911                            }
3912                            result.options =
3913                                map.next_value::<std::option::Option<crate::OneofOptions>>()?;
3914                        }
3915                        __FieldTag::Unknown(key) => {
3916                            let value = map.next_value::<serde_json::Value>()?;
3917                            result._unknown_fields.insert(key, value);
3918                        }
3919                    }
3920                }
3921                std::result::Result::Ok(result)
3922            }
3923        }
3924        deserializer.deserialize_any(Visitor)
3925    }
3926}
3927
3928#[doc(hidden)]
3929impl serde::ser::Serialize for OneofDescriptorProto {
3930    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3931    where
3932        S: serde::ser::Serializer,
3933    {
3934        use serde::ser::SerializeMap;
3935        #[allow(unused_imports)]
3936        use std::option::Option::Some;
3937        let mut state = serializer.serialize_map(std::option::Option::None)?;
3938        if !self.name.is_empty() {
3939            state.serialize_entry("name", &self.name)?;
3940        }
3941        if self.options.is_some() {
3942            state.serialize_entry("options", &self.options)?;
3943        }
3944        if !self._unknown_fields.is_empty() {
3945            for (key, value) in self._unknown_fields.iter() {
3946                state.serialize_entry(key, &value)?;
3947            }
3948        }
3949        state.end()
3950    }
3951}
3952
3953/// Describes an enum type.
3954#[derive(Clone, Debug, Default, PartialEq)]
3955#[non_exhaustive]
3956pub struct EnumDescriptorProto {
3957    pub name: std::string::String,
3958
3959    pub value: std::vec::Vec<crate::EnumValueDescriptorProto>,
3960
3961    pub options: std::option::Option<crate::EnumOptions>,
3962
3963    /// Range of reserved numeric values. Reserved numeric values may not be used
3964    /// by enum values in the same enum declaration. Reserved ranges may not
3965    /// overlap.
3966    pub reserved_range: std::vec::Vec<crate::enum_descriptor_proto::EnumReservedRange>,
3967
3968    /// Reserved enum value names, which may not be reused. A given name may only
3969    /// be reserved once.
3970    pub reserved_name: std::vec::Vec<std::string::String>,
3971
3972    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3973}
3974
3975impl EnumDescriptorProto {
3976    pub fn new() -> Self {
3977        std::default::Default::default()
3978    }
3979
3980    /// Sets the value of [name][crate::EnumDescriptorProto::name].
3981    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3982        self.name = v.into();
3983        self
3984    }
3985
3986    /// Sets the value of [value][crate::EnumDescriptorProto::value].
3987    pub fn set_value<T, V>(mut self, v: T) -> Self
3988    where
3989        T: std::iter::IntoIterator<Item = V>,
3990        V: std::convert::Into<crate::EnumValueDescriptorProto>,
3991    {
3992        use std::iter::Iterator;
3993        self.value = v.into_iter().map(|i| i.into()).collect();
3994        self
3995    }
3996
3997    /// Sets the value of [options][crate::EnumDescriptorProto::options].
3998    pub fn set_options<T>(mut self, v: T) -> Self
3999    where
4000        T: std::convert::Into<crate::EnumOptions>,
4001    {
4002        self.options = std::option::Option::Some(v.into());
4003        self
4004    }
4005
4006    /// Sets or clears the value of [options][crate::EnumDescriptorProto::options].
4007    pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
4008    where
4009        T: std::convert::Into<crate::EnumOptions>,
4010    {
4011        self.options = v.map(|x| x.into());
4012        self
4013    }
4014
4015    /// Sets the value of [reserved_range][crate::EnumDescriptorProto::reserved_range].
4016    pub fn set_reserved_range<T, V>(mut self, v: T) -> Self
4017    where
4018        T: std::iter::IntoIterator<Item = V>,
4019        V: std::convert::Into<crate::enum_descriptor_proto::EnumReservedRange>,
4020    {
4021        use std::iter::Iterator;
4022        self.reserved_range = v.into_iter().map(|i| i.into()).collect();
4023        self
4024    }
4025
4026    /// Sets the value of [reserved_name][crate::EnumDescriptorProto::reserved_name].
4027    pub fn set_reserved_name<T, V>(mut self, v: T) -> Self
4028    where
4029        T: std::iter::IntoIterator<Item = V>,
4030        V: std::convert::Into<std::string::String>,
4031    {
4032        use std::iter::Iterator;
4033        self.reserved_name = v.into_iter().map(|i| i.into()).collect();
4034        self
4035    }
4036}
4037
4038impl wkt::message::Message for EnumDescriptorProto {
4039    fn typename() -> &'static str {
4040        "type.googleapis.com/google.protobuf.EnumDescriptorProto"
4041    }
4042}
4043
4044#[doc(hidden)]
4045impl<'de> serde::de::Deserialize<'de> for EnumDescriptorProto {
4046    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4047    where
4048        D: serde::Deserializer<'de>,
4049    {
4050        #[allow(non_camel_case_types)]
4051        #[doc(hidden)]
4052        #[derive(PartialEq, Eq, Hash)]
4053        enum __FieldTag {
4054            __name,
4055            __value,
4056            __options,
4057            __reserved_range,
4058            __reserved_name,
4059            Unknown(std::string::String),
4060        }
4061        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4062            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4063            where
4064                D: serde::Deserializer<'de>,
4065            {
4066                struct Visitor;
4067                impl<'de> serde::de::Visitor<'de> for Visitor {
4068                    type Value = __FieldTag;
4069                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4070                        formatter.write_str("a field name for EnumDescriptorProto")
4071                    }
4072                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4073                    where
4074                        E: serde::de::Error,
4075                    {
4076                        use std::result::Result::Ok;
4077                        use std::string::ToString;
4078                        match value {
4079                            "name" => Ok(__FieldTag::__name),
4080                            "value" => Ok(__FieldTag::__value),
4081                            "options" => Ok(__FieldTag::__options),
4082                            "reservedRange" => Ok(__FieldTag::__reserved_range),
4083                            "reserved_range" => Ok(__FieldTag::__reserved_range),
4084                            "reservedName" => Ok(__FieldTag::__reserved_name),
4085                            "reserved_name" => Ok(__FieldTag::__reserved_name),
4086                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4087                        }
4088                    }
4089                }
4090                deserializer.deserialize_identifier(Visitor)
4091            }
4092        }
4093        struct Visitor;
4094        impl<'de> serde::de::Visitor<'de> for Visitor {
4095            type Value = EnumDescriptorProto;
4096            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4097                formatter.write_str("struct EnumDescriptorProto")
4098            }
4099            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4100            where
4101                A: serde::de::MapAccess<'de>,
4102            {
4103                #[allow(unused_imports)]
4104                use serde::de::Error;
4105                use std::option::Option::Some;
4106                let mut fields = std::collections::HashSet::new();
4107                let mut result = Self::Value::new();
4108                while let Some(tag) = map.next_key::<__FieldTag>()? {
4109                    #[allow(clippy::match_single_binding)]
4110                    match tag {
4111                        __FieldTag::__name => {
4112                            if !fields.insert(__FieldTag::__name) {
4113                                return std::result::Result::Err(A::Error::duplicate_field(
4114                                    "multiple values for name",
4115                                ));
4116                            }
4117                            result.name = map
4118                                .next_value::<std::option::Option<std::string::String>>()?
4119                                .unwrap_or_default();
4120                        }
4121                        __FieldTag::__value => {
4122                            if !fields.insert(__FieldTag::__value) {
4123                                return std::result::Result::Err(A::Error::duplicate_field(
4124                                    "multiple values for value",
4125                                ));
4126                            }
4127                            result.value =
4128                                map.next_value::<std::option::Option<
4129                                    std::vec::Vec<crate::EnumValueDescriptorProto>,
4130                                >>()?
4131                                .unwrap_or_default();
4132                        }
4133                        __FieldTag::__options => {
4134                            if !fields.insert(__FieldTag::__options) {
4135                                return std::result::Result::Err(A::Error::duplicate_field(
4136                                    "multiple values for options",
4137                                ));
4138                            }
4139                            result.options =
4140                                map.next_value::<std::option::Option<crate::EnumOptions>>()?;
4141                        }
4142                        __FieldTag::__reserved_range => {
4143                            if !fields.insert(__FieldTag::__reserved_range) {
4144                                return std::result::Result::Err(A::Error::duplicate_field(
4145                                    "multiple values for reserved_range",
4146                                ));
4147                            }
4148                            result.reserved_range = map
4149                                .next_value::<std::option::Option<
4150                                    std::vec::Vec<crate::enum_descriptor_proto::EnumReservedRange>,
4151                                >>()?
4152                                .unwrap_or_default();
4153                        }
4154                        __FieldTag::__reserved_name => {
4155                            if !fields.insert(__FieldTag::__reserved_name) {
4156                                return std::result::Result::Err(A::Error::duplicate_field(
4157                                    "multiple values for reserved_name",
4158                                ));
4159                            }
4160                            result.reserved_name = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
4161                        }
4162                        __FieldTag::Unknown(key) => {
4163                            let value = map.next_value::<serde_json::Value>()?;
4164                            result._unknown_fields.insert(key, value);
4165                        }
4166                    }
4167                }
4168                std::result::Result::Ok(result)
4169            }
4170        }
4171        deserializer.deserialize_any(Visitor)
4172    }
4173}
4174
4175#[doc(hidden)]
4176impl serde::ser::Serialize for EnumDescriptorProto {
4177    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4178    where
4179        S: serde::ser::Serializer,
4180    {
4181        use serde::ser::SerializeMap;
4182        #[allow(unused_imports)]
4183        use std::option::Option::Some;
4184        let mut state = serializer.serialize_map(std::option::Option::None)?;
4185        if !self.name.is_empty() {
4186            state.serialize_entry("name", &self.name)?;
4187        }
4188        if !self.value.is_empty() {
4189            state.serialize_entry("value", &self.value)?;
4190        }
4191        if self.options.is_some() {
4192            state.serialize_entry("options", &self.options)?;
4193        }
4194        if !self.reserved_range.is_empty() {
4195            state.serialize_entry("reservedRange", &self.reserved_range)?;
4196        }
4197        if !self.reserved_name.is_empty() {
4198            state.serialize_entry("reservedName", &self.reserved_name)?;
4199        }
4200        if !self._unknown_fields.is_empty() {
4201            for (key, value) in self._unknown_fields.iter() {
4202                state.serialize_entry(key, &value)?;
4203            }
4204        }
4205        state.end()
4206    }
4207}
4208
4209/// Defines additional types related to [EnumDescriptorProto].
4210pub mod enum_descriptor_proto {
4211    #[allow(unused_imports)]
4212    use super::*;
4213
4214    /// Range of reserved numeric values. Reserved values may not be used by
4215    /// entries in the same enum. Reserved ranges may not overlap.
4216    ///
4217    /// Note that this is distinct from DescriptorProto.ReservedRange in that it
4218    /// is inclusive such that it can appropriately represent the entire int32
4219    /// domain.
4220    #[derive(Clone, Debug, Default, PartialEq)]
4221    #[non_exhaustive]
4222    pub struct EnumReservedRange {
4223        pub start: i32,
4224
4225        pub end: i32,
4226
4227        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4228    }
4229
4230    impl EnumReservedRange {
4231        pub fn new() -> Self {
4232            std::default::Default::default()
4233        }
4234
4235        /// Sets the value of [start][crate::enum_descriptor_proto::EnumReservedRange::start].
4236        pub fn set_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4237            self.start = v.into();
4238            self
4239        }
4240
4241        /// Sets the value of [end][crate::enum_descriptor_proto::EnumReservedRange::end].
4242        pub fn set_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4243            self.end = v.into();
4244            self
4245        }
4246    }
4247
4248    impl wkt::message::Message for EnumReservedRange {
4249        fn typename() -> &'static str {
4250            "type.googleapis.com/google.protobuf.EnumDescriptorProto.EnumReservedRange"
4251        }
4252    }
4253
4254    #[doc(hidden)]
4255    impl<'de> serde::de::Deserialize<'de> for EnumReservedRange {
4256        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4257        where
4258            D: serde::Deserializer<'de>,
4259        {
4260            #[allow(non_camel_case_types)]
4261            #[doc(hidden)]
4262            #[derive(PartialEq, Eq, Hash)]
4263            enum __FieldTag {
4264                __start,
4265                __end,
4266                Unknown(std::string::String),
4267            }
4268            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4269                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4270                where
4271                    D: serde::Deserializer<'de>,
4272                {
4273                    struct Visitor;
4274                    impl<'de> serde::de::Visitor<'de> for Visitor {
4275                        type Value = __FieldTag;
4276                        fn expecting(
4277                            &self,
4278                            formatter: &mut std::fmt::Formatter,
4279                        ) -> std::fmt::Result {
4280                            formatter.write_str("a field name for EnumReservedRange")
4281                        }
4282                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4283                        where
4284                            E: serde::de::Error,
4285                        {
4286                            use std::result::Result::Ok;
4287                            use std::string::ToString;
4288                            match value {
4289                                "start" => Ok(__FieldTag::__start),
4290                                "end" => Ok(__FieldTag::__end),
4291                                _ => Ok(__FieldTag::Unknown(value.to_string())),
4292                            }
4293                        }
4294                    }
4295                    deserializer.deserialize_identifier(Visitor)
4296                }
4297            }
4298            struct Visitor;
4299            impl<'de> serde::de::Visitor<'de> for Visitor {
4300                type Value = EnumReservedRange;
4301                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4302                    formatter.write_str("struct EnumReservedRange")
4303                }
4304                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4305                where
4306                    A: serde::de::MapAccess<'de>,
4307                {
4308                    #[allow(unused_imports)]
4309                    use serde::de::Error;
4310                    use std::option::Option::Some;
4311                    let mut fields = std::collections::HashSet::new();
4312                    let mut result = Self::Value::new();
4313                    while let Some(tag) = map.next_key::<__FieldTag>()? {
4314                        #[allow(clippy::match_single_binding)]
4315                        match tag {
4316                            __FieldTag::__start => {
4317                                if !fields.insert(__FieldTag::__start) {
4318                                    return std::result::Result::Err(A::Error::duplicate_field(
4319                                        "multiple values for start",
4320                                    ));
4321                                }
4322                                struct __With(std::option::Option<i32>);
4323                                impl<'de> serde::de::Deserialize<'de> for __With {
4324                                    fn deserialize<D>(
4325                                        deserializer: D,
4326                                    ) -> std::result::Result<Self, D::Error>
4327                                    where
4328                                        D: serde::de::Deserializer<'de>,
4329                                    {
4330                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4331                                    }
4332                                }
4333                                result.start = map.next_value::<__With>()?.0.unwrap_or_default();
4334                            }
4335                            __FieldTag::__end => {
4336                                if !fields.insert(__FieldTag::__end) {
4337                                    return std::result::Result::Err(A::Error::duplicate_field(
4338                                        "multiple values for end",
4339                                    ));
4340                                }
4341                                struct __With(std::option::Option<i32>);
4342                                impl<'de> serde::de::Deserialize<'de> for __With {
4343                                    fn deserialize<D>(
4344                                        deserializer: D,
4345                                    ) -> std::result::Result<Self, D::Error>
4346                                    where
4347                                        D: serde::de::Deserializer<'de>,
4348                                    {
4349                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4350                                    }
4351                                }
4352                                result.end = map.next_value::<__With>()?.0.unwrap_or_default();
4353                            }
4354                            __FieldTag::Unknown(key) => {
4355                                let value = map.next_value::<serde_json::Value>()?;
4356                                result._unknown_fields.insert(key, value);
4357                            }
4358                        }
4359                    }
4360                    std::result::Result::Ok(result)
4361                }
4362            }
4363            deserializer.deserialize_any(Visitor)
4364        }
4365    }
4366
4367    #[doc(hidden)]
4368    impl serde::ser::Serialize for EnumReservedRange {
4369        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4370        where
4371            S: serde::ser::Serializer,
4372        {
4373            use serde::ser::SerializeMap;
4374            #[allow(unused_imports)]
4375            use std::option::Option::Some;
4376            let mut state = serializer.serialize_map(std::option::Option::None)?;
4377            if !wkt::internal::is_default(&self.start) {
4378                struct __With<'a>(&'a i32);
4379                impl<'a> serde::ser::Serialize for __With<'a> {
4380                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4381                    where
4382                        S: serde::ser::Serializer,
4383                    {
4384                        serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4385                    }
4386                }
4387                state.serialize_entry("start", &__With(&self.start))?;
4388            }
4389            if !wkt::internal::is_default(&self.end) {
4390                struct __With<'a>(&'a i32);
4391                impl<'a> serde::ser::Serialize for __With<'a> {
4392                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4393                    where
4394                        S: serde::ser::Serializer,
4395                    {
4396                        serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4397                    }
4398                }
4399                state.serialize_entry("end", &__With(&self.end))?;
4400            }
4401            if !self._unknown_fields.is_empty() {
4402                for (key, value) in self._unknown_fields.iter() {
4403                    state.serialize_entry(key, &value)?;
4404                }
4405            }
4406            state.end()
4407        }
4408    }
4409}
4410
4411/// Describes a value within an enum.
4412#[derive(Clone, Debug, Default, PartialEq)]
4413#[non_exhaustive]
4414pub struct EnumValueDescriptorProto {
4415    pub name: std::string::String,
4416
4417    pub number: i32,
4418
4419    pub options: std::option::Option<crate::EnumValueOptions>,
4420
4421    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4422}
4423
4424impl EnumValueDescriptorProto {
4425    pub fn new() -> Self {
4426        std::default::Default::default()
4427    }
4428
4429    /// Sets the value of [name][crate::EnumValueDescriptorProto::name].
4430    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4431        self.name = v.into();
4432        self
4433    }
4434
4435    /// Sets the value of [number][crate::EnumValueDescriptorProto::number].
4436    pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4437        self.number = v.into();
4438        self
4439    }
4440
4441    /// Sets the value of [options][crate::EnumValueDescriptorProto::options].
4442    pub fn set_options<T>(mut self, v: T) -> Self
4443    where
4444        T: std::convert::Into<crate::EnumValueOptions>,
4445    {
4446        self.options = std::option::Option::Some(v.into());
4447        self
4448    }
4449
4450    /// Sets or clears the value of [options][crate::EnumValueDescriptorProto::options].
4451    pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
4452    where
4453        T: std::convert::Into<crate::EnumValueOptions>,
4454    {
4455        self.options = v.map(|x| x.into());
4456        self
4457    }
4458}
4459
4460impl wkt::message::Message for EnumValueDescriptorProto {
4461    fn typename() -> &'static str {
4462        "type.googleapis.com/google.protobuf.EnumValueDescriptorProto"
4463    }
4464}
4465
4466#[doc(hidden)]
4467impl<'de> serde::de::Deserialize<'de> for EnumValueDescriptorProto {
4468    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4469    where
4470        D: serde::Deserializer<'de>,
4471    {
4472        #[allow(non_camel_case_types)]
4473        #[doc(hidden)]
4474        #[derive(PartialEq, Eq, Hash)]
4475        enum __FieldTag {
4476            __name,
4477            __number,
4478            __options,
4479            Unknown(std::string::String),
4480        }
4481        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4482            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4483            where
4484                D: serde::Deserializer<'de>,
4485            {
4486                struct Visitor;
4487                impl<'de> serde::de::Visitor<'de> for Visitor {
4488                    type Value = __FieldTag;
4489                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4490                        formatter.write_str("a field name for EnumValueDescriptorProto")
4491                    }
4492                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4493                    where
4494                        E: serde::de::Error,
4495                    {
4496                        use std::result::Result::Ok;
4497                        use std::string::ToString;
4498                        match value {
4499                            "name" => Ok(__FieldTag::__name),
4500                            "number" => Ok(__FieldTag::__number),
4501                            "options" => Ok(__FieldTag::__options),
4502                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4503                        }
4504                    }
4505                }
4506                deserializer.deserialize_identifier(Visitor)
4507            }
4508        }
4509        struct Visitor;
4510        impl<'de> serde::de::Visitor<'de> for Visitor {
4511            type Value = EnumValueDescriptorProto;
4512            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4513                formatter.write_str("struct EnumValueDescriptorProto")
4514            }
4515            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4516            where
4517                A: serde::de::MapAccess<'de>,
4518            {
4519                #[allow(unused_imports)]
4520                use serde::de::Error;
4521                use std::option::Option::Some;
4522                let mut fields = std::collections::HashSet::new();
4523                let mut result = Self::Value::new();
4524                while let Some(tag) = map.next_key::<__FieldTag>()? {
4525                    #[allow(clippy::match_single_binding)]
4526                    match tag {
4527                        __FieldTag::__name => {
4528                            if !fields.insert(__FieldTag::__name) {
4529                                return std::result::Result::Err(A::Error::duplicate_field(
4530                                    "multiple values for name",
4531                                ));
4532                            }
4533                            result.name = map
4534                                .next_value::<std::option::Option<std::string::String>>()?
4535                                .unwrap_or_default();
4536                        }
4537                        __FieldTag::__number => {
4538                            if !fields.insert(__FieldTag::__number) {
4539                                return std::result::Result::Err(A::Error::duplicate_field(
4540                                    "multiple values for number",
4541                                ));
4542                            }
4543                            struct __With(std::option::Option<i32>);
4544                            impl<'de> serde::de::Deserialize<'de> for __With {
4545                                fn deserialize<D>(
4546                                    deserializer: D,
4547                                ) -> std::result::Result<Self, D::Error>
4548                                where
4549                                    D: serde::de::Deserializer<'de>,
4550                                {
4551                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4552                                }
4553                            }
4554                            result.number = map.next_value::<__With>()?.0.unwrap_or_default();
4555                        }
4556                        __FieldTag::__options => {
4557                            if !fields.insert(__FieldTag::__options) {
4558                                return std::result::Result::Err(A::Error::duplicate_field(
4559                                    "multiple values for options",
4560                                ));
4561                            }
4562                            result.options =
4563                                map.next_value::<std::option::Option<crate::EnumValueOptions>>()?;
4564                        }
4565                        __FieldTag::Unknown(key) => {
4566                            let value = map.next_value::<serde_json::Value>()?;
4567                            result._unknown_fields.insert(key, value);
4568                        }
4569                    }
4570                }
4571                std::result::Result::Ok(result)
4572            }
4573        }
4574        deserializer.deserialize_any(Visitor)
4575    }
4576}
4577
4578#[doc(hidden)]
4579impl serde::ser::Serialize for EnumValueDescriptorProto {
4580    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4581    where
4582        S: serde::ser::Serializer,
4583    {
4584        use serde::ser::SerializeMap;
4585        #[allow(unused_imports)]
4586        use std::option::Option::Some;
4587        let mut state = serializer.serialize_map(std::option::Option::None)?;
4588        if !self.name.is_empty() {
4589            state.serialize_entry("name", &self.name)?;
4590        }
4591        if !wkt::internal::is_default(&self.number) {
4592            struct __With<'a>(&'a i32);
4593            impl<'a> serde::ser::Serialize for __With<'a> {
4594                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4595                where
4596                    S: serde::ser::Serializer,
4597                {
4598                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4599                }
4600            }
4601            state.serialize_entry("number", &__With(&self.number))?;
4602        }
4603        if self.options.is_some() {
4604            state.serialize_entry("options", &self.options)?;
4605        }
4606        if !self._unknown_fields.is_empty() {
4607            for (key, value) in self._unknown_fields.iter() {
4608                state.serialize_entry(key, &value)?;
4609            }
4610        }
4611        state.end()
4612    }
4613}
4614
4615/// Describes a service.
4616#[derive(Clone, Debug, Default, PartialEq)]
4617#[non_exhaustive]
4618pub struct ServiceDescriptorProto {
4619    pub name: std::string::String,
4620
4621    pub method: std::vec::Vec<crate::MethodDescriptorProto>,
4622
4623    pub options: std::option::Option<crate::ServiceOptions>,
4624
4625    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4626}
4627
4628impl ServiceDescriptorProto {
4629    pub fn new() -> Self {
4630        std::default::Default::default()
4631    }
4632
4633    /// Sets the value of [name][crate::ServiceDescriptorProto::name].
4634    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4635        self.name = v.into();
4636        self
4637    }
4638
4639    /// Sets the value of [method][crate::ServiceDescriptorProto::method].
4640    pub fn set_method<T, V>(mut self, v: T) -> Self
4641    where
4642        T: std::iter::IntoIterator<Item = V>,
4643        V: std::convert::Into<crate::MethodDescriptorProto>,
4644    {
4645        use std::iter::Iterator;
4646        self.method = v.into_iter().map(|i| i.into()).collect();
4647        self
4648    }
4649
4650    /// Sets the value of [options][crate::ServiceDescriptorProto::options].
4651    pub fn set_options<T>(mut self, v: T) -> Self
4652    where
4653        T: std::convert::Into<crate::ServiceOptions>,
4654    {
4655        self.options = std::option::Option::Some(v.into());
4656        self
4657    }
4658
4659    /// Sets or clears the value of [options][crate::ServiceDescriptorProto::options].
4660    pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
4661    where
4662        T: std::convert::Into<crate::ServiceOptions>,
4663    {
4664        self.options = v.map(|x| x.into());
4665        self
4666    }
4667}
4668
4669impl wkt::message::Message for ServiceDescriptorProto {
4670    fn typename() -> &'static str {
4671        "type.googleapis.com/google.protobuf.ServiceDescriptorProto"
4672    }
4673}
4674
4675#[doc(hidden)]
4676impl<'de> serde::de::Deserialize<'de> for ServiceDescriptorProto {
4677    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4678    where
4679        D: serde::Deserializer<'de>,
4680    {
4681        #[allow(non_camel_case_types)]
4682        #[doc(hidden)]
4683        #[derive(PartialEq, Eq, Hash)]
4684        enum __FieldTag {
4685            __name,
4686            __method,
4687            __options,
4688            Unknown(std::string::String),
4689        }
4690        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4691            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4692            where
4693                D: serde::Deserializer<'de>,
4694            {
4695                struct Visitor;
4696                impl<'de> serde::de::Visitor<'de> for Visitor {
4697                    type Value = __FieldTag;
4698                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4699                        formatter.write_str("a field name for ServiceDescriptorProto")
4700                    }
4701                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4702                    where
4703                        E: serde::de::Error,
4704                    {
4705                        use std::result::Result::Ok;
4706                        use std::string::ToString;
4707                        match value {
4708                            "name" => Ok(__FieldTag::__name),
4709                            "method" => Ok(__FieldTag::__method),
4710                            "options" => Ok(__FieldTag::__options),
4711                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4712                        }
4713                    }
4714                }
4715                deserializer.deserialize_identifier(Visitor)
4716            }
4717        }
4718        struct Visitor;
4719        impl<'de> serde::de::Visitor<'de> for Visitor {
4720            type Value = ServiceDescriptorProto;
4721            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4722                formatter.write_str("struct ServiceDescriptorProto")
4723            }
4724            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4725            where
4726                A: serde::de::MapAccess<'de>,
4727            {
4728                #[allow(unused_imports)]
4729                use serde::de::Error;
4730                use std::option::Option::Some;
4731                let mut fields = std::collections::HashSet::new();
4732                let mut result = Self::Value::new();
4733                while let Some(tag) = map.next_key::<__FieldTag>()? {
4734                    #[allow(clippy::match_single_binding)]
4735                    match tag {
4736                        __FieldTag::__name => {
4737                            if !fields.insert(__FieldTag::__name) {
4738                                return std::result::Result::Err(A::Error::duplicate_field(
4739                                    "multiple values for name",
4740                                ));
4741                            }
4742                            result.name = map
4743                                .next_value::<std::option::Option<std::string::String>>()?
4744                                .unwrap_or_default();
4745                        }
4746                        __FieldTag::__method => {
4747                            if !fields.insert(__FieldTag::__method) {
4748                                return std::result::Result::Err(A::Error::duplicate_field(
4749                                    "multiple values for method",
4750                                ));
4751                            }
4752                            result.method =
4753                                map.next_value::<std::option::Option<
4754                                    std::vec::Vec<crate::MethodDescriptorProto>,
4755                                >>()?
4756                                .unwrap_or_default();
4757                        }
4758                        __FieldTag::__options => {
4759                            if !fields.insert(__FieldTag::__options) {
4760                                return std::result::Result::Err(A::Error::duplicate_field(
4761                                    "multiple values for options",
4762                                ));
4763                            }
4764                            result.options =
4765                                map.next_value::<std::option::Option<crate::ServiceOptions>>()?;
4766                        }
4767                        __FieldTag::Unknown(key) => {
4768                            let value = map.next_value::<serde_json::Value>()?;
4769                            result._unknown_fields.insert(key, value);
4770                        }
4771                    }
4772                }
4773                std::result::Result::Ok(result)
4774            }
4775        }
4776        deserializer.deserialize_any(Visitor)
4777    }
4778}
4779
4780#[doc(hidden)]
4781impl serde::ser::Serialize for ServiceDescriptorProto {
4782    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4783    where
4784        S: serde::ser::Serializer,
4785    {
4786        use serde::ser::SerializeMap;
4787        #[allow(unused_imports)]
4788        use std::option::Option::Some;
4789        let mut state = serializer.serialize_map(std::option::Option::None)?;
4790        if !self.name.is_empty() {
4791            state.serialize_entry("name", &self.name)?;
4792        }
4793        if !self.method.is_empty() {
4794            state.serialize_entry("method", &self.method)?;
4795        }
4796        if self.options.is_some() {
4797            state.serialize_entry("options", &self.options)?;
4798        }
4799        if !self._unknown_fields.is_empty() {
4800            for (key, value) in self._unknown_fields.iter() {
4801                state.serialize_entry(key, &value)?;
4802            }
4803        }
4804        state.end()
4805    }
4806}
4807
4808/// Describes a method of a service.
4809#[derive(Clone, Debug, Default, PartialEq)]
4810#[non_exhaustive]
4811pub struct MethodDescriptorProto {
4812    pub name: std::string::String,
4813
4814    /// Input and output type names.  These are resolved in the same way as
4815    /// FieldDescriptorProto.type_name, but must refer to a message type.
4816    pub input_type: std::string::String,
4817
4818    pub output_type: std::string::String,
4819
4820    pub options: std::option::Option<crate::MethodOptions>,
4821
4822    /// Identifies if client streams multiple client messages
4823    pub client_streaming: bool,
4824
4825    /// Identifies if server streams multiple server messages
4826    pub server_streaming: bool,
4827
4828    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4829}
4830
4831impl MethodDescriptorProto {
4832    pub fn new() -> Self {
4833        std::default::Default::default()
4834    }
4835
4836    /// Sets the value of [name][crate::MethodDescriptorProto::name].
4837    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4838        self.name = v.into();
4839        self
4840    }
4841
4842    /// Sets the value of [input_type][crate::MethodDescriptorProto::input_type].
4843    pub fn set_input_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4844        self.input_type = v.into();
4845        self
4846    }
4847
4848    /// Sets the value of [output_type][crate::MethodDescriptorProto::output_type].
4849    pub fn set_output_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4850        self.output_type = v.into();
4851        self
4852    }
4853
4854    /// Sets the value of [options][crate::MethodDescriptorProto::options].
4855    pub fn set_options<T>(mut self, v: T) -> Self
4856    where
4857        T: std::convert::Into<crate::MethodOptions>,
4858    {
4859        self.options = std::option::Option::Some(v.into());
4860        self
4861    }
4862
4863    /// Sets or clears the value of [options][crate::MethodDescriptorProto::options].
4864    pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
4865    where
4866        T: std::convert::Into<crate::MethodOptions>,
4867    {
4868        self.options = v.map(|x| x.into());
4869        self
4870    }
4871
4872    /// Sets the value of [client_streaming][crate::MethodDescriptorProto::client_streaming].
4873    pub fn set_client_streaming<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4874        self.client_streaming = v.into();
4875        self
4876    }
4877
4878    /// Sets the value of [server_streaming][crate::MethodDescriptorProto::server_streaming].
4879    pub fn set_server_streaming<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4880        self.server_streaming = v.into();
4881        self
4882    }
4883}
4884
4885impl wkt::message::Message for MethodDescriptorProto {
4886    fn typename() -> &'static str {
4887        "type.googleapis.com/google.protobuf.MethodDescriptorProto"
4888    }
4889}
4890
4891#[doc(hidden)]
4892impl<'de> serde::de::Deserialize<'de> for MethodDescriptorProto {
4893    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4894    where
4895        D: serde::Deserializer<'de>,
4896    {
4897        #[allow(non_camel_case_types)]
4898        #[doc(hidden)]
4899        #[derive(PartialEq, Eq, Hash)]
4900        enum __FieldTag {
4901            __name,
4902            __input_type,
4903            __output_type,
4904            __options,
4905            __client_streaming,
4906            __server_streaming,
4907            Unknown(std::string::String),
4908        }
4909        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4910            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4911            where
4912                D: serde::Deserializer<'de>,
4913            {
4914                struct Visitor;
4915                impl<'de> serde::de::Visitor<'de> for Visitor {
4916                    type Value = __FieldTag;
4917                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4918                        formatter.write_str("a field name for MethodDescriptorProto")
4919                    }
4920                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4921                    where
4922                        E: serde::de::Error,
4923                    {
4924                        use std::result::Result::Ok;
4925                        use std::string::ToString;
4926                        match value {
4927                            "name" => Ok(__FieldTag::__name),
4928                            "inputType" => Ok(__FieldTag::__input_type),
4929                            "input_type" => Ok(__FieldTag::__input_type),
4930                            "outputType" => Ok(__FieldTag::__output_type),
4931                            "output_type" => Ok(__FieldTag::__output_type),
4932                            "options" => Ok(__FieldTag::__options),
4933                            "clientStreaming" => Ok(__FieldTag::__client_streaming),
4934                            "client_streaming" => Ok(__FieldTag::__client_streaming),
4935                            "serverStreaming" => Ok(__FieldTag::__server_streaming),
4936                            "server_streaming" => Ok(__FieldTag::__server_streaming),
4937                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4938                        }
4939                    }
4940                }
4941                deserializer.deserialize_identifier(Visitor)
4942            }
4943        }
4944        struct Visitor;
4945        impl<'de> serde::de::Visitor<'de> for Visitor {
4946            type Value = MethodDescriptorProto;
4947            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4948                formatter.write_str("struct MethodDescriptorProto")
4949            }
4950            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4951            where
4952                A: serde::de::MapAccess<'de>,
4953            {
4954                #[allow(unused_imports)]
4955                use serde::de::Error;
4956                use std::option::Option::Some;
4957                let mut fields = std::collections::HashSet::new();
4958                let mut result = Self::Value::new();
4959                while let Some(tag) = map.next_key::<__FieldTag>()? {
4960                    #[allow(clippy::match_single_binding)]
4961                    match tag {
4962                        __FieldTag::__name => {
4963                            if !fields.insert(__FieldTag::__name) {
4964                                return std::result::Result::Err(A::Error::duplicate_field(
4965                                    "multiple values for name",
4966                                ));
4967                            }
4968                            result.name = map
4969                                .next_value::<std::option::Option<std::string::String>>()?
4970                                .unwrap_or_default();
4971                        }
4972                        __FieldTag::__input_type => {
4973                            if !fields.insert(__FieldTag::__input_type) {
4974                                return std::result::Result::Err(A::Error::duplicate_field(
4975                                    "multiple values for input_type",
4976                                ));
4977                            }
4978                            result.input_type = map
4979                                .next_value::<std::option::Option<std::string::String>>()?
4980                                .unwrap_or_default();
4981                        }
4982                        __FieldTag::__output_type => {
4983                            if !fields.insert(__FieldTag::__output_type) {
4984                                return std::result::Result::Err(A::Error::duplicate_field(
4985                                    "multiple values for output_type",
4986                                ));
4987                            }
4988                            result.output_type = map
4989                                .next_value::<std::option::Option<std::string::String>>()?
4990                                .unwrap_or_default();
4991                        }
4992                        __FieldTag::__options => {
4993                            if !fields.insert(__FieldTag::__options) {
4994                                return std::result::Result::Err(A::Error::duplicate_field(
4995                                    "multiple values for options",
4996                                ));
4997                            }
4998                            result.options =
4999                                map.next_value::<std::option::Option<crate::MethodOptions>>()?;
5000                        }
5001                        __FieldTag::__client_streaming => {
5002                            if !fields.insert(__FieldTag::__client_streaming) {
5003                                return std::result::Result::Err(A::Error::duplicate_field(
5004                                    "multiple values for client_streaming",
5005                                ));
5006                            }
5007                            result.client_streaming = map
5008                                .next_value::<std::option::Option<bool>>()?
5009                                .unwrap_or_default();
5010                        }
5011                        __FieldTag::__server_streaming => {
5012                            if !fields.insert(__FieldTag::__server_streaming) {
5013                                return std::result::Result::Err(A::Error::duplicate_field(
5014                                    "multiple values for server_streaming",
5015                                ));
5016                            }
5017                            result.server_streaming = map
5018                                .next_value::<std::option::Option<bool>>()?
5019                                .unwrap_or_default();
5020                        }
5021                        __FieldTag::Unknown(key) => {
5022                            let value = map.next_value::<serde_json::Value>()?;
5023                            result._unknown_fields.insert(key, value);
5024                        }
5025                    }
5026                }
5027                std::result::Result::Ok(result)
5028            }
5029        }
5030        deserializer.deserialize_any(Visitor)
5031    }
5032}
5033
5034#[doc(hidden)]
5035impl serde::ser::Serialize for MethodDescriptorProto {
5036    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5037    where
5038        S: serde::ser::Serializer,
5039    {
5040        use serde::ser::SerializeMap;
5041        #[allow(unused_imports)]
5042        use std::option::Option::Some;
5043        let mut state = serializer.serialize_map(std::option::Option::None)?;
5044        if !self.name.is_empty() {
5045            state.serialize_entry("name", &self.name)?;
5046        }
5047        if !self.input_type.is_empty() {
5048            state.serialize_entry("inputType", &self.input_type)?;
5049        }
5050        if !self.output_type.is_empty() {
5051            state.serialize_entry("outputType", &self.output_type)?;
5052        }
5053        if self.options.is_some() {
5054            state.serialize_entry("options", &self.options)?;
5055        }
5056        if !wkt::internal::is_default(&self.client_streaming) {
5057            state.serialize_entry("clientStreaming", &self.client_streaming)?;
5058        }
5059        if !wkt::internal::is_default(&self.server_streaming) {
5060            state.serialize_entry("serverStreaming", &self.server_streaming)?;
5061        }
5062        if !self._unknown_fields.is_empty() {
5063            for (key, value) in self._unknown_fields.iter() {
5064                state.serialize_entry(key, &value)?;
5065            }
5066        }
5067        state.end()
5068    }
5069}
5070
5071#[derive(Clone, Debug, Default, PartialEq)]
5072#[non_exhaustive]
5073pub struct FileOptions {
5074    /// Sets the Java package where classes generated from this .proto will be
5075    /// placed.  By default, the proto package is used, but this is often
5076    /// inappropriate because proto packages do not normally start with backwards
5077    /// domain names.
5078    pub java_package: std::string::String,
5079
5080    /// Controls the name of the wrapper Java class generated for the .proto file.
5081    /// That class will always contain the .proto file's getDescriptor() method as
5082    /// well as any top-level extensions defined in the .proto file.
5083    /// If java_multiple_files is disabled, then all the other classes from the
5084    /// .proto file will be nested inside the single wrapper outer class.
5085    pub java_outer_classname: std::string::String,
5086
5087    /// If enabled, then the Java code generator will generate a separate .java
5088    /// file for each top-level message, enum, and service defined in the .proto
5089    /// file.  Thus, these types will *not* be nested inside the wrapper class
5090    /// named by java_outer_classname.  However, the wrapper class will still be
5091    /// generated to contain the file's getDescriptor() method as well as any
5092    /// top-level extensions defined in the file.
5093    pub java_multiple_files: bool,
5094
5095    /// This option does nothing.
5096    #[deprecated]
5097    pub java_generate_equals_and_hash: bool,
5098
5099    /// A proto2 file can set this to true to opt in to UTF-8 checking for Java,
5100    /// which will throw an exception if invalid UTF-8 is parsed from the wire or
5101    /// assigned to a string field.
5102    ///
5103    /// TODO: clarify exactly what kinds of field types this option
5104    /// applies to, and update these docs accordingly.
5105    ///
5106    /// Proto3 files already perform these checks. Setting the option explicitly to
5107    /// false has no effect: it cannot be used to opt proto3 files out of UTF-8
5108    /// checks.
5109    pub java_string_check_utf8: bool,
5110
5111    pub optimize_for: crate::file_options::OptimizeMode,
5112
5113    /// Sets the Go package where structs generated from this .proto will be
5114    /// placed. If omitted, the Go package will be derived from the following:
5115    ///
5116    /// - The basename of the package import path, if provided.
5117    /// - Otherwise, the package statement in the .proto file, if present.
5118    /// - Otherwise, the basename of the .proto file, without extension.
5119    pub go_package: std::string::String,
5120
5121    /// Should generic services be generated in each language?  "Generic" services
5122    /// are not specific to any particular RPC system.  They are generated by the
5123    /// main code generators in each language (without additional plugins).
5124    /// Generic services were the only kind of service generation supported by
5125    /// early versions of google.protobuf.
5126    ///
5127    /// Generic services are now considered deprecated in favor of using plugins
5128    /// that generate code specific to your particular RPC system.  Therefore,
5129    /// these default to false.  Old code which depends on generic services should
5130    /// explicitly set them to true.
5131    pub cc_generic_services: bool,
5132
5133    pub java_generic_services: bool,
5134
5135    pub py_generic_services: bool,
5136
5137    /// Is this file deprecated?
5138    /// Depending on the target platform, this can emit Deprecated annotations
5139    /// for everything in the file, or it will be completely ignored; in the very
5140    /// least, this is a formalization for deprecating files.
5141    pub deprecated: bool,
5142
5143    /// Enables the use of arenas for the proto messages in this file. This applies
5144    /// only to generated classes for C++.
5145    pub cc_enable_arenas: bool,
5146
5147    /// Sets the objective c class prefix which is prepended to all objective c
5148    /// generated classes from this .proto. There is no default.
5149    pub objc_class_prefix: std::string::String,
5150
5151    /// Namespace for generated classes; defaults to the package.
5152    pub csharp_namespace: std::string::String,
5153
5154    /// By default Swift generators will take the proto package and CamelCase it
5155    /// replacing '.' with underscore and use that to prefix the types/symbols
5156    /// defined. When this options is provided, they will use this value instead
5157    /// to prefix the types/symbols defined.
5158    pub swift_prefix: std::string::String,
5159
5160    /// Sets the php class prefix which is prepended to all php generated classes
5161    /// from this .proto. Default is empty.
5162    pub php_class_prefix: std::string::String,
5163
5164    /// Use this option to change the namespace of php generated classes. Default
5165    /// is empty. When this option is empty, the package name will be used for
5166    /// determining the namespace.
5167    pub php_namespace: std::string::String,
5168
5169    /// Use this option to change the namespace of php generated metadata classes.
5170    /// Default is empty. When this option is empty, the proto file name will be
5171    /// used for determining the namespace.
5172    pub php_metadata_namespace: std::string::String,
5173
5174    /// Use this option to change the package of ruby generated classes. Default
5175    /// is empty. When this option is not set, the package name will be used for
5176    /// determining the ruby package.
5177    pub ruby_package: std::string::String,
5178
5179    /// Any features defined in the specific edition.
5180    pub features: std::option::Option<crate::FeatureSet>,
5181
5182    /// The parser stores options it doesn't recognize here.
5183    /// See the documentation for the "Options" section above.
5184    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
5185
5186    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5187}
5188
5189impl FileOptions {
5190    pub fn new() -> Self {
5191        std::default::Default::default()
5192    }
5193
5194    /// Sets the value of [java_package][crate::FileOptions::java_package].
5195    pub fn set_java_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5196        self.java_package = v.into();
5197        self
5198    }
5199
5200    /// Sets the value of [java_outer_classname][crate::FileOptions::java_outer_classname].
5201    pub fn set_java_outer_classname<T: std::convert::Into<std::string::String>>(
5202        mut self,
5203        v: T,
5204    ) -> Self {
5205        self.java_outer_classname = v.into();
5206        self
5207    }
5208
5209    /// Sets the value of [java_multiple_files][crate::FileOptions::java_multiple_files].
5210    pub fn set_java_multiple_files<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5211        self.java_multiple_files = v.into();
5212        self
5213    }
5214
5215    /// Sets the value of [java_generate_equals_and_hash][crate::FileOptions::java_generate_equals_and_hash].
5216    #[deprecated]
5217    pub fn set_java_generate_equals_and_hash<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5218        self.java_generate_equals_and_hash = v.into();
5219        self
5220    }
5221
5222    /// Sets the value of [java_string_check_utf8][crate::FileOptions::java_string_check_utf8].
5223    pub fn set_java_string_check_utf8<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5224        self.java_string_check_utf8 = v.into();
5225        self
5226    }
5227
5228    /// Sets the value of [optimize_for][crate::FileOptions::optimize_for].
5229    pub fn set_optimize_for<T: std::convert::Into<crate::file_options::OptimizeMode>>(
5230        mut self,
5231        v: T,
5232    ) -> Self {
5233        self.optimize_for = v.into();
5234        self
5235    }
5236
5237    /// Sets the value of [go_package][crate::FileOptions::go_package].
5238    pub fn set_go_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5239        self.go_package = v.into();
5240        self
5241    }
5242
5243    /// Sets the value of [cc_generic_services][crate::FileOptions::cc_generic_services].
5244    pub fn set_cc_generic_services<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5245        self.cc_generic_services = v.into();
5246        self
5247    }
5248
5249    /// Sets the value of [java_generic_services][crate::FileOptions::java_generic_services].
5250    pub fn set_java_generic_services<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5251        self.java_generic_services = v.into();
5252        self
5253    }
5254
5255    /// Sets the value of [py_generic_services][crate::FileOptions::py_generic_services].
5256    pub fn set_py_generic_services<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5257        self.py_generic_services = v.into();
5258        self
5259    }
5260
5261    /// Sets the value of [deprecated][crate::FileOptions::deprecated].
5262    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5263        self.deprecated = v.into();
5264        self
5265    }
5266
5267    /// Sets the value of [cc_enable_arenas][crate::FileOptions::cc_enable_arenas].
5268    pub fn set_cc_enable_arenas<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5269        self.cc_enable_arenas = v.into();
5270        self
5271    }
5272
5273    /// Sets the value of [objc_class_prefix][crate::FileOptions::objc_class_prefix].
5274    pub fn set_objc_class_prefix<T: std::convert::Into<std::string::String>>(
5275        mut self,
5276        v: T,
5277    ) -> Self {
5278        self.objc_class_prefix = v.into();
5279        self
5280    }
5281
5282    /// Sets the value of [csharp_namespace][crate::FileOptions::csharp_namespace].
5283    pub fn set_csharp_namespace<T: std::convert::Into<std::string::String>>(
5284        mut self,
5285        v: T,
5286    ) -> Self {
5287        self.csharp_namespace = v.into();
5288        self
5289    }
5290
5291    /// Sets the value of [swift_prefix][crate::FileOptions::swift_prefix].
5292    pub fn set_swift_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5293        self.swift_prefix = v.into();
5294        self
5295    }
5296
5297    /// Sets the value of [php_class_prefix][crate::FileOptions::php_class_prefix].
5298    pub fn set_php_class_prefix<T: std::convert::Into<std::string::String>>(
5299        mut self,
5300        v: T,
5301    ) -> Self {
5302        self.php_class_prefix = v.into();
5303        self
5304    }
5305
5306    /// Sets the value of [php_namespace][crate::FileOptions::php_namespace].
5307    pub fn set_php_namespace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5308        self.php_namespace = v.into();
5309        self
5310    }
5311
5312    /// Sets the value of [php_metadata_namespace][crate::FileOptions::php_metadata_namespace].
5313    pub fn set_php_metadata_namespace<T: std::convert::Into<std::string::String>>(
5314        mut self,
5315        v: T,
5316    ) -> Self {
5317        self.php_metadata_namespace = v.into();
5318        self
5319    }
5320
5321    /// Sets the value of [ruby_package][crate::FileOptions::ruby_package].
5322    pub fn set_ruby_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5323        self.ruby_package = v.into();
5324        self
5325    }
5326
5327    /// Sets the value of [features][crate::FileOptions::features].
5328    pub fn set_features<T>(mut self, v: T) -> Self
5329    where
5330        T: std::convert::Into<crate::FeatureSet>,
5331    {
5332        self.features = std::option::Option::Some(v.into());
5333        self
5334    }
5335
5336    /// Sets or clears the value of [features][crate::FileOptions::features].
5337    pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
5338    where
5339        T: std::convert::Into<crate::FeatureSet>,
5340    {
5341        self.features = v.map(|x| x.into());
5342        self
5343    }
5344
5345    /// Sets the value of [uninterpreted_option][crate::FileOptions::uninterpreted_option].
5346    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
5347    where
5348        T: std::iter::IntoIterator<Item = V>,
5349        V: std::convert::Into<crate::UninterpretedOption>,
5350    {
5351        use std::iter::Iterator;
5352        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
5353        self
5354    }
5355}
5356
5357impl wkt::message::Message for FileOptions {
5358    fn typename() -> &'static str {
5359        "type.googleapis.com/google.protobuf.FileOptions"
5360    }
5361}
5362
5363#[doc(hidden)]
5364impl<'de> serde::de::Deserialize<'de> for FileOptions {
5365    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5366    where
5367        D: serde::Deserializer<'de>,
5368    {
5369        #[allow(non_camel_case_types)]
5370        #[doc(hidden)]
5371        #[derive(PartialEq, Eq, Hash)]
5372        enum __FieldTag {
5373            __java_package,
5374            __java_outer_classname,
5375            __java_multiple_files,
5376            __java_generate_equals_and_hash,
5377            __java_string_check_utf8,
5378            __optimize_for,
5379            __go_package,
5380            __cc_generic_services,
5381            __java_generic_services,
5382            __py_generic_services,
5383            __deprecated,
5384            __cc_enable_arenas,
5385            __objc_class_prefix,
5386            __csharp_namespace,
5387            __swift_prefix,
5388            __php_class_prefix,
5389            __php_namespace,
5390            __php_metadata_namespace,
5391            __ruby_package,
5392            __features,
5393            __uninterpreted_option,
5394            Unknown(std::string::String),
5395        }
5396        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5397            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5398            where
5399                D: serde::Deserializer<'de>,
5400            {
5401                struct Visitor;
5402                impl<'de> serde::de::Visitor<'de> for Visitor {
5403                    type Value = __FieldTag;
5404                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5405                        formatter.write_str("a field name for FileOptions")
5406                    }
5407                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5408                    where
5409                        E: serde::de::Error,
5410                    {
5411                        use std::result::Result::Ok;
5412                        use std::string::ToString;
5413                        match value {
5414                            "javaPackage" => Ok(__FieldTag::__java_package),
5415                            "java_package" => Ok(__FieldTag::__java_package),
5416                            "javaOuterClassname" => Ok(__FieldTag::__java_outer_classname),
5417                            "java_outer_classname" => Ok(__FieldTag::__java_outer_classname),
5418                            "javaMultipleFiles" => Ok(__FieldTag::__java_multiple_files),
5419                            "java_multiple_files" => Ok(__FieldTag::__java_multiple_files),
5420                            "javaGenerateEqualsAndHash" => {
5421                                Ok(__FieldTag::__java_generate_equals_and_hash)
5422                            }
5423                            "java_generate_equals_and_hash" => {
5424                                Ok(__FieldTag::__java_generate_equals_and_hash)
5425                            }
5426                            "javaStringCheckUtf8" => Ok(__FieldTag::__java_string_check_utf8),
5427                            "java_string_check_utf8" => Ok(__FieldTag::__java_string_check_utf8),
5428                            "optimizeFor" => Ok(__FieldTag::__optimize_for),
5429                            "optimize_for" => Ok(__FieldTag::__optimize_for),
5430                            "goPackage" => Ok(__FieldTag::__go_package),
5431                            "go_package" => Ok(__FieldTag::__go_package),
5432                            "ccGenericServices" => Ok(__FieldTag::__cc_generic_services),
5433                            "cc_generic_services" => Ok(__FieldTag::__cc_generic_services),
5434                            "javaGenericServices" => Ok(__FieldTag::__java_generic_services),
5435                            "java_generic_services" => Ok(__FieldTag::__java_generic_services),
5436                            "pyGenericServices" => Ok(__FieldTag::__py_generic_services),
5437                            "py_generic_services" => Ok(__FieldTag::__py_generic_services),
5438                            "deprecated" => Ok(__FieldTag::__deprecated),
5439                            "ccEnableArenas" => Ok(__FieldTag::__cc_enable_arenas),
5440                            "cc_enable_arenas" => Ok(__FieldTag::__cc_enable_arenas),
5441                            "objcClassPrefix" => Ok(__FieldTag::__objc_class_prefix),
5442                            "objc_class_prefix" => Ok(__FieldTag::__objc_class_prefix),
5443                            "csharpNamespace" => Ok(__FieldTag::__csharp_namespace),
5444                            "csharp_namespace" => Ok(__FieldTag::__csharp_namespace),
5445                            "swiftPrefix" => Ok(__FieldTag::__swift_prefix),
5446                            "swift_prefix" => Ok(__FieldTag::__swift_prefix),
5447                            "phpClassPrefix" => Ok(__FieldTag::__php_class_prefix),
5448                            "php_class_prefix" => Ok(__FieldTag::__php_class_prefix),
5449                            "phpNamespace" => Ok(__FieldTag::__php_namespace),
5450                            "php_namespace" => Ok(__FieldTag::__php_namespace),
5451                            "phpMetadataNamespace" => Ok(__FieldTag::__php_metadata_namespace),
5452                            "php_metadata_namespace" => Ok(__FieldTag::__php_metadata_namespace),
5453                            "rubyPackage" => Ok(__FieldTag::__ruby_package),
5454                            "ruby_package" => Ok(__FieldTag::__ruby_package),
5455                            "features" => Ok(__FieldTag::__features),
5456                            "uninterpretedOption" => Ok(__FieldTag::__uninterpreted_option),
5457                            "uninterpreted_option" => Ok(__FieldTag::__uninterpreted_option),
5458                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5459                        }
5460                    }
5461                }
5462                deserializer.deserialize_identifier(Visitor)
5463            }
5464        }
5465        struct Visitor;
5466        impl<'de> serde::de::Visitor<'de> for Visitor {
5467            type Value = FileOptions;
5468            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5469                formatter.write_str("struct FileOptions")
5470            }
5471            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5472            where
5473                A: serde::de::MapAccess<'de>,
5474            {
5475                #[allow(unused_imports)]
5476                use serde::de::Error;
5477                use std::option::Option::Some;
5478                let mut fields = std::collections::HashSet::new();
5479                let mut result = Self::Value::new();
5480                while let Some(tag) = map.next_key::<__FieldTag>()? {
5481                    #[allow(clippy::match_single_binding)]
5482                    match tag {
5483                        __FieldTag::__java_package => {
5484                            if !fields.insert(__FieldTag::__java_package) {
5485                                return std::result::Result::Err(A::Error::duplicate_field(
5486                                    "multiple values for java_package",
5487                                ));
5488                            }
5489                            result.java_package = map
5490                                .next_value::<std::option::Option<std::string::String>>()?
5491                                .unwrap_or_default();
5492                        }
5493                        __FieldTag::__java_outer_classname => {
5494                            if !fields.insert(__FieldTag::__java_outer_classname) {
5495                                return std::result::Result::Err(A::Error::duplicate_field(
5496                                    "multiple values for java_outer_classname",
5497                                ));
5498                            }
5499                            result.java_outer_classname = map
5500                                .next_value::<std::option::Option<std::string::String>>()?
5501                                .unwrap_or_default();
5502                        }
5503                        __FieldTag::__java_multiple_files => {
5504                            if !fields.insert(__FieldTag::__java_multiple_files) {
5505                                return std::result::Result::Err(A::Error::duplicate_field(
5506                                    "multiple values for java_multiple_files",
5507                                ));
5508                            }
5509                            result.java_multiple_files = map
5510                                .next_value::<std::option::Option<bool>>()?
5511                                .unwrap_or_default();
5512                        }
5513                        __FieldTag::__java_generate_equals_and_hash => {
5514                            if !fields.insert(__FieldTag::__java_generate_equals_and_hash) {
5515                                return std::result::Result::Err(A::Error::duplicate_field(
5516                                    "multiple values for java_generate_equals_and_hash",
5517                                ));
5518                            }
5519                            result.java_generate_equals_and_hash = map
5520                                .next_value::<std::option::Option<bool>>()?
5521                                .unwrap_or_default();
5522                        }
5523                        __FieldTag::__java_string_check_utf8 => {
5524                            if !fields.insert(__FieldTag::__java_string_check_utf8) {
5525                                return std::result::Result::Err(A::Error::duplicate_field(
5526                                    "multiple values for java_string_check_utf8",
5527                                ));
5528                            }
5529                            result.java_string_check_utf8 = map
5530                                .next_value::<std::option::Option<bool>>()?
5531                                .unwrap_or_default();
5532                        }
5533                        __FieldTag::__optimize_for => {
5534                            if !fields.insert(__FieldTag::__optimize_for) {
5535                                return std::result::Result::Err(A::Error::duplicate_field(
5536                                    "multiple values for optimize_for",
5537                                ));
5538                            }
5539                            result.optimize_for = map.next_value::<std::option::Option<crate::file_options::OptimizeMode>>()?.unwrap_or_default();
5540                        }
5541                        __FieldTag::__go_package => {
5542                            if !fields.insert(__FieldTag::__go_package) {
5543                                return std::result::Result::Err(A::Error::duplicate_field(
5544                                    "multiple values for go_package",
5545                                ));
5546                            }
5547                            result.go_package = map
5548                                .next_value::<std::option::Option<std::string::String>>()?
5549                                .unwrap_or_default();
5550                        }
5551                        __FieldTag::__cc_generic_services => {
5552                            if !fields.insert(__FieldTag::__cc_generic_services) {
5553                                return std::result::Result::Err(A::Error::duplicate_field(
5554                                    "multiple values for cc_generic_services",
5555                                ));
5556                            }
5557                            result.cc_generic_services = map
5558                                .next_value::<std::option::Option<bool>>()?
5559                                .unwrap_or_default();
5560                        }
5561                        __FieldTag::__java_generic_services => {
5562                            if !fields.insert(__FieldTag::__java_generic_services) {
5563                                return std::result::Result::Err(A::Error::duplicate_field(
5564                                    "multiple values for java_generic_services",
5565                                ));
5566                            }
5567                            result.java_generic_services = map
5568                                .next_value::<std::option::Option<bool>>()?
5569                                .unwrap_or_default();
5570                        }
5571                        __FieldTag::__py_generic_services => {
5572                            if !fields.insert(__FieldTag::__py_generic_services) {
5573                                return std::result::Result::Err(A::Error::duplicate_field(
5574                                    "multiple values for py_generic_services",
5575                                ));
5576                            }
5577                            result.py_generic_services = map
5578                                .next_value::<std::option::Option<bool>>()?
5579                                .unwrap_or_default();
5580                        }
5581                        __FieldTag::__deprecated => {
5582                            if !fields.insert(__FieldTag::__deprecated) {
5583                                return std::result::Result::Err(A::Error::duplicate_field(
5584                                    "multiple values for deprecated",
5585                                ));
5586                            }
5587                            result.deprecated = map
5588                                .next_value::<std::option::Option<bool>>()?
5589                                .unwrap_or_default();
5590                        }
5591                        __FieldTag::__cc_enable_arenas => {
5592                            if !fields.insert(__FieldTag::__cc_enable_arenas) {
5593                                return std::result::Result::Err(A::Error::duplicate_field(
5594                                    "multiple values for cc_enable_arenas",
5595                                ));
5596                            }
5597                            result.cc_enable_arenas = map
5598                                .next_value::<std::option::Option<bool>>()?
5599                                .unwrap_or_default();
5600                        }
5601                        __FieldTag::__objc_class_prefix => {
5602                            if !fields.insert(__FieldTag::__objc_class_prefix) {
5603                                return std::result::Result::Err(A::Error::duplicate_field(
5604                                    "multiple values for objc_class_prefix",
5605                                ));
5606                            }
5607                            result.objc_class_prefix = map
5608                                .next_value::<std::option::Option<std::string::String>>()?
5609                                .unwrap_or_default();
5610                        }
5611                        __FieldTag::__csharp_namespace => {
5612                            if !fields.insert(__FieldTag::__csharp_namespace) {
5613                                return std::result::Result::Err(A::Error::duplicate_field(
5614                                    "multiple values for csharp_namespace",
5615                                ));
5616                            }
5617                            result.csharp_namespace = map
5618                                .next_value::<std::option::Option<std::string::String>>()?
5619                                .unwrap_or_default();
5620                        }
5621                        __FieldTag::__swift_prefix => {
5622                            if !fields.insert(__FieldTag::__swift_prefix) {
5623                                return std::result::Result::Err(A::Error::duplicate_field(
5624                                    "multiple values for swift_prefix",
5625                                ));
5626                            }
5627                            result.swift_prefix = map
5628                                .next_value::<std::option::Option<std::string::String>>()?
5629                                .unwrap_or_default();
5630                        }
5631                        __FieldTag::__php_class_prefix => {
5632                            if !fields.insert(__FieldTag::__php_class_prefix) {
5633                                return std::result::Result::Err(A::Error::duplicate_field(
5634                                    "multiple values for php_class_prefix",
5635                                ));
5636                            }
5637                            result.php_class_prefix = map
5638                                .next_value::<std::option::Option<std::string::String>>()?
5639                                .unwrap_or_default();
5640                        }
5641                        __FieldTag::__php_namespace => {
5642                            if !fields.insert(__FieldTag::__php_namespace) {
5643                                return std::result::Result::Err(A::Error::duplicate_field(
5644                                    "multiple values for php_namespace",
5645                                ));
5646                            }
5647                            result.php_namespace = map
5648                                .next_value::<std::option::Option<std::string::String>>()?
5649                                .unwrap_or_default();
5650                        }
5651                        __FieldTag::__php_metadata_namespace => {
5652                            if !fields.insert(__FieldTag::__php_metadata_namespace) {
5653                                return std::result::Result::Err(A::Error::duplicate_field(
5654                                    "multiple values for php_metadata_namespace",
5655                                ));
5656                            }
5657                            result.php_metadata_namespace = map
5658                                .next_value::<std::option::Option<std::string::String>>()?
5659                                .unwrap_or_default();
5660                        }
5661                        __FieldTag::__ruby_package => {
5662                            if !fields.insert(__FieldTag::__ruby_package) {
5663                                return std::result::Result::Err(A::Error::duplicate_field(
5664                                    "multiple values for ruby_package",
5665                                ));
5666                            }
5667                            result.ruby_package = map
5668                                .next_value::<std::option::Option<std::string::String>>()?
5669                                .unwrap_or_default();
5670                        }
5671                        __FieldTag::__features => {
5672                            if !fields.insert(__FieldTag::__features) {
5673                                return std::result::Result::Err(A::Error::duplicate_field(
5674                                    "multiple values for features",
5675                                ));
5676                            }
5677                            result.features =
5678                                map.next_value::<std::option::Option<crate::FeatureSet>>()?;
5679                        }
5680                        __FieldTag::__uninterpreted_option => {
5681                            if !fields.insert(__FieldTag::__uninterpreted_option) {
5682                                return std::result::Result::Err(A::Error::duplicate_field(
5683                                    "multiple values for uninterpreted_option",
5684                                ));
5685                            }
5686                            result.uninterpreted_option = map.next_value::<std::option::Option<std::vec::Vec<crate::UninterpretedOption>>>()?.unwrap_or_default();
5687                        }
5688                        __FieldTag::Unknown(key) => {
5689                            let value = map.next_value::<serde_json::Value>()?;
5690                            result._unknown_fields.insert(key, value);
5691                        }
5692                    }
5693                }
5694                std::result::Result::Ok(result)
5695            }
5696        }
5697        deserializer.deserialize_any(Visitor)
5698    }
5699}
5700
5701#[doc(hidden)]
5702impl serde::ser::Serialize for FileOptions {
5703    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5704    where
5705        S: serde::ser::Serializer,
5706    {
5707        use serde::ser::SerializeMap;
5708        #[allow(unused_imports)]
5709        use std::option::Option::Some;
5710        let mut state = serializer.serialize_map(std::option::Option::None)?;
5711        if !self.java_package.is_empty() {
5712            state.serialize_entry("javaPackage", &self.java_package)?;
5713        }
5714        if !self.java_outer_classname.is_empty() {
5715            state.serialize_entry("javaOuterClassname", &self.java_outer_classname)?;
5716        }
5717        if !wkt::internal::is_default(&self.java_multiple_files) {
5718            state.serialize_entry("javaMultipleFiles", &self.java_multiple_files)?;
5719        }
5720        if !wkt::internal::is_default(&self.java_generate_equals_and_hash) {
5721            state.serialize_entry(
5722                "javaGenerateEqualsAndHash",
5723                &self.java_generate_equals_and_hash,
5724            )?;
5725        }
5726        if !wkt::internal::is_default(&self.java_string_check_utf8) {
5727            state.serialize_entry("javaStringCheckUtf8", &self.java_string_check_utf8)?;
5728        }
5729        if !wkt::internal::is_default(&self.optimize_for) {
5730            state.serialize_entry("optimizeFor", &self.optimize_for)?;
5731        }
5732        if !self.go_package.is_empty() {
5733            state.serialize_entry("goPackage", &self.go_package)?;
5734        }
5735        if !wkt::internal::is_default(&self.cc_generic_services) {
5736            state.serialize_entry("ccGenericServices", &self.cc_generic_services)?;
5737        }
5738        if !wkt::internal::is_default(&self.java_generic_services) {
5739            state.serialize_entry("javaGenericServices", &self.java_generic_services)?;
5740        }
5741        if !wkt::internal::is_default(&self.py_generic_services) {
5742            state.serialize_entry("pyGenericServices", &self.py_generic_services)?;
5743        }
5744        if !wkt::internal::is_default(&self.deprecated) {
5745            state.serialize_entry("deprecated", &self.deprecated)?;
5746        }
5747        if !wkt::internal::is_default(&self.cc_enable_arenas) {
5748            state.serialize_entry("ccEnableArenas", &self.cc_enable_arenas)?;
5749        }
5750        if !self.objc_class_prefix.is_empty() {
5751            state.serialize_entry("objcClassPrefix", &self.objc_class_prefix)?;
5752        }
5753        if !self.csharp_namespace.is_empty() {
5754            state.serialize_entry("csharpNamespace", &self.csharp_namespace)?;
5755        }
5756        if !self.swift_prefix.is_empty() {
5757            state.serialize_entry("swiftPrefix", &self.swift_prefix)?;
5758        }
5759        if !self.php_class_prefix.is_empty() {
5760            state.serialize_entry("phpClassPrefix", &self.php_class_prefix)?;
5761        }
5762        if !self.php_namespace.is_empty() {
5763            state.serialize_entry("phpNamespace", &self.php_namespace)?;
5764        }
5765        if !self.php_metadata_namespace.is_empty() {
5766            state.serialize_entry("phpMetadataNamespace", &self.php_metadata_namespace)?;
5767        }
5768        if !self.ruby_package.is_empty() {
5769            state.serialize_entry("rubyPackage", &self.ruby_package)?;
5770        }
5771        if self.features.is_some() {
5772            state.serialize_entry("features", &self.features)?;
5773        }
5774        if !self.uninterpreted_option.is_empty() {
5775            state.serialize_entry("uninterpretedOption", &self.uninterpreted_option)?;
5776        }
5777        if !self._unknown_fields.is_empty() {
5778            for (key, value) in self._unknown_fields.iter() {
5779                state.serialize_entry(key, &value)?;
5780            }
5781        }
5782        state.end()
5783    }
5784}
5785
5786/// Defines additional types related to [FileOptions].
5787pub mod file_options {
5788    #[allow(unused_imports)]
5789    use super::*;
5790
5791    /// Generated classes can be optimized for speed or code size.
5792    ///
5793    /// # Working with unknown values
5794    ///
5795    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5796    /// additional enum variants at any time. Adding new variants is not considered
5797    /// a breaking change. Applications should write their code in anticipation of:
5798    ///
5799    /// - New values appearing in future releases of the client library, **and**
5800    /// - New values received dynamically, without application changes.
5801    ///
5802    /// Please consult the [Working with enums] section in the user guide for some
5803    /// guidelines.
5804    ///
5805    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5806    #[derive(Clone, Debug, PartialEq)]
5807    #[non_exhaustive]
5808    pub enum OptimizeMode {
5809        Speed,
5810        /// etc.
5811        CodeSize,
5812        LiteRuntime,
5813        /// If set, the enum was initialized with an unknown value.
5814        ///
5815        /// Applications can examine the value using [OptimizeMode::value] or
5816        /// [OptimizeMode::name].
5817        UnknownValue(optimize_mode::UnknownValue),
5818    }
5819
5820    #[doc(hidden)]
5821    pub mod optimize_mode {
5822        #[allow(unused_imports)]
5823        use super::*;
5824        #[derive(Clone, Debug, PartialEq)]
5825        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5826    }
5827
5828    impl OptimizeMode {
5829        /// Gets the enum value.
5830        ///
5831        /// Returns `None` if the enum contains an unknown value deserialized from
5832        /// the string representation of enums.
5833        pub fn value(&self) -> std::option::Option<i32> {
5834            match self {
5835                Self::Speed => std::option::Option::Some(1),
5836                Self::CodeSize => std::option::Option::Some(2),
5837                Self::LiteRuntime => std::option::Option::Some(3),
5838                Self::UnknownValue(u) => u.0.value(),
5839            }
5840        }
5841
5842        /// Gets the enum value as a string.
5843        ///
5844        /// Returns `None` if the enum contains an unknown value deserialized from
5845        /// the integer representation of enums.
5846        pub fn name(&self) -> std::option::Option<&str> {
5847            match self {
5848                Self::Speed => std::option::Option::Some("SPEED"),
5849                Self::CodeSize => std::option::Option::Some("CODE_SIZE"),
5850                Self::LiteRuntime => std::option::Option::Some("LITE_RUNTIME"),
5851                Self::UnknownValue(u) => u.0.name(),
5852            }
5853        }
5854    }
5855
5856    impl std::default::Default for OptimizeMode {
5857        fn default() -> Self {
5858            use std::convert::From;
5859            Self::from(0)
5860        }
5861    }
5862
5863    impl std::fmt::Display for OptimizeMode {
5864        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5865            wkt::internal::display_enum(f, self.name(), self.value())
5866        }
5867    }
5868
5869    impl std::convert::From<i32> for OptimizeMode {
5870        fn from(value: i32) -> Self {
5871            match value {
5872                1 => Self::Speed,
5873                2 => Self::CodeSize,
5874                3 => Self::LiteRuntime,
5875                _ => Self::UnknownValue(optimize_mode::UnknownValue(
5876                    wkt::internal::UnknownEnumValue::Integer(value),
5877                )),
5878            }
5879        }
5880    }
5881
5882    impl std::convert::From<&str> for OptimizeMode {
5883        fn from(value: &str) -> Self {
5884            use std::string::ToString;
5885            match value {
5886                "SPEED" => Self::Speed,
5887                "CODE_SIZE" => Self::CodeSize,
5888                "LITE_RUNTIME" => Self::LiteRuntime,
5889                _ => Self::UnknownValue(optimize_mode::UnknownValue(
5890                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5891                )),
5892            }
5893        }
5894    }
5895
5896    impl serde::ser::Serialize for OptimizeMode {
5897        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5898        where
5899            S: serde::Serializer,
5900        {
5901            match self {
5902                Self::Speed => serializer.serialize_i32(1),
5903                Self::CodeSize => serializer.serialize_i32(2),
5904                Self::LiteRuntime => serializer.serialize_i32(3),
5905                Self::UnknownValue(u) => u.0.serialize(serializer),
5906            }
5907        }
5908    }
5909
5910    impl<'de> serde::de::Deserialize<'de> for OptimizeMode {
5911        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5912        where
5913            D: serde::Deserializer<'de>,
5914        {
5915            deserializer.deserialize_any(wkt::internal::EnumVisitor::<OptimizeMode>::new(
5916                ".google.protobuf.FileOptions.OptimizeMode",
5917            ))
5918        }
5919    }
5920}
5921
5922#[derive(Clone, Debug, Default, PartialEq)]
5923#[non_exhaustive]
5924pub struct MessageOptions {
5925    /// Set true to use the old proto1 MessageSet wire format for extensions.
5926    /// This is provided for backwards-compatibility with the MessageSet wire
5927    /// format.  You should not use this for any other reason:  It's less
5928    /// efficient, has fewer features, and is more complicated.
5929    ///
5930    /// The message must be defined exactly as follows:
5931    /// message Foo {
5932    /// option message_set_wire_format = true;
5933    /// extensions 4 to max;
5934    /// }
5935    /// Note that the message cannot have any defined fields; MessageSets only
5936    /// have extensions.
5937    ///
5938    /// All extensions of your type must be singular messages; e.g. they cannot
5939    /// be int32s, enums, or repeated messages.
5940    ///
5941    /// Because this is an option, the above two restrictions are not enforced by
5942    /// the protocol compiler.
5943    pub message_set_wire_format: bool,
5944
5945    /// Disables the generation of the standard "descriptor()" accessor, which can
5946    /// conflict with a field of the same name.  This is meant to make migration
5947    /// from proto1 easier; new code should avoid fields named "descriptor".
5948    pub no_standard_descriptor_accessor: bool,
5949
5950    /// Is this message deprecated?
5951    /// Depending on the target platform, this can emit Deprecated annotations
5952    /// for the message, or it will be completely ignored; in the very least,
5953    /// this is a formalization for deprecating messages.
5954    pub deprecated: bool,
5955
5956    /// Whether the message is an automatically generated map entry type for the
5957    /// maps field.
5958    ///
5959    /// For maps fields:
5960    /// map<KeyType, ValueType> map_field = 1;
5961    /// The parsed descriptor looks like:
5962    /// message MapFieldEntry {
5963    /// option map_entry = true;
5964    /// optional KeyType key = 1;
5965    /// optional ValueType value = 2;
5966    /// }
5967    /// repeated MapFieldEntry map_field = 1;
5968    ///
5969    /// Implementations may choose not to generate the map_entry=true message, but
5970    /// use a native map in the target language to hold the keys and values.
5971    /// The reflection APIs in such implementations still need to work as
5972    /// if the field is a repeated message field.
5973    ///
5974    /// NOTE: Do not set the option in .proto files. Always use the maps syntax
5975    /// instead. The option should only be implicitly set by the proto compiler
5976    /// parser.
5977    pub map_entry: bool,
5978
5979    /// Enable the legacy handling of JSON field name conflicts.  This lowercases
5980    /// and strips underscored from the fields before comparison in proto3 only.
5981    /// The new behavior takes `json_name` into account and applies to proto2 as
5982    /// well.
5983    ///
5984    /// This should only be used as a temporary measure against broken builds due
5985    /// to the change in behavior for JSON field name conflicts.
5986    ///
5987    /// TODO This is legacy behavior we plan to remove once downstream
5988    /// teams have had time to migrate.
5989    #[deprecated]
5990    pub deprecated_legacy_json_field_conflicts: bool,
5991
5992    /// Any features defined in the specific edition.
5993    pub features: std::option::Option<crate::FeatureSet>,
5994
5995    /// The parser stores options it doesn't recognize here. See above.
5996    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
5997
5998    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5999}
6000
6001impl MessageOptions {
6002    pub fn new() -> Self {
6003        std::default::Default::default()
6004    }
6005
6006    /// Sets the value of [message_set_wire_format][crate::MessageOptions::message_set_wire_format].
6007    pub fn set_message_set_wire_format<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6008        self.message_set_wire_format = v.into();
6009        self
6010    }
6011
6012    /// Sets the value of [no_standard_descriptor_accessor][crate::MessageOptions::no_standard_descriptor_accessor].
6013    pub fn set_no_standard_descriptor_accessor<T: std::convert::Into<bool>>(
6014        mut self,
6015        v: T,
6016    ) -> Self {
6017        self.no_standard_descriptor_accessor = v.into();
6018        self
6019    }
6020
6021    /// Sets the value of [deprecated][crate::MessageOptions::deprecated].
6022    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6023        self.deprecated = v.into();
6024        self
6025    }
6026
6027    /// Sets the value of [map_entry][crate::MessageOptions::map_entry].
6028    pub fn set_map_entry<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6029        self.map_entry = v.into();
6030        self
6031    }
6032
6033    /// Sets the value of [deprecated_legacy_json_field_conflicts][crate::MessageOptions::deprecated_legacy_json_field_conflicts].
6034    #[deprecated]
6035    pub fn set_deprecated_legacy_json_field_conflicts<T: std::convert::Into<bool>>(
6036        mut self,
6037        v: T,
6038    ) -> Self {
6039        self.deprecated_legacy_json_field_conflicts = v.into();
6040        self
6041    }
6042
6043    /// Sets the value of [features][crate::MessageOptions::features].
6044    pub fn set_features<T>(mut self, v: T) -> Self
6045    where
6046        T: std::convert::Into<crate::FeatureSet>,
6047    {
6048        self.features = std::option::Option::Some(v.into());
6049        self
6050    }
6051
6052    /// Sets or clears the value of [features][crate::MessageOptions::features].
6053    pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
6054    where
6055        T: std::convert::Into<crate::FeatureSet>,
6056    {
6057        self.features = v.map(|x| x.into());
6058        self
6059    }
6060
6061    /// Sets the value of [uninterpreted_option][crate::MessageOptions::uninterpreted_option].
6062    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
6063    where
6064        T: std::iter::IntoIterator<Item = V>,
6065        V: std::convert::Into<crate::UninterpretedOption>,
6066    {
6067        use std::iter::Iterator;
6068        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
6069        self
6070    }
6071}
6072
6073impl wkt::message::Message for MessageOptions {
6074    fn typename() -> &'static str {
6075        "type.googleapis.com/google.protobuf.MessageOptions"
6076    }
6077}
6078
6079#[doc(hidden)]
6080impl<'de> serde::de::Deserialize<'de> for MessageOptions {
6081    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6082    where
6083        D: serde::Deserializer<'de>,
6084    {
6085        #[allow(non_camel_case_types)]
6086        #[doc(hidden)]
6087        #[derive(PartialEq, Eq, Hash)]
6088        enum __FieldTag {
6089            __message_set_wire_format,
6090            __no_standard_descriptor_accessor,
6091            __deprecated,
6092            __map_entry,
6093            __deprecated_legacy_json_field_conflicts,
6094            __features,
6095            __uninterpreted_option,
6096            Unknown(std::string::String),
6097        }
6098        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6099            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6100            where
6101                D: serde::Deserializer<'de>,
6102            {
6103                struct Visitor;
6104                impl<'de> serde::de::Visitor<'de> for Visitor {
6105                    type Value = __FieldTag;
6106                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6107                        formatter.write_str("a field name for MessageOptions")
6108                    }
6109                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6110                    where
6111                        E: serde::de::Error,
6112                    {
6113                        use std::result::Result::Ok;
6114                        use std::string::ToString;
6115                        match value {
6116                            "messageSetWireFormat" => Ok(__FieldTag::__message_set_wire_format),
6117                            "message_set_wire_format" => Ok(__FieldTag::__message_set_wire_format),
6118                            "noStandardDescriptorAccessor" => {
6119                                Ok(__FieldTag::__no_standard_descriptor_accessor)
6120                            }
6121                            "no_standard_descriptor_accessor" => {
6122                                Ok(__FieldTag::__no_standard_descriptor_accessor)
6123                            }
6124                            "deprecated" => Ok(__FieldTag::__deprecated),
6125                            "mapEntry" => Ok(__FieldTag::__map_entry),
6126                            "map_entry" => Ok(__FieldTag::__map_entry),
6127                            "deprecatedLegacyJsonFieldConflicts" => {
6128                                Ok(__FieldTag::__deprecated_legacy_json_field_conflicts)
6129                            }
6130                            "deprecated_legacy_json_field_conflicts" => {
6131                                Ok(__FieldTag::__deprecated_legacy_json_field_conflicts)
6132                            }
6133                            "features" => Ok(__FieldTag::__features),
6134                            "uninterpretedOption" => Ok(__FieldTag::__uninterpreted_option),
6135                            "uninterpreted_option" => Ok(__FieldTag::__uninterpreted_option),
6136                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6137                        }
6138                    }
6139                }
6140                deserializer.deserialize_identifier(Visitor)
6141            }
6142        }
6143        struct Visitor;
6144        impl<'de> serde::de::Visitor<'de> for Visitor {
6145            type Value = MessageOptions;
6146            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6147                formatter.write_str("struct MessageOptions")
6148            }
6149            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6150            where
6151                A: serde::de::MapAccess<'de>,
6152            {
6153                #[allow(unused_imports)]
6154                use serde::de::Error;
6155                use std::option::Option::Some;
6156                let mut fields = std::collections::HashSet::new();
6157                let mut result = Self::Value::new();
6158                while let Some(tag) = map.next_key::<__FieldTag>()? {
6159                    #[allow(clippy::match_single_binding)]
6160                    match tag {
6161                        __FieldTag::__message_set_wire_format => {
6162                            if !fields.insert(__FieldTag::__message_set_wire_format) {
6163                                return std::result::Result::Err(A::Error::duplicate_field(
6164                                    "multiple values for message_set_wire_format",
6165                                ));
6166                            }
6167                            result.message_set_wire_format = map
6168                                .next_value::<std::option::Option<bool>>()?
6169                                .unwrap_or_default();
6170                        }
6171                        __FieldTag::__no_standard_descriptor_accessor => {
6172                            if !fields.insert(__FieldTag::__no_standard_descriptor_accessor) {
6173                                return std::result::Result::Err(A::Error::duplicate_field(
6174                                    "multiple values for no_standard_descriptor_accessor",
6175                                ));
6176                            }
6177                            result.no_standard_descriptor_accessor = map
6178                                .next_value::<std::option::Option<bool>>()?
6179                                .unwrap_or_default();
6180                        }
6181                        __FieldTag::__deprecated => {
6182                            if !fields.insert(__FieldTag::__deprecated) {
6183                                return std::result::Result::Err(A::Error::duplicate_field(
6184                                    "multiple values for deprecated",
6185                                ));
6186                            }
6187                            result.deprecated = map
6188                                .next_value::<std::option::Option<bool>>()?
6189                                .unwrap_or_default();
6190                        }
6191                        __FieldTag::__map_entry => {
6192                            if !fields.insert(__FieldTag::__map_entry) {
6193                                return std::result::Result::Err(A::Error::duplicate_field(
6194                                    "multiple values for map_entry",
6195                                ));
6196                            }
6197                            result.map_entry = map
6198                                .next_value::<std::option::Option<bool>>()?
6199                                .unwrap_or_default();
6200                        }
6201                        __FieldTag::__deprecated_legacy_json_field_conflicts => {
6202                            if !fields.insert(__FieldTag::__deprecated_legacy_json_field_conflicts)
6203                            {
6204                                return std::result::Result::Err(A::Error::duplicate_field(
6205                                    "multiple values for deprecated_legacy_json_field_conflicts",
6206                                ));
6207                            }
6208                            result.deprecated_legacy_json_field_conflicts = map
6209                                .next_value::<std::option::Option<bool>>()?
6210                                .unwrap_or_default();
6211                        }
6212                        __FieldTag::__features => {
6213                            if !fields.insert(__FieldTag::__features) {
6214                                return std::result::Result::Err(A::Error::duplicate_field(
6215                                    "multiple values for features",
6216                                ));
6217                            }
6218                            result.features =
6219                                map.next_value::<std::option::Option<crate::FeatureSet>>()?;
6220                        }
6221                        __FieldTag::__uninterpreted_option => {
6222                            if !fields.insert(__FieldTag::__uninterpreted_option) {
6223                                return std::result::Result::Err(A::Error::duplicate_field(
6224                                    "multiple values for uninterpreted_option",
6225                                ));
6226                            }
6227                            result.uninterpreted_option = map.next_value::<std::option::Option<std::vec::Vec<crate::UninterpretedOption>>>()?.unwrap_or_default();
6228                        }
6229                        __FieldTag::Unknown(key) => {
6230                            let value = map.next_value::<serde_json::Value>()?;
6231                            result._unknown_fields.insert(key, value);
6232                        }
6233                    }
6234                }
6235                std::result::Result::Ok(result)
6236            }
6237        }
6238        deserializer.deserialize_any(Visitor)
6239    }
6240}
6241
6242#[doc(hidden)]
6243impl serde::ser::Serialize for MessageOptions {
6244    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6245    where
6246        S: serde::ser::Serializer,
6247    {
6248        use serde::ser::SerializeMap;
6249        #[allow(unused_imports)]
6250        use std::option::Option::Some;
6251        let mut state = serializer.serialize_map(std::option::Option::None)?;
6252        if !wkt::internal::is_default(&self.message_set_wire_format) {
6253            state.serialize_entry("messageSetWireFormat", &self.message_set_wire_format)?;
6254        }
6255        if !wkt::internal::is_default(&self.no_standard_descriptor_accessor) {
6256            state.serialize_entry(
6257                "noStandardDescriptorAccessor",
6258                &self.no_standard_descriptor_accessor,
6259            )?;
6260        }
6261        if !wkt::internal::is_default(&self.deprecated) {
6262            state.serialize_entry("deprecated", &self.deprecated)?;
6263        }
6264        if !wkt::internal::is_default(&self.map_entry) {
6265            state.serialize_entry("mapEntry", &self.map_entry)?;
6266        }
6267        if !wkt::internal::is_default(&self.deprecated_legacy_json_field_conflicts) {
6268            state.serialize_entry(
6269                "deprecatedLegacyJsonFieldConflicts",
6270                &self.deprecated_legacy_json_field_conflicts,
6271            )?;
6272        }
6273        if self.features.is_some() {
6274            state.serialize_entry("features", &self.features)?;
6275        }
6276        if !self.uninterpreted_option.is_empty() {
6277            state.serialize_entry("uninterpretedOption", &self.uninterpreted_option)?;
6278        }
6279        if !self._unknown_fields.is_empty() {
6280            for (key, value) in self._unknown_fields.iter() {
6281                state.serialize_entry(key, &value)?;
6282            }
6283        }
6284        state.end()
6285    }
6286}
6287
6288#[derive(Clone, Debug, Default, PartialEq)]
6289#[non_exhaustive]
6290pub struct FieldOptions {
6291    /// NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead.
6292    /// The ctype option instructs the C++ code generator to use a different
6293    /// representation of the field than it normally would.  See the specific
6294    /// options below.  This option is only implemented to support use of
6295    /// [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of
6296    /// type "bytes" in the open source release.
6297    /// TODO: make ctype actually deprecated.
6298    pub ctype: crate::field_options::CType,
6299
6300    /// The packed option can be enabled for repeated primitive fields to enable
6301    /// a more efficient representation on the wire. Rather than repeatedly
6302    /// writing the tag and type for each element, the entire array is encoded as
6303    /// a single length-delimited blob. In proto3, only explicit setting it to
6304    /// false will avoid using packed encoding.  This option is prohibited in
6305    /// Editions, but the `repeated_field_encoding` feature can be used to control
6306    /// the behavior.
6307    pub packed: bool,
6308
6309    /// The jstype option determines the JavaScript type used for values of the
6310    /// field.  The option is permitted only for 64 bit integral and fixed types
6311    /// (int64, uint64, sint64, fixed64, sfixed64).  A field with jstype JS_STRING
6312    /// is represented as JavaScript string, which avoids loss of precision that
6313    /// can happen when a large value is converted to a floating point JavaScript.
6314    /// Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
6315    /// use the JavaScript "number" type.  The behavior of the default option
6316    /// JS_NORMAL is implementation dependent.
6317    ///
6318    /// This option is an enum to permit additional types to be added, e.g.
6319    /// goog.math.Integer.
6320    pub jstype: crate::field_options::JSType,
6321
6322    /// Should this field be parsed lazily?  Lazy applies only to message-type
6323    /// fields.  It means that when the outer message is initially parsed, the
6324    /// inner message's contents will not be parsed but instead stored in encoded
6325    /// form.  The inner message will actually be parsed when it is first accessed.
6326    ///
6327    /// This is only a hint.  Implementations are free to choose whether to use
6328    /// eager or lazy parsing regardless of the value of this option.  However,
6329    /// setting this option true suggests that the protocol author believes that
6330    /// using lazy parsing on this field is worth the additional bookkeeping
6331    /// overhead typically needed to implement it.
6332    ///
6333    /// This option does not affect the public interface of any generated code;
6334    /// all method signatures remain the same.  Furthermore, thread-safety of the
6335    /// interface is not affected by this option; const methods remain safe to
6336    /// call from multiple threads concurrently, while non-const methods continue
6337    /// to require exclusive access.
6338    ///
6339    /// Note that lazy message fields are still eagerly verified to check
6340    /// ill-formed wireformat or missing required fields. Calling IsInitialized()
6341    /// on the outer message would fail if the inner message has missing required
6342    /// fields. Failed verification would result in parsing failure (except when
6343    /// uninitialized messages are acceptable).
6344    pub lazy: bool,
6345
6346    /// unverified_lazy does no correctness checks on the byte stream. This should
6347    /// only be used where lazy with verification is prohibitive for performance
6348    /// reasons.
6349    pub unverified_lazy: bool,
6350
6351    /// Is this field deprecated?
6352    /// Depending on the target platform, this can emit Deprecated annotations
6353    /// for accessors, or it will be completely ignored; in the very least, this
6354    /// is a formalization for deprecating fields.
6355    pub deprecated: bool,
6356
6357    /// For Google-internal migration only. Do not use.
6358    pub weak: bool,
6359
6360    /// Indicate that the field value should not be printed out when using debug
6361    /// formats, e.g. when the field contains sensitive credentials.
6362    pub debug_redact: bool,
6363
6364    pub retention: crate::field_options::OptionRetention,
6365
6366    pub targets: std::vec::Vec<crate::field_options::OptionTargetType>,
6367
6368    pub edition_defaults: std::vec::Vec<crate::field_options::EditionDefault>,
6369
6370    /// Any features defined in the specific edition.
6371    pub features: std::option::Option<crate::FeatureSet>,
6372
6373    pub feature_support: std::option::Option<crate::field_options::FeatureSupport>,
6374
6375    /// The parser stores options it doesn't recognize here. See above.
6376    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
6377
6378    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6379}
6380
6381impl FieldOptions {
6382    pub fn new() -> Self {
6383        std::default::Default::default()
6384    }
6385
6386    /// Sets the value of [ctype][crate::FieldOptions::ctype].
6387    pub fn set_ctype<T: std::convert::Into<crate::field_options::CType>>(mut self, v: T) -> Self {
6388        self.ctype = v.into();
6389        self
6390    }
6391
6392    /// Sets the value of [packed][crate::FieldOptions::packed].
6393    pub fn set_packed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6394        self.packed = v.into();
6395        self
6396    }
6397
6398    /// Sets the value of [jstype][crate::FieldOptions::jstype].
6399    pub fn set_jstype<T: std::convert::Into<crate::field_options::JSType>>(mut self, v: T) -> Self {
6400        self.jstype = v.into();
6401        self
6402    }
6403
6404    /// Sets the value of [lazy][crate::FieldOptions::lazy].
6405    pub fn set_lazy<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6406        self.lazy = v.into();
6407        self
6408    }
6409
6410    /// Sets the value of [unverified_lazy][crate::FieldOptions::unverified_lazy].
6411    pub fn set_unverified_lazy<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6412        self.unverified_lazy = v.into();
6413        self
6414    }
6415
6416    /// Sets the value of [deprecated][crate::FieldOptions::deprecated].
6417    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6418        self.deprecated = v.into();
6419        self
6420    }
6421
6422    /// Sets the value of [weak][crate::FieldOptions::weak].
6423    pub fn set_weak<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6424        self.weak = v.into();
6425        self
6426    }
6427
6428    /// Sets the value of [debug_redact][crate::FieldOptions::debug_redact].
6429    pub fn set_debug_redact<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6430        self.debug_redact = v.into();
6431        self
6432    }
6433
6434    /// Sets the value of [retention][crate::FieldOptions::retention].
6435    pub fn set_retention<T: std::convert::Into<crate::field_options::OptionRetention>>(
6436        mut self,
6437        v: T,
6438    ) -> Self {
6439        self.retention = v.into();
6440        self
6441    }
6442
6443    /// Sets the value of [targets][crate::FieldOptions::targets].
6444    pub fn set_targets<T, V>(mut self, v: T) -> Self
6445    where
6446        T: std::iter::IntoIterator<Item = V>,
6447        V: std::convert::Into<crate::field_options::OptionTargetType>,
6448    {
6449        use std::iter::Iterator;
6450        self.targets = v.into_iter().map(|i| i.into()).collect();
6451        self
6452    }
6453
6454    /// Sets the value of [edition_defaults][crate::FieldOptions::edition_defaults].
6455    pub fn set_edition_defaults<T, V>(mut self, v: T) -> Self
6456    where
6457        T: std::iter::IntoIterator<Item = V>,
6458        V: std::convert::Into<crate::field_options::EditionDefault>,
6459    {
6460        use std::iter::Iterator;
6461        self.edition_defaults = v.into_iter().map(|i| i.into()).collect();
6462        self
6463    }
6464
6465    /// Sets the value of [features][crate::FieldOptions::features].
6466    pub fn set_features<T>(mut self, v: T) -> Self
6467    where
6468        T: std::convert::Into<crate::FeatureSet>,
6469    {
6470        self.features = std::option::Option::Some(v.into());
6471        self
6472    }
6473
6474    /// Sets or clears the value of [features][crate::FieldOptions::features].
6475    pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
6476    where
6477        T: std::convert::Into<crate::FeatureSet>,
6478    {
6479        self.features = v.map(|x| x.into());
6480        self
6481    }
6482
6483    /// Sets the value of [feature_support][crate::FieldOptions::feature_support].
6484    pub fn set_feature_support<T>(mut self, v: T) -> Self
6485    where
6486        T: std::convert::Into<crate::field_options::FeatureSupport>,
6487    {
6488        self.feature_support = std::option::Option::Some(v.into());
6489        self
6490    }
6491
6492    /// Sets or clears the value of [feature_support][crate::FieldOptions::feature_support].
6493    pub fn set_or_clear_feature_support<T>(mut self, v: std::option::Option<T>) -> Self
6494    where
6495        T: std::convert::Into<crate::field_options::FeatureSupport>,
6496    {
6497        self.feature_support = v.map(|x| x.into());
6498        self
6499    }
6500
6501    /// Sets the value of [uninterpreted_option][crate::FieldOptions::uninterpreted_option].
6502    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
6503    where
6504        T: std::iter::IntoIterator<Item = V>,
6505        V: std::convert::Into<crate::UninterpretedOption>,
6506    {
6507        use std::iter::Iterator;
6508        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
6509        self
6510    }
6511}
6512
6513impl wkt::message::Message for FieldOptions {
6514    fn typename() -> &'static str {
6515        "type.googleapis.com/google.protobuf.FieldOptions"
6516    }
6517}
6518
6519#[doc(hidden)]
6520impl<'de> serde::de::Deserialize<'de> for FieldOptions {
6521    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6522    where
6523        D: serde::Deserializer<'de>,
6524    {
6525        #[allow(non_camel_case_types)]
6526        #[doc(hidden)]
6527        #[derive(PartialEq, Eq, Hash)]
6528        enum __FieldTag {
6529            __ctype,
6530            __packed,
6531            __jstype,
6532            __lazy,
6533            __unverified_lazy,
6534            __deprecated,
6535            __weak,
6536            __debug_redact,
6537            __retention,
6538            __targets,
6539            __edition_defaults,
6540            __features,
6541            __feature_support,
6542            __uninterpreted_option,
6543            Unknown(std::string::String),
6544        }
6545        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6546            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6547            where
6548                D: serde::Deserializer<'de>,
6549            {
6550                struct Visitor;
6551                impl<'de> serde::de::Visitor<'de> for Visitor {
6552                    type Value = __FieldTag;
6553                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6554                        formatter.write_str("a field name for FieldOptions")
6555                    }
6556                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6557                    where
6558                        E: serde::de::Error,
6559                    {
6560                        use std::result::Result::Ok;
6561                        use std::string::ToString;
6562                        match value {
6563                            "ctype" => Ok(__FieldTag::__ctype),
6564                            "packed" => Ok(__FieldTag::__packed),
6565                            "jstype" => Ok(__FieldTag::__jstype),
6566                            "lazy" => Ok(__FieldTag::__lazy),
6567                            "unverifiedLazy" => Ok(__FieldTag::__unverified_lazy),
6568                            "unverified_lazy" => Ok(__FieldTag::__unverified_lazy),
6569                            "deprecated" => Ok(__FieldTag::__deprecated),
6570                            "weak" => Ok(__FieldTag::__weak),
6571                            "debugRedact" => Ok(__FieldTag::__debug_redact),
6572                            "debug_redact" => Ok(__FieldTag::__debug_redact),
6573                            "retention" => Ok(__FieldTag::__retention),
6574                            "targets" => Ok(__FieldTag::__targets),
6575                            "editionDefaults" => Ok(__FieldTag::__edition_defaults),
6576                            "edition_defaults" => Ok(__FieldTag::__edition_defaults),
6577                            "features" => Ok(__FieldTag::__features),
6578                            "featureSupport" => Ok(__FieldTag::__feature_support),
6579                            "feature_support" => Ok(__FieldTag::__feature_support),
6580                            "uninterpretedOption" => Ok(__FieldTag::__uninterpreted_option),
6581                            "uninterpreted_option" => Ok(__FieldTag::__uninterpreted_option),
6582                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6583                        }
6584                    }
6585                }
6586                deserializer.deserialize_identifier(Visitor)
6587            }
6588        }
6589        struct Visitor;
6590        impl<'de> serde::de::Visitor<'de> for Visitor {
6591            type Value = FieldOptions;
6592            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6593                formatter.write_str("struct FieldOptions")
6594            }
6595            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6596            where
6597                A: serde::de::MapAccess<'de>,
6598            {
6599                #[allow(unused_imports)]
6600                use serde::de::Error;
6601                use std::option::Option::Some;
6602                let mut fields = std::collections::HashSet::new();
6603                let mut result = Self::Value::new();
6604                while let Some(tag) = map.next_key::<__FieldTag>()? {
6605                    #[allow(clippy::match_single_binding)]
6606                    match tag {
6607                        __FieldTag::__ctype => {
6608                            if !fields.insert(__FieldTag::__ctype) {
6609                                return std::result::Result::Err(A::Error::duplicate_field(
6610                                    "multiple values for ctype",
6611                                ));
6612                            }
6613                            result.ctype = map
6614                                .next_value::<std::option::Option<crate::field_options::CType>>()?
6615                                .unwrap_or_default();
6616                        }
6617                        __FieldTag::__packed => {
6618                            if !fields.insert(__FieldTag::__packed) {
6619                                return std::result::Result::Err(A::Error::duplicate_field(
6620                                    "multiple values for packed",
6621                                ));
6622                            }
6623                            result.packed = map
6624                                .next_value::<std::option::Option<bool>>()?
6625                                .unwrap_or_default();
6626                        }
6627                        __FieldTag::__jstype => {
6628                            if !fields.insert(__FieldTag::__jstype) {
6629                                return std::result::Result::Err(A::Error::duplicate_field(
6630                                    "multiple values for jstype",
6631                                ));
6632                            }
6633                            result.jstype = map
6634                                .next_value::<std::option::Option<crate::field_options::JSType>>()?
6635                                .unwrap_or_default();
6636                        }
6637                        __FieldTag::__lazy => {
6638                            if !fields.insert(__FieldTag::__lazy) {
6639                                return std::result::Result::Err(A::Error::duplicate_field(
6640                                    "multiple values for lazy",
6641                                ));
6642                            }
6643                            result.lazy = map
6644                                .next_value::<std::option::Option<bool>>()?
6645                                .unwrap_or_default();
6646                        }
6647                        __FieldTag::__unverified_lazy => {
6648                            if !fields.insert(__FieldTag::__unverified_lazy) {
6649                                return std::result::Result::Err(A::Error::duplicate_field(
6650                                    "multiple values for unverified_lazy",
6651                                ));
6652                            }
6653                            result.unverified_lazy = map
6654                                .next_value::<std::option::Option<bool>>()?
6655                                .unwrap_or_default();
6656                        }
6657                        __FieldTag::__deprecated => {
6658                            if !fields.insert(__FieldTag::__deprecated) {
6659                                return std::result::Result::Err(A::Error::duplicate_field(
6660                                    "multiple values for deprecated",
6661                                ));
6662                            }
6663                            result.deprecated = map
6664                                .next_value::<std::option::Option<bool>>()?
6665                                .unwrap_or_default();
6666                        }
6667                        __FieldTag::__weak => {
6668                            if !fields.insert(__FieldTag::__weak) {
6669                                return std::result::Result::Err(A::Error::duplicate_field(
6670                                    "multiple values for weak",
6671                                ));
6672                            }
6673                            result.weak = map
6674                                .next_value::<std::option::Option<bool>>()?
6675                                .unwrap_or_default();
6676                        }
6677                        __FieldTag::__debug_redact => {
6678                            if !fields.insert(__FieldTag::__debug_redact) {
6679                                return std::result::Result::Err(A::Error::duplicate_field(
6680                                    "multiple values for debug_redact",
6681                                ));
6682                            }
6683                            result.debug_redact = map
6684                                .next_value::<std::option::Option<bool>>()?
6685                                .unwrap_or_default();
6686                        }
6687                        __FieldTag::__retention => {
6688                            if !fields.insert(__FieldTag::__retention) {
6689                                return std::result::Result::Err(A::Error::duplicate_field(
6690                                    "multiple values for retention",
6691                                ));
6692                            }
6693                            result.retention = map.next_value::<std::option::Option<crate::field_options::OptionRetention>>()?.unwrap_or_default();
6694                        }
6695                        __FieldTag::__targets => {
6696                            if !fields.insert(__FieldTag::__targets) {
6697                                return std::result::Result::Err(A::Error::duplicate_field(
6698                                    "multiple values for targets",
6699                                ));
6700                            }
6701                            result.targets = map
6702                                .next_value::<std::option::Option<
6703                                    std::vec::Vec<crate::field_options::OptionTargetType>,
6704                                >>()?
6705                                .unwrap_or_default();
6706                        }
6707                        __FieldTag::__edition_defaults => {
6708                            if !fields.insert(__FieldTag::__edition_defaults) {
6709                                return std::result::Result::Err(A::Error::duplicate_field(
6710                                    "multiple values for edition_defaults",
6711                                ));
6712                            }
6713                            result.edition_defaults = map
6714                                .next_value::<std::option::Option<
6715                                    std::vec::Vec<crate::field_options::EditionDefault>,
6716                                >>()?
6717                                .unwrap_or_default();
6718                        }
6719                        __FieldTag::__features => {
6720                            if !fields.insert(__FieldTag::__features) {
6721                                return std::result::Result::Err(A::Error::duplicate_field(
6722                                    "multiple values for features",
6723                                ));
6724                            }
6725                            result.features =
6726                                map.next_value::<std::option::Option<crate::FeatureSet>>()?;
6727                        }
6728                        __FieldTag::__feature_support => {
6729                            if !fields.insert(__FieldTag::__feature_support) {
6730                                return std::result::Result::Err(A::Error::duplicate_field(
6731                                    "multiple values for feature_support",
6732                                ));
6733                            }
6734                            result.feature_support = map.next_value::<std::option::Option<crate::field_options::FeatureSupport>>()?
6735                                ;
6736                        }
6737                        __FieldTag::__uninterpreted_option => {
6738                            if !fields.insert(__FieldTag::__uninterpreted_option) {
6739                                return std::result::Result::Err(A::Error::duplicate_field(
6740                                    "multiple values for uninterpreted_option",
6741                                ));
6742                            }
6743                            result.uninterpreted_option = map.next_value::<std::option::Option<std::vec::Vec<crate::UninterpretedOption>>>()?.unwrap_or_default();
6744                        }
6745                        __FieldTag::Unknown(key) => {
6746                            let value = map.next_value::<serde_json::Value>()?;
6747                            result._unknown_fields.insert(key, value);
6748                        }
6749                    }
6750                }
6751                std::result::Result::Ok(result)
6752            }
6753        }
6754        deserializer.deserialize_any(Visitor)
6755    }
6756}
6757
6758#[doc(hidden)]
6759impl serde::ser::Serialize for FieldOptions {
6760    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6761    where
6762        S: serde::ser::Serializer,
6763    {
6764        use serde::ser::SerializeMap;
6765        #[allow(unused_imports)]
6766        use std::option::Option::Some;
6767        let mut state = serializer.serialize_map(std::option::Option::None)?;
6768        if !wkt::internal::is_default(&self.ctype) {
6769            state.serialize_entry("ctype", &self.ctype)?;
6770        }
6771        if !wkt::internal::is_default(&self.packed) {
6772            state.serialize_entry("packed", &self.packed)?;
6773        }
6774        if !wkt::internal::is_default(&self.jstype) {
6775            state.serialize_entry("jstype", &self.jstype)?;
6776        }
6777        if !wkt::internal::is_default(&self.lazy) {
6778            state.serialize_entry("lazy", &self.lazy)?;
6779        }
6780        if !wkt::internal::is_default(&self.unverified_lazy) {
6781            state.serialize_entry("unverifiedLazy", &self.unverified_lazy)?;
6782        }
6783        if !wkt::internal::is_default(&self.deprecated) {
6784            state.serialize_entry("deprecated", &self.deprecated)?;
6785        }
6786        if !wkt::internal::is_default(&self.weak) {
6787            state.serialize_entry("weak", &self.weak)?;
6788        }
6789        if !wkt::internal::is_default(&self.debug_redact) {
6790            state.serialize_entry("debugRedact", &self.debug_redact)?;
6791        }
6792        if !wkt::internal::is_default(&self.retention) {
6793            state.serialize_entry("retention", &self.retention)?;
6794        }
6795        if !self.targets.is_empty() {
6796            state.serialize_entry("targets", &self.targets)?;
6797        }
6798        if !self.edition_defaults.is_empty() {
6799            state.serialize_entry("editionDefaults", &self.edition_defaults)?;
6800        }
6801        if self.features.is_some() {
6802            state.serialize_entry("features", &self.features)?;
6803        }
6804        if self.feature_support.is_some() {
6805            state.serialize_entry("featureSupport", &self.feature_support)?;
6806        }
6807        if !self.uninterpreted_option.is_empty() {
6808            state.serialize_entry("uninterpretedOption", &self.uninterpreted_option)?;
6809        }
6810        if !self._unknown_fields.is_empty() {
6811            for (key, value) in self._unknown_fields.iter() {
6812                state.serialize_entry(key, &value)?;
6813            }
6814        }
6815        state.end()
6816    }
6817}
6818
6819/// Defines additional types related to [FieldOptions].
6820pub mod field_options {
6821    #[allow(unused_imports)]
6822    use super::*;
6823
6824    #[derive(Clone, Debug, Default, PartialEq)]
6825    #[non_exhaustive]
6826    pub struct EditionDefault {
6827        pub edition: crate::Edition,
6828
6829        pub value: std::string::String,
6830
6831        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6832    }
6833
6834    impl EditionDefault {
6835        pub fn new() -> Self {
6836            std::default::Default::default()
6837        }
6838
6839        /// Sets the value of [edition][crate::field_options::EditionDefault::edition].
6840        pub fn set_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
6841            self.edition = v.into();
6842            self
6843        }
6844
6845        /// Sets the value of [value][crate::field_options::EditionDefault::value].
6846        pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6847            self.value = v.into();
6848            self
6849        }
6850    }
6851
6852    impl wkt::message::Message for EditionDefault {
6853        fn typename() -> &'static str {
6854            "type.googleapis.com/google.protobuf.FieldOptions.EditionDefault"
6855        }
6856    }
6857
6858    #[doc(hidden)]
6859    impl<'de> serde::de::Deserialize<'de> for EditionDefault {
6860        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6861        where
6862            D: serde::Deserializer<'de>,
6863        {
6864            #[allow(non_camel_case_types)]
6865            #[doc(hidden)]
6866            #[derive(PartialEq, Eq, Hash)]
6867            enum __FieldTag {
6868                __edition,
6869                __value,
6870                Unknown(std::string::String),
6871            }
6872            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6873                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6874                where
6875                    D: serde::Deserializer<'de>,
6876                {
6877                    struct Visitor;
6878                    impl<'de> serde::de::Visitor<'de> for Visitor {
6879                        type Value = __FieldTag;
6880                        fn expecting(
6881                            &self,
6882                            formatter: &mut std::fmt::Formatter,
6883                        ) -> std::fmt::Result {
6884                            formatter.write_str("a field name for EditionDefault")
6885                        }
6886                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6887                        where
6888                            E: serde::de::Error,
6889                        {
6890                            use std::result::Result::Ok;
6891                            use std::string::ToString;
6892                            match value {
6893                                "edition" => Ok(__FieldTag::__edition),
6894                                "value" => Ok(__FieldTag::__value),
6895                                _ => Ok(__FieldTag::Unknown(value.to_string())),
6896                            }
6897                        }
6898                    }
6899                    deserializer.deserialize_identifier(Visitor)
6900                }
6901            }
6902            struct Visitor;
6903            impl<'de> serde::de::Visitor<'de> for Visitor {
6904                type Value = EditionDefault;
6905                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6906                    formatter.write_str("struct EditionDefault")
6907                }
6908                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6909                where
6910                    A: serde::de::MapAccess<'de>,
6911                {
6912                    #[allow(unused_imports)]
6913                    use serde::de::Error;
6914                    use std::option::Option::Some;
6915                    let mut fields = std::collections::HashSet::new();
6916                    let mut result = Self::Value::new();
6917                    while let Some(tag) = map.next_key::<__FieldTag>()? {
6918                        #[allow(clippy::match_single_binding)]
6919                        match tag {
6920                            __FieldTag::__edition => {
6921                                if !fields.insert(__FieldTag::__edition) {
6922                                    return std::result::Result::Err(A::Error::duplicate_field(
6923                                        "multiple values for edition",
6924                                    ));
6925                                }
6926                                result.edition = map
6927                                    .next_value::<std::option::Option<crate::Edition>>()?
6928                                    .unwrap_or_default();
6929                            }
6930                            __FieldTag::__value => {
6931                                if !fields.insert(__FieldTag::__value) {
6932                                    return std::result::Result::Err(A::Error::duplicate_field(
6933                                        "multiple values for value",
6934                                    ));
6935                                }
6936                                result.value = map
6937                                    .next_value::<std::option::Option<std::string::String>>()?
6938                                    .unwrap_or_default();
6939                            }
6940                            __FieldTag::Unknown(key) => {
6941                                let value = map.next_value::<serde_json::Value>()?;
6942                                result._unknown_fields.insert(key, value);
6943                            }
6944                        }
6945                    }
6946                    std::result::Result::Ok(result)
6947                }
6948            }
6949            deserializer.deserialize_any(Visitor)
6950        }
6951    }
6952
6953    #[doc(hidden)]
6954    impl serde::ser::Serialize for EditionDefault {
6955        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6956        where
6957            S: serde::ser::Serializer,
6958        {
6959            use serde::ser::SerializeMap;
6960            #[allow(unused_imports)]
6961            use std::option::Option::Some;
6962            let mut state = serializer.serialize_map(std::option::Option::None)?;
6963            if !wkt::internal::is_default(&self.edition) {
6964                state.serialize_entry("edition", &self.edition)?;
6965            }
6966            if !self.value.is_empty() {
6967                state.serialize_entry("value", &self.value)?;
6968            }
6969            if !self._unknown_fields.is_empty() {
6970                for (key, value) in self._unknown_fields.iter() {
6971                    state.serialize_entry(key, &value)?;
6972                }
6973            }
6974            state.end()
6975        }
6976    }
6977
6978    /// Information about the support window of a feature.
6979    #[derive(Clone, Debug, Default, PartialEq)]
6980    #[non_exhaustive]
6981    pub struct FeatureSupport {
6982        /// The edition that this feature was first available in.  In editions
6983        /// earlier than this one, the default assigned to EDITION_LEGACY will be
6984        /// used, and proto files will not be able to override it.
6985        pub edition_introduced: crate::Edition,
6986
6987        /// The edition this feature becomes deprecated in.  Using this after this
6988        /// edition may trigger warnings.
6989        pub edition_deprecated: crate::Edition,
6990
6991        /// The deprecation warning text if this feature is used after the edition it
6992        /// was marked deprecated in.
6993        pub deprecation_warning: std::string::String,
6994
6995        /// The edition this feature is no longer available in.  In editions after
6996        /// this one, the last default assigned will be used, and proto files will
6997        /// not be able to override it.
6998        pub edition_removed: crate::Edition,
6999
7000        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7001    }
7002
7003    impl FeatureSupport {
7004        pub fn new() -> Self {
7005            std::default::Default::default()
7006        }
7007
7008        /// Sets the value of [edition_introduced][crate::field_options::FeatureSupport::edition_introduced].
7009        pub fn set_edition_introduced<T: std::convert::Into<crate::Edition>>(
7010            mut self,
7011            v: T,
7012        ) -> Self {
7013            self.edition_introduced = v.into();
7014            self
7015        }
7016
7017        /// Sets the value of [edition_deprecated][crate::field_options::FeatureSupport::edition_deprecated].
7018        pub fn set_edition_deprecated<T: std::convert::Into<crate::Edition>>(
7019            mut self,
7020            v: T,
7021        ) -> Self {
7022            self.edition_deprecated = v.into();
7023            self
7024        }
7025
7026        /// Sets the value of [deprecation_warning][crate::field_options::FeatureSupport::deprecation_warning].
7027        pub fn set_deprecation_warning<T: std::convert::Into<std::string::String>>(
7028            mut self,
7029            v: T,
7030        ) -> Self {
7031            self.deprecation_warning = v.into();
7032            self
7033        }
7034
7035        /// Sets the value of [edition_removed][crate::field_options::FeatureSupport::edition_removed].
7036        pub fn set_edition_removed<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
7037            self.edition_removed = v.into();
7038            self
7039        }
7040    }
7041
7042    impl wkt::message::Message for FeatureSupport {
7043        fn typename() -> &'static str {
7044            "type.googleapis.com/google.protobuf.FieldOptions.FeatureSupport"
7045        }
7046    }
7047
7048    #[doc(hidden)]
7049    impl<'de> serde::de::Deserialize<'de> for FeatureSupport {
7050        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7051        where
7052            D: serde::Deserializer<'de>,
7053        {
7054            #[allow(non_camel_case_types)]
7055            #[doc(hidden)]
7056            #[derive(PartialEq, Eq, Hash)]
7057            enum __FieldTag {
7058                __edition_introduced,
7059                __edition_deprecated,
7060                __deprecation_warning,
7061                __edition_removed,
7062                Unknown(std::string::String),
7063            }
7064            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7065                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7066                where
7067                    D: serde::Deserializer<'de>,
7068                {
7069                    struct Visitor;
7070                    impl<'de> serde::de::Visitor<'de> for Visitor {
7071                        type Value = __FieldTag;
7072                        fn expecting(
7073                            &self,
7074                            formatter: &mut std::fmt::Formatter,
7075                        ) -> std::fmt::Result {
7076                            formatter.write_str("a field name for FeatureSupport")
7077                        }
7078                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7079                        where
7080                            E: serde::de::Error,
7081                        {
7082                            use std::result::Result::Ok;
7083                            use std::string::ToString;
7084                            match value {
7085                                "editionIntroduced" => Ok(__FieldTag::__edition_introduced),
7086                                "edition_introduced" => Ok(__FieldTag::__edition_introduced),
7087                                "editionDeprecated" => Ok(__FieldTag::__edition_deprecated),
7088                                "edition_deprecated" => Ok(__FieldTag::__edition_deprecated),
7089                                "deprecationWarning" => Ok(__FieldTag::__deprecation_warning),
7090                                "deprecation_warning" => Ok(__FieldTag::__deprecation_warning),
7091                                "editionRemoved" => Ok(__FieldTag::__edition_removed),
7092                                "edition_removed" => Ok(__FieldTag::__edition_removed),
7093                                _ => Ok(__FieldTag::Unknown(value.to_string())),
7094                            }
7095                        }
7096                    }
7097                    deserializer.deserialize_identifier(Visitor)
7098                }
7099            }
7100            struct Visitor;
7101            impl<'de> serde::de::Visitor<'de> for Visitor {
7102                type Value = FeatureSupport;
7103                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7104                    formatter.write_str("struct FeatureSupport")
7105                }
7106                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7107                where
7108                    A: serde::de::MapAccess<'de>,
7109                {
7110                    #[allow(unused_imports)]
7111                    use serde::de::Error;
7112                    use std::option::Option::Some;
7113                    let mut fields = std::collections::HashSet::new();
7114                    let mut result = Self::Value::new();
7115                    while let Some(tag) = map.next_key::<__FieldTag>()? {
7116                        #[allow(clippy::match_single_binding)]
7117                        match tag {
7118                            __FieldTag::__edition_introduced => {
7119                                if !fields.insert(__FieldTag::__edition_introduced) {
7120                                    return std::result::Result::Err(A::Error::duplicate_field(
7121                                        "multiple values for edition_introduced",
7122                                    ));
7123                                }
7124                                result.edition_introduced = map
7125                                    .next_value::<std::option::Option<crate::Edition>>()?
7126                                    .unwrap_or_default();
7127                            }
7128                            __FieldTag::__edition_deprecated => {
7129                                if !fields.insert(__FieldTag::__edition_deprecated) {
7130                                    return std::result::Result::Err(A::Error::duplicate_field(
7131                                        "multiple values for edition_deprecated",
7132                                    ));
7133                                }
7134                                result.edition_deprecated = map
7135                                    .next_value::<std::option::Option<crate::Edition>>()?
7136                                    .unwrap_or_default();
7137                            }
7138                            __FieldTag::__deprecation_warning => {
7139                                if !fields.insert(__FieldTag::__deprecation_warning) {
7140                                    return std::result::Result::Err(A::Error::duplicate_field(
7141                                        "multiple values for deprecation_warning",
7142                                    ));
7143                                }
7144                                result.deprecation_warning = map
7145                                    .next_value::<std::option::Option<std::string::String>>()?
7146                                    .unwrap_or_default();
7147                            }
7148                            __FieldTag::__edition_removed => {
7149                                if !fields.insert(__FieldTag::__edition_removed) {
7150                                    return std::result::Result::Err(A::Error::duplicate_field(
7151                                        "multiple values for edition_removed",
7152                                    ));
7153                                }
7154                                result.edition_removed = map
7155                                    .next_value::<std::option::Option<crate::Edition>>()?
7156                                    .unwrap_or_default();
7157                            }
7158                            __FieldTag::Unknown(key) => {
7159                                let value = map.next_value::<serde_json::Value>()?;
7160                                result._unknown_fields.insert(key, value);
7161                            }
7162                        }
7163                    }
7164                    std::result::Result::Ok(result)
7165                }
7166            }
7167            deserializer.deserialize_any(Visitor)
7168        }
7169    }
7170
7171    #[doc(hidden)]
7172    impl serde::ser::Serialize for FeatureSupport {
7173        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7174        where
7175            S: serde::ser::Serializer,
7176        {
7177            use serde::ser::SerializeMap;
7178            #[allow(unused_imports)]
7179            use std::option::Option::Some;
7180            let mut state = serializer.serialize_map(std::option::Option::None)?;
7181            if !wkt::internal::is_default(&self.edition_introduced) {
7182                state.serialize_entry("editionIntroduced", &self.edition_introduced)?;
7183            }
7184            if !wkt::internal::is_default(&self.edition_deprecated) {
7185                state.serialize_entry("editionDeprecated", &self.edition_deprecated)?;
7186            }
7187            if !self.deprecation_warning.is_empty() {
7188                state.serialize_entry("deprecationWarning", &self.deprecation_warning)?;
7189            }
7190            if !wkt::internal::is_default(&self.edition_removed) {
7191                state.serialize_entry("editionRemoved", &self.edition_removed)?;
7192            }
7193            if !self._unknown_fields.is_empty() {
7194                for (key, value) in self._unknown_fields.iter() {
7195                    state.serialize_entry(key, &value)?;
7196                }
7197            }
7198            state.end()
7199        }
7200    }
7201
7202    ///
7203    /// # Working with unknown values
7204    ///
7205    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7206    /// additional enum variants at any time. Adding new variants is not considered
7207    /// a breaking change. Applications should write their code in anticipation of:
7208    ///
7209    /// - New values appearing in future releases of the client library, **and**
7210    /// - New values received dynamically, without application changes.
7211    ///
7212    /// Please consult the [Working with enums] section in the user guide for some
7213    /// guidelines.
7214    ///
7215    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7216    #[derive(Clone, Debug, PartialEq)]
7217    #[non_exhaustive]
7218    pub enum CType {
7219        /// Default mode.
7220        String,
7221        /// The option [ctype=CORD] may be applied to a non-repeated field of type
7222        /// "bytes". It indicates that in C++, the data should be stored in a Cord
7223        /// instead of a string.  For very large strings, this may reduce memory
7224        /// fragmentation. It may also allow better performance when parsing from a
7225        /// Cord, or when parsing with aliasing enabled, as the parsed Cord may then
7226        /// alias the original buffer.
7227        Cord,
7228        StringPiece,
7229        /// If set, the enum was initialized with an unknown value.
7230        ///
7231        /// Applications can examine the value using [CType::value] or
7232        /// [CType::name].
7233        UnknownValue(c_type::UnknownValue),
7234    }
7235
7236    #[doc(hidden)]
7237    pub mod c_type {
7238        #[allow(unused_imports)]
7239        use super::*;
7240        #[derive(Clone, Debug, PartialEq)]
7241        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7242    }
7243
7244    impl CType {
7245        /// Gets the enum value.
7246        ///
7247        /// Returns `None` if the enum contains an unknown value deserialized from
7248        /// the string representation of enums.
7249        pub fn value(&self) -> std::option::Option<i32> {
7250            match self {
7251                Self::String => std::option::Option::Some(0),
7252                Self::Cord => std::option::Option::Some(1),
7253                Self::StringPiece => std::option::Option::Some(2),
7254                Self::UnknownValue(u) => u.0.value(),
7255            }
7256        }
7257
7258        /// Gets the enum value as a string.
7259        ///
7260        /// Returns `None` if the enum contains an unknown value deserialized from
7261        /// the integer representation of enums.
7262        pub fn name(&self) -> std::option::Option<&str> {
7263            match self {
7264                Self::String => std::option::Option::Some("STRING"),
7265                Self::Cord => std::option::Option::Some("CORD"),
7266                Self::StringPiece => std::option::Option::Some("STRING_PIECE"),
7267                Self::UnknownValue(u) => u.0.name(),
7268            }
7269        }
7270    }
7271
7272    impl std::default::Default for CType {
7273        fn default() -> Self {
7274            use std::convert::From;
7275            Self::from(0)
7276        }
7277    }
7278
7279    impl std::fmt::Display for CType {
7280        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7281            wkt::internal::display_enum(f, self.name(), self.value())
7282        }
7283    }
7284
7285    impl std::convert::From<i32> for CType {
7286        fn from(value: i32) -> Self {
7287            match value {
7288                0 => Self::String,
7289                1 => Self::Cord,
7290                2 => Self::StringPiece,
7291                _ => Self::UnknownValue(c_type::UnknownValue(
7292                    wkt::internal::UnknownEnumValue::Integer(value),
7293                )),
7294            }
7295        }
7296    }
7297
7298    impl std::convert::From<&str> for CType {
7299        fn from(value: &str) -> Self {
7300            use std::string::ToString;
7301            match value {
7302                "STRING" => Self::String,
7303                "CORD" => Self::Cord,
7304                "STRING_PIECE" => Self::StringPiece,
7305                _ => Self::UnknownValue(c_type::UnknownValue(
7306                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7307                )),
7308            }
7309        }
7310    }
7311
7312    impl serde::ser::Serialize for CType {
7313        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7314        where
7315            S: serde::Serializer,
7316        {
7317            match self {
7318                Self::String => serializer.serialize_i32(0),
7319                Self::Cord => serializer.serialize_i32(1),
7320                Self::StringPiece => serializer.serialize_i32(2),
7321                Self::UnknownValue(u) => u.0.serialize(serializer),
7322            }
7323        }
7324    }
7325
7326    impl<'de> serde::de::Deserialize<'de> for CType {
7327        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7328        where
7329            D: serde::Deserializer<'de>,
7330        {
7331            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CType>::new(
7332                ".google.protobuf.FieldOptions.CType",
7333            ))
7334        }
7335    }
7336
7337    ///
7338    /// # Working with unknown values
7339    ///
7340    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7341    /// additional enum variants at any time. Adding new variants is not considered
7342    /// a breaking change. Applications should write their code in anticipation of:
7343    ///
7344    /// - New values appearing in future releases of the client library, **and**
7345    /// - New values received dynamically, without application changes.
7346    ///
7347    /// Please consult the [Working with enums] section in the user guide for some
7348    /// guidelines.
7349    ///
7350    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7351    #[derive(Clone, Debug, PartialEq)]
7352    #[non_exhaustive]
7353    pub enum JSType {
7354        /// Use the default type.
7355        JsNormal,
7356        /// Use JavaScript strings.
7357        JsString,
7358        /// Use JavaScript numbers.
7359        JsNumber,
7360        /// If set, the enum was initialized with an unknown value.
7361        ///
7362        /// Applications can examine the value using [JSType::value] or
7363        /// [JSType::name].
7364        UnknownValue(js_type::UnknownValue),
7365    }
7366
7367    #[doc(hidden)]
7368    pub mod js_type {
7369        #[allow(unused_imports)]
7370        use super::*;
7371        #[derive(Clone, Debug, PartialEq)]
7372        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7373    }
7374
7375    impl JSType {
7376        /// Gets the enum value.
7377        ///
7378        /// Returns `None` if the enum contains an unknown value deserialized from
7379        /// the string representation of enums.
7380        pub fn value(&self) -> std::option::Option<i32> {
7381            match self {
7382                Self::JsNormal => std::option::Option::Some(0),
7383                Self::JsString => std::option::Option::Some(1),
7384                Self::JsNumber => std::option::Option::Some(2),
7385                Self::UnknownValue(u) => u.0.value(),
7386            }
7387        }
7388
7389        /// Gets the enum value as a string.
7390        ///
7391        /// Returns `None` if the enum contains an unknown value deserialized from
7392        /// the integer representation of enums.
7393        pub fn name(&self) -> std::option::Option<&str> {
7394            match self {
7395                Self::JsNormal => std::option::Option::Some("JS_NORMAL"),
7396                Self::JsString => std::option::Option::Some("JS_STRING"),
7397                Self::JsNumber => std::option::Option::Some("JS_NUMBER"),
7398                Self::UnknownValue(u) => u.0.name(),
7399            }
7400        }
7401    }
7402
7403    impl std::default::Default for JSType {
7404        fn default() -> Self {
7405            use std::convert::From;
7406            Self::from(0)
7407        }
7408    }
7409
7410    impl std::fmt::Display for JSType {
7411        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7412            wkt::internal::display_enum(f, self.name(), self.value())
7413        }
7414    }
7415
7416    impl std::convert::From<i32> for JSType {
7417        fn from(value: i32) -> Self {
7418            match value {
7419                0 => Self::JsNormal,
7420                1 => Self::JsString,
7421                2 => Self::JsNumber,
7422                _ => Self::UnknownValue(js_type::UnknownValue(
7423                    wkt::internal::UnknownEnumValue::Integer(value),
7424                )),
7425            }
7426        }
7427    }
7428
7429    impl std::convert::From<&str> for JSType {
7430        fn from(value: &str) -> Self {
7431            use std::string::ToString;
7432            match value {
7433                "JS_NORMAL" => Self::JsNormal,
7434                "JS_STRING" => Self::JsString,
7435                "JS_NUMBER" => Self::JsNumber,
7436                _ => Self::UnknownValue(js_type::UnknownValue(
7437                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7438                )),
7439            }
7440        }
7441    }
7442
7443    impl serde::ser::Serialize for JSType {
7444        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7445        where
7446            S: serde::Serializer,
7447        {
7448            match self {
7449                Self::JsNormal => serializer.serialize_i32(0),
7450                Self::JsString => serializer.serialize_i32(1),
7451                Self::JsNumber => serializer.serialize_i32(2),
7452                Self::UnknownValue(u) => u.0.serialize(serializer),
7453            }
7454        }
7455    }
7456
7457    impl<'de> serde::de::Deserialize<'de> for JSType {
7458        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7459        where
7460            D: serde::Deserializer<'de>,
7461        {
7462            deserializer.deserialize_any(wkt::internal::EnumVisitor::<JSType>::new(
7463                ".google.protobuf.FieldOptions.JSType",
7464            ))
7465        }
7466    }
7467
7468    /// If set to RETENTION_SOURCE, the option will be omitted from the binary.
7469    ///
7470    /// # Working with unknown values
7471    ///
7472    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7473    /// additional enum variants at any time. Adding new variants is not considered
7474    /// a breaking change. Applications should write their code in anticipation of:
7475    ///
7476    /// - New values appearing in future releases of the client library, **and**
7477    /// - New values received dynamically, without application changes.
7478    ///
7479    /// Please consult the [Working with enums] section in the user guide for some
7480    /// guidelines.
7481    ///
7482    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7483    #[derive(Clone, Debug, PartialEq)]
7484    #[non_exhaustive]
7485    pub enum OptionRetention {
7486        RetentionUnknown,
7487        RetentionRuntime,
7488        RetentionSource,
7489        /// If set, the enum was initialized with an unknown value.
7490        ///
7491        /// Applications can examine the value using [OptionRetention::value] or
7492        /// [OptionRetention::name].
7493        UnknownValue(option_retention::UnknownValue),
7494    }
7495
7496    #[doc(hidden)]
7497    pub mod option_retention {
7498        #[allow(unused_imports)]
7499        use super::*;
7500        #[derive(Clone, Debug, PartialEq)]
7501        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7502    }
7503
7504    impl OptionRetention {
7505        /// Gets the enum value.
7506        ///
7507        /// Returns `None` if the enum contains an unknown value deserialized from
7508        /// the string representation of enums.
7509        pub fn value(&self) -> std::option::Option<i32> {
7510            match self {
7511                Self::RetentionUnknown => std::option::Option::Some(0),
7512                Self::RetentionRuntime => std::option::Option::Some(1),
7513                Self::RetentionSource => std::option::Option::Some(2),
7514                Self::UnknownValue(u) => u.0.value(),
7515            }
7516        }
7517
7518        /// Gets the enum value as a string.
7519        ///
7520        /// Returns `None` if the enum contains an unknown value deserialized from
7521        /// the integer representation of enums.
7522        pub fn name(&self) -> std::option::Option<&str> {
7523            match self {
7524                Self::RetentionUnknown => std::option::Option::Some("RETENTION_UNKNOWN"),
7525                Self::RetentionRuntime => std::option::Option::Some("RETENTION_RUNTIME"),
7526                Self::RetentionSource => std::option::Option::Some("RETENTION_SOURCE"),
7527                Self::UnknownValue(u) => u.0.name(),
7528            }
7529        }
7530    }
7531
7532    impl std::default::Default for OptionRetention {
7533        fn default() -> Self {
7534            use std::convert::From;
7535            Self::from(0)
7536        }
7537    }
7538
7539    impl std::fmt::Display for OptionRetention {
7540        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7541            wkt::internal::display_enum(f, self.name(), self.value())
7542        }
7543    }
7544
7545    impl std::convert::From<i32> for OptionRetention {
7546        fn from(value: i32) -> Self {
7547            match value {
7548                0 => Self::RetentionUnknown,
7549                1 => Self::RetentionRuntime,
7550                2 => Self::RetentionSource,
7551                _ => Self::UnknownValue(option_retention::UnknownValue(
7552                    wkt::internal::UnknownEnumValue::Integer(value),
7553                )),
7554            }
7555        }
7556    }
7557
7558    impl std::convert::From<&str> for OptionRetention {
7559        fn from(value: &str) -> Self {
7560            use std::string::ToString;
7561            match value {
7562                "RETENTION_UNKNOWN" => Self::RetentionUnknown,
7563                "RETENTION_RUNTIME" => Self::RetentionRuntime,
7564                "RETENTION_SOURCE" => Self::RetentionSource,
7565                _ => Self::UnknownValue(option_retention::UnknownValue(
7566                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7567                )),
7568            }
7569        }
7570    }
7571
7572    impl serde::ser::Serialize for OptionRetention {
7573        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7574        where
7575            S: serde::Serializer,
7576        {
7577            match self {
7578                Self::RetentionUnknown => serializer.serialize_i32(0),
7579                Self::RetentionRuntime => serializer.serialize_i32(1),
7580                Self::RetentionSource => serializer.serialize_i32(2),
7581                Self::UnknownValue(u) => u.0.serialize(serializer),
7582            }
7583        }
7584    }
7585
7586    impl<'de> serde::de::Deserialize<'de> for OptionRetention {
7587        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7588        where
7589            D: serde::Deserializer<'de>,
7590        {
7591            deserializer.deserialize_any(wkt::internal::EnumVisitor::<OptionRetention>::new(
7592                ".google.protobuf.FieldOptions.OptionRetention",
7593            ))
7594        }
7595    }
7596
7597    /// This indicates the types of entities that the field may apply to when used
7598    /// as an option. If it is unset, then the field may be freely used as an
7599    /// option on any kind of entity.
7600    ///
7601    /// # Working with unknown values
7602    ///
7603    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7604    /// additional enum variants at any time. Adding new variants is not considered
7605    /// a breaking change. Applications should write their code in anticipation of:
7606    ///
7607    /// - New values appearing in future releases of the client library, **and**
7608    /// - New values received dynamically, without application changes.
7609    ///
7610    /// Please consult the [Working with enums] section in the user guide for some
7611    /// guidelines.
7612    ///
7613    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7614    #[derive(Clone, Debug, PartialEq)]
7615    #[non_exhaustive]
7616    pub enum OptionTargetType {
7617        TargetTypeUnknown,
7618        TargetTypeFile,
7619        TargetTypeExtensionRange,
7620        TargetTypeMessage,
7621        TargetTypeField,
7622        TargetTypeOneof,
7623        TargetTypeEnum,
7624        TargetTypeEnumEntry,
7625        TargetTypeService,
7626        TargetTypeMethod,
7627        /// If set, the enum was initialized with an unknown value.
7628        ///
7629        /// Applications can examine the value using [OptionTargetType::value] or
7630        /// [OptionTargetType::name].
7631        UnknownValue(option_target_type::UnknownValue),
7632    }
7633
7634    #[doc(hidden)]
7635    pub mod option_target_type {
7636        #[allow(unused_imports)]
7637        use super::*;
7638        #[derive(Clone, Debug, PartialEq)]
7639        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7640    }
7641
7642    impl OptionTargetType {
7643        /// Gets the enum value.
7644        ///
7645        /// Returns `None` if the enum contains an unknown value deserialized from
7646        /// the string representation of enums.
7647        pub fn value(&self) -> std::option::Option<i32> {
7648            match self {
7649                Self::TargetTypeUnknown => std::option::Option::Some(0),
7650                Self::TargetTypeFile => std::option::Option::Some(1),
7651                Self::TargetTypeExtensionRange => std::option::Option::Some(2),
7652                Self::TargetTypeMessage => std::option::Option::Some(3),
7653                Self::TargetTypeField => std::option::Option::Some(4),
7654                Self::TargetTypeOneof => std::option::Option::Some(5),
7655                Self::TargetTypeEnum => std::option::Option::Some(6),
7656                Self::TargetTypeEnumEntry => std::option::Option::Some(7),
7657                Self::TargetTypeService => std::option::Option::Some(8),
7658                Self::TargetTypeMethod => std::option::Option::Some(9),
7659                Self::UnknownValue(u) => u.0.value(),
7660            }
7661        }
7662
7663        /// Gets the enum value as a string.
7664        ///
7665        /// Returns `None` if the enum contains an unknown value deserialized from
7666        /// the integer representation of enums.
7667        pub fn name(&self) -> std::option::Option<&str> {
7668            match self {
7669                Self::TargetTypeUnknown => std::option::Option::Some("TARGET_TYPE_UNKNOWN"),
7670                Self::TargetTypeFile => std::option::Option::Some("TARGET_TYPE_FILE"),
7671                Self::TargetTypeExtensionRange => {
7672                    std::option::Option::Some("TARGET_TYPE_EXTENSION_RANGE")
7673                }
7674                Self::TargetTypeMessage => std::option::Option::Some("TARGET_TYPE_MESSAGE"),
7675                Self::TargetTypeField => std::option::Option::Some("TARGET_TYPE_FIELD"),
7676                Self::TargetTypeOneof => std::option::Option::Some("TARGET_TYPE_ONEOF"),
7677                Self::TargetTypeEnum => std::option::Option::Some("TARGET_TYPE_ENUM"),
7678                Self::TargetTypeEnumEntry => std::option::Option::Some("TARGET_TYPE_ENUM_ENTRY"),
7679                Self::TargetTypeService => std::option::Option::Some("TARGET_TYPE_SERVICE"),
7680                Self::TargetTypeMethod => std::option::Option::Some("TARGET_TYPE_METHOD"),
7681                Self::UnknownValue(u) => u.0.name(),
7682            }
7683        }
7684    }
7685
7686    impl std::default::Default for OptionTargetType {
7687        fn default() -> Self {
7688            use std::convert::From;
7689            Self::from(0)
7690        }
7691    }
7692
7693    impl std::fmt::Display for OptionTargetType {
7694        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7695            wkt::internal::display_enum(f, self.name(), self.value())
7696        }
7697    }
7698
7699    impl std::convert::From<i32> for OptionTargetType {
7700        fn from(value: i32) -> Self {
7701            match value {
7702                0 => Self::TargetTypeUnknown,
7703                1 => Self::TargetTypeFile,
7704                2 => Self::TargetTypeExtensionRange,
7705                3 => Self::TargetTypeMessage,
7706                4 => Self::TargetTypeField,
7707                5 => Self::TargetTypeOneof,
7708                6 => Self::TargetTypeEnum,
7709                7 => Self::TargetTypeEnumEntry,
7710                8 => Self::TargetTypeService,
7711                9 => Self::TargetTypeMethod,
7712                _ => Self::UnknownValue(option_target_type::UnknownValue(
7713                    wkt::internal::UnknownEnumValue::Integer(value),
7714                )),
7715            }
7716        }
7717    }
7718
7719    impl std::convert::From<&str> for OptionTargetType {
7720        fn from(value: &str) -> Self {
7721            use std::string::ToString;
7722            match value {
7723                "TARGET_TYPE_UNKNOWN" => Self::TargetTypeUnknown,
7724                "TARGET_TYPE_FILE" => Self::TargetTypeFile,
7725                "TARGET_TYPE_EXTENSION_RANGE" => Self::TargetTypeExtensionRange,
7726                "TARGET_TYPE_MESSAGE" => Self::TargetTypeMessage,
7727                "TARGET_TYPE_FIELD" => Self::TargetTypeField,
7728                "TARGET_TYPE_ONEOF" => Self::TargetTypeOneof,
7729                "TARGET_TYPE_ENUM" => Self::TargetTypeEnum,
7730                "TARGET_TYPE_ENUM_ENTRY" => Self::TargetTypeEnumEntry,
7731                "TARGET_TYPE_SERVICE" => Self::TargetTypeService,
7732                "TARGET_TYPE_METHOD" => Self::TargetTypeMethod,
7733                _ => Self::UnknownValue(option_target_type::UnknownValue(
7734                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7735                )),
7736            }
7737        }
7738    }
7739
7740    impl serde::ser::Serialize for OptionTargetType {
7741        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7742        where
7743            S: serde::Serializer,
7744        {
7745            match self {
7746                Self::TargetTypeUnknown => serializer.serialize_i32(0),
7747                Self::TargetTypeFile => serializer.serialize_i32(1),
7748                Self::TargetTypeExtensionRange => serializer.serialize_i32(2),
7749                Self::TargetTypeMessage => serializer.serialize_i32(3),
7750                Self::TargetTypeField => serializer.serialize_i32(4),
7751                Self::TargetTypeOneof => serializer.serialize_i32(5),
7752                Self::TargetTypeEnum => serializer.serialize_i32(6),
7753                Self::TargetTypeEnumEntry => serializer.serialize_i32(7),
7754                Self::TargetTypeService => serializer.serialize_i32(8),
7755                Self::TargetTypeMethod => serializer.serialize_i32(9),
7756                Self::UnknownValue(u) => u.0.serialize(serializer),
7757            }
7758        }
7759    }
7760
7761    impl<'de> serde::de::Deserialize<'de> for OptionTargetType {
7762        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7763        where
7764            D: serde::Deserializer<'de>,
7765        {
7766            deserializer.deserialize_any(wkt::internal::EnumVisitor::<OptionTargetType>::new(
7767                ".google.protobuf.FieldOptions.OptionTargetType",
7768            ))
7769        }
7770    }
7771}
7772
7773#[derive(Clone, Debug, Default, PartialEq)]
7774#[non_exhaustive]
7775pub struct OneofOptions {
7776    /// Any features defined in the specific edition.
7777    pub features: std::option::Option<crate::FeatureSet>,
7778
7779    /// The parser stores options it doesn't recognize here. See above.
7780    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
7781
7782    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7783}
7784
7785impl OneofOptions {
7786    pub fn new() -> Self {
7787        std::default::Default::default()
7788    }
7789
7790    /// Sets the value of [features][crate::OneofOptions::features].
7791    pub fn set_features<T>(mut self, v: T) -> Self
7792    where
7793        T: std::convert::Into<crate::FeatureSet>,
7794    {
7795        self.features = std::option::Option::Some(v.into());
7796        self
7797    }
7798
7799    /// Sets or clears the value of [features][crate::OneofOptions::features].
7800    pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
7801    where
7802        T: std::convert::Into<crate::FeatureSet>,
7803    {
7804        self.features = v.map(|x| x.into());
7805        self
7806    }
7807
7808    /// Sets the value of [uninterpreted_option][crate::OneofOptions::uninterpreted_option].
7809    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
7810    where
7811        T: std::iter::IntoIterator<Item = V>,
7812        V: std::convert::Into<crate::UninterpretedOption>,
7813    {
7814        use std::iter::Iterator;
7815        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
7816        self
7817    }
7818}
7819
7820impl wkt::message::Message for OneofOptions {
7821    fn typename() -> &'static str {
7822        "type.googleapis.com/google.protobuf.OneofOptions"
7823    }
7824}
7825
7826#[doc(hidden)]
7827impl<'de> serde::de::Deserialize<'de> for OneofOptions {
7828    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7829    where
7830        D: serde::Deserializer<'de>,
7831    {
7832        #[allow(non_camel_case_types)]
7833        #[doc(hidden)]
7834        #[derive(PartialEq, Eq, Hash)]
7835        enum __FieldTag {
7836            __features,
7837            __uninterpreted_option,
7838            Unknown(std::string::String),
7839        }
7840        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7841            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7842            where
7843                D: serde::Deserializer<'de>,
7844            {
7845                struct Visitor;
7846                impl<'de> serde::de::Visitor<'de> for Visitor {
7847                    type Value = __FieldTag;
7848                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7849                        formatter.write_str("a field name for OneofOptions")
7850                    }
7851                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7852                    where
7853                        E: serde::de::Error,
7854                    {
7855                        use std::result::Result::Ok;
7856                        use std::string::ToString;
7857                        match value {
7858                            "features" => Ok(__FieldTag::__features),
7859                            "uninterpretedOption" => Ok(__FieldTag::__uninterpreted_option),
7860                            "uninterpreted_option" => Ok(__FieldTag::__uninterpreted_option),
7861                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7862                        }
7863                    }
7864                }
7865                deserializer.deserialize_identifier(Visitor)
7866            }
7867        }
7868        struct Visitor;
7869        impl<'de> serde::de::Visitor<'de> for Visitor {
7870            type Value = OneofOptions;
7871            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7872                formatter.write_str("struct OneofOptions")
7873            }
7874            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7875            where
7876                A: serde::de::MapAccess<'de>,
7877            {
7878                #[allow(unused_imports)]
7879                use serde::de::Error;
7880                use std::option::Option::Some;
7881                let mut fields = std::collections::HashSet::new();
7882                let mut result = Self::Value::new();
7883                while let Some(tag) = map.next_key::<__FieldTag>()? {
7884                    #[allow(clippy::match_single_binding)]
7885                    match tag {
7886                        __FieldTag::__features => {
7887                            if !fields.insert(__FieldTag::__features) {
7888                                return std::result::Result::Err(A::Error::duplicate_field(
7889                                    "multiple values for features",
7890                                ));
7891                            }
7892                            result.features =
7893                                map.next_value::<std::option::Option<crate::FeatureSet>>()?;
7894                        }
7895                        __FieldTag::__uninterpreted_option => {
7896                            if !fields.insert(__FieldTag::__uninterpreted_option) {
7897                                return std::result::Result::Err(A::Error::duplicate_field(
7898                                    "multiple values for uninterpreted_option",
7899                                ));
7900                            }
7901                            result.uninterpreted_option = map.next_value::<std::option::Option<std::vec::Vec<crate::UninterpretedOption>>>()?.unwrap_or_default();
7902                        }
7903                        __FieldTag::Unknown(key) => {
7904                            let value = map.next_value::<serde_json::Value>()?;
7905                            result._unknown_fields.insert(key, value);
7906                        }
7907                    }
7908                }
7909                std::result::Result::Ok(result)
7910            }
7911        }
7912        deserializer.deserialize_any(Visitor)
7913    }
7914}
7915
7916#[doc(hidden)]
7917impl serde::ser::Serialize for OneofOptions {
7918    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7919    where
7920        S: serde::ser::Serializer,
7921    {
7922        use serde::ser::SerializeMap;
7923        #[allow(unused_imports)]
7924        use std::option::Option::Some;
7925        let mut state = serializer.serialize_map(std::option::Option::None)?;
7926        if self.features.is_some() {
7927            state.serialize_entry("features", &self.features)?;
7928        }
7929        if !self.uninterpreted_option.is_empty() {
7930            state.serialize_entry("uninterpretedOption", &self.uninterpreted_option)?;
7931        }
7932        if !self._unknown_fields.is_empty() {
7933            for (key, value) in self._unknown_fields.iter() {
7934                state.serialize_entry(key, &value)?;
7935            }
7936        }
7937        state.end()
7938    }
7939}
7940
7941#[derive(Clone, Debug, Default, PartialEq)]
7942#[non_exhaustive]
7943pub struct EnumOptions {
7944    /// Set this option to true to allow mapping different tag names to the same
7945    /// value.
7946    pub allow_alias: bool,
7947
7948    /// Is this enum deprecated?
7949    /// Depending on the target platform, this can emit Deprecated annotations
7950    /// for the enum, or it will be completely ignored; in the very least, this
7951    /// is a formalization for deprecating enums.
7952    pub deprecated: bool,
7953
7954    /// Enable the legacy handling of JSON field name conflicts.  This lowercases
7955    /// and strips underscored from the fields before comparison in proto3 only.
7956    /// The new behavior takes `json_name` into account and applies to proto2 as
7957    /// well.
7958    /// TODO Remove this legacy behavior once downstream teams have
7959    /// had time to migrate.
7960    #[deprecated]
7961    pub deprecated_legacy_json_field_conflicts: bool,
7962
7963    /// Any features defined in the specific edition.
7964    pub features: std::option::Option<crate::FeatureSet>,
7965
7966    /// The parser stores options it doesn't recognize here. See above.
7967    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
7968
7969    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7970}
7971
7972impl EnumOptions {
7973    pub fn new() -> Self {
7974        std::default::Default::default()
7975    }
7976
7977    /// Sets the value of [allow_alias][crate::EnumOptions::allow_alias].
7978    pub fn set_allow_alias<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7979        self.allow_alias = v.into();
7980        self
7981    }
7982
7983    /// Sets the value of [deprecated][crate::EnumOptions::deprecated].
7984    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7985        self.deprecated = v.into();
7986        self
7987    }
7988
7989    /// Sets the value of [deprecated_legacy_json_field_conflicts][crate::EnumOptions::deprecated_legacy_json_field_conflicts].
7990    #[deprecated]
7991    pub fn set_deprecated_legacy_json_field_conflicts<T: std::convert::Into<bool>>(
7992        mut self,
7993        v: T,
7994    ) -> Self {
7995        self.deprecated_legacy_json_field_conflicts = v.into();
7996        self
7997    }
7998
7999    /// Sets the value of [features][crate::EnumOptions::features].
8000    pub fn set_features<T>(mut self, v: T) -> Self
8001    where
8002        T: std::convert::Into<crate::FeatureSet>,
8003    {
8004        self.features = std::option::Option::Some(v.into());
8005        self
8006    }
8007
8008    /// Sets or clears the value of [features][crate::EnumOptions::features].
8009    pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
8010    where
8011        T: std::convert::Into<crate::FeatureSet>,
8012    {
8013        self.features = v.map(|x| x.into());
8014        self
8015    }
8016
8017    /// Sets the value of [uninterpreted_option][crate::EnumOptions::uninterpreted_option].
8018    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
8019    where
8020        T: std::iter::IntoIterator<Item = V>,
8021        V: std::convert::Into<crate::UninterpretedOption>,
8022    {
8023        use std::iter::Iterator;
8024        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
8025        self
8026    }
8027}
8028
8029impl wkt::message::Message for EnumOptions {
8030    fn typename() -> &'static str {
8031        "type.googleapis.com/google.protobuf.EnumOptions"
8032    }
8033}
8034
8035#[doc(hidden)]
8036impl<'de> serde::de::Deserialize<'de> for EnumOptions {
8037    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8038    where
8039        D: serde::Deserializer<'de>,
8040    {
8041        #[allow(non_camel_case_types)]
8042        #[doc(hidden)]
8043        #[derive(PartialEq, Eq, Hash)]
8044        enum __FieldTag {
8045            __allow_alias,
8046            __deprecated,
8047            __deprecated_legacy_json_field_conflicts,
8048            __features,
8049            __uninterpreted_option,
8050            Unknown(std::string::String),
8051        }
8052        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8053            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8054            where
8055                D: serde::Deserializer<'de>,
8056            {
8057                struct Visitor;
8058                impl<'de> serde::de::Visitor<'de> for Visitor {
8059                    type Value = __FieldTag;
8060                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8061                        formatter.write_str("a field name for EnumOptions")
8062                    }
8063                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8064                    where
8065                        E: serde::de::Error,
8066                    {
8067                        use std::result::Result::Ok;
8068                        use std::string::ToString;
8069                        match value {
8070                            "allowAlias" => Ok(__FieldTag::__allow_alias),
8071                            "allow_alias" => Ok(__FieldTag::__allow_alias),
8072                            "deprecated" => Ok(__FieldTag::__deprecated),
8073                            "deprecatedLegacyJsonFieldConflicts" => {
8074                                Ok(__FieldTag::__deprecated_legacy_json_field_conflicts)
8075                            }
8076                            "deprecated_legacy_json_field_conflicts" => {
8077                                Ok(__FieldTag::__deprecated_legacy_json_field_conflicts)
8078                            }
8079                            "features" => Ok(__FieldTag::__features),
8080                            "uninterpretedOption" => Ok(__FieldTag::__uninterpreted_option),
8081                            "uninterpreted_option" => Ok(__FieldTag::__uninterpreted_option),
8082                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8083                        }
8084                    }
8085                }
8086                deserializer.deserialize_identifier(Visitor)
8087            }
8088        }
8089        struct Visitor;
8090        impl<'de> serde::de::Visitor<'de> for Visitor {
8091            type Value = EnumOptions;
8092            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8093                formatter.write_str("struct EnumOptions")
8094            }
8095            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8096            where
8097                A: serde::de::MapAccess<'de>,
8098            {
8099                #[allow(unused_imports)]
8100                use serde::de::Error;
8101                use std::option::Option::Some;
8102                let mut fields = std::collections::HashSet::new();
8103                let mut result = Self::Value::new();
8104                while let Some(tag) = map.next_key::<__FieldTag>()? {
8105                    #[allow(clippy::match_single_binding)]
8106                    match tag {
8107                        __FieldTag::__allow_alias => {
8108                            if !fields.insert(__FieldTag::__allow_alias) {
8109                                return std::result::Result::Err(A::Error::duplicate_field(
8110                                    "multiple values for allow_alias",
8111                                ));
8112                            }
8113                            result.allow_alias = map
8114                                .next_value::<std::option::Option<bool>>()?
8115                                .unwrap_or_default();
8116                        }
8117                        __FieldTag::__deprecated => {
8118                            if !fields.insert(__FieldTag::__deprecated) {
8119                                return std::result::Result::Err(A::Error::duplicate_field(
8120                                    "multiple values for deprecated",
8121                                ));
8122                            }
8123                            result.deprecated = map
8124                                .next_value::<std::option::Option<bool>>()?
8125                                .unwrap_or_default();
8126                        }
8127                        __FieldTag::__deprecated_legacy_json_field_conflicts => {
8128                            if !fields.insert(__FieldTag::__deprecated_legacy_json_field_conflicts)
8129                            {
8130                                return std::result::Result::Err(A::Error::duplicate_field(
8131                                    "multiple values for deprecated_legacy_json_field_conflicts",
8132                                ));
8133                            }
8134                            result.deprecated_legacy_json_field_conflicts = map
8135                                .next_value::<std::option::Option<bool>>()?
8136                                .unwrap_or_default();
8137                        }
8138                        __FieldTag::__features => {
8139                            if !fields.insert(__FieldTag::__features) {
8140                                return std::result::Result::Err(A::Error::duplicate_field(
8141                                    "multiple values for features",
8142                                ));
8143                            }
8144                            result.features =
8145                                map.next_value::<std::option::Option<crate::FeatureSet>>()?;
8146                        }
8147                        __FieldTag::__uninterpreted_option => {
8148                            if !fields.insert(__FieldTag::__uninterpreted_option) {
8149                                return std::result::Result::Err(A::Error::duplicate_field(
8150                                    "multiple values for uninterpreted_option",
8151                                ));
8152                            }
8153                            result.uninterpreted_option = map.next_value::<std::option::Option<std::vec::Vec<crate::UninterpretedOption>>>()?.unwrap_or_default();
8154                        }
8155                        __FieldTag::Unknown(key) => {
8156                            let value = map.next_value::<serde_json::Value>()?;
8157                            result._unknown_fields.insert(key, value);
8158                        }
8159                    }
8160                }
8161                std::result::Result::Ok(result)
8162            }
8163        }
8164        deserializer.deserialize_any(Visitor)
8165    }
8166}
8167
8168#[doc(hidden)]
8169impl serde::ser::Serialize for EnumOptions {
8170    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8171    where
8172        S: serde::ser::Serializer,
8173    {
8174        use serde::ser::SerializeMap;
8175        #[allow(unused_imports)]
8176        use std::option::Option::Some;
8177        let mut state = serializer.serialize_map(std::option::Option::None)?;
8178        if !wkt::internal::is_default(&self.allow_alias) {
8179            state.serialize_entry("allowAlias", &self.allow_alias)?;
8180        }
8181        if !wkt::internal::is_default(&self.deprecated) {
8182            state.serialize_entry("deprecated", &self.deprecated)?;
8183        }
8184        if !wkt::internal::is_default(&self.deprecated_legacy_json_field_conflicts) {
8185            state.serialize_entry(
8186                "deprecatedLegacyJsonFieldConflicts",
8187                &self.deprecated_legacy_json_field_conflicts,
8188            )?;
8189        }
8190        if self.features.is_some() {
8191            state.serialize_entry("features", &self.features)?;
8192        }
8193        if !self.uninterpreted_option.is_empty() {
8194            state.serialize_entry("uninterpretedOption", &self.uninterpreted_option)?;
8195        }
8196        if !self._unknown_fields.is_empty() {
8197            for (key, value) in self._unknown_fields.iter() {
8198                state.serialize_entry(key, &value)?;
8199            }
8200        }
8201        state.end()
8202    }
8203}
8204
8205#[derive(Clone, Debug, Default, PartialEq)]
8206#[non_exhaustive]
8207pub struct EnumValueOptions {
8208    /// Is this enum value deprecated?
8209    /// Depending on the target platform, this can emit Deprecated annotations
8210    /// for the enum value, or it will be completely ignored; in the very least,
8211    /// this is a formalization for deprecating enum values.
8212    pub deprecated: bool,
8213
8214    /// Any features defined in the specific edition.
8215    pub features: std::option::Option<crate::FeatureSet>,
8216
8217    /// Indicate that fields annotated with this enum value should not be printed
8218    /// out when using debug formats, e.g. when the field contains sensitive
8219    /// credentials.
8220    pub debug_redact: bool,
8221
8222    /// Information about the support window of a feature value.
8223    pub feature_support: std::option::Option<crate::field_options::FeatureSupport>,
8224
8225    /// The parser stores options it doesn't recognize here. See above.
8226    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
8227
8228    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8229}
8230
8231impl EnumValueOptions {
8232    pub fn new() -> Self {
8233        std::default::Default::default()
8234    }
8235
8236    /// Sets the value of [deprecated][crate::EnumValueOptions::deprecated].
8237    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8238        self.deprecated = v.into();
8239        self
8240    }
8241
8242    /// Sets the value of [features][crate::EnumValueOptions::features].
8243    pub fn set_features<T>(mut self, v: T) -> Self
8244    where
8245        T: std::convert::Into<crate::FeatureSet>,
8246    {
8247        self.features = std::option::Option::Some(v.into());
8248        self
8249    }
8250
8251    /// Sets or clears the value of [features][crate::EnumValueOptions::features].
8252    pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
8253    where
8254        T: std::convert::Into<crate::FeatureSet>,
8255    {
8256        self.features = v.map(|x| x.into());
8257        self
8258    }
8259
8260    /// Sets the value of [debug_redact][crate::EnumValueOptions::debug_redact].
8261    pub fn set_debug_redact<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8262        self.debug_redact = v.into();
8263        self
8264    }
8265
8266    /// Sets the value of [feature_support][crate::EnumValueOptions::feature_support].
8267    pub fn set_feature_support<T>(mut self, v: T) -> Self
8268    where
8269        T: std::convert::Into<crate::field_options::FeatureSupport>,
8270    {
8271        self.feature_support = std::option::Option::Some(v.into());
8272        self
8273    }
8274
8275    /// Sets or clears the value of [feature_support][crate::EnumValueOptions::feature_support].
8276    pub fn set_or_clear_feature_support<T>(mut self, v: std::option::Option<T>) -> Self
8277    where
8278        T: std::convert::Into<crate::field_options::FeatureSupport>,
8279    {
8280        self.feature_support = v.map(|x| x.into());
8281        self
8282    }
8283
8284    /// Sets the value of [uninterpreted_option][crate::EnumValueOptions::uninterpreted_option].
8285    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
8286    where
8287        T: std::iter::IntoIterator<Item = V>,
8288        V: std::convert::Into<crate::UninterpretedOption>,
8289    {
8290        use std::iter::Iterator;
8291        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
8292        self
8293    }
8294}
8295
8296impl wkt::message::Message for EnumValueOptions {
8297    fn typename() -> &'static str {
8298        "type.googleapis.com/google.protobuf.EnumValueOptions"
8299    }
8300}
8301
8302#[doc(hidden)]
8303impl<'de> serde::de::Deserialize<'de> for EnumValueOptions {
8304    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8305    where
8306        D: serde::Deserializer<'de>,
8307    {
8308        #[allow(non_camel_case_types)]
8309        #[doc(hidden)]
8310        #[derive(PartialEq, Eq, Hash)]
8311        enum __FieldTag {
8312            __deprecated,
8313            __features,
8314            __debug_redact,
8315            __feature_support,
8316            __uninterpreted_option,
8317            Unknown(std::string::String),
8318        }
8319        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8320            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8321            where
8322                D: serde::Deserializer<'de>,
8323            {
8324                struct Visitor;
8325                impl<'de> serde::de::Visitor<'de> for Visitor {
8326                    type Value = __FieldTag;
8327                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8328                        formatter.write_str("a field name for EnumValueOptions")
8329                    }
8330                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8331                    where
8332                        E: serde::de::Error,
8333                    {
8334                        use std::result::Result::Ok;
8335                        use std::string::ToString;
8336                        match value {
8337                            "deprecated" => Ok(__FieldTag::__deprecated),
8338                            "features" => Ok(__FieldTag::__features),
8339                            "debugRedact" => Ok(__FieldTag::__debug_redact),
8340                            "debug_redact" => Ok(__FieldTag::__debug_redact),
8341                            "featureSupport" => Ok(__FieldTag::__feature_support),
8342                            "feature_support" => Ok(__FieldTag::__feature_support),
8343                            "uninterpretedOption" => Ok(__FieldTag::__uninterpreted_option),
8344                            "uninterpreted_option" => Ok(__FieldTag::__uninterpreted_option),
8345                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8346                        }
8347                    }
8348                }
8349                deserializer.deserialize_identifier(Visitor)
8350            }
8351        }
8352        struct Visitor;
8353        impl<'de> serde::de::Visitor<'de> for Visitor {
8354            type Value = EnumValueOptions;
8355            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8356                formatter.write_str("struct EnumValueOptions")
8357            }
8358            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8359            where
8360                A: serde::de::MapAccess<'de>,
8361            {
8362                #[allow(unused_imports)]
8363                use serde::de::Error;
8364                use std::option::Option::Some;
8365                let mut fields = std::collections::HashSet::new();
8366                let mut result = Self::Value::new();
8367                while let Some(tag) = map.next_key::<__FieldTag>()? {
8368                    #[allow(clippy::match_single_binding)]
8369                    match tag {
8370                        __FieldTag::__deprecated => {
8371                            if !fields.insert(__FieldTag::__deprecated) {
8372                                return std::result::Result::Err(A::Error::duplicate_field(
8373                                    "multiple values for deprecated",
8374                                ));
8375                            }
8376                            result.deprecated = map
8377                                .next_value::<std::option::Option<bool>>()?
8378                                .unwrap_or_default();
8379                        }
8380                        __FieldTag::__features => {
8381                            if !fields.insert(__FieldTag::__features) {
8382                                return std::result::Result::Err(A::Error::duplicate_field(
8383                                    "multiple values for features",
8384                                ));
8385                            }
8386                            result.features =
8387                                map.next_value::<std::option::Option<crate::FeatureSet>>()?;
8388                        }
8389                        __FieldTag::__debug_redact => {
8390                            if !fields.insert(__FieldTag::__debug_redact) {
8391                                return std::result::Result::Err(A::Error::duplicate_field(
8392                                    "multiple values for debug_redact",
8393                                ));
8394                            }
8395                            result.debug_redact = map
8396                                .next_value::<std::option::Option<bool>>()?
8397                                .unwrap_or_default();
8398                        }
8399                        __FieldTag::__feature_support => {
8400                            if !fields.insert(__FieldTag::__feature_support) {
8401                                return std::result::Result::Err(A::Error::duplicate_field(
8402                                    "multiple values for feature_support",
8403                                ));
8404                            }
8405                            result.feature_support = map.next_value::<std::option::Option<crate::field_options::FeatureSupport>>()?
8406                                ;
8407                        }
8408                        __FieldTag::__uninterpreted_option => {
8409                            if !fields.insert(__FieldTag::__uninterpreted_option) {
8410                                return std::result::Result::Err(A::Error::duplicate_field(
8411                                    "multiple values for uninterpreted_option",
8412                                ));
8413                            }
8414                            result.uninterpreted_option = map.next_value::<std::option::Option<std::vec::Vec<crate::UninterpretedOption>>>()?.unwrap_or_default();
8415                        }
8416                        __FieldTag::Unknown(key) => {
8417                            let value = map.next_value::<serde_json::Value>()?;
8418                            result._unknown_fields.insert(key, value);
8419                        }
8420                    }
8421                }
8422                std::result::Result::Ok(result)
8423            }
8424        }
8425        deserializer.deserialize_any(Visitor)
8426    }
8427}
8428
8429#[doc(hidden)]
8430impl serde::ser::Serialize for EnumValueOptions {
8431    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8432    where
8433        S: serde::ser::Serializer,
8434    {
8435        use serde::ser::SerializeMap;
8436        #[allow(unused_imports)]
8437        use std::option::Option::Some;
8438        let mut state = serializer.serialize_map(std::option::Option::None)?;
8439        if !wkt::internal::is_default(&self.deprecated) {
8440            state.serialize_entry("deprecated", &self.deprecated)?;
8441        }
8442        if self.features.is_some() {
8443            state.serialize_entry("features", &self.features)?;
8444        }
8445        if !wkt::internal::is_default(&self.debug_redact) {
8446            state.serialize_entry("debugRedact", &self.debug_redact)?;
8447        }
8448        if self.feature_support.is_some() {
8449            state.serialize_entry("featureSupport", &self.feature_support)?;
8450        }
8451        if !self.uninterpreted_option.is_empty() {
8452            state.serialize_entry("uninterpretedOption", &self.uninterpreted_option)?;
8453        }
8454        if !self._unknown_fields.is_empty() {
8455            for (key, value) in self._unknown_fields.iter() {
8456                state.serialize_entry(key, &value)?;
8457            }
8458        }
8459        state.end()
8460    }
8461}
8462
8463#[derive(Clone, Debug, Default, PartialEq)]
8464#[non_exhaustive]
8465pub struct ServiceOptions {
8466    /// Any features defined in the specific edition.
8467    pub features: std::option::Option<crate::FeatureSet>,
8468
8469    /// Is this service deprecated?
8470    /// Depending on the target platform, this can emit Deprecated annotations
8471    /// for the service, or it will be completely ignored; in the very least,
8472    /// this is a formalization for deprecating services.
8473    pub deprecated: bool,
8474
8475    /// The parser stores options it doesn't recognize here. See above.
8476    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
8477
8478    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8479}
8480
8481impl ServiceOptions {
8482    pub fn new() -> Self {
8483        std::default::Default::default()
8484    }
8485
8486    /// Sets the value of [features][crate::ServiceOptions::features].
8487    pub fn set_features<T>(mut self, v: T) -> Self
8488    where
8489        T: std::convert::Into<crate::FeatureSet>,
8490    {
8491        self.features = std::option::Option::Some(v.into());
8492        self
8493    }
8494
8495    /// Sets or clears the value of [features][crate::ServiceOptions::features].
8496    pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
8497    where
8498        T: std::convert::Into<crate::FeatureSet>,
8499    {
8500        self.features = v.map(|x| x.into());
8501        self
8502    }
8503
8504    /// Sets the value of [deprecated][crate::ServiceOptions::deprecated].
8505    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8506        self.deprecated = v.into();
8507        self
8508    }
8509
8510    /// Sets the value of [uninterpreted_option][crate::ServiceOptions::uninterpreted_option].
8511    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
8512    where
8513        T: std::iter::IntoIterator<Item = V>,
8514        V: std::convert::Into<crate::UninterpretedOption>,
8515    {
8516        use std::iter::Iterator;
8517        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
8518        self
8519    }
8520}
8521
8522impl wkt::message::Message for ServiceOptions {
8523    fn typename() -> &'static str {
8524        "type.googleapis.com/google.protobuf.ServiceOptions"
8525    }
8526}
8527
8528#[doc(hidden)]
8529impl<'de> serde::de::Deserialize<'de> for ServiceOptions {
8530    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8531    where
8532        D: serde::Deserializer<'de>,
8533    {
8534        #[allow(non_camel_case_types)]
8535        #[doc(hidden)]
8536        #[derive(PartialEq, Eq, Hash)]
8537        enum __FieldTag {
8538            __features,
8539            __deprecated,
8540            __uninterpreted_option,
8541            Unknown(std::string::String),
8542        }
8543        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8544            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8545            where
8546                D: serde::Deserializer<'de>,
8547            {
8548                struct Visitor;
8549                impl<'de> serde::de::Visitor<'de> for Visitor {
8550                    type Value = __FieldTag;
8551                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8552                        formatter.write_str("a field name for ServiceOptions")
8553                    }
8554                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8555                    where
8556                        E: serde::de::Error,
8557                    {
8558                        use std::result::Result::Ok;
8559                        use std::string::ToString;
8560                        match value {
8561                            "features" => Ok(__FieldTag::__features),
8562                            "deprecated" => Ok(__FieldTag::__deprecated),
8563                            "uninterpretedOption" => Ok(__FieldTag::__uninterpreted_option),
8564                            "uninterpreted_option" => Ok(__FieldTag::__uninterpreted_option),
8565                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8566                        }
8567                    }
8568                }
8569                deserializer.deserialize_identifier(Visitor)
8570            }
8571        }
8572        struct Visitor;
8573        impl<'de> serde::de::Visitor<'de> for Visitor {
8574            type Value = ServiceOptions;
8575            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8576                formatter.write_str("struct ServiceOptions")
8577            }
8578            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8579            where
8580                A: serde::de::MapAccess<'de>,
8581            {
8582                #[allow(unused_imports)]
8583                use serde::de::Error;
8584                use std::option::Option::Some;
8585                let mut fields = std::collections::HashSet::new();
8586                let mut result = Self::Value::new();
8587                while let Some(tag) = map.next_key::<__FieldTag>()? {
8588                    #[allow(clippy::match_single_binding)]
8589                    match tag {
8590                        __FieldTag::__features => {
8591                            if !fields.insert(__FieldTag::__features) {
8592                                return std::result::Result::Err(A::Error::duplicate_field(
8593                                    "multiple values for features",
8594                                ));
8595                            }
8596                            result.features =
8597                                map.next_value::<std::option::Option<crate::FeatureSet>>()?;
8598                        }
8599                        __FieldTag::__deprecated => {
8600                            if !fields.insert(__FieldTag::__deprecated) {
8601                                return std::result::Result::Err(A::Error::duplicate_field(
8602                                    "multiple values for deprecated",
8603                                ));
8604                            }
8605                            result.deprecated = map
8606                                .next_value::<std::option::Option<bool>>()?
8607                                .unwrap_or_default();
8608                        }
8609                        __FieldTag::__uninterpreted_option => {
8610                            if !fields.insert(__FieldTag::__uninterpreted_option) {
8611                                return std::result::Result::Err(A::Error::duplicate_field(
8612                                    "multiple values for uninterpreted_option",
8613                                ));
8614                            }
8615                            result.uninterpreted_option = map.next_value::<std::option::Option<std::vec::Vec<crate::UninterpretedOption>>>()?.unwrap_or_default();
8616                        }
8617                        __FieldTag::Unknown(key) => {
8618                            let value = map.next_value::<serde_json::Value>()?;
8619                            result._unknown_fields.insert(key, value);
8620                        }
8621                    }
8622                }
8623                std::result::Result::Ok(result)
8624            }
8625        }
8626        deserializer.deserialize_any(Visitor)
8627    }
8628}
8629
8630#[doc(hidden)]
8631impl serde::ser::Serialize for ServiceOptions {
8632    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8633    where
8634        S: serde::ser::Serializer,
8635    {
8636        use serde::ser::SerializeMap;
8637        #[allow(unused_imports)]
8638        use std::option::Option::Some;
8639        let mut state = serializer.serialize_map(std::option::Option::None)?;
8640        if self.features.is_some() {
8641            state.serialize_entry("features", &self.features)?;
8642        }
8643        if !wkt::internal::is_default(&self.deprecated) {
8644            state.serialize_entry("deprecated", &self.deprecated)?;
8645        }
8646        if !self.uninterpreted_option.is_empty() {
8647            state.serialize_entry("uninterpretedOption", &self.uninterpreted_option)?;
8648        }
8649        if !self._unknown_fields.is_empty() {
8650            for (key, value) in self._unknown_fields.iter() {
8651                state.serialize_entry(key, &value)?;
8652            }
8653        }
8654        state.end()
8655    }
8656}
8657
8658#[derive(Clone, Debug, Default, PartialEq)]
8659#[non_exhaustive]
8660pub struct MethodOptions {
8661    /// Is this method deprecated?
8662    /// Depending on the target platform, this can emit Deprecated annotations
8663    /// for the method, or it will be completely ignored; in the very least,
8664    /// this is a formalization for deprecating methods.
8665    pub deprecated: bool,
8666
8667    pub idempotency_level: crate::method_options::IdempotencyLevel,
8668
8669    /// Any features defined in the specific edition.
8670    pub features: std::option::Option<crate::FeatureSet>,
8671
8672    /// The parser stores options it doesn't recognize here. See above.
8673    pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
8674
8675    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8676}
8677
8678impl MethodOptions {
8679    pub fn new() -> Self {
8680        std::default::Default::default()
8681    }
8682
8683    /// Sets the value of [deprecated][crate::MethodOptions::deprecated].
8684    pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8685        self.deprecated = v.into();
8686        self
8687    }
8688
8689    /// Sets the value of [idempotency_level][crate::MethodOptions::idempotency_level].
8690    pub fn set_idempotency_level<T: std::convert::Into<crate::method_options::IdempotencyLevel>>(
8691        mut self,
8692        v: T,
8693    ) -> Self {
8694        self.idempotency_level = v.into();
8695        self
8696    }
8697
8698    /// Sets the value of [features][crate::MethodOptions::features].
8699    pub fn set_features<T>(mut self, v: T) -> Self
8700    where
8701        T: std::convert::Into<crate::FeatureSet>,
8702    {
8703        self.features = std::option::Option::Some(v.into());
8704        self
8705    }
8706
8707    /// Sets or clears the value of [features][crate::MethodOptions::features].
8708    pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
8709    where
8710        T: std::convert::Into<crate::FeatureSet>,
8711    {
8712        self.features = v.map(|x| x.into());
8713        self
8714    }
8715
8716    /// Sets the value of [uninterpreted_option][crate::MethodOptions::uninterpreted_option].
8717    pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
8718    where
8719        T: std::iter::IntoIterator<Item = V>,
8720        V: std::convert::Into<crate::UninterpretedOption>,
8721    {
8722        use std::iter::Iterator;
8723        self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
8724        self
8725    }
8726}
8727
8728impl wkt::message::Message for MethodOptions {
8729    fn typename() -> &'static str {
8730        "type.googleapis.com/google.protobuf.MethodOptions"
8731    }
8732}
8733
8734#[doc(hidden)]
8735impl<'de> serde::de::Deserialize<'de> for MethodOptions {
8736    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8737    where
8738        D: serde::Deserializer<'de>,
8739    {
8740        #[allow(non_camel_case_types)]
8741        #[doc(hidden)]
8742        #[derive(PartialEq, Eq, Hash)]
8743        enum __FieldTag {
8744            __deprecated,
8745            __idempotency_level,
8746            __features,
8747            __uninterpreted_option,
8748            Unknown(std::string::String),
8749        }
8750        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8751            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8752            where
8753                D: serde::Deserializer<'de>,
8754            {
8755                struct Visitor;
8756                impl<'de> serde::de::Visitor<'de> for Visitor {
8757                    type Value = __FieldTag;
8758                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8759                        formatter.write_str("a field name for MethodOptions")
8760                    }
8761                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8762                    where
8763                        E: serde::de::Error,
8764                    {
8765                        use std::result::Result::Ok;
8766                        use std::string::ToString;
8767                        match value {
8768                            "deprecated" => Ok(__FieldTag::__deprecated),
8769                            "idempotencyLevel" => Ok(__FieldTag::__idempotency_level),
8770                            "idempotency_level" => Ok(__FieldTag::__idempotency_level),
8771                            "features" => Ok(__FieldTag::__features),
8772                            "uninterpretedOption" => Ok(__FieldTag::__uninterpreted_option),
8773                            "uninterpreted_option" => Ok(__FieldTag::__uninterpreted_option),
8774                            _ => Ok(__FieldTag::Unknown(value.to_string())),
8775                        }
8776                    }
8777                }
8778                deserializer.deserialize_identifier(Visitor)
8779            }
8780        }
8781        struct Visitor;
8782        impl<'de> serde::de::Visitor<'de> for Visitor {
8783            type Value = MethodOptions;
8784            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8785                formatter.write_str("struct MethodOptions")
8786            }
8787            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8788            where
8789                A: serde::de::MapAccess<'de>,
8790            {
8791                #[allow(unused_imports)]
8792                use serde::de::Error;
8793                use std::option::Option::Some;
8794                let mut fields = std::collections::HashSet::new();
8795                let mut result = Self::Value::new();
8796                while let Some(tag) = map.next_key::<__FieldTag>()? {
8797                    #[allow(clippy::match_single_binding)]
8798                    match tag {
8799                        __FieldTag::__deprecated => {
8800                            if !fields.insert(__FieldTag::__deprecated) {
8801                                return std::result::Result::Err(A::Error::duplicate_field(
8802                                    "multiple values for deprecated",
8803                                ));
8804                            }
8805                            result.deprecated = map
8806                                .next_value::<std::option::Option<bool>>()?
8807                                .unwrap_or_default();
8808                        }
8809                        __FieldTag::__idempotency_level => {
8810                            if !fields.insert(__FieldTag::__idempotency_level) {
8811                                return std::result::Result::Err(A::Error::duplicate_field(
8812                                    "multiple values for idempotency_level",
8813                                ));
8814                            }
8815                            result.idempotency_level = map.next_value::<std::option::Option<crate::method_options::IdempotencyLevel>>()?.unwrap_or_default();
8816                        }
8817                        __FieldTag::__features => {
8818                            if !fields.insert(__FieldTag::__features) {
8819                                return std::result::Result::Err(A::Error::duplicate_field(
8820                                    "multiple values for features",
8821                                ));
8822                            }
8823                            result.features =
8824                                map.next_value::<std::option::Option<crate::FeatureSet>>()?;
8825                        }
8826                        __FieldTag::__uninterpreted_option => {
8827                            if !fields.insert(__FieldTag::__uninterpreted_option) {
8828                                return std::result::Result::Err(A::Error::duplicate_field(
8829                                    "multiple values for uninterpreted_option",
8830                                ));
8831                            }
8832                            result.uninterpreted_option = map.next_value::<std::option::Option<std::vec::Vec<crate::UninterpretedOption>>>()?.unwrap_or_default();
8833                        }
8834                        __FieldTag::Unknown(key) => {
8835                            let value = map.next_value::<serde_json::Value>()?;
8836                            result._unknown_fields.insert(key, value);
8837                        }
8838                    }
8839                }
8840                std::result::Result::Ok(result)
8841            }
8842        }
8843        deserializer.deserialize_any(Visitor)
8844    }
8845}
8846
8847#[doc(hidden)]
8848impl serde::ser::Serialize for MethodOptions {
8849    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8850    where
8851        S: serde::ser::Serializer,
8852    {
8853        use serde::ser::SerializeMap;
8854        #[allow(unused_imports)]
8855        use std::option::Option::Some;
8856        let mut state = serializer.serialize_map(std::option::Option::None)?;
8857        if !wkt::internal::is_default(&self.deprecated) {
8858            state.serialize_entry("deprecated", &self.deprecated)?;
8859        }
8860        if !wkt::internal::is_default(&self.idempotency_level) {
8861            state.serialize_entry("idempotencyLevel", &self.idempotency_level)?;
8862        }
8863        if self.features.is_some() {
8864            state.serialize_entry("features", &self.features)?;
8865        }
8866        if !self.uninterpreted_option.is_empty() {
8867            state.serialize_entry("uninterpretedOption", &self.uninterpreted_option)?;
8868        }
8869        if !self._unknown_fields.is_empty() {
8870            for (key, value) in self._unknown_fields.iter() {
8871                state.serialize_entry(key, &value)?;
8872            }
8873        }
8874        state.end()
8875    }
8876}
8877
8878/// Defines additional types related to [MethodOptions].
8879pub mod method_options {
8880    #[allow(unused_imports)]
8881    use super::*;
8882
8883    /// Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
8884    /// or neither? HTTP based RPC implementation may choose GET verb for safe
8885    /// methods, and PUT verb for idempotent methods instead of the default POST.
8886    ///
8887    /// # Working with unknown values
8888    ///
8889    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8890    /// additional enum variants at any time. Adding new variants is not considered
8891    /// a breaking change. Applications should write their code in anticipation of:
8892    ///
8893    /// - New values appearing in future releases of the client library, **and**
8894    /// - New values received dynamically, without application changes.
8895    ///
8896    /// Please consult the [Working with enums] section in the user guide for some
8897    /// guidelines.
8898    ///
8899    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8900    #[derive(Clone, Debug, PartialEq)]
8901    #[non_exhaustive]
8902    pub enum IdempotencyLevel {
8903        IdempotencyUnknown,
8904        NoSideEffects,
8905        Idempotent,
8906        /// If set, the enum was initialized with an unknown value.
8907        ///
8908        /// Applications can examine the value using [IdempotencyLevel::value] or
8909        /// [IdempotencyLevel::name].
8910        UnknownValue(idempotency_level::UnknownValue),
8911    }
8912
8913    #[doc(hidden)]
8914    pub mod idempotency_level {
8915        #[allow(unused_imports)]
8916        use super::*;
8917        #[derive(Clone, Debug, PartialEq)]
8918        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8919    }
8920
8921    impl IdempotencyLevel {
8922        /// Gets the enum value.
8923        ///
8924        /// Returns `None` if the enum contains an unknown value deserialized from
8925        /// the string representation of enums.
8926        pub fn value(&self) -> std::option::Option<i32> {
8927            match self {
8928                Self::IdempotencyUnknown => std::option::Option::Some(0),
8929                Self::NoSideEffects => std::option::Option::Some(1),
8930                Self::Idempotent => std::option::Option::Some(2),
8931                Self::UnknownValue(u) => u.0.value(),
8932            }
8933        }
8934
8935        /// Gets the enum value as a string.
8936        ///
8937        /// Returns `None` if the enum contains an unknown value deserialized from
8938        /// the integer representation of enums.
8939        pub fn name(&self) -> std::option::Option<&str> {
8940            match self {
8941                Self::IdempotencyUnknown => std::option::Option::Some("IDEMPOTENCY_UNKNOWN"),
8942                Self::NoSideEffects => std::option::Option::Some("NO_SIDE_EFFECTS"),
8943                Self::Idempotent => std::option::Option::Some("IDEMPOTENT"),
8944                Self::UnknownValue(u) => u.0.name(),
8945            }
8946        }
8947    }
8948
8949    impl std::default::Default for IdempotencyLevel {
8950        fn default() -> Self {
8951            use std::convert::From;
8952            Self::from(0)
8953        }
8954    }
8955
8956    impl std::fmt::Display for IdempotencyLevel {
8957        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8958            wkt::internal::display_enum(f, self.name(), self.value())
8959        }
8960    }
8961
8962    impl std::convert::From<i32> for IdempotencyLevel {
8963        fn from(value: i32) -> Self {
8964            match value {
8965                0 => Self::IdempotencyUnknown,
8966                1 => Self::NoSideEffects,
8967                2 => Self::Idempotent,
8968                _ => Self::UnknownValue(idempotency_level::UnknownValue(
8969                    wkt::internal::UnknownEnumValue::Integer(value),
8970                )),
8971            }
8972        }
8973    }
8974
8975    impl std::convert::From<&str> for IdempotencyLevel {
8976        fn from(value: &str) -> Self {
8977            use std::string::ToString;
8978            match value {
8979                "IDEMPOTENCY_UNKNOWN" => Self::IdempotencyUnknown,
8980                "NO_SIDE_EFFECTS" => Self::NoSideEffects,
8981                "IDEMPOTENT" => Self::Idempotent,
8982                _ => Self::UnknownValue(idempotency_level::UnknownValue(
8983                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8984                )),
8985            }
8986        }
8987    }
8988
8989    impl serde::ser::Serialize for IdempotencyLevel {
8990        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8991        where
8992            S: serde::Serializer,
8993        {
8994            match self {
8995                Self::IdempotencyUnknown => serializer.serialize_i32(0),
8996                Self::NoSideEffects => serializer.serialize_i32(1),
8997                Self::Idempotent => serializer.serialize_i32(2),
8998                Self::UnknownValue(u) => u.0.serialize(serializer),
8999            }
9000        }
9001    }
9002
9003    impl<'de> serde::de::Deserialize<'de> for IdempotencyLevel {
9004        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9005        where
9006            D: serde::Deserializer<'de>,
9007        {
9008            deserializer.deserialize_any(wkt::internal::EnumVisitor::<IdempotencyLevel>::new(
9009                ".google.protobuf.MethodOptions.IdempotencyLevel",
9010            ))
9011        }
9012    }
9013}
9014
9015/// A message representing a option the parser does not recognize. This only
9016/// appears in options protos created by the compiler::Parser class.
9017/// DescriptorPool resolves these when building Descriptor objects. Therefore,
9018/// options protos in descriptor objects (e.g. returned by Descriptor::options(),
9019/// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
9020/// in them.
9021#[derive(Clone, Debug, Default, PartialEq)]
9022#[non_exhaustive]
9023pub struct UninterpretedOption {
9024    pub name: std::vec::Vec<crate::uninterpreted_option::NamePart>,
9025
9026    /// The value of the uninterpreted option, in whatever type the tokenizer
9027    /// identified it as during parsing. Exactly one of these should be set.
9028    pub identifier_value: std::string::String,
9029
9030    pub positive_int_value: u64,
9031
9032    pub negative_int_value: i64,
9033
9034    pub double_value: f64,
9035
9036    pub string_value: ::bytes::Bytes,
9037
9038    pub aggregate_value: std::string::String,
9039
9040    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9041}
9042
9043impl UninterpretedOption {
9044    pub fn new() -> Self {
9045        std::default::Default::default()
9046    }
9047
9048    /// Sets the value of [name][crate::UninterpretedOption::name].
9049    pub fn set_name<T, V>(mut self, v: T) -> Self
9050    where
9051        T: std::iter::IntoIterator<Item = V>,
9052        V: std::convert::Into<crate::uninterpreted_option::NamePart>,
9053    {
9054        use std::iter::Iterator;
9055        self.name = v.into_iter().map(|i| i.into()).collect();
9056        self
9057    }
9058
9059    /// Sets the value of [identifier_value][crate::UninterpretedOption::identifier_value].
9060    pub fn set_identifier_value<T: std::convert::Into<std::string::String>>(
9061        mut self,
9062        v: T,
9063    ) -> Self {
9064        self.identifier_value = v.into();
9065        self
9066    }
9067
9068    /// Sets the value of [positive_int_value][crate::UninterpretedOption::positive_int_value].
9069    pub fn set_positive_int_value<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
9070        self.positive_int_value = v.into();
9071        self
9072    }
9073
9074    /// Sets the value of [negative_int_value][crate::UninterpretedOption::negative_int_value].
9075    pub fn set_negative_int_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9076        self.negative_int_value = v.into();
9077        self
9078    }
9079
9080    /// Sets the value of [double_value][crate::UninterpretedOption::double_value].
9081    pub fn set_double_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
9082        self.double_value = v.into();
9083        self
9084    }
9085
9086    /// Sets the value of [string_value][crate::UninterpretedOption::string_value].
9087    pub fn set_string_value<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9088        self.string_value = v.into();
9089        self
9090    }
9091
9092    /// Sets the value of [aggregate_value][crate::UninterpretedOption::aggregate_value].
9093    pub fn set_aggregate_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9094        self.aggregate_value = v.into();
9095        self
9096    }
9097}
9098
9099impl wkt::message::Message for UninterpretedOption {
9100    fn typename() -> &'static str {
9101        "type.googleapis.com/google.protobuf.UninterpretedOption"
9102    }
9103}
9104
9105#[doc(hidden)]
9106impl<'de> serde::de::Deserialize<'de> for UninterpretedOption {
9107    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9108    where
9109        D: serde::Deserializer<'de>,
9110    {
9111        #[allow(non_camel_case_types)]
9112        #[doc(hidden)]
9113        #[derive(PartialEq, Eq, Hash)]
9114        enum __FieldTag {
9115            __name,
9116            __identifier_value,
9117            __positive_int_value,
9118            __negative_int_value,
9119            __double_value,
9120            __string_value,
9121            __aggregate_value,
9122            Unknown(std::string::String),
9123        }
9124        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9125            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9126            where
9127                D: serde::Deserializer<'de>,
9128            {
9129                struct Visitor;
9130                impl<'de> serde::de::Visitor<'de> for Visitor {
9131                    type Value = __FieldTag;
9132                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9133                        formatter.write_str("a field name for UninterpretedOption")
9134                    }
9135                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9136                    where
9137                        E: serde::de::Error,
9138                    {
9139                        use std::result::Result::Ok;
9140                        use std::string::ToString;
9141                        match value {
9142                            "name" => Ok(__FieldTag::__name),
9143                            "identifierValue" => Ok(__FieldTag::__identifier_value),
9144                            "identifier_value" => Ok(__FieldTag::__identifier_value),
9145                            "positiveIntValue" => Ok(__FieldTag::__positive_int_value),
9146                            "positive_int_value" => Ok(__FieldTag::__positive_int_value),
9147                            "negativeIntValue" => Ok(__FieldTag::__negative_int_value),
9148                            "negative_int_value" => Ok(__FieldTag::__negative_int_value),
9149                            "doubleValue" => Ok(__FieldTag::__double_value),
9150                            "double_value" => Ok(__FieldTag::__double_value),
9151                            "stringValue" => Ok(__FieldTag::__string_value),
9152                            "string_value" => Ok(__FieldTag::__string_value),
9153                            "aggregateValue" => Ok(__FieldTag::__aggregate_value),
9154                            "aggregate_value" => Ok(__FieldTag::__aggregate_value),
9155                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9156                        }
9157                    }
9158                }
9159                deserializer.deserialize_identifier(Visitor)
9160            }
9161        }
9162        struct Visitor;
9163        impl<'de> serde::de::Visitor<'de> for Visitor {
9164            type Value = UninterpretedOption;
9165            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9166                formatter.write_str("struct UninterpretedOption")
9167            }
9168            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9169            where
9170                A: serde::de::MapAccess<'de>,
9171            {
9172                #[allow(unused_imports)]
9173                use serde::de::Error;
9174                use std::option::Option::Some;
9175                let mut fields = std::collections::HashSet::new();
9176                let mut result = Self::Value::new();
9177                while let Some(tag) = map.next_key::<__FieldTag>()? {
9178                    #[allow(clippy::match_single_binding)]
9179                    match tag {
9180                        __FieldTag::__name => {
9181                            if !fields.insert(__FieldTag::__name) {
9182                                return std::result::Result::Err(A::Error::duplicate_field(
9183                                    "multiple values for name",
9184                                ));
9185                            }
9186                            result.name = map
9187                                .next_value::<std::option::Option<
9188                                    std::vec::Vec<crate::uninterpreted_option::NamePart>,
9189                                >>()?
9190                                .unwrap_or_default();
9191                        }
9192                        __FieldTag::__identifier_value => {
9193                            if !fields.insert(__FieldTag::__identifier_value) {
9194                                return std::result::Result::Err(A::Error::duplicate_field(
9195                                    "multiple values for identifier_value",
9196                                ));
9197                            }
9198                            result.identifier_value = map
9199                                .next_value::<std::option::Option<std::string::String>>()?
9200                                .unwrap_or_default();
9201                        }
9202                        __FieldTag::__positive_int_value => {
9203                            if !fields.insert(__FieldTag::__positive_int_value) {
9204                                return std::result::Result::Err(A::Error::duplicate_field(
9205                                    "multiple values for positive_int_value",
9206                                ));
9207                            }
9208                            struct __With(std::option::Option<u64>);
9209                            impl<'de> serde::de::Deserialize<'de> for __With {
9210                                fn deserialize<D>(
9211                                    deserializer: D,
9212                                ) -> std::result::Result<Self, D::Error>
9213                                where
9214                                    D: serde::de::Deserializer<'de>,
9215                                {
9216                                    serde_with::As::< std::option::Option<wkt::internal::U64> >::deserialize(deserializer).map(__With)
9217                                }
9218                            }
9219                            result.positive_int_value =
9220                                map.next_value::<__With>()?.0.unwrap_or_default();
9221                        }
9222                        __FieldTag::__negative_int_value => {
9223                            if !fields.insert(__FieldTag::__negative_int_value) {
9224                                return std::result::Result::Err(A::Error::duplicate_field(
9225                                    "multiple values for negative_int_value",
9226                                ));
9227                            }
9228                            struct __With(std::option::Option<i64>);
9229                            impl<'de> serde::de::Deserialize<'de> for __With {
9230                                fn deserialize<D>(
9231                                    deserializer: D,
9232                                ) -> std::result::Result<Self, D::Error>
9233                                where
9234                                    D: serde::de::Deserializer<'de>,
9235                                {
9236                                    serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
9237                                }
9238                            }
9239                            result.negative_int_value =
9240                                map.next_value::<__With>()?.0.unwrap_or_default();
9241                        }
9242                        __FieldTag::__double_value => {
9243                            if !fields.insert(__FieldTag::__double_value) {
9244                                return std::result::Result::Err(A::Error::duplicate_field(
9245                                    "multiple values for double_value",
9246                                ));
9247                            }
9248                            struct __With(std::option::Option<f64>);
9249                            impl<'de> serde::de::Deserialize<'de> for __With {
9250                                fn deserialize<D>(
9251                                    deserializer: D,
9252                                ) -> std::result::Result<Self, D::Error>
9253                                where
9254                                    D: serde::de::Deserializer<'de>,
9255                                {
9256                                    serde_with::As::< std::option::Option<wkt::internal::F64> >::deserialize(deserializer).map(__With)
9257                                }
9258                            }
9259                            result.double_value = map.next_value::<__With>()?.0.unwrap_or_default();
9260                        }
9261                        __FieldTag::__string_value => {
9262                            if !fields.insert(__FieldTag::__string_value) {
9263                                return std::result::Result::Err(A::Error::duplicate_field(
9264                                    "multiple values for string_value",
9265                                ));
9266                            }
9267                            struct __With(std::option::Option<::bytes::Bytes>);
9268                            impl<'de> serde::de::Deserialize<'de> for __With {
9269                                fn deserialize<D>(
9270                                    deserializer: D,
9271                                ) -> std::result::Result<Self, D::Error>
9272                                where
9273                                    D: serde::de::Deserializer<'de>,
9274                                {
9275                                    serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
9276                                }
9277                            }
9278                            result.string_value = map.next_value::<__With>()?.0.unwrap_or_default();
9279                        }
9280                        __FieldTag::__aggregate_value => {
9281                            if !fields.insert(__FieldTag::__aggregate_value) {
9282                                return std::result::Result::Err(A::Error::duplicate_field(
9283                                    "multiple values for aggregate_value",
9284                                ));
9285                            }
9286                            result.aggregate_value = map
9287                                .next_value::<std::option::Option<std::string::String>>()?
9288                                .unwrap_or_default();
9289                        }
9290                        __FieldTag::Unknown(key) => {
9291                            let value = map.next_value::<serde_json::Value>()?;
9292                            result._unknown_fields.insert(key, value);
9293                        }
9294                    }
9295                }
9296                std::result::Result::Ok(result)
9297            }
9298        }
9299        deserializer.deserialize_any(Visitor)
9300    }
9301}
9302
9303#[doc(hidden)]
9304impl serde::ser::Serialize for UninterpretedOption {
9305    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9306    where
9307        S: serde::ser::Serializer,
9308    {
9309        use serde::ser::SerializeMap;
9310        #[allow(unused_imports)]
9311        use std::option::Option::Some;
9312        let mut state = serializer.serialize_map(std::option::Option::None)?;
9313        if !self.name.is_empty() {
9314            state.serialize_entry("name", &self.name)?;
9315        }
9316        if !self.identifier_value.is_empty() {
9317            state.serialize_entry("identifierValue", &self.identifier_value)?;
9318        }
9319        if !wkt::internal::is_default(&self.positive_int_value) {
9320            struct __With<'a>(&'a u64);
9321            impl<'a> serde::ser::Serialize for __With<'a> {
9322                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9323                where
9324                    S: serde::ser::Serializer,
9325                {
9326                    serde_with::As::<wkt::internal::U64>::serialize(self.0, serializer)
9327                }
9328            }
9329            state.serialize_entry("positiveIntValue", &__With(&self.positive_int_value))?;
9330        }
9331        if !wkt::internal::is_default(&self.negative_int_value) {
9332            struct __With<'a>(&'a i64);
9333            impl<'a> serde::ser::Serialize for __With<'a> {
9334                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9335                where
9336                    S: serde::ser::Serializer,
9337                {
9338                    serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
9339                }
9340            }
9341            state.serialize_entry("negativeIntValue", &__With(&self.negative_int_value))?;
9342        }
9343        if !wkt::internal::is_default(&self.double_value) {
9344            struct __With<'a>(&'a f64);
9345            impl<'a> serde::ser::Serialize for __With<'a> {
9346                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9347                where
9348                    S: serde::ser::Serializer,
9349                {
9350                    serde_with::As::<wkt::internal::F64>::serialize(self.0, serializer)
9351                }
9352            }
9353            state.serialize_entry("doubleValue", &__With(&self.double_value))?;
9354        }
9355        if !self.string_value.is_empty() {
9356            struct __With<'a>(&'a ::bytes::Bytes);
9357            impl<'a> serde::ser::Serialize for __With<'a> {
9358                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9359                where
9360                    S: serde::ser::Serializer,
9361                {
9362                    serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
9363                }
9364            }
9365            state.serialize_entry("stringValue", &__With(&self.string_value))?;
9366        }
9367        if !self.aggregate_value.is_empty() {
9368            state.serialize_entry("aggregateValue", &self.aggregate_value)?;
9369        }
9370        if !self._unknown_fields.is_empty() {
9371            for (key, value) in self._unknown_fields.iter() {
9372                state.serialize_entry(key, &value)?;
9373            }
9374        }
9375        state.end()
9376    }
9377}
9378
9379/// Defines additional types related to [UninterpretedOption].
9380pub mod uninterpreted_option {
9381    #[allow(unused_imports)]
9382    use super::*;
9383
9384    /// The name of the uninterpreted option.  Each string represents a segment in
9385    /// a dot-separated name.  is_extension is true iff a segment represents an
9386    /// extension (denoted with parentheses in options specs in .proto files).
9387    /// E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents
9388    /// "foo.(bar.baz).moo".
9389    #[derive(Clone, Debug, Default, PartialEq)]
9390    #[non_exhaustive]
9391    pub struct NamePart {
9392        pub name_part: std::string::String,
9393
9394        pub is_extension: bool,
9395
9396        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9397    }
9398
9399    impl NamePart {
9400        pub fn new() -> Self {
9401            std::default::Default::default()
9402        }
9403
9404        /// Sets the value of [name_part][crate::uninterpreted_option::NamePart::name_part].
9405        pub fn set_name_part<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9406            self.name_part = v.into();
9407            self
9408        }
9409
9410        /// Sets the value of [is_extension][crate::uninterpreted_option::NamePart::is_extension].
9411        pub fn set_is_extension<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9412            self.is_extension = v.into();
9413            self
9414        }
9415    }
9416
9417    impl wkt::message::Message for NamePart {
9418        fn typename() -> &'static str {
9419            "type.googleapis.com/google.protobuf.UninterpretedOption.NamePart"
9420        }
9421    }
9422
9423    #[doc(hidden)]
9424    impl<'de> serde::de::Deserialize<'de> for NamePart {
9425        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9426        where
9427            D: serde::Deserializer<'de>,
9428        {
9429            #[allow(non_camel_case_types)]
9430            #[doc(hidden)]
9431            #[derive(PartialEq, Eq, Hash)]
9432            enum __FieldTag {
9433                __name_part,
9434                __is_extension,
9435                Unknown(std::string::String),
9436            }
9437            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9438                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9439                where
9440                    D: serde::Deserializer<'de>,
9441                {
9442                    struct Visitor;
9443                    impl<'de> serde::de::Visitor<'de> for Visitor {
9444                        type Value = __FieldTag;
9445                        fn expecting(
9446                            &self,
9447                            formatter: &mut std::fmt::Formatter,
9448                        ) -> std::fmt::Result {
9449                            formatter.write_str("a field name for NamePart")
9450                        }
9451                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9452                        where
9453                            E: serde::de::Error,
9454                        {
9455                            use std::result::Result::Ok;
9456                            use std::string::ToString;
9457                            match value {
9458                                "namePart" => Ok(__FieldTag::__name_part),
9459                                "name_part" => Ok(__FieldTag::__name_part),
9460                                "isExtension" => Ok(__FieldTag::__is_extension),
9461                                "is_extension" => Ok(__FieldTag::__is_extension),
9462                                _ => Ok(__FieldTag::Unknown(value.to_string())),
9463                            }
9464                        }
9465                    }
9466                    deserializer.deserialize_identifier(Visitor)
9467                }
9468            }
9469            struct Visitor;
9470            impl<'de> serde::de::Visitor<'de> for Visitor {
9471                type Value = NamePart;
9472                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9473                    formatter.write_str("struct NamePart")
9474                }
9475                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9476                where
9477                    A: serde::de::MapAccess<'de>,
9478                {
9479                    #[allow(unused_imports)]
9480                    use serde::de::Error;
9481                    use std::option::Option::Some;
9482                    let mut fields = std::collections::HashSet::new();
9483                    let mut result = Self::Value::new();
9484                    while let Some(tag) = map.next_key::<__FieldTag>()? {
9485                        #[allow(clippy::match_single_binding)]
9486                        match tag {
9487                            __FieldTag::__name_part => {
9488                                if !fields.insert(__FieldTag::__name_part) {
9489                                    return std::result::Result::Err(A::Error::duplicate_field(
9490                                        "multiple values for name_part",
9491                                    ));
9492                                }
9493                                result.name_part = map
9494                                    .next_value::<std::option::Option<std::string::String>>()?
9495                                    .unwrap_or_default();
9496                            }
9497                            __FieldTag::__is_extension => {
9498                                if !fields.insert(__FieldTag::__is_extension) {
9499                                    return std::result::Result::Err(A::Error::duplicate_field(
9500                                        "multiple values for is_extension",
9501                                    ));
9502                                }
9503                                result.is_extension = map
9504                                    .next_value::<std::option::Option<bool>>()?
9505                                    .unwrap_or_default();
9506                            }
9507                            __FieldTag::Unknown(key) => {
9508                                let value = map.next_value::<serde_json::Value>()?;
9509                                result._unknown_fields.insert(key, value);
9510                            }
9511                        }
9512                    }
9513                    std::result::Result::Ok(result)
9514                }
9515            }
9516            deserializer.deserialize_any(Visitor)
9517        }
9518    }
9519
9520    #[doc(hidden)]
9521    impl serde::ser::Serialize for NamePart {
9522        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9523        where
9524            S: serde::ser::Serializer,
9525        {
9526            use serde::ser::SerializeMap;
9527            #[allow(unused_imports)]
9528            use std::option::Option::Some;
9529            let mut state = serializer.serialize_map(std::option::Option::None)?;
9530            if !self.name_part.is_empty() {
9531                state.serialize_entry("namePart", &self.name_part)?;
9532            }
9533            if !wkt::internal::is_default(&self.is_extension) {
9534                state.serialize_entry("isExtension", &self.is_extension)?;
9535            }
9536            if !self._unknown_fields.is_empty() {
9537                for (key, value) in self._unknown_fields.iter() {
9538                    state.serialize_entry(key, &value)?;
9539                }
9540            }
9541            state.end()
9542        }
9543    }
9544}
9545
9546/// TODO Enums in C++ gencode (and potentially other languages) are
9547/// not well scoped.  This means that each of the feature enums below can clash
9548/// with each other.  The short names we've chosen maximize call-site
9549/// readability, but leave us very open to this scenario.  A future feature will
9550/// be designed and implemented to handle this, hopefully before we ever hit a
9551/// conflict here.
9552#[derive(Clone, Debug, Default, PartialEq)]
9553#[non_exhaustive]
9554pub struct FeatureSet {
9555    pub field_presence: crate::feature_set::FieldPresence,
9556
9557    pub enum_type: crate::feature_set::EnumType,
9558
9559    pub repeated_field_encoding: crate::feature_set::RepeatedFieldEncoding,
9560
9561    pub utf8_validation: crate::feature_set::Utf8Validation,
9562
9563    pub message_encoding: crate::feature_set::MessageEncoding,
9564
9565    pub json_format: crate::feature_set::JsonFormat,
9566
9567    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9568}
9569
9570impl FeatureSet {
9571    pub fn new() -> Self {
9572        std::default::Default::default()
9573    }
9574
9575    /// Sets the value of [field_presence][crate::FeatureSet::field_presence].
9576    pub fn set_field_presence<T: std::convert::Into<crate::feature_set::FieldPresence>>(
9577        mut self,
9578        v: T,
9579    ) -> Self {
9580        self.field_presence = v.into();
9581        self
9582    }
9583
9584    /// Sets the value of [enum_type][crate::FeatureSet::enum_type].
9585    pub fn set_enum_type<T: std::convert::Into<crate::feature_set::EnumType>>(
9586        mut self,
9587        v: T,
9588    ) -> Self {
9589        self.enum_type = v.into();
9590        self
9591    }
9592
9593    /// Sets the value of [repeated_field_encoding][crate::FeatureSet::repeated_field_encoding].
9594    pub fn set_repeated_field_encoding<
9595        T: std::convert::Into<crate::feature_set::RepeatedFieldEncoding>,
9596    >(
9597        mut self,
9598        v: T,
9599    ) -> Self {
9600        self.repeated_field_encoding = v.into();
9601        self
9602    }
9603
9604    /// Sets the value of [utf8_validation][crate::FeatureSet::utf8_validation].
9605    pub fn set_utf8_validation<T: std::convert::Into<crate::feature_set::Utf8Validation>>(
9606        mut self,
9607        v: T,
9608    ) -> Self {
9609        self.utf8_validation = v.into();
9610        self
9611    }
9612
9613    /// Sets the value of [message_encoding][crate::FeatureSet::message_encoding].
9614    pub fn set_message_encoding<T: std::convert::Into<crate::feature_set::MessageEncoding>>(
9615        mut self,
9616        v: T,
9617    ) -> Self {
9618        self.message_encoding = v.into();
9619        self
9620    }
9621
9622    /// Sets the value of [json_format][crate::FeatureSet::json_format].
9623    pub fn set_json_format<T: std::convert::Into<crate::feature_set::JsonFormat>>(
9624        mut self,
9625        v: T,
9626    ) -> Self {
9627        self.json_format = v.into();
9628        self
9629    }
9630}
9631
9632impl wkt::message::Message for FeatureSet {
9633    fn typename() -> &'static str {
9634        "type.googleapis.com/google.protobuf.FeatureSet"
9635    }
9636}
9637
9638#[doc(hidden)]
9639impl<'de> serde::de::Deserialize<'de> for FeatureSet {
9640    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9641    where
9642        D: serde::Deserializer<'de>,
9643    {
9644        #[allow(non_camel_case_types)]
9645        #[doc(hidden)]
9646        #[derive(PartialEq, Eq, Hash)]
9647        enum __FieldTag {
9648            __field_presence,
9649            __enum_type,
9650            __repeated_field_encoding,
9651            __utf8_validation,
9652            __message_encoding,
9653            __json_format,
9654            Unknown(std::string::String),
9655        }
9656        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9657            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9658            where
9659                D: serde::Deserializer<'de>,
9660            {
9661                struct Visitor;
9662                impl<'de> serde::de::Visitor<'de> for Visitor {
9663                    type Value = __FieldTag;
9664                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9665                        formatter.write_str("a field name for FeatureSet")
9666                    }
9667                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9668                    where
9669                        E: serde::de::Error,
9670                    {
9671                        use std::result::Result::Ok;
9672                        use std::string::ToString;
9673                        match value {
9674                            "fieldPresence" => Ok(__FieldTag::__field_presence),
9675                            "field_presence" => Ok(__FieldTag::__field_presence),
9676                            "enumType" => Ok(__FieldTag::__enum_type),
9677                            "enum_type" => Ok(__FieldTag::__enum_type),
9678                            "repeatedFieldEncoding" => Ok(__FieldTag::__repeated_field_encoding),
9679                            "repeated_field_encoding" => Ok(__FieldTag::__repeated_field_encoding),
9680                            "utf8Validation" => Ok(__FieldTag::__utf8_validation),
9681                            "utf8_validation" => Ok(__FieldTag::__utf8_validation),
9682                            "messageEncoding" => Ok(__FieldTag::__message_encoding),
9683                            "message_encoding" => Ok(__FieldTag::__message_encoding),
9684                            "jsonFormat" => Ok(__FieldTag::__json_format),
9685                            "json_format" => Ok(__FieldTag::__json_format),
9686                            _ => Ok(__FieldTag::Unknown(value.to_string())),
9687                        }
9688                    }
9689                }
9690                deserializer.deserialize_identifier(Visitor)
9691            }
9692        }
9693        struct Visitor;
9694        impl<'de> serde::de::Visitor<'de> for Visitor {
9695            type Value = FeatureSet;
9696            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9697                formatter.write_str("struct FeatureSet")
9698            }
9699            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9700            where
9701                A: serde::de::MapAccess<'de>,
9702            {
9703                #[allow(unused_imports)]
9704                use serde::de::Error;
9705                use std::option::Option::Some;
9706                let mut fields = std::collections::HashSet::new();
9707                let mut result = Self::Value::new();
9708                while let Some(tag) = map.next_key::<__FieldTag>()? {
9709                    #[allow(clippy::match_single_binding)]
9710                    match tag {
9711                        __FieldTag::__field_presence => {
9712                            if !fields.insert(__FieldTag::__field_presence) {
9713                                return std::result::Result::Err(A::Error::duplicate_field(
9714                                    "multiple values for field_presence",
9715                                ));
9716                            }
9717                            result.field_presence = map.next_value::<std::option::Option<crate::feature_set::FieldPresence>>()?.unwrap_or_default();
9718                        }
9719                        __FieldTag::__enum_type => {
9720                            if !fields.insert(__FieldTag::__enum_type) {
9721                                return std::result::Result::Err(A::Error::duplicate_field(
9722                                    "multiple values for enum_type",
9723                                ));
9724                            }
9725                            result.enum_type = map
9726                                .next_value::<std::option::Option<crate::feature_set::EnumType>>()?
9727                                .unwrap_or_default();
9728                        }
9729                        __FieldTag::__repeated_field_encoding => {
9730                            if !fields.insert(__FieldTag::__repeated_field_encoding) {
9731                                return std::result::Result::Err(A::Error::duplicate_field(
9732                                    "multiple values for repeated_field_encoding",
9733                                ));
9734                            }
9735                            result.repeated_field_encoding = map.next_value::<std::option::Option<crate::feature_set::RepeatedFieldEncoding>>()?.unwrap_or_default();
9736                        }
9737                        __FieldTag::__utf8_validation => {
9738                            if !fields.insert(__FieldTag::__utf8_validation) {
9739                                return std::result::Result::Err(A::Error::duplicate_field(
9740                                    "multiple values for utf8_validation",
9741                                ));
9742                            }
9743                            result.utf8_validation = map.next_value::<std::option::Option<crate::feature_set::Utf8Validation>>()?.unwrap_or_default();
9744                        }
9745                        __FieldTag::__message_encoding => {
9746                            if !fields.insert(__FieldTag::__message_encoding) {
9747                                return std::result::Result::Err(A::Error::duplicate_field(
9748                                    "multiple values for message_encoding",
9749                                ));
9750                            }
9751                            result.message_encoding = map.next_value::<std::option::Option<crate::feature_set::MessageEncoding>>()?.unwrap_or_default();
9752                        }
9753                        __FieldTag::__json_format => {
9754                            if !fields.insert(__FieldTag::__json_format) {
9755                                return std::result::Result::Err(A::Error::duplicate_field(
9756                                    "multiple values for json_format",
9757                                ));
9758                            }
9759                            result.json_format = map
9760                                .next_value::<std::option::Option<crate::feature_set::JsonFormat>>(
9761                                )?
9762                                .unwrap_or_default();
9763                        }
9764                        __FieldTag::Unknown(key) => {
9765                            let value = map.next_value::<serde_json::Value>()?;
9766                            result._unknown_fields.insert(key, value);
9767                        }
9768                    }
9769                }
9770                std::result::Result::Ok(result)
9771            }
9772        }
9773        deserializer.deserialize_any(Visitor)
9774    }
9775}
9776
9777#[doc(hidden)]
9778impl serde::ser::Serialize for FeatureSet {
9779    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9780    where
9781        S: serde::ser::Serializer,
9782    {
9783        use serde::ser::SerializeMap;
9784        #[allow(unused_imports)]
9785        use std::option::Option::Some;
9786        let mut state = serializer.serialize_map(std::option::Option::None)?;
9787        if !wkt::internal::is_default(&self.field_presence) {
9788            state.serialize_entry("fieldPresence", &self.field_presence)?;
9789        }
9790        if !wkt::internal::is_default(&self.enum_type) {
9791            state.serialize_entry("enumType", &self.enum_type)?;
9792        }
9793        if !wkt::internal::is_default(&self.repeated_field_encoding) {
9794            state.serialize_entry("repeatedFieldEncoding", &self.repeated_field_encoding)?;
9795        }
9796        if !wkt::internal::is_default(&self.utf8_validation) {
9797            state.serialize_entry("utf8Validation", &self.utf8_validation)?;
9798        }
9799        if !wkt::internal::is_default(&self.message_encoding) {
9800            state.serialize_entry("messageEncoding", &self.message_encoding)?;
9801        }
9802        if !wkt::internal::is_default(&self.json_format) {
9803            state.serialize_entry("jsonFormat", &self.json_format)?;
9804        }
9805        if !self._unknown_fields.is_empty() {
9806            for (key, value) in self._unknown_fields.iter() {
9807                state.serialize_entry(key, &value)?;
9808            }
9809        }
9810        state.end()
9811    }
9812}
9813
9814/// Defines additional types related to [FeatureSet].
9815pub mod feature_set {
9816    #[allow(unused_imports)]
9817    use super::*;
9818
9819    ///
9820    /// # Working with unknown values
9821    ///
9822    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9823    /// additional enum variants at any time. Adding new variants is not considered
9824    /// a breaking change. Applications should write their code in anticipation of:
9825    ///
9826    /// - New values appearing in future releases of the client library, **and**
9827    /// - New values received dynamically, without application changes.
9828    ///
9829    /// Please consult the [Working with enums] section in the user guide for some
9830    /// guidelines.
9831    ///
9832    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9833    #[derive(Clone, Debug, PartialEq)]
9834    #[non_exhaustive]
9835    pub enum FieldPresence {
9836        Unknown,
9837        Explicit,
9838        Implicit,
9839        LegacyRequired,
9840        /// If set, the enum was initialized with an unknown value.
9841        ///
9842        /// Applications can examine the value using [FieldPresence::value] or
9843        /// [FieldPresence::name].
9844        UnknownValue(field_presence::UnknownValue),
9845    }
9846
9847    #[doc(hidden)]
9848    pub mod field_presence {
9849        #[allow(unused_imports)]
9850        use super::*;
9851        #[derive(Clone, Debug, PartialEq)]
9852        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9853    }
9854
9855    impl FieldPresence {
9856        /// Gets the enum value.
9857        ///
9858        /// Returns `None` if the enum contains an unknown value deserialized from
9859        /// the string representation of enums.
9860        pub fn value(&self) -> std::option::Option<i32> {
9861            match self {
9862                Self::Unknown => std::option::Option::Some(0),
9863                Self::Explicit => std::option::Option::Some(1),
9864                Self::Implicit => std::option::Option::Some(2),
9865                Self::LegacyRequired => std::option::Option::Some(3),
9866                Self::UnknownValue(u) => u.0.value(),
9867            }
9868        }
9869
9870        /// Gets the enum value as a string.
9871        ///
9872        /// Returns `None` if the enum contains an unknown value deserialized from
9873        /// the integer representation of enums.
9874        pub fn name(&self) -> std::option::Option<&str> {
9875            match self {
9876                Self::Unknown => std::option::Option::Some("FIELD_PRESENCE_UNKNOWN"),
9877                Self::Explicit => std::option::Option::Some("EXPLICIT"),
9878                Self::Implicit => std::option::Option::Some("IMPLICIT"),
9879                Self::LegacyRequired => std::option::Option::Some("LEGACY_REQUIRED"),
9880                Self::UnknownValue(u) => u.0.name(),
9881            }
9882        }
9883    }
9884
9885    impl std::default::Default for FieldPresence {
9886        fn default() -> Self {
9887            use std::convert::From;
9888            Self::from(0)
9889        }
9890    }
9891
9892    impl std::fmt::Display for FieldPresence {
9893        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9894            wkt::internal::display_enum(f, self.name(), self.value())
9895        }
9896    }
9897
9898    impl std::convert::From<i32> for FieldPresence {
9899        fn from(value: i32) -> Self {
9900            match value {
9901                0 => Self::Unknown,
9902                1 => Self::Explicit,
9903                2 => Self::Implicit,
9904                3 => Self::LegacyRequired,
9905                _ => Self::UnknownValue(field_presence::UnknownValue(
9906                    wkt::internal::UnknownEnumValue::Integer(value),
9907                )),
9908            }
9909        }
9910    }
9911
9912    impl std::convert::From<&str> for FieldPresence {
9913        fn from(value: &str) -> Self {
9914            use std::string::ToString;
9915            match value {
9916                "FIELD_PRESENCE_UNKNOWN" => Self::Unknown,
9917                "EXPLICIT" => Self::Explicit,
9918                "IMPLICIT" => Self::Implicit,
9919                "LEGACY_REQUIRED" => Self::LegacyRequired,
9920                _ => Self::UnknownValue(field_presence::UnknownValue(
9921                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9922                )),
9923            }
9924        }
9925    }
9926
9927    impl serde::ser::Serialize for FieldPresence {
9928        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9929        where
9930            S: serde::Serializer,
9931        {
9932            match self {
9933                Self::Unknown => serializer.serialize_i32(0),
9934                Self::Explicit => serializer.serialize_i32(1),
9935                Self::Implicit => serializer.serialize_i32(2),
9936                Self::LegacyRequired => serializer.serialize_i32(3),
9937                Self::UnknownValue(u) => u.0.serialize(serializer),
9938            }
9939        }
9940    }
9941
9942    impl<'de> serde::de::Deserialize<'de> for FieldPresence {
9943        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9944        where
9945            D: serde::Deserializer<'de>,
9946        {
9947            deserializer.deserialize_any(wkt::internal::EnumVisitor::<FieldPresence>::new(
9948                ".google.protobuf.FeatureSet.FieldPresence",
9949            ))
9950        }
9951    }
9952
9953    ///
9954    /// # Working with unknown values
9955    ///
9956    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9957    /// additional enum variants at any time. Adding new variants is not considered
9958    /// a breaking change. Applications should write their code in anticipation of:
9959    ///
9960    /// - New values appearing in future releases of the client library, **and**
9961    /// - New values received dynamically, without application changes.
9962    ///
9963    /// Please consult the [Working with enums] section in the user guide for some
9964    /// guidelines.
9965    ///
9966    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9967    #[derive(Clone, Debug, PartialEq)]
9968    #[non_exhaustive]
9969    pub enum EnumType {
9970        Unknown,
9971        Open,
9972        Closed,
9973        /// If set, the enum was initialized with an unknown value.
9974        ///
9975        /// Applications can examine the value using [EnumType::value] or
9976        /// [EnumType::name].
9977        UnknownValue(enum_type::UnknownValue),
9978    }
9979
9980    #[doc(hidden)]
9981    pub mod enum_type {
9982        #[allow(unused_imports)]
9983        use super::*;
9984        #[derive(Clone, Debug, PartialEq)]
9985        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9986    }
9987
9988    impl EnumType {
9989        /// Gets the enum value.
9990        ///
9991        /// Returns `None` if the enum contains an unknown value deserialized from
9992        /// the string representation of enums.
9993        pub fn value(&self) -> std::option::Option<i32> {
9994            match self {
9995                Self::Unknown => std::option::Option::Some(0),
9996                Self::Open => std::option::Option::Some(1),
9997                Self::Closed => std::option::Option::Some(2),
9998                Self::UnknownValue(u) => u.0.value(),
9999            }
10000        }
10001
10002        /// Gets the enum value as a string.
10003        ///
10004        /// Returns `None` if the enum contains an unknown value deserialized from
10005        /// the integer representation of enums.
10006        pub fn name(&self) -> std::option::Option<&str> {
10007            match self {
10008                Self::Unknown => std::option::Option::Some("ENUM_TYPE_UNKNOWN"),
10009                Self::Open => std::option::Option::Some("OPEN"),
10010                Self::Closed => std::option::Option::Some("CLOSED"),
10011                Self::UnknownValue(u) => u.0.name(),
10012            }
10013        }
10014    }
10015
10016    impl std::default::Default for EnumType {
10017        fn default() -> Self {
10018            use std::convert::From;
10019            Self::from(0)
10020        }
10021    }
10022
10023    impl std::fmt::Display for EnumType {
10024        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10025            wkt::internal::display_enum(f, self.name(), self.value())
10026        }
10027    }
10028
10029    impl std::convert::From<i32> for EnumType {
10030        fn from(value: i32) -> Self {
10031            match value {
10032                0 => Self::Unknown,
10033                1 => Self::Open,
10034                2 => Self::Closed,
10035                _ => Self::UnknownValue(enum_type::UnknownValue(
10036                    wkt::internal::UnknownEnumValue::Integer(value),
10037                )),
10038            }
10039        }
10040    }
10041
10042    impl std::convert::From<&str> for EnumType {
10043        fn from(value: &str) -> Self {
10044            use std::string::ToString;
10045            match value {
10046                "ENUM_TYPE_UNKNOWN" => Self::Unknown,
10047                "OPEN" => Self::Open,
10048                "CLOSED" => Self::Closed,
10049                _ => Self::UnknownValue(enum_type::UnknownValue(
10050                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10051                )),
10052            }
10053        }
10054    }
10055
10056    impl serde::ser::Serialize for EnumType {
10057        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10058        where
10059            S: serde::Serializer,
10060        {
10061            match self {
10062                Self::Unknown => serializer.serialize_i32(0),
10063                Self::Open => serializer.serialize_i32(1),
10064                Self::Closed => serializer.serialize_i32(2),
10065                Self::UnknownValue(u) => u.0.serialize(serializer),
10066            }
10067        }
10068    }
10069
10070    impl<'de> serde::de::Deserialize<'de> for EnumType {
10071        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10072        where
10073            D: serde::Deserializer<'de>,
10074        {
10075            deserializer.deserialize_any(wkt::internal::EnumVisitor::<EnumType>::new(
10076                ".google.protobuf.FeatureSet.EnumType",
10077            ))
10078        }
10079    }
10080
10081    ///
10082    /// # Working with unknown values
10083    ///
10084    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10085    /// additional enum variants at any time. Adding new variants is not considered
10086    /// a breaking change. Applications should write their code in anticipation of:
10087    ///
10088    /// - New values appearing in future releases of the client library, **and**
10089    /// - New values received dynamically, without application changes.
10090    ///
10091    /// Please consult the [Working with enums] section in the user guide for some
10092    /// guidelines.
10093    ///
10094    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10095    #[derive(Clone, Debug, PartialEq)]
10096    #[non_exhaustive]
10097    pub enum RepeatedFieldEncoding {
10098        Unknown,
10099        Packed,
10100        Expanded,
10101        /// If set, the enum was initialized with an unknown value.
10102        ///
10103        /// Applications can examine the value using [RepeatedFieldEncoding::value] or
10104        /// [RepeatedFieldEncoding::name].
10105        UnknownValue(repeated_field_encoding::UnknownValue),
10106    }
10107
10108    #[doc(hidden)]
10109    pub mod repeated_field_encoding {
10110        #[allow(unused_imports)]
10111        use super::*;
10112        #[derive(Clone, Debug, PartialEq)]
10113        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10114    }
10115
10116    impl RepeatedFieldEncoding {
10117        /// Gets the enum value.
10118        ///
10119        /// Returns `None` if the enum contains an unknown value deserialized from
10120        /// the string representation of enums.
10121        pub fn value(&self) -> std::option::Option<i32> {
10122            match self {
10123                Self::Unknown => std::option::Option::Some(0),
10124                Self::Packed => std::option::Option::Some(1),
10125                Self::Expanded => std::option::Option::Some(2),
10126                Self::UnknownValue(u) => u.0.value(),
10127            }
10128        }
10129
10130        /// Gets the enum value as a string.
10131        ///
10132        /// Returns `None` if the enum contains an unknown value deserialized from
10133        /// the integer representation of enums.
10134        pub fn name(&self) -> std::option::Option<&str> {
10135            match self {
10136                Self::Unknown => std::option::Option::Some("REPEATED_FIELD_ENCODING_UNKNOWN"),
10137                Self::Packed => std::option::Option::Some("PACKED"),
10138                Self::Expanded => std::option::Option::Some("EXPANDED"),
10139                Self::UnknownValue(u) => u.0.name(),
10140            }
10141        }
10142    }
10143
10144    impl std::default::Default for RepeatedFieldEncoding {
10145        fn default() -> Self {
10146            use std::convert::From;
10147            Self::from(0)
10148        }
10149    }
10150
10151    impl std::fmt::Display for RepeatedFieldEncoding {
10152        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10153            wkt::internal::display_enum(f, self.name(), self.value())
10154        }
10155    }
10156
10157    impl std::convert::From<i32> for RepeatedFieldEncoding {
10158        fn from(value: i32) -> Self {
10159            match value {
10160                0 => Self::Unknown,
10161                1 => Self::Packed,
10162                2 => Self::Expanded,
10163                _ => Self::UnknownValue(repeated_field_encoding::UnknownValue(
10164                    wkt::internal::UnknownEnumValue::Integer(value),
10165                )),
10166            }
10167        }
10168    }
10169
10170    impl std::convert::From<&str> for RepeatedFieldEncoding {
10171        fn from(value: &str) -> Self {
10172            use std::string::ToString;
10173            match value {
10174                "REPEATED_FIELD_ENCODING_UNKNOWN" => Self::Unknown,
10175                "PACKED" => Self::Packed,
10176                "EXPANDED" => Self::Expanded,
10177                _ => Self::UnknownValue(repeated_field_encoding::UnknownValue(
10178                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10179                )),
10180            }
10181        }
10182    }
10183
10184    impl serde::ser::Serialize for RepeatedFieldEncoding {
10185        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10186        where
10187            S: serde::Serializer,
10188        {
10189            match self {
10190                Self::Unknown => serializer.serialize_i32(0),
10191                Self::Packed => serializer.serialize_i32(1),
10192                Self::Expanded => serializer.serialize_i32(2),
10193                Self::UnknownValue(u) => u.0.serialize(serializer),
10194            }
10195        }
10196    }
10197
10198    impl<'de> serde::de::Deserialize<'de> for RepeatedFieldEncoding {
10199        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10200        where
10201            D: serde::Deserializer<'de>,
10202        {
10203            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RepeatedFieldEncoding>::new(
10204                ".google.protobuf.FeatureSet.RepeatedFieldEncoding",
10205            ))
10206        }
10207    }
10208
10209    ///
10210    /// # Working with unknown values
10211    ///
10212    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10213    /// additional enum variants at any time. Adding new variants is not considered
10214    /// a breaking change. Applications should write their code in anticipation of:
10215    ///
10216    /// - New values appearing in future releases of the client library, **and**
10217    /// - New values received dynamically, without application changes.
10218    ///
10219    /// Please consult the [Working with enums] section in the user guide for some
10220    /// guidelines.
10221    ///
10222    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10223    #[derive(Clone, Debug, PartialEq)]
10224    #[non_exhaustive]
10225    pub enum Utf8Validation {
10226        Unknown,
10227        Verify,
10228        None,
10229        /// If set, the enum was initialized with an unknown value.
10230        ///
10231        /// Applications can examine the value using [Utf8Validation::value] or
10232        /// [Utf8Validation::name].
10233        UnknownValue(utf_8_validation::UnknownValue),
10234    }
10235
10236    #[doc(hidden)]
10237    pub mod utf_8_validation {
10238        #[allow(unused_imports)]
10239        use super::*;
10240        #[derive(Clone, Debug, PartialEq)]
10241        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10242    }
10243
10244    impl Utf8Validation {
10245        /// Gets the enum value.
10246        ///
10247        /// Returns `None` if the enum contains an unknown value deserialized from
10248        /// the string representation of enums.
10249        pub fn value(&self) -> std::option::Option<i32> {
10250            match self {
10251                Self::Unknown => std::option::Option::Some(0),
10252                Self::Verify => std::option::Option::Some(2),
10253                Self::None => std::option::Option::Some(3),
10254                Self::UnknownValue(u) => u.0.value(),
10255            }
10256        }
10257
10258        /// Gets the enum value as a string.
10259        ///
10260        /// Returns `None` if the enum contains an unknown value deserialized from
10261        /// the integer representation of enums.
10262        pub fn name(&self) -> std::option::Option<&str> {
10263            match self {
10264                Self::Unknown => std::option::Option::Some("UTF8_VALIDATION_UNKNOWN"),
10265                Self::Verify => std::option::Option::Some("VERIFY"),
10266                Self::None => std::option::Option::Some("NONE"),
10267                Self::UnknownValue(u) => u.0.name(),
10268            }
10269        }
10270    }
10271
10272    impl std::default::Default for Utf8Validation {
10273        fn default() -> Self {
10274            use std::convert::From;
10275            Self::from(0)
10276        }
10277    }
10278
10279    impl std::fmt::Display for Utf8Validation {
10280        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10281            wkt::internal::display_enum(f, self.name(), self.value())
10282        }
10283    }
10284
10285    impl std::convert::From<i32> for Utf8Validation {
10286        fn from(value: i32) -> Self {
10287            match value {
10288                0 => Self::Unknown,
10289                2 => Self::Verify,
10290                3 => Self::None,
10291                _ => Self::UnknownValue(utf_8_validation::UnknownValue(
10292                    wkt::internal::UnknownEnumValue::Integer(value),
10293                )),
10294            }
10295        }
10296    }
10297
10298    impl std::convert::From<&str> for Utf8Validation {
10299        fn from(value: &str) -> Self {
10300            use std::string::ToString;
10301            match value {
10302                "UTF8_VALIDATION_UNKNOWN" => Self::Unknown,
10303                "VERIFY" => Self::Verify,
10304                "NONE" => Self::None,
10305                _ => Self::UnknownValue(utf_8_validation::UnknownValue(
10306                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10307                )),
10308            }
10309        }
10310    }
10311
10312    impl serde::ser::Serialize for Utf8Validation {
10313        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10314        where
10315            S: serde::Serializer,
10316        {
10317            match self {
10318                Self::Unknown => serializer.serialize_i32(0),
10319                Self::Verify => serializer.serialize_i32(2),
10320                Self::None => serializer.serialize_i32(3),
10321                Self::UnknownValue(u) => u.0.serialize(serializer),
10322            }
10323        }
10324    }
10325
10326    impl<'de> serde::de::Deserialize<'de> for Utf8Validation {
10327        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10328        where
10329            D: serde::Deserializer<'de>,
10330        {
10331            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Utf8Validation>::new(
10332                ".google.protobuf.FeatureSet.Utf8Validation",
10333            ))
10334        }
10335    }
10336
10337    ///
10338    /// # Working with unknown values
10339    ///
10340    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10341    /// additional enum variants at any time. Adding new variants is not considered
10342    /// a breaking change. Applications should write their code in anticipation of:
10343    ///
10344    /// - New values appearing in future releases of the client library, **and**
10345    /// - New values received dynamically, without application changes.
10346    ///
10347    /// Please consult the [Working with enums] section in the user guide for some
10348    /// guidelines.
10349    ///
10350    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10351    #[derive(Clone, Debug, PartialEq)]
10352    #[non_exhaustive]
10353    pub enum MessageEncoding {
10354        Unknown,
10355        LengthPrefixed,
10356        Delimited,
10357        /// If set, the enum was initialized with an unknown value.
10358        ///
10359        /// Applications can examine the value using [MessageEncoding::value] or
10360        /// [MessageEncoding::name].
10361        UnknownValue(message_encoding::UnknownValue),
10362    }
10363
10364    #[doc(hidden)]
10365    pub mod message_encoding {
10366        #[allow(unused_imports)]
10367        use super::*;
10368        #[derive(Clone, Debug, PartialEq)]
10369        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10370    }
10371
10372    impl MessageEncoding {
10373        /// Gets the enum value.
10374        ///
10375        /// Returns `None` if the enum contains an unknown value deserialized from
10376        /// the string representation of enums.
10377        pub fn value(&self) -> std::option::Option<i32> {
10378            match self {
10379                Self::Unknown => std::option::Option::Some(0),
10380                Self::LengthPrefixed => std::option::Option::Some(1),
10381                Self::Delimited => std::option::Option::Some(2),
10382                Self::UnknownValue(u) => u.0.value(),
10383            }
10384        }
10385
10386        /// Gets the enum value as a string.
10387        ///
10388        /// Returns `None` if the enum contains an unknown value deserialized from
10389        /// the integer representation of enums.
10390        pub fn name(&self) -> std::option::Option<&str> {
10391            match self {
10392                Self::Unknown => std::option::Option::Some("MESSAGE_ENCODING_UNKNOWN"),
10393                Self::LengthPrefixed => std::option::Option::Some("LENGTH_PREFIXED"),
10394                Self::Delimited => std::option::Option::Some("DELIMITED"),
10395                Self::UnknownValue(u) => u.0.name(),
10396            }
10397        }
10398    }
10399
10400    impl std::default::Default for MessageEncoding {
10401        fn default() -> Self {
10402            use std::convert::From;
10403            Self::from(0)
10404        }
10405    }
10406
10407    impl std::fmt::Display for MessageEncoding {
10408        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10409            wkt::internal::display_enum(f, self.name(), self.value())
10410        }
10411    }
10412
10413    impl std::convert::From<i32> for MessageEncoding {
10414        fn from(value: i32) -> Self {
10415            match value {
10416                0 => Self::Unknown,
10417                1 => Self::LengthPrefixed,
10418                2 => Self::Delimited,
10419                _ => Self::UnknownValue(message_encoding::UnknownValue(
10420                    wkt::internal::UnknownEnumValue::Integer(value),
10421                )),
10422            }
10423        }
10424    }
10425
10426    impl std::convert::From<&str> for MessageEncoding {
10427        fn from(value: &str) -> Self {
10428            use std::string::ToString;
10429            match value {
10430                "MESSAGE_ENCODING_UNKNOWN" => Self::Unknown,
10431                "LENGTH_PREFIXED" => Self::LengthPrefixed,
10432                "DELIMITED" => Self::Delimited,
10433                _ => Self::UnknownValue(message_encoding::UnknownValue(
10434                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10435                )),
10436            }
10437        }
10438    }
10439
10440    impl serde::ser::Serialize for MessageEncoding {
10441        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10442        where
10443            S: serde::Serializer,
10444        {
10445            match self {
10446                Self::Unknown => serializer.serialize_i32(0),
10447                Self::LengthPrefixed => serializer.serialize_i32(1),
10448                Self::Delimited => serializer.serialize_i32(2),
10449                Self::UnknownValue(u) => u.0.serialize(serializer),
10450            }
10451        }
10452    }
10453
10454    impl<'de> serde::de::Deserialize<'de> for MessageEncoding {
10455        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10456        where
10457            D: serde::Deserializer<'de>,
10458        {
10459            deserializer.deserialize_any(wkt::internal::EnumVisitor::<MessageEncoding>::new(
10460                ".google.protobuf.FeatureSet.MessageEncoding",
10461            ))
10462        }
10463    }
10464
10465    ///
10466    /// # Working with unknown values
10467    ///
10468    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10469    /// additional enum variants at any time. Adding new variants is not considered
10470    /// a breaking change. Applications should write their code in anticipation of:
10471    ///
10472    /// - New values appearing in future releases of the client library, **and**
10473    /// - New values received dynamically, without application changes.
10474    ///
10475    /// Please consult the [Working with enums] section in the user guide for some
10476    /// guidelines.
10477    ///
10478    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10479    #[derive(Clone, Debug, PartialEq)]
10480    #[non_exhaustive]
10481    pub enum JsonFormat {
10482        Unknown,
10483        Allow,
10484        LegacyBestEffort,
10485        /// If set, the enum was initialized with an unknown value.
10486        ///
10487        /// Applications can examine the value using [JsonFormat::value] or
10488        /// [JsonFormat::name].
10489        UnknownValue(json_format::UnknownValue),
10490    }
10491
10492    #[doc(hidden)]
10493    pub mod json_format {
10494        #[allow(unused_imports)]
10495        use super::*;
10496        #[derive(Clone, Debug, PartialEq)]
10497        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10498    }
10499
10500    impl JsonFormat {
10501        /// Gets the enum value.
10502        ///
10503        /// Returns `None` if the enum contains an unknown value deserialized from
10504        /// the string representation of enums.
10505        pub fn value(&self) -> std::option::Option<i32> {
10506            match self {
10507                Self::Unknown => std::option::Option::Some(0),
10508                Self::Allow => std::option::Option::Some(1),
10509                Self::LegacyBestEffort => std::option::Option::Some(2),
10510                Self::UnknownValue(u) => u.0.value(),
10511            }
10512        }
10513
10514        /// Gets the enum value as a string.
10515        ///
10516        /// Returns `None` if the enum contains an unknown value deserialized from
10517        /// the integer representation of enums.
10518        pub fn name(&self) -> std::option::Option<&str> {
10519            match self {
10520                Self::Unknown => std::option::Option::Some("JSON_FORMAT_UNKNOWN"),
10521                Self::Allow => std::option::Option::Some("ALLOW"),
10522                Self::LegacyBestEffort => std::option::Option::Some("LEGACY_BEST_EFFORT"),
10523                Self::UnknownValue(u) => u.0.name(),
10524            }
10525        }
10526    }
10527
10528    impl std::default::Default for JsonFormat {
10529        fn default() -> Self {
10530            use std::convert::From;
10531            Self::from(0)
10532        }
10533    }
10534
10535    impl std::fmt::Display for JsonFormat {
10536        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10537            wkt::internal::display_enum(f, self.name(), self.value())
10538        }
10539    }
10540
10541    impl std::convert::From<i32> for JsonFormat {
10542        fn from(value: i32) -> Self {
10543            match value {
10544                0 => Self::Unknown,
10545                1 => Self::Allow,
10546                2 => Self::LegacyBestEffort,
10547                _ => Self::UnknownValue(json_format::UnknownValue(
10548                    wkt::internal::UnknownEnumValue::Integer(value),
10549                )),
10550            }
10551        }
10552    }
10553
10554    impl std::convert::From<&str> for JsonFormat {
10555        fn from(value: &str) -> Self {
10556            use std::string::ToString;
10557            match value {
10558                "JSON_FORMAT_UNKNOWN" => Self::Unknown,
10559                "ALLOW" => Self::Allow,
10560                "LEGACY_BEST_EFFORT" => Self::LegacyBestEffort,
10561                _ => Self::UnknownValue(json_format::UnknownValue(
10562                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10563                )),
10564            }
10565        }
10566    }
10567
10568    impl serde::ser::Serialize for JsonFormat {
10569        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10570        where
10571            S: serde::Serializer,
10572        {
10573            match self {
10574                Self::Unknown => serializer.serialize_i32(0),
10575                Self::Allow => serializer.serialize_i32(1),
10576                Self::LegacyBestEffort => serializer.serialize_i32(2),
10577                Self::UnknownValue(u) => u.0.serialize(serializer),
10578            }
10579        }
10580    }
10581
10582    impl<'de> serde::de::Deserialize<'de> for JsonFormat {
10583        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10584        where
10585            D: serde::Deserializer<'de>,
10586        {
10587            deserializer.deserialize_any(wkt::internal::EnumVisitor::<JsonFormat>::new(
10588                ".google.protobuf.FeatureSet.JsonFormat",
10589            ))
10590        }
10591    }
10592}
10593
10594/// A compiled specification for the defaults of a set of features.  These
10595/// messages are generated from FeatureSet extensions and can be used to seed
10596/// feature resolution. The resolution with this object becomes a simple search
10597/// for the closest matching edition, followed by proto merges.
10598#[derive(Clone, Debug, Default, PartialEq)]
10599#[non_exhaustive]
10600pub struct FeatureSetDefaults {
10601    pub defaults: std::vec::Vec<crate::feature_set_defaults::FeatureSetEditionDefault>,
10602
10603    /// The minimum supported edition (inclusive) when this was constructed.
10604    /// Editions before this will not have defaults.
10605    pub minimum_edition: crate::Edition,
10606
10607    /// The maximum known edition (inclusive) when this was constructed. Editions
10608    /// after this will not have reliable defaults.
10609    pub maximum_edition: crate::Edition,
10610
10611    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10612}
10613
10614impl FeatureSetDefaults {
10615    pub fn new() -> Self {
10616        std::default::Default::default()
10617    }
10618
10619    /// Sets the value of [defaults][crate::FeatureSetDefaults::defaults].
10620    pub fn set_defaults<T, V>(mut self, v: T) -> Self
10621    where
10622        T: std::iter::IntoIterator<Item = V>,
10623        V: std::convert::Into<crate::feature_set_defaults::FeatureSetEditionDefault>,
10624    {
10625        use std::iter::Iterator;
10626        self.defaults = v.into_iter().map(|i| i.into()).collect();
10627        self
10628    }
10629
10630    /// Sets the value of [minimum_edition][crate::FeatureSetDefaults::minimum_edition].
10631    pub fn set_minimum_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
10632        self.minimum_edition = v.into();
10633        self
10634    }
10635
10636    /// Sets the value of [maximum_edition][crate::FeatureSetDefaults::maximum_edition].
10637    pub fn set_maximum_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
10638        self.maximum_edition = v.into();
10639        self
10640    }
10641}
10642
10643impl wkt::message::Message for FeatureSetDefaults {
10644    fn typename() -> &'static str {
10645        "type.googleapis.com/google.protobuf.FeatureSetDefaults"
10646    }
10647}
10648
10649#[doc(hidden)]
10650impl<'de> serde::de::Deserialize<'de> for FeatureSetDefaults {
10651    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10652    where
10653        D: serde::Deserializer<'de>,
10654    {
10655        #[allow(non_camel_case_types)]
10656        #[doc(hidden)]
10657        #[derive(PartialEq, Eq, Hash)]
10658        enum __FieldTag {
10659            __defaults,
10660            __minimum_edition,
10661            __maximum_edition,
10662            Unknown(std::string::String),
10663        }
10664        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10665            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10666            where
10667                D: serde::Deserializer<'de>,
10668            {
10669                struct Visitor;
10670                impl<'de> serde::de::Visitor<'de> for Visitor {
10671                    type Value = __FieldTag;
10672                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10673                        formatter.write_str("a field name for FeatureSetDefaults")
10674                    }
10675                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10676                    where
10677                        E: serde::de::Error,
10678                    {
10679                        use std::result::Result::Ok;
10680                        use std::string::ToString;
10681                        match value {
10682                            "defaults" => Ok(__FieldTag::__defaults),
10683                            "minimumEdition" => Ok(__FieldTag::__minimum_edition),
10684                            "minimum_edition" => Ok(__FieldTag::__minimum_edition),
10685                            "maximumEdition" => Ok(__FieldTag::__maximum_edition),
10686                            "maximum_edition" => Ok(__FieldTag::__maximum_edition),
10687                            _ => Ok(__FieldTag::Unknown(value.to_string())),
10688                        }
10689                    }
10690                }
10691                deserializer.deserialize_identifier(Visitor)
10692            }
10693        }
10694        struct Visitor;
10695        impl<'de> serde::de::Visitor<'de> for Visitor {
10696            type Value = FeatureSetDefaults;
10697            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10698                formatter.write_str("struct FeatureSetDefaults")
10699            }
10700            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10701            where
10702                A: serde::de::MapAccess<'de>,
10703            {
10704                #[allow(unused_imports)]
10705                use serde::de::Error;
10706                use std::option::Option::Some;
10707                let mut fields = std::collections::HashSet::new();
10708                let mut result = Self::Value::new();
10709                while let Some(tag) = map.next_key::<__FieldTag>()? {
10710                    #[allow(clippy::match_single_binding)]
10711                    match tag {
10712                        __FieldTag::__defaults => {
10713                            if !fields.insert(__FieldTag::__defaults) {
10714                                return std::result::Result::Err(A::Error::duplicate_field(
10715                                    "multiple values for defaults",
10716                                ));
10717                            }
10718                            result.defaults = map
10719                                .next_value::<std::option::Option<
10720                                    std::vec::Vec<
10721                                        crate::feature_set_defaults::FeatureSetEditionDefault,
10722                                    >,
10723                                >>()?
10724                                .unwrap_or_default();
10725                        }
10726                        __FieldTag::__minimum_edition => {
10727                            if !fields.insert(__FieldTag::__minimum_edition) {
10728                                return std::result::Result::Err(A::Error::duplicate_field(
10729                                    "multiple values for minimum_edition",
10730                                ));
10731                            }
10732                            result.minimum_edition = map
10733                                .next_value::<std::option::Option<crate::Edition>>()?
10734                                .unwrap_or_default();
10735                        }
10736                        __FieldTag::__maximum_edition => {
10737                            if !fields.insert(__FieldTag::__maximum_edition) {
10738                                return std::result::Result::Err(A::Error::duplicate_field(
10739                                    "multiple values for maximum_edition",
10740                                ));
10741                            }
10742                            result.maximum_edition = map
10743                                .next_value::<std::option::Option<crate::Edition>>()?
10744                                .unwrap_or_default();
10745                        }
10746                        __FieldTag::Unknown(key) => {
10747                            let value = map.next_value::<serde_json::Value>()?;
10748                            result._unknown_fields.insert(key, value);
10749                        }
10750                    }
10751                }
10752                std::result::Result::Ok(result)
10753            }
10754        }
10755        deserializer.deserialize_any(Visitor)
10756    }
10757}
10758
10759#[doc(hidden)]
10760impl serde::ser::Serialize for FeatureSetDefaults {
10761    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10762    where
10763        S: serde::ser::Serializer,
10764    {
10765        use serde::ser::SerializeMap;
10766        #[allow(unused_imports)]
10767        use std::option::Option::Some;
10768        let mut state = serializer.serialize_map(std::option::Option::None)?;
10769        if !self.defaults.is_empty() {
10770            state.serialize_entry("defaults", &self.defaults)?;
10771        }
10772        if !wkt::internal::is_default(&self.minimum_edition) {
10773            state.serialize_entry("minimumEdition", &self.minimum_edition)?;
10774        }
10775        if !wkt::internal::is_default(&self.maximum_edition) {
10776            state.serialize_entry("maximumEdition", &self.maximum_edition)?;
10777        }
10778        if !self._unknown_fields.is_empty() {
10779            for (key, value) in self._unknown_fields.iter() {
10780                state.serialize_entry(key, &value)?;
10781            }
10782        }
10783        state.end()
10784    }
10785}
10786
10787/// Defines additional types related to [FeatureSetDefaults].
10788pub mod feature_set_defaults {
10789    #[allow(unused_imports)]
10790    use super::*;
10791
10792    /// A map from every known edition with a unique set of defaults to its
10793    /// defaults. Not all editions may be contained here.  For a given edition,
10794    /// the defaults at the closest matching edition ordered at or before it should
10795    /// be used.  This field must be in strict ascending order by edition.
10796    #[derive(Clone, Debug, Default, PartialEq)]
10797    #[non_exhaustive]
10798    pub struct FeatureSetEditionDefault {
10799        pub edition: crate::Edition,
10800
10801        /// Defaults of features that can be overridden in this edition.
10802        pub overridable_features: std::option::Option<crate::FeatureSet>,
10803
10804        /// Defaults of features that can't be overridden in this edition.
10805        pub fixed_features: std::option::Option<crate::FeatureSet>,
10806
10807        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10808    }
10809
10810    impl FeatureSetEditionDefault {
10811        pub fn new() -> Self {
10812            std::default::Default::default()
10813        }
10814
10815        /// Sets the value of [edition][crate::feature_set_defaults::FeatureSetEditionDefault::edition].
10816        pub fn set_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
10817            self.edition = v.into();
10818            self
10819        }
10820
10821        /// Sets the value of [overridable_features][crate::feature_set_defaults::FeatureSetEditionDefault::overridable_features].
10822        pub fn set_overridable_features<T>(mut self, v: T) -> Self
10823        where
10824            T: std::convert::Into<crate::FeatureSet>,
10825        {
10826            self.overridable_features = std::option::Option::Some(v.into());
10827            self
10828        }
10829
10830        /// Sets or clears the value of [overridable_features][crate::feature_set_defaults::FeatureSetEditionDefault::overridable_features].
10831        pub fn set_or_clear_overridable_features<T>(mut self, v: std::option::Option<T>) -> Self
10832        where
10833            T: std::convert::Into<crate::FeatureSet>,
10834        {
10835            self.overridable_features = v.map(|x| x.into());
10836            self
10837        }
10838
10839        /// Sets the value of [fixed_features][crate::feature_set_defaults::FeatureSetEditionDefault::fixed_features].
10840        pub fn set_fixed_features<T>(mut self, v: T) -> Self
10841        where
10842            T: std::convert::Into<crate::FeatureSet>,
10843        {
10844            self.fixed_features = std::option::Option::Some(v.into());
10845            self
10846        }
10847
10848        /// Sets or clears the value of [fixed_features][crate::feature_set_defaults::FeatureSetEditionDefault::fixed_features].
10849        pub fn set_or_clear_fixed_features<T>(mut self, v: std::option::Option<T>) -> Self
10850        where
10851            T: std::convert::Into<crate::FeatureSet>,
10852        {
10853            self.fixed_features = v.map(|x| x.into());
10854            self
10855        }
10856    }
10857
10858    impl wkt::message::Message for FeatureSetEditionDefault {
10859        fn typename() -> &'static str {
10860            "type.googleapis.com/google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"
10861        }
10862    }
10863
10864    #[doc(hidden)]
10865    impl<'de> serde::de::Deserialize<'de> for FeatureSetEditionDefault {
10866        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10867        where
10868            D: serde::Deserializer<'de>,
10869        {
10870            #[allow(non_camel_case_types)]
10871            #[doc(hidden)]
10872            #[derive(PartialEq, Eq, Hash)]
10873            enum __FieldTag {
10874                __edition,
10875                __overridable_features,
10876                __fixed_features,
10877                Unknown(std::string::String),
10878            }
10879            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10880                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10881                where
10882                    D: serde::Deserializer<'de>,
10883                {
10884                    struct Visitor;
10885                    impl<'de> serde::de::Visitor<'de> for Visitor {
10886                        type Value = __FieldTag;
10887                        fn expecting(
10888                            &self,
10889                            formatter: &mut std::fmt::Formatter,
10890                        ) -> std::fmt::Result {
10891                            formatter.write_str("a field name for FeatureSetEditionDefault")
10892                        }
10893                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10894                        where
10895                            E: serde::de::Error,
10896                        {
10897                            use std::result::Result::Ok;
10898                            use std::string::ToString;
10899                            match value {
10900                                "edition" => Ok(__FieldTag::__edition),
10901                                "overridableFeatures" => Ok(__FieldTag::__overridable_features),
10902                                "overridable_features" => Ok(__FieldTag::__overridable_features),
10903                                "fixedFeatures" => Ok(__FieldTag::__fixed_features),
10904                                "fixed_features" => Ok(__FieldTag::__fixed_features),
10905                                _ => Ok(__FieldTag::Unknown(value.to_string())),
10906                            }
10907                        }
10908                    }
10909                    deserializer.deserialize_identifier(Visitor)
10910                }
10911            }
10912            struct Visitor;
10913            impl<'de> serde::de::Visitor<'de> for Visitor {
10914                type Value = FeatureSetEditionDefault;
10915                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10916                    formatter.write_str("struct FeatureSetEditionDefault")
10917                }
10918                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10919                where
10920                    A: serde::de::MapAccess<'de>,
10921                {
10922                    #[allow(unused_imports)]
10923                    use serde::de::Error;
10924                    use std::option::Option::Some;
10925                    let mut fields = std::collections::HashSet::new();
10926                    let mut result = Self::Value::new();
10927                    while let Some(tag) = map.next_key::<__FieldTag>()? {
10928                        #[allow(clippy::match_single_binding)]
10929                        match tag {
10930                            __FieldTag::__edition => {
10931                                if !fields.insert(__FieldTag::__edition) {
10932                                    return std::result::Result::Err(A::Error::duplicate_field(
10933                                        "multiple values for edition",
10934                                    ));
10935                                }
10936                                result.edition = map
10937                                    .next_value::<std::option::Option<crate::Edition>>()?
10938                                    .unwrap_or_default();
10939                            }
10940                            __FieldTag::__overridable_features => {
10941                                if !fields.insert(__FieldTag::__overridable_features) {
10942                                    return std::result::Result::Err(A::Error::duplicate_field(
10943                                        "multiple values for overridable_features",
10944                                    ));
10945                                }
10946                                result.overridable_features =
10947                                    map.next_value::<std::option::Option<crate::FeatureSet>>()?;
10948                            }
10949                            __FieldTag::__fixed_features => {
10950                                if !fields.insert(__FieldTag::__fixed_features) {
10951                                    return std::result::Result::Err(A::Error::duplicate_field(
10952                                        "multiple values for fixed_features",
10953                                    ));
10954                                }
10955                                result.fixed_features =
10956                                    map.next_value::<std::option::Option<crate::FeatureSet>>()?;
10957                            }
10958                            __FieldTag::Unknown(key) => {
10959                                let value = map.next_value::<serde_json::Value>()?;
10960                                result._unknown_fields.insert(key, value);
10961                            }
10962                        }
10963                    }
10964                    std::result::Result::Ok(result)
10965                }
10966            }
10967            deserializer.deserialize_any(Visitor)
10968        }
10969    }
10970
10971    #[doc(hidden)]
10972    impl serde::ser::Serialize for FeatureSetEditionDefault {
10973        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10974        where
10975            S: serde::ser::Serializer,
10976        {
10977            use serde::ser::SerializeMap;
10978            #[allow(unused_imports)]
10979            use std::option::Option::Some;
10980            let mut state = serializer.serialize_map(std::option::Option::None)?;
10981            if !wkt::internal::is_default(&self.edition) {
10982                state.serialize_entry("edition", &self.edition)?;
10983            }
10984            if self.overridable_features.is_some() {
10985                state.serialize_entry("overridableFeatures", &self.overridable_features)?;
10986            }
10987            if self.fixed_features.is_some() {
10988                state.serialize_entry("fixedFeatures", &self.fixed_features)?;
10989            }
10990            if !self._unknown_fields.is_empty() {
10991                for (key, value) in self._unknown_fields.iter() {
10992                    state.serialize_entry(key, &value)?;
10993                }
10994            }
10995            state.end()
10996        }
10997    }
10998}
10999
11000/// Encapsulates information about the original source file from which a
11001/// FileDescriptorProto was generated.
11002#[derive(Clone, Debug, Default, PartialEq)]
11003#[non_exhaustive]
11004pub struct SourceCodeInfo {
11005    /// A Location identifies a piece of source code in a .proto file which
11006    /// corresponds to a particular definition.  This information is intended
11007    /// to be useful to IDEs, code indexers, documentation generators, and similar
11008    /// tools.
11009    ///
11010    /// For example, say we have a file like:
11011    /// message Foo {
11012    /// optional string foo = 1;
11013    /// }
11014    /// Let's look at just the field definition:
11015    /// optional string foo = 1;
11016    /// ^       ^^     ^^  ^  ^^^
11017    /// a       bc     de  f  ghi
11018    /// We have the following locations:
11019    /// span   path               represents
11020    /// [a,i)  [ 4, 0, 2, 0 ]     The whole field definition.
11021    /// [a,b)  [ 4, 0, 2, 0, 4 ]  The label (optional).
11022    /// [c,d)  [ 4, 0, 2, 0, 5 ]  The type (string).
11023    /// [e,f)  [ 4, 0, 2, 0, 1 ]  The name (foo).
11024    /// [g,h)  [ 4, 0, 2, 0, 3 ]  The number (1).
11025    ///
11026    /// Notes:
11027    ///
11028    /// - A location may refer to a repeated field itself (i.e. not to any
11029    ///   particular index within it).  This is used whenever a set of elements are
11030    ///   logically enclosed in a single code segment.  For example, an entire
11031    ///   extend block (possibly containing multiple extension definitions) will
11032    ///   have an outer location whose path refers to the "extensions" repeated
11033    ///   field without an index.
11034    /// - Multiple locations may have the same path.  This happens when a single
11035    ///   logical declaration is spread out across multiple places.  The most
11036    ///   obvious example is the "extend" block again -- there may be multiple
11037    ///   extend blocks in the same scope, each of which will have the same path.
11038    /// - A location's span is not always a subset of its parent's span.  For
11039    ///   example, the "extendee" of an extension declaration appears at the
11040    ///   beginning of the "extend" block and is shared by all extensions within
11041    ///   the block.
11042    /// - Just because a location's span is a subset of some other location's span
11043    ///   does not mean that it is a descendant.  For example, a "group" defines
11044    ///   both a type and a field in a single declaration.  Thus, the locations
11045    ///   corresponding to the type and field and their components will overlap.
11046    /// - Code which tries to interpret locations should probably be designed to
11047    ///   ignore those that it doesn't understand, as more types of locations could
11048    ///   be recorded in the future.
11049    pub location: std::vec::Vec<crate::source_code_info::Location>,
11050
11051    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11052}
11053
11054impl SourceCodeInfo {
11055    pub fn new() -> Self {
11056        std::default::Default::default()
11057    }
11058
11059    /// Sets the value of [location][crate::SourceCodeInfo::location].
11060    pub fn set_location<T, V>(mut self, v: T) -> Self
11061    where
11062        T: std::iter::IntoIterator<Item = V>,
11063        V: std::convert::Into<crate::source_code_info::Location>,
11064    {
11065        use std::iter::Iterator;
11066        self.location = v.into_iter().map(|i| i.into()).collect();
11067        self
11068    }
11069}
11070
11071impl wkt::message::Message for SourceCodeInfo {
11072    fn typename() -> &'static str {
11073        "type.googleapis.com/google.protobuf.SourceCodeInfo"
11074    }
11075}
11076
11077#[doc(hidden)]
11078impl<'de> serde::de::Deserialize<'de> for SourceCodeInfo {
11079    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11080    where
11081        D: serde::Deserializer<'de>,
11082    {
11083        #[allow(non_camel_case_types)]
11084        #[doc(hidden)]
11085        #[derive(PartialEq, Eq, Hash)]
11086        enum __FieldTag {
11087            __location,
11088            Unknown(std::string::String),
11089        }
11090        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11091            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11092            where
11093                D: serde::Deserializer<'de>,
11094            {
11095                struct Visitor;
11096                impl<'de> serde::de::Visitor<'de> for Visitor {
11097                    type Value = __FieldTag;
11098                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11099                        formatter.write_str("a field name for SourceCodeInfo")
11100                    }
11101                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11102                    where
11103                        E: serde::de::Error,
11104                    {
11105                        use std::result::Result::Ok;
11106                        use std::string::ToString;
11107                        match value {
11108                            "location" => Ok(__FieldTag::__location),
11109                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11110                        }
11111                    }
11112                }
11113                deserializer.deserialize_identifier(Visitor)
11114            }
11115        }
11116        struct Visitor;
11117        impl<'de> serde::de::Visitor<'de> for Visitor {
11118            type Value = SourceCodeInfo;
11119            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11120                formatter.write_str("struct SourceCodeInfo")
11121            }
11122            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11123            where
11124                A: serde::de::MapAccess<'de>,
11125            {
11126                #[allow(unused_imports)]
11127                use serde::de::Error;
11128                use std::option::Option::Some;
11129                let mut fields = std::collections::HashSet::new();
11130                let mut result = Self::Value::new();
11131                while let Some(tag) = map.next_key::<__FieldTag>()? {
11132                    #[allow(clippy::match_single_binding)]
11133                    match tag {
11134                        __FieldTag::__location => {
11135                            if !fields.insert(__FieldTag::__location) {
11136                                return std::result::Result::Err(A::Error::duplicate_field(
11137                                    "multiple values for location",
11138                                ));
11139                            }
11140                            result.location = map
11141                                .next_value::<std::option::Option<
11142                                    std::vec::Vec<crate::source_code_info::Location>,
11143                                >>()?
11144                                .unwrap_or_default();
11145                        }
11146                        __FieldTag::Unknown(key) => {
11147                            let value = map.next_value::<serde_json::Value>()?;
11148                            result._unknown_fields.insert(key, value);
11149                        }
11150                    }
11151                }
11152                std::result::Result::Ok(result)
11153            }
11154        }
11155        deserializer.deserialize_any(Visitor)
11156    }
11157}
11158
11159#[doc(hidden)]
11160impl serde::ser::Serialize for SourceCodeInfo {
11161    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11162    where
11163        S: serde::ser::Serializer,
11164    {
11165        use serde::ser::SerializeMap;
11166        #[allow(unused_imports)]
11167        use std::option::Option::Some;
11168        let mut state = serializer.serialize_map(std::option::Option::None)?;
11169        if !self.location.is_empty() {
11170            state.serialize_entry("location", &self.location)?;
11171        }
11172        if !self._unknown_fields.is_empty() {
11173            for (key, value) in self._unknown_fields.iter() {
11174                state.serialize_entry(key, &value)?;
11175            }
11176        }
11177        state.end()
11178    }
11179}
11180
11181/// Defines additional types related to [SourceCodeInfo].
11182pub mod source_code_info {
11183    #[allow(unused_imports)]
11184    use super::*;
11185
11186    #[derive(Clone, Debug, Default, PartialEq)]
11187    #[non_exhaustive]
11188    pub struct Location {
11189        /// Identifies which part of the FileDescriptorProto was defined at this
11190        /// location.
11191        ///
11192        /// Each element is a field number or an index.  They form a path from
11193        /// the root FileDescriptorProto to the place where the definition appears.
11194        /// For example, this path:
11195        /// [ 4, 3, 2, 7, 1 ]
11196        /// refers to:
11197        /// file.message_type(3)  // 4, 3
11198        /// .field(7)         // 2, 7
11199        /// .name()           // 1
11200        /// This is because FileDescriptorProto.message_type has field number 4:
11201        /// repeated DescriptorProto message_type = 4;
11202        /// and DescriptorProto.field has field number 2:
11203        /// repeated FieldDescriptorProto field = 2;
11204        /// and FieldDescriptorProto.name has field number 1:
11205        /// optional string name = 1;
11206        ///
11207        /// Thus, the above path gives the location of a field name.  If we removed
11208        /// the last element:
11209        /// [ 4, 3, 2, 7 ]
11210        /// this path refers to the whole field declaration (from the beginning
11211        /// of the label to the terminating semicolon).
11212        pub path: std::vec::Vec<i32>,
11213
11214        /// Always has exactly three or four elements: start line, start column,
11215        /// end line (optional, otherwise assumed same as start line), end column.
11216        /// These are packed into a single field for efficiency.  Note that line
11217        /// and column numbers are zero-based -- typically you will want to add
11218        /// 1 to each before displaying to a user.
11219        pub span: std::vec::Vec<i32>,
11220
11221        /// If this SourceCodeInfo represents a complete declaration, these are any
11222        /// comments appearing before and after the declaration which appear to be
11223        /// attached to the declaration.
11224        ///
11225        /// A series of line comments appearing on consecutive lines, with no other
11226        /// tokens appearing on those lines, will be treated as a single comment.
11227        ///
11228        /// leading_detached_comments will keep paragraphs of comments that appear
11229        /// before (but not connected to) the current element. Each paragraph,
11230        /// separated by empty lines, will be one comment element in the repeated
11231        /// field.
11232        ///
11233        /// Only the comment content is provided; comment markers (e.g. //) are
11234        /// stripped out.  For block comments, leading whitespace and an asterisk
11235        /// will be stripped from the beginning of each line other than the first.
11236        /// Newlines are included in the output.
11237        ///
11238        /// Examples:
11239        ///
11240        /// optional int32 foo = 1;  // Comment attached to foo.
11241        /// // Comment attached to bar.
11242        /// optional int32 bar = 2;
11243        ///
11244        /// optional string baz = 3;
11245        /// // Comment attached to baz.
11246        /// // Another line attached to baz.
11247        ///
11248        /// // Comment attached to moo.
11249        /// //
11250        /// // Another line attached to moo.
11251        /// optional double moo = 4;
11252        ///
11253        /// // Detached comment for corge. This is not leading or trailing comments
11254        /// // to moo or corge because there are blank lines separating it from
11255        /// // both.
11256        ///
11257        /// // Detached comment for corge paragraph 2.
11258        ///
11259        /// optional string corge = 5;
11260        /// /* Block comment attached
11261        ///
11262        /// * to corge.  Leading asterisks
11263        /// * will be removed. */
11264        ///   /* Block comment attached to
11265        /// * grault. */
11266        ///   optional int32 grault = 6;
11267        ///
11268        /// // ignored detached comments.
11269        pub leading_comments: std::string::String,
11270
11271        pub trailing_comments: std::string::String,
11272
11273        pub leading_detached_comments: std::vec::Vec<std::string::String>,
11274
11275        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11276    }
11277
11278    impl Location {
11279        pub fn new() -> Self {
11280            std::default::Default::default()
11281        }
11282
11283        /// Sets the value of [path][crate::source_code_info::Location::path].
11284        pub fn set_path<T, V>(mut self, v: T) -> Self
11285        where
11286            T: std::iter::IntoIterator<Item = V>,
11287            V: std::convert::Into<i32>,
11288        {
11289            use std::iter::Iterator;
11290            self.path = v.into_iter().map(|i| i.into()).collect();
11291            self
11292        }
11293
11294        /// Sets the value of [span][crate::source_code_info::Location::span].
11295        pub fn set_span<T, V>(mut self, v: T) -> Self
11296        where
11297            T: std::iter::IntoIterator<Item = V>,
11298            V: std::convert::Into<i32>,
11299        {
11300            use std::iter::Iterator;
11301            self.span = v.into_iter().map(|i| i.into()).collect();
11302            self
11303        }
11304
11305        /// Sets the value of [leading_comments][crate::source_code_info::Location::leading_comments].
11306        pub fn set_leading_comments<T: std::convert::Into<std::string::String>>(
11307            mut self,
11308            v: T,
11309        ) -> Self {
11310            self.leading_comments = v.into();
11311            self
11312        }
11313
11314        /// Sets the value of [trailing_comments][crate::source_code_info::Location::trailing_comments].
11315        pub fn set_trailing_comments<T: std::convert::Into<std::string::String>>(
11316            mut self,
11317            v: T,
11318        ) -> Self {
11319            self.trailing_comments = v.into();
11320            self
11321        }
11322
11323        /// Sets the value of [leading_detached_comments][crate::source_code_info::Location::leading_detached_comments].
11324        pub fn set_leading_detached_comments<T, V>(mut self, v: T) -> Self
11325        where
11326            T: std::iter::IntoIterator<Item = V>,
11327            V: std::convert::Into<std::string::String>,
11328        {
11329            use std::iter::Iterator;
11330            self.leading_detached_comments = v.into_iter().map(|i| i.into()).collect();
11331            self
11332        }
11333    }
11334
11335    impl wkt::message::Message for Location {
11336        fn typename() -> &'static str {
11337            "type.googleapis.com/google.protobuf.SourceCodeInfo.Location"
11338        }
11339    }
11340
11341    #[doc(hidden)]
11342    impl<'de> serde::de::Deserialize<'de> for Location {
11343        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11344        where
11345            D: serde::Deserializer<'de>,
11346        {
11347            #[allow(non_camel_case_types)]
11348            #[doc(hidden)]
11349            #[derive(PartialEq, Eq, Hash)]
11350            enum __FieldTag {
11351                __path,
11352                __span,
11353                __leading_comments,
11354                __trailing_comments,
11355                __leading_detached_comments,
11356                Unknown(std::string::String),
11357            }
11358            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11359                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11360                where
11361                    D: serde::Deserializer<'de>,
11362                {
11363                    struct Visitor;
11364                    impl<'de> serde::de::Visitor<'de> for Visitor {
11365                        type Value = __FieldTag;
11366                        fn expecting(
11367                            &self,
11368                            formatter: &mut std::fmt::Formatter,
11369                        ) -> std::fmt::Result {
11370                            formatter.write_str("a field name for Location")
11371                        }
11372                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11373                        where
11374                            E: serde::de::Error,
11375                        {
11376                            use std::result::Result::Ok;
11377                            use std::string::ToString;
11378                            match value {
11379                                "path" => Ok(__FieldTag::__path),
11380                                "span" => Ok(__FieldTag::__span),
11381                                "leadingComments" => Ok(__FieldTag::__leading_comments),
11382                                "leading_comments" => Ok(__FieldTag::__leading_comments),
11383                                "trailingComments" => Ok(__FieldTag::__trailing_comments),
11384                                "trailing_comments" => Ok(__FieldTag::__trailing_comments),
11385                                "leadingDetachedComments" => {
11386                                    Ok(__FieldTag::__leading_detached_comments)
11387                                }
11388                                "leading_detached_comments" => {
11389                                    Ok(__FieldTag::__leading_detached_comments)
11390                                }
11391                                _ => Ok(__FieldTag::Unknown(value.to_string())),
11392                            }
11393                        }
11394                    }
11395                    deserializer.deserialize_identifier(Visitor)
11396                }
11397            }
11398            struct Visitor;
11399            impl<'de> serde::de::Visitor<'de> for Visitor {
11400                type Value = Location;
11401                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11402                    formatter.write_str("struct Location")
11403                }
11404                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11405                where
11406                    A: serde::de::MapAccess<'de>,
11407                {
11408                    #[allow(unused_imports)]
11409                    use serde::de::Error;
11410                    use std::option::Option::Some;
11411                    let mut fields = std::collections::HashSet::new();
11412                    let mut result = Self::Value::new();
11413                    while let Some(tag) = map.next_key::<__FieldTag>()? {
11414                        #[allow(clippy::match_single_binding)]
11415                        match tag {
11416                            __FieldTag::__path => {
11417                                if !fields.insert(__FieldTag::__path) {
11418                                    return std::result::Result::Err(A::Error::duplicate_field(
11419                                        "multiple values for path",
11420                                    ));
11421                                }
11422                                struct __With(std::option::Option<std::vec::Vec<i32>>);
11423                                impl<'de> serde::de::Deserialize<'de> for __With {
11424                                    fn deserialize<D>(
11425                                        deserializer: D,
11426                                    ) -> std::result::Result<Self, D::Error>
11427                                    where
11428                                        D: serde::de::Deserializer<'de>,
11429                                    {
11430                                        serde_with::As::<
11431                                            std::option::Option<std::vec::Vec<wkt::internal::I32>>,
11432                                        >::deserialize(
11433                                            deserializer
11434                                        )
11435                                        .map(__With)
11436                                    }
11437                                }
11438                                result.path = map.next_value::<__With>()?.0.unwrap_or_default();
11439                            }
11440                            __FieldTag::__span => {
11441                                if !fields.insert(__FieldTag::__span) {
11442                                    return std::result::Result::Err(A::Error::duplicate_field(
11443                                        "multiple values for span",
11444                                    ));
11445                                }
11446                                struct __With(std::option::Option<std::vec::Vec<i32>>);
11447                                impl<'de> serde::de::Deserialize<'de> for __With {
11448                                    fn deserialize<D>(
11449                                        deserializer: D,
11450                                    ) -> std::result::Result<Self, D::Error>
11451                                    where
11452                                        D: serde::de::Deserializer<'de>,
11453                                    {
11454                                        serde_with::As::<
11455                                            std::option::Option<std::vec::Vec<wkt::internal::I32>>,
11456                                        >::deserialize(
11457                                            deserializer
11458                                        )
11459                                        .map(__With)
11460                                    }
11461                                }
11462                                result.span = map.next_value::<__With>()?.0.unwrap_or_default();
11463                            }
11464                            __FieldTag::__leading_comments => {
11465                                if !fields.insert(__FieldTag::__leading_comments) {
11466                                    return std::result::Result::Err(A::Error::duplicate_field(
11467                                        "multiple values for leading_comments",
11468                                    ));
11469                                }
11470                                result.leading_comments = map
11471                                    .next_value::<std::option::Option<std::string::String>>()?
11472                                    .unwrap_or_default();
11473                            }
11474                            __FieldTag::__trailing_comments => {
11475                                if !fields.insert(__FieldTag::__trailing_comments) {
11476                                    return std::result::Result::Err(A::Error::duplicate_field(
11477                                        "multiple values for trailing_comments",
11478                                    ));
11479                                }
11480                                result.trailing_comments = map
11481                                    .next_value::<std::option::Option<std::string::String>>()?
11482                                    .unwrap_or_default();
11483                            }
11484                            __FieldTag::__leading_detached_comments => {
11485                                if !fields.insert(__FieldTag::__leading_detached_comments) {
11486                                    return std::result::Result::Err(A::Error::duplicate_field(
11487                                        "multiple values for leading_detached_comments",
11488                                    ));
11489                                }
11490                                result.leading_detached_comments = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
11491                            }
11492                            __FieldTag::Unknown(key) => {
11493                                let value = map.next_value::<serde_json::Value>()?;
11494                                result._unknown_fields.insert(key, value);
11495                            }
11496                        }
11497                    }
11498                    std::result::Result::Ok(result)
11499                }
11500            }
11501            deserializer.deserialize_any(Visitor)
11502        }
11503    }
11504
11505    #[doc(hidden)]
11506    impl serde::ser::Serialize for Location {
11507        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11508        where
11509            S: serde::ser::Serializer,
11510        {
11511            use serde::ser::SerializeMap;
11512            #[allow(unused_imports)]
11513            use std::option::Option::Some;
11514            let mut state = serializer.serialize_map(std::option::Option::None)?;
11515            if !self.path.is_empty() {
11516                struct __With<'a>(&'a std::vec::Vec<i32>);
11517                impl<'a> serde::ser::Serialize for __With<'a> {
11518                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11519                    where
11520                        S: serde::ser::Serializer,
11521                    {
11522                        serde_with::As::<std::vec::Vec<wkt::internal::I32>>::serialize(
11523                            self.0, serializer,
11524                        )
11525                    }
11526                }
11527                state.serialize_entry("path", &__With(&self.path))?;
11528            }
11529            if !self.span.is_empty() {
11530                struct __With<'a>(&'a std::vec::Vec<i32>);
11531                impl<'a> serde::ser::Serialize for __With<'a> {
11532                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11533                    where
11534                        S: serde::ser::Serializer,
11535                    {
11536                        serde_with::As::<std::vec::Vec<wkt::internal::I32>>::serialize(
11537                            self.0, serializer,
11538                        )
11539                    }
11540                }
11541                state.serialize_entry("span", &__With(&self.span))?;
11542            }
11543            if !self.leading_comments.is_empty() {
11544                state.serialize_entry("leadingComments", &self.leading_comments)?;
11545            }
11546            if !self.trailing_comments.is_empty() {
11547                state.serialize_entry("trailingComments", &self.trailing_comments)?;
11548            }
11549            if !self.leading_detached_comments.is_empty() {
11550                state
11551                    .serialize_entry("leadingDetachedComments", &self.leading_detached_comments)?;
11552            }
11553            if !self._unknown_fields.is_empty() {
11554                for (key, value) in self._unknown_fields.iter() {
11555                    state.serialize_entry(key, &value)?;
11556                }
11557            }
11558            state.end()
11559        }
11560    }
11561}
11562
11563/// Describes the relationship between generated code and its original source
11564/// file. A GeneratedCodeInfo message is associated with only one generated
11565/// source file, but may contain references to different source .proto files.
11566#[derive(Clone, Debug, Default, PartialEq)]
11567#[non_exhaustive]
11568pub struct GeneratedCodeInfo {
11569    /// An Annotation connects some span of text in generated code to an element
11570    /// of its generating .proto file.
11571    pub annotation: std::vec::Vec<crate::generated_code_info::Annotation>,
11572
11573    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11574}
11575
11576impl GeneratedCodeInfo {
11577    pub fn new() -> Self {
11578        std::default::Default::default()
11579    }
11580
11581    /// Sets the value of [annotation][crate::GeneratedCodeInfo::annotation].
11582    pub fn set_annotation<T, V>(mut self, v: T) -> Self
11583    where
11584        T: std::iter::IntoIterator<Item = V>,
11585        V: std::convert::Into<crate::generated_code_info::Annotation>,
11586    {
11587        use std::iter::Iterator;
11588        self.annotation = v.into_iter().map(|i| i.into()).collect();
11589        self
11590    }
11591}
11592
11593impl wkt::message::Message for GeneratedCodeInfo {
11594    fn typename() -> &'static str {
11595        "type.googleapis.com/google.protobuf.GeneratedCodeInfo"
11596    }
11597}
11598
11599#[doc(hidden)]
11600impl<'de> serde::de::Deserialize<'de> for GeneratedCodeInfo {
11601    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11602    where
11603        D: serde::Deserializer<'de>,
11604    {
11605        #[allow(non_camel_case_types)]
11606        #[doc(hidden)]
11607        #[derive(PartialEq, Eq, Hash)]
11608        enum __FieldTag {
11609            __annotation,
11610            Unknown(std::string::String),
11611        }
11612        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11613            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11614            where
11615                D: serde::Deserializer<'de>,
11616            {
11617                struct Visitor;
11618                impl<'de> serde::de::Visitor<'de> for Visitor {
11619                    type Value = __FieldTag;
11620                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11621                        formatter.write_str("a field name for GeneratedCodeInfo")
11622                    }
11623                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11624                    where
11625                        E: serde::de::Error,
11626                    {
11627                        use std::result::Result::Ok;
11628                        use std::string::ToString;
11629                        match value {
11630                            "annotation" => Ok(__FieldTag::__annotation),
11631                            _ => Ok(__FieldTag::Unknown(value.to_string())),
11632                        }
11633                    }
11634                }
11635                deserializer.deserialize_identifier(Visitor)
11636            }
11637        }
11638        struct Visitor;
11639        impl<'de> serde::de::Visitor<'de> for Visitor {
11640            type Value = GeneratedCodeInfo;
11641            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11642                formatter.write_str("struct GeneratedCodeInfo")
11643            }
11644            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11645            where
11646                A: serde::de::MapAccess<'de>,
11647            {
11648                #[allow(unused_imports)]
11649                use serde::de::Error;
11650                use std::option::Option::Some;
11651                let mut fields = std::collections::HashSet::new();
11652                let mut result = Self::Value::new();
11653                while let Some(tag) = map.next_key::<__FieldTag>()? {
11654                    #[allow(clippy::match_single_binding)]
11655                    match tag {
11656                        __FieldTag::__annotation => {
11657                            if !fields.insert(__FieldTag::__annotation) {
11658                                return std::result::Result::Err(A::Error::duplicate_field(
11659                                    "multiple values for annotation",
11660                                ));
11661                            }
11662                            result.annotation = map
11663                                .next_value::<std::option::Option<
11664                                    std::vec::Vec<crate::generated_code_info::Annotation>,
11665                                >>()?
11666                                .unwrap_or_default();
11667                        }
11668                        __FieldTag::Unknown(key) => {
11669                            let value = map.next_value::<serde_json::Value>()?;
11670                            result._unknown_fields.insert(key, value);
11671                        }
11672                    }
11673                }
11674                std::result::Result::Ok(result)
11675            }
11676        }
11677        deserializer.deserialize_any(Visitor)
11678    }
11679}
11680
11681#[doc(hidden)]
11682impl serde::ser::Serialize for GeneratedCodeInfo {
11683    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11684    where
11685        S: serde::ser::Serializer,
11686    {
11687        use serde::ser::SerializeMap;
11688        #[allow(unused_imports)]
11689        use std::option::Option::Some;
11690        let mut state = serializer.serialize_map(std::option::Option::None)?;
11691        if !self.annotation.is_empty() {
11692            state.serialize_entry("annotation", &self.annotation)?;
11693        }
11694        if !self._unknown_fields.is_empty() {
11695            for (key, value) in self._unknown_fields.iter() {
11696                state.serialize_entry(key, &value)?;
11697            }
11698        }
11699        state.end()
11700    }
11701}
11702
11703/// Defines additional types related to [GeneratedCodeInfo].
11704pub mod generated_code_info {
11705    #[allow(unused_imports)]
11706    use super::*;
11707
11708    #[derive(Clone, Debug, Default, PartialEq)]
11709    #[non_exhaustive]
11710    pub struct Annotation {
11711        /// Identifies the element in the original source .proto file. This field
11712        /// is formatted the same as SourceCodeInfo.Location.path.
11713        pub path: std::vec::Vec<i32>,
11714
11715        /// Identifies the filesystem path to the original source .proto.
11716        pub source_file: std::string::String,
11717
11718        /// Identifies the starting offset in bytes in the generated code
11719        /// that relates to the identified object.
11720        pub begin: i32,
11721
11722        /// Identifies the ending offset in bytes in the generated code that
11723        /// relates to the identified object. The end offset should be one past
11724        /// the last relevant byte (so the length of the text = end - begin).
11725        pub end: i32,
11726
11727        pub semantic: crate::generated_code_info::annotation::Semantic,
11728
11729        _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11730    }
11731
11732    impl Annotation {
11733        pub fn new() -> Self {
11734            std::default::Default::default()
11735        }
11736
11737        /// Sets the value of [path][crate::generated_code_info::Annotation::path].
11738        pub fn set_path<T, V>(mut self, v: T) -> Self
11739        where
11740            T: std::iter::IntoIterator<Item = V>,
11741            V: std::convert::Into<i32>,
11742        {
11743            use std::iter::Iterator;
11744            self.path = v.into_iter().map(|i| i.into()).collect();
11745            self
11746        }
11747
11748        /// Sets the value of [source_file][crate::generated_code_info::Annotation::source_file].
11749        pub fn set_source_file<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11750            self.source_file = v.into();
11751            self
11752        }
11753
11754        /// Sets the value of [begin][crate::generated_code_info::Annotation::begin].
11755        pub fn set_begin<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11756            self.begin = v.into();
11757            self
11758        }
11759
11760        /// Sets the value of [end][crate::generated_code_info::Annotation::end].
11761        pub fn set_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11762            self.end = v.into();
11763            self
11764        }
11765
11766        /// Sets the value of [semantic][crate::generated_code_info::Annotation::semantic].
11767        pub fn set_semantic<
11768            T: std::convert::Into<crate::generated_code_info::annotation::Semantic>,
11769        >(
11770            mut self,
11771            v: T,
11772        ) -> Self {
11773            self.semantic = v.into();
11774            self
11775        }
11776    }
11777
11778    impl wkt::message::Message for Annotation {
11779        fn typename() -> &'static str {
11780            "type.googleapis.com/google.protobuf.GeneratedCodeInfo.Annotation"
11781        }
11782    }
11783
11784    #[doc(hidden)]
11785    impl<'de> serde::de::Deserialize<'de> for Annotation {
11786        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11787        where
11788            D: serde::Deserializer<'de>,
11789        {
11790            #[allow(non_camel_case_types)]
11791            #[doc(hidden)]
11792            #[derive(PartialEq, Eq, Hash)]
11793            enum __FieldTag {
11794                __path,
11795                __source_file,
11796                __begin,
11797                __end,
11798                __semantic,
11799                Unknown(std::string::String),
11800            }
11801            impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11802                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11803                where
11804                    D: serde::Deserializer<'de>,
11805                {
11806                    struct Visitor;
11807                    impl<'de> serde::de::Visitor<'de> for Visitor {
11808                        type Value = __FieldTag;
11809                        fn expecting(
11810                            &self,
11811                            formatter: &mut std::fmt::Formatter,
11812                        ) -> std::fmt::Result {
11813                            formatter.write_str("a field name for Annotation")
11814                        }
11815                        fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11816                        where
11817                            E: serde::de::Error,
11818                        {
11819                            use std::result::Result::Ok;
11820                            use std::string::ToString;
11821                            match value {
11822                                "path" => Ok(__FieldTag::__path),
11823                                "sourceFile" => Ok(__FieldTag::__source_file),
11824                                "source_file" => Ok(__FieldTag::__source_file),
11825                                "begin" => Ok(__FieldTag::__begin),
11826                                "end" => Ok(__FieldTag::__end),
11827                                "semantic" => Ok(__FieldTag::__semantic),
11828                                _ => Ok(__FieldTag::Unknown(value.to_string())),
11829                            }
11830                        }
11831                    }
11832                    deserializer.deserialize_identifier(Visitor)
11833                }
11834            }
11835            struct Visitor;
11836            impl<'de> serde::de::Visitor<'de> for Visitor {
11837                type Value = Annotation;
11838                fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11839                    formatter.write_str("struct Annotation")
11840                }
11841                fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11842                where
11843                    A: serde::de::MapAccess<'de>,
11844                {
11845                    #[allow(unused_imports)]
11846                    use serde::de::Error;
11847                    use std::option::Option::Some;
11848                    let mut fields = std::collections::HashSet::new();
11849                    let mut result = Self::Value::new();
11850                    while let Some(tag) = map.next_key::<__FieldTag>()? {
11851                        #[allow(clippy::match_single_binding)]
11852                        match tag {
11853                            __FieldTag::__path => {
11854                                if !fields.insert(__FieldTag::__path) {
11855                                    return std::result::Result::Err(A::Error::duplicate_field(
11856                                        "multiple values for path",
11857                                    ));
11858                                }
11859                                struct __With(std::option::Option<std::vec::Vec<i32>>);
11860                                impl<'de> serde::de::Deserialize<'de> for __With {
11861                                    fn deserialize<D>(
11862                                        deserializer: D,
11863                                    ) -> std::result::Result<Self, D::Error>
11864                                    where
11865                                        D: serde::de::Deserializer<'de>,
11866                                    {
11867                                        serde_with::As::<
11868                                            std::option::Option<std::vec::Vec<wkt::internal::I32>>,
11869                                        >::deserialize(
11870                                            deserializer
11871                                        )
11872                                        .map(__With)
11873                                    }
11874                                }
11875                                result.path = map.next_value::<__With>()?.0.unwrap_or_default();
11876                            }
11877                            __FieldTag::__source_file => {
11878                                if !fields.insert(__FieldTag::__source_file) {
11879                                    return std::result::Result::Err(A::Error::duplicate_field(
11880                                        "multiple values for source_file",
11881                                    ));
11882                                }
11883                                result.source_file = map
11884                                    .next_value::<std::option::Option<std::string::String>>()?
11885                                    .unwrap_or_default();
11886                            }
11887                            __FieldTag::__begin => {
11888                                if !fields.insert(__FieldTag::__begin) {
11889                                    return std::result::Result::Err(A::Error::duplicate_field(
11890                                        "multiple values for begin",
11891                                    ));
11892                                }
11893                                struct __With(std::option::Option<i32>);
11894                                impl<'de> serde::de::Deserialize<'de> for __With {
11895                                    fn deserialize<D>(
11896                                        deserializer: D,
11897                                    ) -> std::result::Result<Self, D::Error>
11898                                    where
11899                                        D: serde::de::Deserializer<'de>,
11900                                    {
11901                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
11902                                    }
11903                                }
11904                                result.begin = map.next_value::<__With>()?.0.unwrap_or_default();
11905                            }
11906                            __FieldTag::__end => {
11907                                if !fields.insert(__FieldTag::__end) {
11908                                    return std::result::Result::Err(A::Error::duplicate_field(
11909                                        "multiple values for end",
11910                                    ));
11911                                }
11912                                struct __With(std::option::Option<i32>);
11913                                impl<'de> serde::de::Deserialize<'de> for __With {
11914                                    fn deserialize<D>(
11915                                        deserializer: D,
11916                                    ) -> std::result::Result<Self, D::Error>
11917                                    where
11918                                        D: serde::de::Deserializer<'de>,
11919                                    {
11920                                        serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
11921                                    }
11922                                }
11923                                result.end = map.next_value::<__With>()?.0.unwrap_or_default();
11924                            }
11925                            __FieldTag::__semantic => {
11926                                if !fields.insert(__FieldTag::__semantic) {
11927                                    return std::result::Result::Err(A::Error::duplicate_field(
11928                                        "multiple values for semantic",
11929                                    ));
11930                                }
11931                                result.semantic = map
11932                                    .next_value::<std::option::Option<
11933                                        crate::generated_code_info::annotation::Semantic,
11934                                    >>()?
11935                                    .unwrap_or_default();
11936                            }
11937                            __FieldTag::Unknown(key) => {
11938                                let value = map.next_value::<serde_json::Value>()?;
11939                                result._unknown_fields.insert(key, value);
11940                            }
11941                        }
11942                    }
11943                    std::result::Result::Ok(result)
11944                }
11945            }
11946            deserializer.deserialize_any(Visitor)
11947        }
11948    }
11949
11950    #[doc(hidden)]
11951    impl serde::ser::Serialize for Annotation {
11952        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11953        where
11954            S: serde::ser::Serializer,
11955        {
11956            use serde::ser::SerializeMap;
11957            #[allow(unused_imports)]
11958            use std::option::Option::Some;
11959            let mut state = serializer.serialize_map(std::option::Option::None)?;
11960            if !self.path.is_empty() {
11961                struct __With<'a>(&'a std::vec::Vec<i32>);
11962                impl<'a> serde::ser::Serialize for __With<'a> {
11963                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11964                    where
11965                        S: serde::ser::Serializer,
11966                    {
11967                        serde_with::As::<std::vec::Vec<wkt::internal::I32>>::serialize(
11968                            self.0, serializer,
11969                        )
11970                    }
11971                }
11972                state.serialize_entry("path", &__With(&self.path))?;
11973            }
11974            if !self.source_file.is_empty() {
11975                state.serialize_entry("sourceFile", &self.source_file)?;
11976            }
11977            if !wkt::internal::is_default(&self.begin) {
11978                struct __With<'a>(&'a i32);
11979                impl<'a> serde::ser::Serialize for __With<'a> {
11980                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11981                    where
11982                        S: serde::ser::Serializer,
11983                    {
11984                        serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
11985                    }
11986                }
11987                state.serialize_entry("begin", &__With(&self.begin))?;
11988            }
11989            if !wkt::internal::is_default(&self.end) {
11990                struct __With<'a>(&'a i32);
11991                impl<'a> serde::ser::Serialize for __With<'a> {
11992                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11993                    where
11994                        S: serde::ser::Serializer,
11995                    {
11996                        serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
11997                    }
11998                }
11999                state.serialize_entry("end", &__With(&self.end))?;
12000            }
12001            if !wkt::internal::is_default(&self.semantic) {
12002                state.serialize_entry("semantic", &self.semantic)?;
12003            }
12004            if !self._unknown_fields.is_empty() {
12005                for (key, value) in self._unknown_fields.iter() {
12006                    state.serialize_entry(key, &value)?;
12007                }
12008            }
12009            state.end()
12010        }
12011    }
12012
12013    /// Defines additional types related to [Annotation].
12014    pub mod annotation {
12015        #[allow(unused_imports)]
12016        use super::*;
12017
12018        /// Represents the identified object's effect on the element in the original
12019        /// .proto file.
12020        ///
12021        /// # Working with unknown values
12022        ///
12023        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12024        /// additional enum variants at any time. Adding new variants is not considered
12025        /// a breaking change. Applications should write their code in anticipation of:
12026        ///
12027        /// - New values appearing in future releases of the client library, **and**
12028        /// - New values received dynamically, without application changes.
12029        ///
12030        /// Please consult the [Working with enums] section in the user guide for some
12031        /// guidelines.
12032        ///
12033        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12034        #[derive(Clone, Debug, PartialEq)]
12035        #[non_exhaustive]
12036        pub enum Semantic {
12037            /// There is no effect or the effect is indescribable.
12038            None,
12039            /// The element is set or otherwise mutated.
12040            Set,
12041            /// An alias to the element is returned.
12042            Alias,
12043            /// If set, the enum was initialized with an unknown value.
12044            ///
12045            /// Applications can examine the value using [Semantic::value] or
12046            /// [Semantic::name].
12047            UnknownValue(semantic::UnknownValue),
12048        }
12049
12050        #[doc(hidden)]
12051        pub mod semantic {
12052            #[allow(unused_imports)]
12053            use super::*;
12054            #[derive(Clone, Debug, PartialEq)]
12055            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12056        }
12057
12058        impl Semantic {
12059            /// Gets the enum value.
12060            ///
12061            /// Returns `None` if the enum contains an unknown value deserialized from
12062            /// the string representation of enums.
12063            pub fn value(&self) -> std::option::Option<i32> {
12064                match self {
12065                    Self::None => std::option::Option::Some(0),
12066                    Self::Set => std::option::Option::Some(1),
12067                    Self::Alias => std::option::Option::Some(2),
12068                    Self::UnknownValue(u) => u.0.value(),
12069                }
12070            }
12071
12072            /// Gets the enum value as a string.
12073            ///
12074            /// Returns `None` if the enum contains an unknown value deserialized from
12075            /// the integer representation of enums.
12076            pub fn name(&self) -> std::option::Option<&str> {
12077                match self {
12078                    Self::None => std::option::Option::Some("NONE"),
12079                    Self::Set => std::option::Option::Some("SET"),
12080                    Self::Alias => std::option::Option::Some("ALIAS"),
12081                    Self::UnknownValue(u) => u.0.name(),
12082                }
12083            }
12084        }
12085
12086        impl std::default::Default for Semantic {
12087            fn default() -> Self {
12088                use std::convert::From;
12089                Self::from(0)
12090            }
12091        }
12092
12093        impl std::fmt::Display for Semantic {
12094            fn fmt(
12095                &self,
12096                f: &mut std::fmt::Formatter<'_>,
12097            ) -> std::result::Result<(), std::fmt::Error> {
12098                wkt::internal::display_enum(f, self.name(), self.value())
12099            }
12100        }
12101
12102        impl std::convert::From<i32> for Semantic {
12103            fn from(value: i32) -> Self {
12104                match value {
12105                    0 => Self::None,
12106                    1 => Self::Set,
12107                    2 => Self::Alias,
12108                    _ => Self::UnknownValue(semantic::UnknownValue(
12109                        wkt::internal::UnknownEnumValue::Integer(value),
12110                    )),
12111                }
12112            }
12113        }
12114
12115        impl std::convert::From<&str> for Semantic {
12116            fn from(value: &str) -> Self {
12117                use std::string::ToString;
12118                match value {
12119                    "NONE" => Self::None,
12120                    "SET" => Self::Set,
12121                    "ALIAS" => Self::Alias,
12122                    _ => Self::UnknownValue(semantic::UnknownValue(
12123                        wkt::internal::UnknownEnumValue::String(value.to_string()),
12124                    )),
12125                }
12126            }
12127        }
12128
12129        impl serde::ser::Serialize for Semantic {
12130            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12131            where
12132                S: serde::Serializer,
12133            {
12134                match self {
12135                    Self::None => serializer.serialize_i32(0),
12136                    Self::Set => serializer.serialize_i32(1),
12137                    Self::Alias => serializer.serialize_i32(2),
12138                    Self::UnknownValue(u) => u.0.serialize(serializer),
12139                }
12140            }
12141        }
12142
12143        impl<'de> serde::de::Deserialize<'de> for Semantic {
12144            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12145            where
12146                D: serde::Deserializer<'de>,
12147            {
12148                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Semantic>::new(
12149                    ".google.protobuf.GeneratedCodeInfo.Annotation.Semantic",
12150                ))
12151            }
12152        }
12153    }
12154}
12155
12156/// `SourceContext` represents information about the source of a
12157/// protobuf element, like the file in which it is defined.
12158#[derive(Clone, Debug, Default, PartialEq)]
12159#[non_exhaustive]
12160pub struct SourceContext {
12161    /// The path-qualified name of the .proto file that contained the associated
12162    /// protobuf element.  For example: `"google/protobuf/source_context.proto"`.
12163    pub file_name: std::string::String,
12164
12165    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12166}
12167
12168impl SourceContext {
12169    pub fn new() -> Self {
12170        std::default::Default::default()
12171    }
12172
12173    /// Sets the value of [file_name][crate::SourceContext::file_name].
12174    pub fn set_file_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12175        self.file_name = v.into();
12176        self
12177    }
12178}
12179
12180impl wkt::message::Message for SourceContext {
12181    fn typename() -> &'static str {
12182        "type.googleapis.com/google.protobuf.SourceContext"
12183    }
12184}
12185
12186#[doc(hidden)]
12187impl<'de> serde::de::Deserialize<'de> for SourceContext {
12188    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12189    where
12190        D: serde::Deserializer<'de>,
12191    {
12192        #[allow(non_camel_case_types)]
12193        #[doc(hidden)]
12194        #[derive(PartialEq, Eq, Hash)]
12195        enum __FieldTag {
12196            __file_name,
12197            Unknown(std::string::String),
12198        }
12199        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12200            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12201            where
12202                D: serde::Deserializer<'de>,
12203            {
12204                struct Visitor;
12205                impl<'de> serde::de::Visitor<'de> for Visitor {
12206                    type Value = __FieldTag;
12207                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12208                        formatter.write_str("a field name for SourceContext")
12209                    }
12210                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12211                    where
12212                        E: serde::de::Error,
12213                    {
12214                        use std::result::Result::Ok;
12215                        use std::string::ToString;
12216                        match value {
12217                            "fileName" => Ok(__FieldTag::__file_name),
12218                            "file_name" => Ok(__FieldTag::__file_name),
12219                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12220                        }
12221                    }
12222                }
12223                deserializer.deserialize_identifier(Visitor)
12224            }
12225        }
12226        struct Visitor;
12227        impl<'de> serde::de::Visitor<'de> for Visitor {
12228            type Value = SourceContext;
12229            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12230                formatter.write_str("struct SourceContext")
12231            }
12232            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12233            where
12234                A: serde::de::MapAccess<'de>,
12235            {
12236                #[allow(unused_imports)]
12237                use serde::de::Error;
12238                use std::option::Option::Some;
12239                let mut fields = std::collections::HashSet::new();
12240                let mut result = Self::Value::new();
12241                while let Some(tag) = map.next_key::<__FieldTag>()? {
12242                    #[allow(clippy::match_single_binding)]
12243                    match tag {
12244                        __FieldTag::__file_name => {
12245                            if !fields.insert(__FieldTag::__file_name) {
12246                                return std::result::Result::Err(A::Error::duplicate_field(
12247                                    "multiple values for file_name",
12248                                ));
12249                            }
12250                            result.file_name = map
12251                                .next_value::<std::option::Option<std::string::String>>()?
12252                                .unwrap_or_default();
12253                        }
12254                        __FieldTag::Unknown(key) => {
12255                            let value = map.next_value::<serde_json::Value>()?;
12256                            result._unknown_fields.insert(key, value);
12257                        }
12258                    }
12259                }
12260                std::result::Result::Ok(result)
12261            }
12262        }
12263        deserializer.deserialize_any(Visitor)
12264    }
12265}
12266
12267#[doc(hidden)]
12268impl serde::ser::Serialize for SourceContext {
12269    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12270    where
12271        S: serde::ser::Serializer,
12272    {
12273        use serde::ser::SerializeMap;
12274        #[allow(unused_imports)]
12275        use std::option::Option::Some;
12276        let mut state = serializer.serialize_map(std::option::Option::None)?;
12277        if !self.file_name.is_empty() {
12278            state.serialize_entry("fileName", &self.file_name)?;
12279        }
12280        if !self._unknown_fields.is_empty() {
12281            for (key, value) in self._unknown_fields.iter() {
12282                state.serialize_entry(key, &value)?;
12283            }
12284        }
12285        state.end()
12286    }
12287}
12288
12289/// A protocol buffer message type.
12290#[derive(Clone, Debug, Default, PartialEq)]
12291#[non_exhaustive]
12292pub struct Type {
12293    /// The fully qualified message name.
12294    pub name: std::string::String,
12295
12296    /// The list of fields.
12297    pub fields: std::vec::Vec<crate::Field>,
12298
12299    /// The list of types appearing in `oneof` definitions in this type.
12300    pub oneofs: std::vec::Vec<std::string::String>,
12301
12302    /// The protocol buffer options.
12303    pub options: std::vec::Vec<crate::Option>,
12304
12305    /// The source context.
12306    pub source_context: std::option::Option<crate::SourceContext>,
12307
12308    /// The source syntax.
12309    pub syntax: crate::Syntax,
12310
12311    /// The source edition string, only valid when syntax is SYNTAX_EDITIONS.
12312    pub edition: std::string::String,
12313
12314    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12315}
12316
12317impl Type {
12318    pub fn new() -> Self {
12319        std::default::Default::default()
12320    }
12321
12322    /// Sets the value of [name][crate::Type::name].
12323    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12324        self.name = v.into();
12325        self
12326    }
12327
12328    /// Sets the value of [fields][crate::Type::fields].
12329    pub fn set_fields<T, V>(mut self, v: T) -> Self
12330    where
12331        T: std::iter::IntoIterator<Item = V>,
12332        V: std::convert::Into<crate::Field>,
12333    {
12334        use std::iter::Iterator;
12335        self.fields = v.into_iter().map(|i| i.into()).collect();
12336        self
12337    }
12338
12339    /// Sets the value of [oneofs][crate::Type::oneofs].
12340    pub fn set_oneofs<T, V>(mut self, v: T) -> Self
12341    where
12342        T: std::iter::IntoIterator<Item = V>,
12343        V: std::convert::Into<std::string::String>,
12344    {
12345        use std::iter::Iterator;
12346        self.oneofs = v.into_iter().map(|i| i.into()).collect();
12347        self
12348    }
12349
12350    /// Sets the value of [options][crate::Type::options].
12351    pub fn set_options<T, V>(mut self, v: T) -> Self
12352    where
12353        T: std::iter::IntoIterator<Item = V>,
12354        V: std::convert::Into<crate::Option>,
12355    {
12356        use std::iter::Iterator;
12357        self.options = v.into_iter().map(|i| i.into()).collect();
12358        self
12359    }
12360
12361    /// Sets the value of [source_context][crate::Type::source_context].
12362    pub fn set_source_context<T>(mut self, v: T) -> Self
12363    where
12364        T: std::convert::Into<crate::SourceContext>,
12365    {
12366        self.source_context = std::option::Option::Some(v.into());
12367        self
12368    }
12369
12370    /// Sets or clears the value of [source_context][crate::Type::source_context].
12371    pub fn set_or_clear_source_context<T>(mut self, v: std::option::Option<T>) -> Self
12372    where
12373        T: std::convert::Into<crate::SourceContext>,
12374    {
12375        self.source_context = v.map(|x| x.into());
12376        self
12377    }
12378
12379    /// Sets the value of [syntax][crate::Type::syntax].
12380    pub fn set_syntax<T: std::convert::Into<crate::Syntax>>(mut self, v: T) -> Self {
12381        self.syntax = v.into();
12382        self
12383    }
12384
12385    /// Sets the value of [edition][crate::Type::edition].
12386    pub fn set_edition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12387        self.edition = v.into();
12388        self
12389    }
12390}
12391
12392impl wkt::message::Message for Type {
12393    fn typename() -> &'static str {
12394        "type.googleapis.com/google.protobuf.Type"
12395    }
12396}
12397
12398#[doc(hidden)]
12399impl<'de> serde::de::Deserialize<'de> for Type {
12400    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12401    where
12402        D: serde::Deserializer<'de>,
12403    {
12404        #[allow(non_camel_case_types)]
12405        #[doc(hidden)]
12406        #[derive(PartialEq, Eq, Hash)]
12407        enum __FieldTag {
12408            __name,
12409            __fields,
12410            __oneofs,
12411            __options,
12412            __source_context,
12413            __syntax,
12414            __edition,
12415            Unknown(std::string::String),
12416        }
12417        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12418            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12419            where
12420                D: serde::Deserializer<'de>,
12421            {
12422                struct Visitor;
12423                impl<'de> serde::de::Visitor<'de> for Visitor {
12424                    type Value = __FieldTag;
12425                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12426                        formatter.write_str("a field name for Type")
12427                    }
12428                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12429                    where
12430                        E: serde::de::Error,
12431                    {
12432                        use std::result::Result::Ok;
12433                        use std::string::ToString;
12434                        match value {
12435                            "name" => Ok(__FieldTag::__name),
12436                            "fields" => Ok(__FieldTag::__fields),
12437                            "oneofs" => Ok(__FieldTag::__oneofs),
12438                            "options" => Ok(__FieldTag::__options),
12439                            "sourceContext" => Ok(__FieldTag::__source_context),
12440                            "source_context" => Ok(__FieldTag::__source_context),
12441                            "syntax" => Ok(__FieldTag::__syntax),
12442                            "edition" => Ok(__FieldTag::__edition),
12443                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12444                        }
12445                    }
12446                }
12447                deserializer.deserialize_identifier(Visitor)
12448            }
12449        }
12450        struct Visitor;
12451        impl<'de> serde::de::Visitor<'de> for Visitor {
12452            type Value = Type;
12453            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12454                formatter.write_str("struct Type")
12455            }
12456            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12457            where
12458                A: serde::de::MapAccess<'de>,
12459            {
12460                #[allow(unused_imports)]
12461                use serde::de::Error;
12462                use std::option::Option::Some;
12463                let mut fields = std::collections::HashSet::new();
12464                let mut result = Self::Value::new();
12465                while let Some(tag) = map.next_key::<__FieldTag>()? {
12466                    #[allow(clippy::match_single_binding)]
12467                    match tag {
12468                        __FieldTag::__name => {
12469                            if !fields.insert(__FieldTag::__name) {
12470                                return std::result::Result::Err(A::Error::duplicate_field(
12471                                    "multiple values for name",
12472                                ));
12473                            }
12474                            result.name = map
12475                                .next_value::<std::option::Option<std::string::String>>()?
12476                                .unwrap_or_default();
12477                        }
12478                        __FieldTag::__fields => {
12479                            if !fields.insert(__FieldTag::__fields) {
12480                                return std::result::Result::Err(A::Error::duplicate_field(
12481                                    "multiple values for fields",
12482                                ));
12483                            }
12484                            result.fields = map
12485                                .next_value::<std::option::Option<std::vec::Vec<crate::Field>>>()?
12486                                .unwrap_or_default();
12487                        }
12488                        __FieldTag::__oneofs => {
12489                            if !fields.insert(__FieldTag::__oneofs) {
12490                                return std::result::Result::Err(A::Error::duplicate_field(
12491                                    "multiple values for oneofs",
12492                                ));
12493                            }
12494                            result.oneofs = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
12495                        }
12496                        __FieldTag::__options => {
12497                            if !fields.insert(__FieldTag::__options) {
12498                                return std::result::Result::Err(A::Error::duplicate_field(
12499                                    "multiple values for options",
12500                                ));
12501                            }
12502                            result.options = map
12503                                .next_value::<std::option::Option<std::vec::Vec<crate::Option>>>()?
12504                                .unwrap_or_default();
12505                        }
12506                        __FieldTag::__source_context => {
12507                            if !fields.insert(__FieldTag::__source_context) {
12508                                return std::result::Result::Err(A::Error::duplicate_field(
12509                                    "multiple values for source_context",
12510                                ));
12511                            }
12512                            result.source_context =
12513                                map.next_value::<std::option::Option<crate::SourceContext>>()?;
12514                        }
12515                        __FieldTag::__syntax => {
12516                            if !fields.insert(__FieldTag::__syntax) {
12517                                return std::result::Result::Err(A::Error::duplicate_field(
12518                                    "multiple values for syntax",
12519                                ));
12520                            }
12521                            result.syntax = map
12522                                .next_value::<std::option::Option<crate::Syntax>>()?
12523                                .unwrap_or_default();
12524                        }
12525                        __FieldTag::__edition => {
12526                            if !fields.insert(__FieldTag::__edition) {
12527                                return std::result::Result::Err(A::Error::duplicate_field(
12528                                    "multiple values for edition",
12529                                ));
12530                            }
12531                            result.edition = map
12532                                .next_value::<std::option::Option<std::string::String>>()?
12533                                .unwrap_or_default();
12534                        }
12535                        __FieldTag::Unknown(key) => {
12536                            let value = map.next_value::<serde_json::Value>()?;
12537                            result._unknown_fields.insert(key, value);
12538                        }
12539                    }
12540                }
12541                std::result::Result::Ok(result)
12542            }
12543        }
12544        deserializer.deserialize_any(Visitor)
12545    }
12546}
12547
12548#[doc(hidden)]
12549impl serde::ser::Serialize for Type {
12550    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12551    where
12552        S: serde::ser::Serializer,
12553    {
12554        use serde::ser::SerializeMap;
12555        #[allow(unused_imports)]
12556        use std::option::Option::Some;
12557        let mut state = serializer.serialize_map(std::option::Option::None)?;
12558        if !self.name.is_empty() {
12559            state.serialize_entry("name", &self.name)?;
12560        }
12561        if !self.fields.is_empty() {
12562            state.serialize_entry("fields", &self.fields)?;
12563        }
12564        if !self.oneofs.is_empty() {
12565            state.serialize_entry("oneofs", &self.oneofs)?;
12566        }
12567        if !self.options.is_empty() {
12568            state.serialize_entry("options", &self.options)?;
12569        }
12570        if self.source_context.is_some() {
12571            state.serialize_entry("sourceContext", &self.source_context)?;
12572        }
12573        if !wkt::internal::is_default(&self.syntax) {
12574            state.serialize_entry("syntax", &self.syntax)?;
12575        }
12576        if !self.edition.is_empty() {
12577            state.serialize_entry("edition", &self.edition)?;
12578        }
12579        if !self._unknown_fields.is_empty() {
12580            for (key, value) in self._unknown_fields.iter() {
12581                state.serialize_entry(key, &value)?;
12582            }
12583        }
12584        state.end()
12585    }
12586}
12587
12588/// A single field of a message type.
12589#[derive(Clone, Debug, Default, PartialEq)]
12590#[non_exhaustive]
12591pub struct Field {
12592    /// The field type.
12593    pub kind: crate::field::Kind,
12594
12595    /// The field cardinality.
12596    pub cardinality: crate::field::Cardinality,
12597
12598    /// The field number.
12599    pub number: i32,
12600
12601    /// The field name.
12602    pub name: std::string::String,
12603
12604    /// The field type URL, without the scheme, for message or enumeration
12605    /// types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
12606    pub type_url: std::string::String,
12607
12608    /// The index of the field type in `Type.oneofs`, for message or enumeration
12609    /// types. The first type has index 1; zero means the type is not in the list.
12610    pub oneof_index: i32,
12611
12612    /// Whether to use alternative packed wire representation.
12613    pub packed: bool,
12614
12615    /// The protocol buffer options.
12616    pub options: std::vec::Vec<crate::Option>,
12617
12618    /// The field JSON name.
12619    pub json_name: std::string::String,
12620
12621    /// The string value of the default value of this field. Proto2 syntax only.
12622    pub default_value: std::string::String,
12623
12624    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12625}
12626
12627impl Field {
12628    pub fn new() -> Self {
12629        std::default::Default::default()
12630    }
12631
12632    /// Sets the value of [kind][crate::Field::kind].
12633    pub fn set_kind<T: std::convert::Into<crate::field::Kind>>(mut self, v: T) -> Self {
12634        self.kind = v.into();
12635        self
12636    }
12637
12638    /// Sets the value of [cardinality][crate::Field::cardinality].
12639    pub fn set_cardinality<T: std::convert::Into<crate::field::Cardinality>>(
12640        mut self,
12641        v: T,
12642    ) -> Self {
12643        self.cardinality = v.into();
12644        self
12645    }
12646
12647    /// Sets the value of [number][crate::Field::number].
12648    pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12649        self.number = v.into();
12650        self
12651    }
12652
12653    /// Sets the value of [name][crate::Field::name].
12654    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12655        self.name = v.into();
12656        self
12657    }
12658
12659    /// Sets the value of [type_url][crate::Field::type_url].
12660    pub fn set_type_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12661        self.type_url = v.into();
12662        self
12663    }
12664
12665    /// Sets the value of [oneof_index][crate::Field::oneof_index].
12666    pub fn set_oneof_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12667        self.oneof_index = v.into();
12668        self
12669    }
12670
12671    /// Sets the value of [packed][crate::Field::packed].
12672    pub fn set_packed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12673        self.packed = v.into();
12674        self
12675    }
12676
12677    /// Sets the value of [options][crate::Field::options].
12678    pub fn set_options<T, V>(mut self, v: T) -> Self
12679    where
12680        T: std::iter::IntoIterator<Item = V>,
12681        V: std::convert::Into<crate::Option>,
12682    {
12683        use std::iter::Iterator;
12684        self.options = v.into_iter().map(|i| i.into()).collect();
12685        self
12686    }
12687
12688    /// Sets the value of [json_name][crate::Field::json_name].
12689    pub fn set_json_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12690        self.json_name = v.into();
12691        self
12692    }
12693
12694    /// Sets the value of [default_value][crate::Field::default_value].
12695    pub fn set_default_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12696        self.default_value = v.into();
12697        self
12698    }
12699}
12700
12701impl wkt::message::Message for Field {
12702    fn typename() -> &'static str {
12703        "type.googleapis.com/google.protobuf.Field"
12704    }
12705}
12706
12707#[doc(hidden)]
12708impl<'de> serde::de::Deserialize<'de> for Field {
12709    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12710    where
12711        D: serde::Deserializer<'de>,
12712    {
12713        #[allow(non_camel_case_types)]
12714        #[doc(hidden)]
12715        #[derive(PartialEq, Eq, Hash)]
12716        enum __FieldTag {
12717            __kind,
12718            __cardinality,
12719            __number,
12720            __name,
12721            __type_url,
12722            __oneof_index,
12723            __packed,
12724            __options,
12725            __json_name,
12726            __default_value,
12727            Unknown(std::string::String),
12728        }
12729        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12730            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12731            where
12732                D: serde::Deserializer<'de>,
12733            {
12734                struct Visitor;
12735                impl<'de> serde::de::Visitor<'de> for Visitor {
12736                    type Value = __FieldTag;
12737                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12738                        formatter.write_str("a field name for Field")
12739                    }
12740                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12741                    where
12742                        E: serde::de::Error,
12743                    {
12744                        use std::result::Result::Ok;
12745                        use std::string::ToString;
12746                        match value {
12747                            "kind" => Ok(__FieldTag::__kind),
12748                            "cardinality" => Ok(__FieldTag::__cardinality),
12749                            "number" => Ok(__FieldTag::__number),
12750                            "name" => Ok(__FieldTag::__name),
12751                            "typeUrl" => Ok(__FieldTag::__type_url),
12752                            "type_url" => Ok(__FieldTag::__type_url),
12753                            "oneofIndex" => Ok(__FieldTag::__oneof_index),
12754                            "oneof_index" => Ok(__FieldTag::__oneof_index),
12755                            "packed" => Ok(__FieldTag::__packed),
12756                            "options" => Ok(__FieldTag::__options),
12757                            "jsonName" => Ok(__FieldTag::__json_name),
12758                            "json_name" => Ok(__FieldTag::__json_name),
12759                            "defaultValue" => Ok(__FieldTag::__default_value),
12760                            "default_value" => Ok(__FieldTag::__default_value),
12761                            _ => Ok(__FieldTag::Unknown(value.to_string())),
12762                        }
12763                    }
12764                }
12765                deserializer.deserialize_identifier(Visitor)
12766            }
12767        }
12768        struct Visitor;
12769        impl<'de> serde::de::Visitor<'de> for Visitor {
12770            type Value = Field;
12771            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12772                formatter.write_str("struct Field")
12773            }
12774            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12775            where
12776                A: serde::de::MapAccess<'de>,
12777            {
12778                #[allow(unused_imports)]
12779                use serde::de::Error;
12780                use std::option::Option::Some;
12781                let mut fields = std::collections::HashSet::new();
12782                let mut result = Self::Value::new();
12783                while let Some(tag) = map.next_key::<__FieldTag>()? {
12784                    #[allow(clippy::match_single_binding)]
12785                    match tag {
12786                        __FieldTag::__kind => {
12787                            if !fields.insert(__FieldTag::__kind) {
12788                                return std::result::Result::Err(A::Error::duplicate_field(
12789                                    "multiple values for kind",
12790                                ));
12791                            }
12792                            result.kind = map
12793                                .next_value::<std::option::Option<crate::field::Kind>>()?
12794                                .unwrap_or_default();
12795                        }
12796                        __FieldTag::__cardinality => {
12797                            if !fields.insert(__FieldTag::__cardinality) {
12798                                return std::result::Result::Err(A::Error::duplicate_field(
12799                                    "multiple values for cardinality",
12800                                ));
12801                            }
12802                            result.cardinality = map
12803                                .next_value::<std::option::Option<crate::field::Cardinality>>()?
12804                                .unwrap_or_default();
12805                        }
12806                        __FieldTag::__number => {
12807                            if !fields.insert(__FieldTag::__number) {
12808                                return std::result::Result::Err(A::Error::duplicate_field(
12809                                    "multiple values for number",
12810                                ));
12811                            }
12812                            struct __With(std::option::Option<i32>);
12813                            impl<'de> serde::de::Deserialize<'de> for __With {
12814                                fn deserialize<D>(
12815                                    deserializer: D,
12816                                ) -> std::result::Result<Self, D::Error>
12817                                where
12818                                    D: serde::de::Deserializer<'de>,
12819                                {
12820                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
12821                                }
12822                            }
12823                            result.number = map.next_value::<__With>()?.0.unwrap_or_default();
12824                        }
12825                        __FieldTag::__name => {
12826                            if !fields.insert(__FieldTag::__name) {
12827                                return std::result::Result::Err(A::Error::duplicate_field(
12828                                    "multiple values for name",
12829                                ));
12830                            }
12831                            result.name = map
12832                                .next_value::<std::option::Option<std::string::String>>()?
12833                                .unwrap_or_default();
12834                        }
12835                        __FieldTag::__type_url => {
12836                            if !fields.insert(__FieldTag::__type_url) {
12837                                return std::result::Result::Err(A::Error::duplicate_field(
12838                                    "multiple values for type_url",
12839                                ));
12840                            }
12841                            result.type_url = map
12842                                .next_value::<std::option::Option<std::string::String>>()?
12843                                .unwrap_or_default();
12844                        }
12845                        __FieldTag::__oneof_index => {
12846                            if !fields.insert(__FieldTag::__oneof_index) {
12847                                return std::result::Result::Err(A::Error::duplicate_field(
12848                                    "multiple values for oneof_index",
12849                                ));
12850                            }
12851                            struct __With(std::option::Option<i32>);
12852                            impl<'de> serde::de::Deserialize<'de> for __With {
12853                                fn deserialize<D>(
12854                                    deserializer: D,
12855                                ) -> std::result::Result<Self, D::Error>
12856                                where
12857                                    D: serde::de::Deserializer<'de>,
12858                                {
12859                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
12860                                }
12861                            }
12862                            result.oneof_index = map.next_value::<__With>()?.0.unwrap_or_default();
12863                        }
12864                        __FieldTag::__packed => {
12865                            if !fields.insert(__FieldTag::__packed) {
12866                                return std::result::Result::Err(A::Error::duplicate_field(
12867                                    "multiple values for packed",
12868                                ));
12869                            }
12870                            result.packed = map
12871                                .next_value::<std::option::Option<bool>>()?
12872                                .unwrap_or_default();
12873                        }
12874                        __FieldTag::__options => {
12875                            if !fields.insert(__FieldTag::__options) {
12876                                return std::result::Result::Err(A::Error::duplicate_field(
12877                                    "multiple values for options",
12878                                ));
12879                            }
12880                            result.options = map
12881                                .next_value::<std::option::Option<std::vec::Vec<crate::Option>>>()?
12882                                .unwrap_or_default();
12883                        }
12884                        __FieldTag::__json_name => {
12885                            if !fields.insert(__FieldTag::__json_name) {
12886                                return std::result::Result::Err(A::Error::duplicate_field(
12887                                    "multiple values for json_name",
12888                                ));
12889                            }
12890                            result.json_name = map
12891                                .next_value::<std::option::Option<std::string::String>>()?
12892                                .unwrap_or_default();
12893                        }
12894                        __FieldTag::__default_value => {
12895                            if !fields.insert(__FieldTag::__default_value) {
12896                                return std::result::Result::Err(A::Error::duplicate_field(
12897                                    "multiple values for default_value",
12898                                ));
12899                            }
12900                            result.default_value = map
12901                                .next_value::<std::option::Option<std::string::String>>()?
12902                                .unwrap_or_default();
12903                        }
12904                        __FieldTag::Unknown(key) => {
12905                            let value = map.next_value::<serde_json::Value>()?;
12906                            result._unknown_fields.insert(key, value);
12907                        }
12908                    }
12909                }
12910                std::result::Result::Ok(result)
12911            }
12912        }
12913        deserializer.deserialize_any(Visitor)
12914    }
12915}
12916
12917#[doc(hidden)]
12918impl serde::ser::Serialize for Field {
12919    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12920    where
12921        S: serde::ser::Serializer,
12922    {
12923        use serde::ser::SerializeMap;
12924        #[allow(unused_imports)]
12925        use std::option::Option::Some;
12926        let mut state = serializer.serialize_map(std::option::Option::None)?;
12927        if !wkt::internal::is_default(&self.kind) {
12928            state.serialize_entry("kind", &self.kind)?;
12929        }
12930        if !wkt::internal::is_default(&self.cardinality) {
12931            state.serialize_entry("cardinality", &self.cardinality)?;
12932        }
12933        if !wkt::internal::is_default(&self.number) {
12934            struct __With<'a>(&'a i32);
12935            impl<'a> serde::ser::Serialize for __With<'a> {
12936                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12937                where
12938                    S: serde::ser::Serializer,
12939                {
12940                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
12941                }
12942            }
12943            state.serialize_entry("number", &__With(&self.number))?;
12944        }
12945        if !self.name.is_empty() {
12946            state.serialize_entry("name", &self.name)?;
12947        }
12948        if !self.type_url.is_empty() {
12949            state.serialize_entry("typeUrl", &self.type_url)?;
12950        }
12951        if !wkt::internal::is_default(&self.oneof_index) {
12952            struct __With<'a>(&'a i32);
12953            impl<'a> serde::ser::Serialize for __With<'a> {
12954                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12955                where
12956                    S: serde::ser::Serializer,
12957                {
12958                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
12959                }
12960            }
12961            state.serialize_entry("oneofIndex", &__With(&self.oneof_index))?;
12962        }
12963        if !wkt::internal::is_default(&self.packed) {
12964            state.serialize_entry("packed", &self.packed)?;
12965        }
12966        if !self.options.is_empty() {
12967            state.serialize_entry("options", &self.options)?;
12968        }
12969        if !self.json_name.is_empty() {
12970            state.serialize_entry("jsonName", &self.json_name)?;
12971        }
12972        if !self.default_value.is_empty() {
12973            state.serialize_entry("defaultValue", &self.default_value)?;
12974        }
12975        if !self._unknown_fields.is_empty() {
12976            for (key, value) in self._unknown_fields.iter() {
12977                state.serialize_entry(key, &value)?;
12978            }
12979        }
12980        state.end()
12981    }
12982}
12983
12984/// Defines additional types related to [Field].
12985pub mod field {
12986    #[allow(unused_imports)]
12987    use super::*;
12988
12989    /// Basic field types.
12990    ///
12991    /// # Working with unknown values
12992    ///
12993    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12994    /// additional enum variants at any time. Adding new variants is not considered
12995    /// a breaking change. Applications should write their code in anticipation of:
12996    ///
12997    /// - New values appearing in future releases of the client library, **and**
12998    /// - New values received dynamically, without application changes.
12999    ///
13000    /// Please consult the [Working with enums] section in the user guide for some
13001    /// guidelines.
13002    ///
13003    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13004    #[derive(Clone, Debug, PartialEq)]
13005    #[non_exhaustive]
13006    pub enum Kind {
13007        /// Field type unknown.
13008        TypeUnknown,
13009        /// Field type double.
13010        TypeDouble,
13011        /// Field type float.
13012        TypeFloat,
13013        /// Field type int64.
13014        TypeInt64,
13015        /// Field type uint64.
13016        TypeUint64,
13017        /// Field type int32.
13018        TypeInt32,
13019        /// Field type fixed64.
13020        TypeFixed64,
13021        /// Field type fixed32.
13022        TypeFixed32,
13023        /// Field type bool.
13024        TypeBool,
13025        /// Field type string.
13026        TypeString,
13027        /// Field type group. Proto2 syntax only, and deprecated.
13028        TypeGroup,
13029        /// Field type message.
13030        TypeMessage,
13031        /// Field type bytes.
13032        TypeBytes,
13033        /// Field type uint32.
13034        TypeUint32,
13035        /// Field type enum.
13036        TypeEnum,
13037        /// Field type sfixed32.
13038        TypeSfixed32,
13039        /// Field type sfixed64.
13040        TypeSfixed64,
13041        /// Field type sint32.
13042        TypeSint32,
13043        /// Field type sint64.
13044        TypeSint64,
13045        /// If set, the enum was initialized with an unknown value.
13046        ///
13047        /// Applications can examine the value using [Kind::value] or
13048        /// [Kind::name].
13049        UnknownValue(kind::UnknownValue),
13050    }
13051
13052    #[doc(hidden)]
13053    pub mod kind {
13054        #[allow(unused_imports)]
13055        use super::*;
13056        #[derive(Clone, Debug, PartialEq)]
13057        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13058    }
13059
13060    impl Kind {
13061        /// Gets the enum value.
13062        ///
13063        /// Returns `None` if the enum contains an unknown value deserialized from
13064        /// the string representation of enums.
13065        pub fn value(&self) -> std::option::Option<i32> {
13066            match self {
13067                Self::TypeUnknown => std::option::Option::Some(0),
13068                Self::TypeDouble => std::option::Option::Some(1),
13069                Self::TypeFloat => std::option::Option::Some(2),
13070                Self::TypeInt64 => std::option::Option::Some(3),
13071                Self::TypeUint64 => std::option::Option::Some(4),
13072                Self::TypeInt32 => std::option::Option::Some(5),
13073                Self::TypeFixed64 => std::option::Option::Some(6),
13074                Self::TypeFixed32 => std::option::Option::Some(7),
13075                Self::TypeBool => std::option::Option::Some(8),
13076                Self::TypeString => std::option::Option::Some(9),
13077                Self::TypeGroup => std::option::Option::Some(10),
13078                Self::TypeMessage => std::option::Option::Some(11),
13079                Self::TypeBytes => std::option::Option::Some(12),
13080                Self::TypeUint32 => std::option::Option::Some(13),
13081                Self::TypeEnum => std::option::Option::Some(14),
13082                Self::TypeSfixed32 => std::option::Option::Some(15),
13083                Self::TypeSfixed64 => std::option::Option::Some(16),
13084                Self::TypeSint32 => std::option::Option::Some(17),
13085                Self::TypeSint64 => std::option::Option::Some(18),
13086                Self::UnknownValue(u) => u.0.value(),
13087            }
13088        }
13089
13090        /// Gets the enum value as a string.
13091        ///
13092        /// Returns `None` if the enum contains an unknown value deserialized from
13093        /// the integer representation of enums.
13094        pub fn name(&self) -> std::option::Option<&str> {
13095            match self {
13096                Self::TypeUnknown => std::option::Option::Some("TYPE_UNKNOWN"),
13097                Self::TypeDouble => std::option::Option::Some("TYPE_DOUBLE"),
13098                Self::TypeFloat => std::option::Option::Some("TYPE_FLOAT"),
13099                Self::TypeInt64 => std::option::Option::Some("TYPE_INT64"),
13100                Self::TypeUint64 => std::option::Option::Some("TYPE_UINT64"),
13101                Self::TypeInt32 => std::option::Option::Some("TYPE_INT32"),
13102                Self::TypeFixed64 => std::option::Option::Some("TYPE_FIXED64"),
13103                Self::TypeFixed32 => std::option::Option::Some("TYPE_FIXED32"),
13104                Self::TypeBool => std::option::Option::Some("TYPE_BOOL"),
13105                Self::TypeString => std::option::Option::Some("TYPE_STRING"),
13106                Self::TypeGroup => std::option::Option::Some("TYPE_GROUP"),
13107                Self::TypeMessage => std::option::Option::Some("TYPE_MESSAGE"),
13108                Self::TypeBytes => std::option::Option::Some("TYPE_BYTES"),
13109                Self::TypeUint32 => std::option::Option::Some("TYPE_UINT32"),
13110                Self::TypeEnum => std::option::Option::Some("TYPE_ENUM"),
13111                Self::TypeSfixed32 => std::option::Option::Some("TYPE_SFIXED32"),
13112                Self::TypeSfixed64 => std::option::Option::Some("TYPE_SFIXED64"),
13113                Self::TypeSint32 => std::option::Option::Some("TYPE_SINT32"),
13114                Self::TypeSint64 => std::option::Option::Some("TYPE_SINT64"),
13115                Self::UnknownValue(u) => u.0.name(),
13116            }
13117        }
13118    }
13119
13120    impl std::default::Default for Kind {
13121        fn default() -> Self {
13122            use std::convert::From;
13123            Self::from(0)
13124        }
13125    }
13126
13127    impl std::fmt::Display for Kind {
13128        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13129            wkt::internal::display_enum(f, self.name(), self.value())
13130        }
13131    }
13132
13133    impl std::convert::From<i32> for Kind {
13134        fn from(value: i32) -> Self {
13135            match value {
13136                0 => Self::TypeUnknown,
13137                1 => Self::TypeDouble,
13138                2 => Self::TypeFloat,
13139                3 => Self::TypeInt64,
13140                4 => Self::TypeUint64,
13141                5 => Self::TypeInt32,
13142                6 => Self::TypeFixed64,
13143                7 => Self::TypeFixed32,
13144                8 => Self::TypeBool,
13145                9 => Self::TypeString,
13146                10 => Self::TypeGroup,
13147                11 => Self::TypeMessage,
13148                12 => Self::TypeBytes,
13149                13 => Self::TypeUint32,
13150                14 => Self::TypeEnum,
13151                15 => Self::TypeSfixed32,
13152                16 => Self::TypeSfixed64,
13153                17 => Self::TypeSint32,
13154                18 => Self::TypeSint64,
13155                _ => Self::UnknownValue(kind::UnknownValue(
13156                    wkt::internal::UnknownEnumValue::Integer(value),
13157                )),
13158            }
13159        }
13160    }
13161
13162    impl std::convert::From<&str> for Kind {
13163        fn from(value: &str) -> Self {
13164            use std::string::ToString;
13165            match value {
13166                "TYPE_UNKNOWN" => Self::TypeUnknown,
13167                "TYPE_DOUBLE" => Self::TypeDouble,
13168                "TYPE_FLOAT" => Self::TypeFloat,
13169                "TYPE_INT64" => Self::TypeInt64,
13170                "TYPE_UINT64" => Self::TypeUint64,
13171                "TYPE_INT32" => Self::TypeInt32,
13172                "TYPE_FIXED64" => Self::TypeFixed64,
13173                "TYPE_FIXED32" => Self::TypeFixed32,
13174                "TYPE_BOOL" => Self::TypeBool,
13175                "TYPE_STRING" => Self::TypeString,
13176                "TYPE_GROUP" => Self::TypeGroup,
13177                "TYPE_MESSAGE" => Self::TypeMessage,
13178                "TYPE_BYTES" => Self::TypeBytes,
13179                "TYPE_UINT32" => Self::TypeUint32,
13180                "TYPE_ENUM" => Self::TypeEnum,
13181                "TYPE_SFIXED32" => Self::TypeSfixed32,
13182                "TYPE_SFIXED64" => Self::TypeSfixed64,
13183                "TYPE_SINT32" => Self::TypeSint32,
13184                "TYPE_SINT64" => Self::TypeSint64,
13185                _ => Self::UnknownValue(kind::UnknownValue(
13186                    wkt::internal::UnknownEnumValue::String(value.to_string()),
13187                )),
13188            }
13189        }
13190    }
13191
13192    impl serde::ser::Serialize for Kind {
13193        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13194        where
13195            S: serde::Serializer,
13196        {
13197            match self {
13198                Self::TypeUnknown => serializer.serialize_i32(0),
13199                Self::TypeDouble => serializer.serialize_i32(1),
13200                Self::TypeFloat => serializer.serialize_i32(2),
13201                Self::TypeInt64 => serializer.serialize_i32(3),
13202                Self::TypeUint64 => serializer.serialize_i32(4),
13203                Self::TypeInt32 => serializer.serialize_i32(5),
13204                Self::TypeFixed64 => serializer.serialize_i32(6),
13205                Self::TypeFixed32 => serializer.serialize_i32(7),
13206                Self::TypeBool => serializer.serialize_i32(8),
13207                Self::TypeString => serializer.serialize_i32(9),
13208                Self::TypeGroup => serializer.serialize_i32(10),
13209                Self::TypeMessage => serializer.serialize_i32(11),
13210                Self::TypeBytes => serializer.serialize_i32(12),
13211                Self::TypeUint32 => serializer.serialize_i32(13),
13212                Self::TypeEnum => serializer.serialize_i32(14),
13213                Self::TypeSfixed32 => serializer.serialize_i32(15),
13214                Self::TypeSfixed64 => serializer.serialize_i32(16),
13215                Self::TypeSint32 => serializer.serialize_i32(17),
13216                Self::TypeSint64 => serializer.serialize_i32(18),
13217                Self::UnknownValue(u) => u.0.serialize(serializer),
13218            }
13219        }
13220    }
13221
13222    impl<'de> serde::de::Deserialize<'de> for Kind {
13223        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13224        where
13225            D: serde::Deserializer<'de>,
13226        {
13227            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Kind>::new(
13228                ".google.protobuf.Field.Kind",
13229            ))
13230        }
13231    }
13232
13233    /// Whether a field is optional, required, or repeated.
13234    ///
13235    /// # Working with unknown values
13236    ///
13237    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13238    /// additional enum variants at any time. Adding new variants is not considered
13239    /// a breaking change. Applications should write their code in anticipation of:
13240    ///
13241    /// - New values appearing in future releases of the client library, **and**
13242    /// - New values received dynamically, without application changes.
13243    ///
13244    /// Please consult the [Working with enums] section in the user guide for some
13245    /// guidelines.
13246    ///
13247    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13248    #[derive(Clone, Debug, PartialEq)]
13249    #[non_exhaustive]
13250    pub enum Cardinality {
13251        /// For fields with unknown cardinality.
13252        Unknown,
13253        /// For optional fields.
13254        Optional,
13255        /// For required fields. Proto2 syntax only.
13256        Required,
13257        /// For repeated fields.
13258        Repeated,
13259        /// If set, the enum was initialized with an unknown value.
13260        ///
13261        /// Applications can examine the value using [Cardinality::value] or
13262        /// [Cardinality::name].
13263        UnknownValue(cardinality::UnknownValue),
13264    }
13265
13266    #[doc(hidden)]
13267    pub mod cardinality {
13268        #[allow(unused_imports)]
13269        use super::*;
13270        #[derive(Clone, Debug, PartialEq)]
13271        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13272    }
13273
13274    impl Cardinality {
13275        /// Gets the enum value.
13276        ///
13277        /// Returns `None` if the enum contains an unknown value deserialized from
13278        /// the string representation of enums.
13279        pub fn value(&self) -> std::option::Option<i32> {
13280            match self {
13281                Self::Unknown => std::option::Option::Some(0),
13282                Self::Optional => std::option::Option::Some(1),
13283                Self::Required => std::option::Option::Some(2),
13284                Self::Repeated => std::option::Option::Some(3),
13285                Self::UnknownValue(u) => u.0.value(),
13286            }
13287        }
13288
13289        /// Gets the enum value as a string.
13290        ///
13291        /// Returns `None` if the enum contains an unknown value deserialized from
13292        /// the integer representation of enums.
13293        pub fn name(&self) -> std::option::Option<&str> {
13294            match self {
13295                Self::Unknown => std::option::Option::Some("CARDINALITY_UNKNOWN"),
13296                Self::Optional => std::option::Option::Some("CARDINALITY_OPTIONAL"),
13297                Self::Required => std::option::Option::Some("CARDINALITY_REQUIRED"),
13298                Self::Repeated => std::option::Option::Some("CARDINALITY_REPEATED"),
13299                Self::UnknownValue(u) => u.0.name(),
13300            }
13301        }
13302    }
13303
13304    impl std::default::Default for Cardinality {
13305        fn default() -> Self {
13306            use std::convert::From;
13307            Self::from(0)
13308        }
13309    }
13310
13311    impl std::fmt::Display for Cardinality {
13312        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13313            wkt::internal::display_enum(f, self.name(), self.value())
13314        }
13315    }
13316
13317    impl std::convert::From<i32> for Cardinality {
13318        fn from(value: i32) -> Self {
13319            match value {
13320                0 => Self::Unknown,
13321                1 => Self::Optional,
13322                2 => Self::Required,
13323                3 => Self::Repeated,
13324                _ => Self::UnknownValue(cardinality::UnknownValue(
13325                    wkt::internal::UnknownEnumValue::Integer(value),
13326                )),
13327            }
13328        }
13329    }
13330
13331    impl std::convert::From<&str> for Cardinality {
13332        fn from(value: &str) -> Self {
13333            use std::string::ToString;
13334            match value {
13335                "CARDINALITY_UNKNOWN" => Self::Unknown,
13336                "CARDINALITY_OPTIONAL" => Self::Optional,
13337                "CARDINALITY_REQUIRED" => Self::Required,
13338                "CARDINALITY_REPEATED" => Self::Repeated,
13339                _ => Self::UnknownValue(cardinality::UnknownValue(
13340                    wkt::internal::UnknownEnumValue::String(value.to_string()),
13341                )),
13342            }
13343        }
13344    }
13345
13346    impl serde::ser::Serialize for Cardinality {
13347        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13348        where
13349            S: serde::Serializer,
13350        {
13351            match self {
13352                Self::Unknown => serializer.serialize_i32(0),
13353                Self::Optional => serializer.serialize_i32(1),
13354                Self::Required => serializer.serialize_i32(2),
13355                Self::Repeated => serializer.serialize_i32(3),
13356                Self::UnknownValue(u) => u.0.serialize(serializer),
13357            }
13358        }
13359    }
13360
13361    impl<'de> serde::de::Deserialize<'de> for Cardinality {
13362        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13363        where
13364            D: serde::Deserializer<'de>,
13365        {
13366            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Cardinality>::new(
13367                ".google.protobuf.Field.Cardinality",
13368            ))
13369        }
13370    }
13371}
13372
13373/// Enum type definition.
13374#[derive(Clone, Debug, Default, PartialEq)]
13375#[non_exhaustive]
13376pub struct Enum {
13377    /// Enum type name.
13378    pub name: std::string::String,
13379
13380    /// Enum value definitions.
13381    pub enumvalue: std::vec::Vec<crate::EnumValue>,
13382
13383    /// Protocol buffer options.
13384    pub options: std::vec::Vec<crate::Option>,
13385
13386    /// The source context.
13387    pub source_context: std::option::Option<crate::SourceContext>,
13388
13389    /// The source syntax.
13390    pub syntax: crate::Syntax,
13391
13392    /// The source edition string, only valid when syntax is SYNTAX_EDITIONS.
13393    pub edition: std::string::String,
13394
13395    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13396}
13397
13398impl Enum {
13399    pub fn new() -> Self {
13400        std::default::Default::default()
13401    }
13402
13403    /// Sets the value of [name][crate::Enum::name].
13404    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13405        self.name = v.into();
13406        self
13407    }
13408
13409    /// Sets the value of [enumvalue][crate::Enum::enumvalue].
13410    pub fn set_enumvalue<T, V>(mut self, v: T) -> Self
13411    where
13412        T: std::iter::IntoIterator<Item = V>,
13413        V: std::convert::Into<crate::EnumValue>,
13414    {
13415        use std::iter::Iterator;
13416        self.enumvalue = v.into_iter().map(|i| i.into()).collect();
13417        self
13418    }
13419
13420    /// Sets the value of [options][crate::Enum::options].
13421    pub fn set_options<T, V>(mut self, v: T) -> Self
13422    where
13423        T: std::iter::IntoIterator<Item = V>,
13424        V: std::convert::Into<crate::Option>,
13425    {
13426        use std::iter::Iterator;
13427        self.options = v.into_iter().map(|i| i.into()).collect();
13428        self
13429    }
13430
13431    /// Sets the value of [source_context][crate::Enum::source_context].
13432    pub fn set_source_context<T>(mut self, v: T) -> Self
13433    where
13434        T: std::convert::Into<crate::SourceContext>,
13435    {
13436        self.source_context = std::option::Option::Some(v.into());
13437        self
13438    }
13439
13440    /// Sets or clears the value of [source_context][crate::Enum::source_context].
13441    pub fn set_or_clear_source_context<T>(mut self, v: std::option::Option<T>) -> Self
13442    where
13443        T: std::convert::Into<crate::SourceContext>,
13444    {
13445        self.source_context = v.map(|x| x.into());
13446        self
13447    }
13448
13449    /// Sets the value of [syntax][crate::Enum::syntax].
13450    pub fn set_syntax<T: std::convert::Into<crate::Syntax>>(mut self, v: T) -> Self {
13451        self.syntax = v.into();
13452        self
13453    }
13454
13455    /// Sets the value of [edition][crate::Enum::edition].
13456    pub fn set_edition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13457        self.edition = v.into();
13458        self
13459    }
13460}
13461
13462impl wkt::message::Message for Enum {
13463    fn typename() -> &'static str {
13464        "type.googleapis.com/google.protobuf.Enum"
13465    }
13466}
13467
13468#[doc(hidden)]
13469impl<'de> serde::de::Deserialize<'de> for Enum {
13470    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13471    where
13472        D: serde::Deserializer<'de>,
13473    {
13474        #[allow(non_camel_case_types)]
13475        #[doc(hidden)]
13476        #[derive(PartialEq, Eq, Hash)]
13477        enum __FieldTag {
13478            __name,
13479            __enumvalue,
13480            __options,
13481            __source_context,
13482            __syntax,
13483            __edition,
13484            Unknown(std::string::String),
13485        }
13486        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13487            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13488            where
13489                D: serde::Deserializer<'de>,
13490            {
13491                struct Visitor;
13492                impl<'de> serde::de::Visitor<'de> for Visitor {
13493                    type Value = __FieldTag;
13494                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13495                        formatter.write_str("a field name for Enum")
13496                    }
13497                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13498                    where
13499                        E: serde::de::Error,
13500                    {
13501                        use std::result::Result::Ok;
13502                        use std::string::ToString;
13503                        match value {
13504                            "name" => Ok(__FieldTag::__name),
13505                            "enumvalue" => Ok(__FieldTag::__enumvalue),
13506                            "options" => Ok(__FieldTag::__options),
13507                            "sourceContext" => Ok(__FieldTag::__source_context),
13508                            "source_context" => Ok(__FieldTag::__source_context),
13509                            "syntax" => Ok(__FieldTag::__syntax),
13510                            "edition" => Ok(__FieldTag::__edition),
13511                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13512                        }
13513                    }
13514                }
13515                deserializer.deserialize_identifier(Visitor)
13516            }
13517        }
13518        struct Visitor;
13519        impl<'de> serde::de::Visitor<'de> for Visitor {
13520            type Value = Enum;
13521            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13522                formatter.write_str("struct Enum")
13523            }
13524            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13525            where
13526                A: serde::de::MapAccess<'de>,
13527            {
13528                #[allow(unused_imports)]
13529                use serde::de::Error;
13530                use std::option::Option::Some;
13531                let mut fields = std::collections::HashSet::new();
13532                let mut result = Self::Value::new();
13533                while let Some(tag) = map.next_key::<__FieldTag>()? {
13534                    #[allow(clippy::match_single_binding)]
13535                    match tag {
13536                        __FieldTag::__name => {
13537                            if !fields.insert(__FieldTag::__name) {
13538                                return std::result::Result::Err(A::Error::duplicate_field(
13539                                    "multiple values for name",
13540                                ));
13541                            }
13542                            result.name = map
13543                                .next_value::<std::option::Option<std::string::String>>()?
13544                                .unwrap_or_default();
13545                        }
13546                        __FieldTag::__enumvalue => {
13547                            if !fields.insert(__FieldTag::__enumvalue) {
13548                                return std::result::Result::Err(A::Error::duplicate_field(
13549                                    "multiple values for enumvalue",
13550                                ));
13551                            }
13552                            result.enumvalue = map
13553                                .next_value::<std::option::Option<std::vec::Vec<crate::EnumValue>>>(
13554                                )?
13555                                .unwrap_or_default();
13556                        }
13557                        __FieldTag::__options => {
13558                            if !fields.insert(__FieldTag::__options) {
13559                                return std::result::Result::Err(A::Error::duplicate_field(
13560                                    "multiple values for options",
13561                                ));
13562                            }
13563                            result.options = map
13564                                .next_value::<std::option::Option<std::vec::Vec<crate::Option>>>()?
13565                                .unwrap_or_default();
13566                        }
13567                        __FieldTag::__source_context => {
13568                            if !fields.insert(__FieldTag::__source_context) {
13569                                return std::result::Result::Err(A::Error::duplicate_field(
13570                                    "multiple values for source_context",
13571                                ));
13572                            }
13573                            result.source_context =
13574                                map.next_value::<std::option::Option<crate::SourceContext>>()?;
13575                        }
13576                        __FieldTag::__syntax => {
13577                            if !fields.insert(__FieldTag::__syntax) {
13578                                return std::result::Result::Err(A::Error::duplicate_field(
13579                                    "multiple values for syntax",
13580                                ));
13581                            }
13582                            result.syntax = map
13583                                .next_value::<std::option::Option<crate::Syntax>>()?
13584                                .unwrap_or_default();
13585                        }
13586                        __FieldTag::__edition => {
13587                            if !fields.insert(__FieldTag::__edition) {
13588                                return std::result::Result::Err(A::Error::duplicate_field(
13589                                    "multiple values for edition",
13590                                ));
13591                            }
13592                            result.edition = map
13593                                .next_value::<std::option::Option<std::string::String>>()?
13594                                .unwrap_or_default();
13595                        }
13596                        __FieldTag::Unknown(key) => {
13597                            let value = map.next_value::<serde_json::Value>()?;
13598                            result._unknown_fields.insert(key, value);
13599                        }
13600                    }
13601                }
13602                std::result::Result::Ok(result)
13603            }
13604        }
13605        deserializer.deserialize_any(Visitor)
13606    }
13607}
13608
13609#[doc(hidden)]
13610impl serde::ser::Serialize for Enum {
13611    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13612    where
13613        S: serde::ser::Serializer,
13614    {
13615        use serde::ser::SerializeMap;
13616        #[allow(unused_imports)]
13617        use std::option::Option::Some;
13618        let mut state = serializer.serialize_map(std::option::Option::None)?;
13619        if !self.name.is_empty() {
13620            state.serialize_entry("name", &self.name)?;
13621        }
13622        if !self.enumvalue.is_empty() {
13623            state.serialize_entry("enumvalue", &self.enumvalue)?;
13624        }
13625        if !self.options.is_empty() {
13626            state.serialize_entry("options", &self.options)?;
13627        }
13628        if self.source_context.is_some() {
13629            state.serialize_entry("sourceContext", &self.source_context)?;
13630        }
13631        if !wkt::internal::is_default(&self.syntax) {
13632            state.serialize_entry("syntax", &self.syntax)?;
13633        }
13634        if !self.edition.is_empty() {
13635            state.serialize_entry("edition", &self.edition)?;
13636        }
13637        if !self._unknown_fields.is_empty() {
13638            for (key, value) in self._unknown_fields.iter() {
13639                state.serialize_entry(key, &value)?;
13640            }
13641        }
13642        state.end()
13643    }
13644}
13645
13646/// Enum value definition.
13647#[derive(Clone, Debug, Default, PartialEq)]
13648#[non_exhaustive]
13649pub struct EnumValue {
13650    /// Enum value name.
13651    pub name: std::string::String,
13652
13653    /// Enum value number.
13654    pub number: i32,
13655
13656    /// Protocol buffer options.
13657    pub options: std::vec::Vec<crate::Option>,
13658
13659    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13660}
13661
13662impl EnumValue {
13663    pub fn new() -> Self {
13664        std::default::Default::default()
13665    }
13666
13667    /// Sets the value of [name][crate::EnumValue::name].
13668    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13669        self.name = v.into();
13670        self
13671    }
13672
13673    /// Sets the value of [number][crate::EnumValue::number].
13674    pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13675        self.number = v.into();
13676        self
13677    }
13678
13679    /// Sets the value of [options][crate::EnumValue::options].
13680    pub fn set_options<T, V>(mut self, v: T) -> Self
13681    where
13682        T: std::iter::IntoIterator<Item = V>,
13683        V: std::convert::Into<crate::Option>,
13684    {
13685        use std::iter::Iterator;
13686        self.options = v.into_iter().map(|i| i.into()).collect();
13687        self
13688    }
13689}
13690
13691impl wkt::message::Message for EnumValue {
13692    fn typename() -> &'static str {
13693        "type.googleapis.com/google.protobuf.EnumValue"
13694    }
13695}
13696
13697#[doc(hidden)]
13698impl<'de> serde::de::Deserialize<'de> for EnumValue {
13699    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13700    where
13701        D: serde::Deserializer<'de>,
13702    {
13703        #[allow(non_camel_case_types)]
13704        #[doc(hidden)]
13705        #[derive(PartialEq, Eq, Hash)]
13706        enum __FieldTag {
13707            __name,
13708            __number,
13709            __options,
13710            Unknown(std::string::String),
13711        }
13712        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13713            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13714            where
13715                D: serde::Deserializer<'de>,
13716            {
13717                struct Visitor;
13718                impl<'de> serde::de::Visitor<'de> for Visitor {
13719                    type Value = __FieldTag;
13720                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13721                        formatter.write_str("a field name for EnumValue")
13722                    }
13723                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13724                    where
13725                        E: serde::de::Error,
13726                    {
13727                        use std::result::Result::Ok;
13728                        use std::string::ToString;
13729                        match value {
13730                            "name" => Ok(__FieldTag::__name),
13731                            "number" => Ok(__FieldTag::__number),
13732                            "options" => Ok(__FieldTag::__options),
13733                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13734                        }
13735                    }
13736                }
13737                deserializer.deserialize_identifier(Visitor)
13738            }
13739        }
13740        struct Visitor;
13741        impl<'de> serde::de::Visitor<'de> for Visitor {
13742            type Value = EnumValue;
13743            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13744                formatter.write_str("struct EnumValue")
13745            }
13746            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13747            where
13748                A: serde::de::MapAccess<'de>,
13749            {
13750                #[allow(unused_imports)]
13751                use serde::de::Error;
13752                use std::option::Option::Some;
13753                let mut fields = std::collections::HashSet::new();
13754                let mut result = Self::Value::new();
13755                while let Some(tag) = map.next_key::<__FieldTag>()? {
13756                    #[allow(clippy::match_single_binding)]
13757                    match tag {
13758                        __FieldTag::__name => {
13759                            if !fields.insert(__FieldTag::__name) {
13760                                return std::result::Result::Err(A::Error::duplicate_field(
13761                                    "multiple values for name",
13762                                ));
13763                            }
13764                            result.name = map
13765                                .next_value::<std::option::Option<std::string::String>>()?
13766                                .unwrap_or_default();
13767                        }
13768                        __FieldTag::__number => {
13769                            if !fields.insert(__FieldTag::__number) {
13770                                return std::result::Result::Err(A::Error::duplicate_field(
13771                                    "multiple values for number",
13772                                ));
13773                            }
13774                            struct __With(std::option::Option<i32>);
13775                            impl<'de> serde::de::Deserialize<'de> for __With {
13776                                fn deserialize<D>(
13777                                    deserializer: D,
13778                                ) -> std::result::Result<Self, D::Error>
13779                                where
13780                                    D: serde::de::Deserializer<'de>,
13781                                {
13782                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
13783                                }
13784                            }
13785                            result.number = map.next_value::<__With>()?.0.unwrap_or_default();
13786                        }
13787                        __FieldTag::__options => {
13788                            if !fields.insert(__FieldTag::__options) {
13789                                return std::result::Result::Err(A::Error::duplicate_field(
13790                                    "multiple values for options",
13791                                ));
13792                            }
13793                            result.options = map
13794                                .next_value::<std::option::Option<std::vec::Vec<crate::Option>>>()?
13795                                .unwrap_or_default();
13796                        }
13797                        __FieldTag::Unknown(key) => {
13798                            let value = map.next_value::<serde_json::Value>()?;
13799                            result._unknown_fields.insert(key, value);
13800                        }
13801                    }
13802                }
13803                std::result::Result::Ok(result)
13804            }
13805        }
13806        deserializer.deserialize_any(Visitor)
13807    }
13808}
13809
13810#[doc(hidden)]
13811impl serde::ser::Serialize for EnumValue {
13812    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13813    where
13814        S: serde::ser::Serializer,
13815    {
13816        use serde::ser::SerializeMap;
13817        #[allow(unused_imports)]
13818        use std::option::Option::Some;
13819        let mut state = serializer.serialize_map(std::option::Option::None)?;
13820        if !self.name.is_empty() {
13821            state.serialize_entry("name", &self.name)?;
13822        }
13823        if !wkt::internal::is_default(&self.number) {
13824            struct __With<'a>(&'a i32);
13825            impl<'a> serde::ser::Serialize for __With<'a> {
13826                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13827                where
13828                    S: serde::ser::Serializer,
13829                {
13830                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
13831                }
13832            }
13833            state.serialize_entry("number", &__With(&self.number))?;
13834        }
13835        if !self.options.is_empty() {
13836            state.serialize_entry("options", &self.options)?;
13837        }
13838        if !self._unknown_fields.is_empty() {
13839            for (key, value) in self._unknown_fields.iter() {
13840                state.serialize_entry(key, &value)?;
13841            }
13842        }
13843        state.end()
13844    }
13845}
13846
13847/// A protocol buffer option, which can be attached to a message, field,
13848/// enumeration, etc.
13849#[derive(Clone, Debug, Default, PartialEq)]
13850#[non_exhaustive]
13851pub struct Option {
13852    /// The option's name. For protobuf built-in options (options defined in
13853    /// descriptor.proto), this is the short name. For example, `"map_entry"`.
13854    /// For custom options, it should be the fully-qualified name. For example,
13855    /// `"google.api.http"`.
13856    pub name: std::string::String,
13857
13858    /// The option's value packed in an Any message. If the value is a primitive,
13859    /// the corresponding wrapper type defined in google/protobuf/wrappers.proto
13860    /// should be used. If the value is an enum, it should be stored as an int32
13861    /// value using the google.protobuf.Int32Value type.
13862    pub value: std::option::Option<crate::Any>,
13863
13864    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13865}
13866
13867impl Option {
13868    pub fn new() -> Self {
13869        std::default::Default::default()
13870    }
13871
13872    /// Sets the value of [name][crate::Option::name].
13873    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13874        self.name = v.into();
13875        self
13876    }
13877
13878    /// Sets the value of [value][crate::Option::value].
13879    pub fn set_value<T>(mut self, v: T) -> Self
13880    where
13881        T: std::convert::Into<crate::Any>,
13882    {
13883        self.value = std::option::Option::Some(v.into());
13884        self
13885    }
13886
13887    /// Sets or clears the value of [value][crate::Option::value].
13888    pub fn set_or_clear_value<T>(mut self, v: std::option::Option<T>) -> Self
13889    where
13890        T: std::convert::Into<crate::Any>,
13891    {
13892        self.value = v.map(|x| x.into());
13893        self
13894    }
13895}
13896
13897impl wkt::message::Message for Option {
13898    fn typename() -> &'static str {
13899        "type.googleapis.com/google.protobuf.Option"
13900    }
13901}
13902
13903#[doc(hidden)]
13904impl<'de> serde::de::Deserialize<'de> for Option {
13905    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13906    where
13907        D: serde::Deserializer<'de>,
13908    {
13909        #[allow(non_camel_case_types)]
13910        #[doc(hidden)]
13911        #[derive(PartialEq, Eq, Hash)]
13912        enum __FieldTag {
13913            __name,
13914            __value,
13915            Unknown(std::string::String),
13916        }
13917        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13918            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13919            where
13920                D: serde::Deserializer<'de>,
13921            {
13922                struct Visitor;
13923                impl<'de> serde::de::Visitor<'de> for Visitor {
13924                    type Value = __FieldTag;
13925                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13926                        formatter.write_str("a field name for Option")
13927                    }
13928                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13929                    where
13930                        E: serde::de::Error,
13931                    {
13932                        use std::result::Result::Ok;
13933                        use std::string::ToString;
13934                        match value {
13935                            "name" => Ok(__FieldTag::__name),
13936                            "value" => Ok(__FieldTag::__value),
13937                            _ => Ok(__FieldTag::Unknown(value.to_string())),
13938                        }
13939                    }
13940                }
13941                deserializer.deserialize_identifier(Visitor)
13942            }
13943        }
13944        struct Visitor;
13945        impl<'de> serde::de::Visitor<'de> for Visitor {
13946            type Value = Option;
13947            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13948                formatter.write_str("struct Option")
13949            }
13950            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13951            where
13952                A: serde::de::MapAccess<'de>,
13953            {
13954                #[allow(unused_imports)]
13955                use serde::de::Error;
13956                use std::option::Option::Some;
13957                let mut fields = std::collections::HashSet::new();
13958                let mut result = Self::Value::new();
13959                while let Some(tag) = map.next_key::<__FieldTag>()? {
13960                    #[allow(clippy::match_single_binding)]
13961                    match tag {
13962                        __FieldTag::__name => {
13963                            if !fields.insert(__FieldTag::__name) {
13964                                return std::result::Result::Err(A::Error::duplicate_field(
13965                                    "multiple values for name",
13966                                ));
13967                            }
13968                            result.name = map
13969                                .next_value::<std::option::Option<std::string::String>>()?
13970                                .unwrap_or_default();
13971                        }
13972                        __FieldTag::__value => {
13973                            if !fields.insert(__FieldTag::__value) {
13974                                return std::result::Result::Err(A::Error::duplicate_field(
13975                                    "multiple values for value",
13976                                ));
13977                            }
13978                            result.value = map.next_value::<std::option::Option<crate::Any>>()?;
13979                        }
13980                        __FieldTag::Unknown(key) => {
13981                            let value = map.next_value::<serde_json::Value>()?;
13982                            result._unknown_fields.insert(key, value);
13983                        }
13984                    }
13985                }
13986                std::result::Result::Ok(result)
13987            }
13988        }
13989        deserializer.deserialize_any(Visitor)
13990    }
13991}
13992
13993#[doc(hidden)]
13994impl serde::ser::Serialize for Option {
13995    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13996    where
13997        S: serde::ser::Serializer,
13998    {
13999        use serde::ser::SerializeMap;
14000        #[allow(unused_imports)]
14001        use std::option::Option::Some;
14002        let mut state = serializer.serialize_map(std::option::Option::None)?;
14003        if !self.name.is_empty() {
14004            state.serialize_entry("name", &self.name)?;
14005        }
14006        if self.value.is_some() {
14007            state.serialize_entry("value", &self.value)?;
14008        }
14009        if !self._unknown_fields.is_empty() {
14010            for (key, value) in self._unknown_fields.iter() {
14011                state.serialize_entry(key, &value)?;
14012            }
14013        }
14014        state.end()
14015    }
14016}
14017
14018/// The full set of known editions.
14019///
14020/// # Working with unknown values
14021///
14022/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14023/// additional enum variants at any time. Adding new variants is not considered
14024/// a breaking change. Applications should write their code in anticipation of:
14025///
14026/// - New values appearing in future releases of the client library, **and**
14027/// - New values received dynamically, without application changes.
14028///
14029/// Please consult the [Working with enums] section in the user guide for some
14030/// guidelines.
14031///
14032/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14033#[derive(Clone, Debug, PartialEq)]
14034#[non_exhaustive]
14035pub enum Edition {
14036    /// A placeholder for an unknown edition value.
14037    Unknown,
14038    /// A placeholder edition for specifying default behaviors *before* a feature
14039    /// was first introduced.  This is effectively an "infinite past".
14040    Legacy,
14041    /// Legacy syntax "editions".  These pre-date editions, but behave much like
14042    /// distinct editions.  These can't be used to specify the edition of proto
14043    /// files, but feature definitions must supply proto2/proto3 defaults for
14044    /// backwards compatibility.
14045    Proto2,
14046    Proto3,
14047    /// Editions that have been released.  The specific values are arbitrary and
14048    /// should not be depended on, but they will always be time-ordered for easy
14049    /// comparison.
14050    Edition2023,
14051    Edition2024,
14052    /// Placeholder editions for testing feature resolution.  These should not be
14053    /// used or relied on outside of tests.
14054    Edition1TestOnly,
14055    Edition2TestOnly,
14056    Edition99997TestOnly,
14057    Edition99998TestOnly,
14058    Edition99999TestOnly,
14059    /// Placeholder for specifying unbounded edition support.  This should only
14060    /// ever be used by plugins that can expect to never require any changes to
14061    /// support a new edition.
14062    Max,
14063    /// If set, the enum was initialized with an unknown value.
14064    ///
14065    /// Applications can examine the value using [Edition::value] or
14066    /// [Edition::name].
14067    UnknownValue(edition::UnknownValue),
14068}
14069
14070#[doc(hidden)]
14071pub mod edition {
14072    #[allow(unused_imports)]
14073    use super::*;
14074    #[derive(Clone, Debug, PartialEq)]
14075    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14076}
14077
14078impl Edition {
14079    /// Gets the enum value.
14080    ///
14081    /// Returns `None` if the enum contains an unknown value deserialized from
14082    /// the string representation of enums.
14083    pub fn value(&self) -> std::option::Option<i32> {
14084        match self {
14085            Self::Unknown => std::option::Option::Some(0),
14086            Self::Legacy => std::option::Option::Some(900),
14087            Self::Proto2 => std::option::Option::Some(998),
14088            Self::Proto3 => std::option::Option::Some(999),
14089            Self::Edition2023 => std::option::Option::Some(1000),
14090            Self::Edition2024 => std::option::Option::Some(1001),
14091            Self::Edition1TestOnly => std::option::Option::Some(1),
14092            Self::Edition2TestOnly => std::option::Option::Some(2),
14093            Self::Edition99997TestOnly => std::option::Option::Some(99997),
14094            Self::Edition99998TestOnly => std::option::Option::Some(99998),
14095            Self::Edition99999TestOnly => std::option::Option::Some(99999),
14096            Self::Max => std::option::Option::Some(2147483647),
14097            Self::UnknownValue(u) => u.0.value(),
14098        }
14099    }
14100
14101    /// Gets the enum value as a string.
14102    ///
14103    /// Returns `None` if the enum contains an unknown value deserialized from
14104    /// the integer representation of enums.
14105    pub fn name(&self) -> std::option::Option<&str> {
14106        match self {
14107            Self::Unknown => std::option::Option::Some("EDITION_UNKNOWN"),
14108            Self::Legacy => std::option::Option::Some("EDITION_LEGACY"),
14109            Self::Proto2 => std::option::Option::Some("EDITION_PROTO2"),
14110            Self::Proto3 => std::option::Option::Some("EDITION_PROTO3"),
14111            Self::Edition2023 => std::option::Option::Some("EDITION_2023"),
14112            Self::Edition2024 => std::option::Option::Some("EDITION_2024"),
14113            Self::Edition1TestOnly => std::option::Option::Some("EDITION_1_TEST_ONLY"),
14114            Self::Edition2TestOnly => std::option::Option::Some("EDITION_2_TEST_ONLY"),
14115            Self::Edition99997TestOnly => std::option::Option::Some("EDITION_99997_TEST_ONLY"),
14116            Self::Edition99998TestOnly => std::option::Option::Some("EDITION_99998_TEST_ONLY"),
14117            Self::Edition99999TestOnly => std::option::Option::Some("EDITION_99999_TEST_ONLY"),
14118            Self::Max => std::option::Option::Some("EDITION_MAX"),
14119            Self::UnknownValue(u) => u.0.name(),
14120        }
14121    }
14122}
14123
14124impl std::default::Default for Edition {
14125    fn default() -> Self {
14126        use std::convert::From;
14127        Self::from(0)
14128    }
14129}
14130
14131impl std::fmt::Display for Edition {
14132    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14133        wkt::internal::display_enum(f, self.name(), self.value())
14134    }
14135}
14136
14137impl std::convert::From<i32> for Edition {
14138    fn from(value: i32) -> Self {
14139        match value {
14140            0 => Self::Unknown,
14141            1 => Self::Edition1TestOnly,
14142            2 => Self::Edition2TestOnly,
14143            900 => Self::Legacy,
14144            998 => Self::Proto2,
14145            999 => Self::Proto3,
14146            1000 => Self::Edition2023,
14147            1001 => Self::Edition2024,
14148            99997 => Self::Edition99997TestOnly,
14149            99998 => Self::Edition99998TestOnly,
14150            99999 => Self::Edition99999TestOnly,
14151            2147483647 => Self::Max,
14152            _ => Self::UnknownValue(edition::UnknownValue(
14153                wkt::internal::UnknownEnumValue::Integer(value),
14154            )),
14155        }
14156    }
14157}
14158
14159impl std::convert::From<&str> for Edition {
14160    fn from(value: &str) -> Self {
14161        use std::string::ToString;
14162        match value {
14163            "EDITION_UNKNOWN" => Self::Unknown,
14164            "EDITION_LEGACY" => Self::Legacy,
14165            "EDITION_PROTO2" => Self::Proto2,
14166            "EDITION_PROTO3" => Self::Proto3,
14167            "EDITION_2023" => Self::Edition2023,
14168            "EDITION_2024" => Self::Edition2024,
14169            "EDITION_1_TEST_ONLY" => Self::Edition1TestOnly,
14170            "EDITION_2_TEST_ONLY" => Self::Edition2TestOnly,
14171            "EDITION_99997_TEST_ONLY" => Self::Edition99997TestOnly,
14172            "EDITION_99998_TEST_ONLY" => Self::Edition99998TestOnly,
14173            "EDITION_99999_TEST_ONLY" => Self::Edition99999TestOnly,
14174            "EDITION_MAX" => Self::Max,
14175            _ => Self::UnknownValue(edition::UnknownValue(
14176                wkt::internal::UnknownEnumValue::String(value.to_string()),
14177            )),
14178        }
14179    }
14180}
14181
14182impl serde::ser::Serialize for Edition {
14183    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14184    where
14185        S: serde::Serializer,
14186    {
14187        match self {
14188            Self::Unknown => serializer.serialize_i32(0),
14189            Self::Legacy => serializer.serialize_i32(900),
14190            Self::Proto2 => serializer.serialize_i32(998),
14191            Self::Proto3 => serializer.serialize_i32(999),
14192            Self::Edition2023 => serializer.serialize_i32(1000),
14193            Self::Edition2024 => serializer.serialize_i32(1001),
14194            Self::Edition1TestOnly => serializer.serialize_i32(1),
14195            Self::Edition2TestOnly => serializer.serialize_i32(2),
14196            Self::Edition99997TestOnly => serializer.serialize_i32(99997),
14197            Self::Edition99998TestOnly => serializer.serialize_i32(99998),
14198            Self::Edition99999TestOnly => serializer.serialize_i32(99999),
14199            Self::Max => serializer.serialize_i32(2147483647),
14200            Self::UnknownValue(u) => u.0.serialize(serializer),
14201        }
14202    }
14203}
14204
14205impl<'de> serde::de::Deserialize<'de> for Edition {
14206    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14207    where
14208        D: serde::Deserializer<'de>,
14209    {
14210        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Edition>::new(
14211            ".google.protobuf.Edition",
14212        ))
14213    }
14214}
14215
14216/// The syntax in which a protocol buffer element is defined.
14217///
14218/// # Working with unknown values
14219///
14220/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14221/// additional enum variants at any time. Adding new variants is not considered
14222/// a breaking change. Applications should write their code in anticipation of:
14223///
14224/// - New values appearing in future releases of the client library, **and**
14225/// - New values received dynamically, without application changes.
14226///
14227/// Please consult the [Working with enums] section in the user guide for some
14228/// guidelines.
14229///
14230/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14231#[derive(Clone, Debug, PartialEq)]
14232#[non_exhaustive]
14233pub enum Syntax {
14234    /// Syntax `proto2`.
14235    Proto2,
14236    /// Syntax `proto3`.
14237    Proto3,
14238    /// Syntax `editions`.
14239    Editions,
14240    /// If set, the enum was initialized with an unknown value.
14241    ///
14242    /// Applications can examine the value using [Syntax::value] or
14243    /// [Syntax::name].
14244    UnknownValue(syntax::UnknownValue),
14245}
14246
14247#[doc(hidden)]
14248pub mod syntax {
14249    #[allow(unused_imports)]
14250    use super::*;
14251    #[derive(Clone, Debug, PartialEq)]
14252    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14253}
14254
14255impl Syntax {
14256    /// Gets the enum value.
14257    ///
14258    /// Returns `None` if the enum contains an unknown value deserialized from
14259    /// the string representation of enums.
14260    pub fn value(&self) -> std::option::Option<i32> {
14261        match self {
14262            Self::Proto2 => std::option::Option::Some(0),
14263            Self::Proto3 => std::option::Option::Some(1),
14264            Self::Editions => std::option::Option::Some(2),
14265            Self::UnknownValue(u) => u.0.value(),
14266        }
14267    }
14268
14269    /// Gets the enum value as a string.
14270    ///
14271    /// Returns `None` if the enum contains an unknown value deserialized from
14272    /// the integer representation of enums.
14273    pub fn name(&self) -> std::option::Option<&str> {
14274        match self {
14275            Self::Proto2 => std::option::Option::Some("SYNTAX_PROTO2"),
14276            Self::Proto3 => std::option::Option::Some("SYNTAX_PROTO3"),
14277            Self::Editions => std::option::Option::Some("SYNTAX_EDITIONS"),
14278            Self::UnknownValue(u) => u.0.name(),
14279        }
14280    }
14281}
14282
14283impl std::default::Default for Syntax {
14284    fn default() -> Self {
14285        use std::convert::From;
14286        Self::from(0)
14287    }
14288}
14289
14290impl std::fmt::Display for Syntax {
14291    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14292        wkt::internal::display_enum(f, self.name(), self.value())
14293    }
14294}
14295
14296impl std::convert::From<i32> for Syntax {
14297    fn from(value: i32) -> Self {
14298        match value {
14299            0 => Self::Proto2,
14300            1 => Self::Proto3,
14301            2 => Self::Editions,
14302            _ => Self::UnknownValue(syntax::UnknownValue(
14303                wkt::internal::UnknownEnumValue::Integer(value),
14304            )),
14305        }
14306    }
14307}
14308
14309impl std::convert::From<&str> for Syntax {
14310    fn from(value: &str) -> Self {
14311        use std::string::ToString;
14312        match value {
14313            "SYNTAX_PROTO2" => Self::Proto2,
14314            "SYNTAX_PROTO3" => Self::Proto3,
14315            "SYNTAX_EDITIONS" => Self::Editions,
14316            _ => Self::UnknownValue(syntax::UnknownValue(
14317                wkt::internal::UnknownEnumValue::String(value.to_string()),
14318            )),
14319        }
14320    }
14321}
14322
14323impl serde::ser::Serialize for Syntax {
14324    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14325    where
14326        S: serde::Serializer,
14327    {
14328        match self {
14329            Self::Proto2 => serializer.serialize_i32(0),
14330            Self::Proto3 => serializer.serialize_i32(1),
14331            Self::Editions => serializer.serialize_i32(2),
14332            Self::UnknownValue(u) => u.0.serialize(serializer),
14333        }
14334    }
14335}
14336
14337impl<'de> serde::de::Deserialize<'de> for Syntax {
14338    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14339    where
14340        D: serde::Deserializer<'de>,
14341    {
14342        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Syntax>::new(
14343            ".google.protobuf.Syntax",
14344        ))
14345    }
14346}