1#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19use crate as wkt;
20
21#[derive(Clone, Default, PartialEq)]
31#[non_exhaustive]
32pub struct Api {
33 pub name: std::string::String,
36
37 pub methods: std::vec::Vec<crate::Method>,
39
40 pub options: std::vec::Vec<crate::Option>,
42
43 pub version: std::string::String,
63
64 pub source_context: std::option::Option<crate::SourceContext>,
67
68 pub mixins: std::vec::Vec<crate::Mixin>,
72
73 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 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 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 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 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 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 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 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 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
352impl std::fmt::Debug for Api {
353 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
354 let mut debug_struct = f.debug_struct("Api");
355 debug_struct.field("name", &self.name);
356 debug_struct.field("methods", &self.methods);
357 debug_struct.field("options", &self.options);
358 debug_struct.field("version", &self.version);
359 debug_struct.field("source_context", &self.source_context);
360 debug_struct.field("mixins", &self.mixins);
361 debug_struct.field("syntax", &self.syntax);
362 if !self._unknown_fields.is_empty() {
363 debug_struct.field("_unknown_fields", &self._unknown_fields);
364 }
365 debug_struct.finish()
366 }
367}
368
369#[derive(Clone, Default, PartialEq)]
371#[non_exhaustive]
372pub struct Method {
373 pub name: std::string::String,
375
376 pub request_type_url: std::string::String,
378
379 pub request_streaming: bool,
381
382 pub response_type_url: std::string::String,
384
385 pub response_streaming: bool,
387
388 pub options: std::vec::Vec<crate::Option>,
390
391 pub syntax: crate::Syntax,
393
394 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
395}
396
397impl Method {
398 pub fn new() -> Self {
399 std::default::Default::default()
400 }
401
402 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
404 self.name = v.into();
405 self
406 }
407
408 pub fn set_request_type_url<T: std::convert::Into<std::string::String>>(
410 mut self,
411 v: T,
412 ) -> Self {
413 self.request_type_url = v.into();
414 self
415 }
416
417 pub fn set_request_streaming<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
419 self.request_streaming = v.into();
420 self
421 }
422
423 pub fn set_response_type_url<T: std::convert::Into<std::string::String>>(
425 mut self,
426 v: T,
427 ) -> Self {
428 self.response_type_url = v.into();
429 self
430 }
431
432 pub fn set_response_streaming<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
434 self.response_streaming = v.into();
435 self
436 }
437
438 pub fn set_options<T, V>(mut self, v: T) -> Self
440 where
441 T: std::iter::IntoIterator<Item = V>,
442 V: std::convert::Into<crate::Option>,
443 {
444 use std::iter::Iterator;
445 self.options = v.into_iter().map(|i| i.into()).collect();
446 self
447 }
448
449 pub fn set_syntax<T: std::convert::Into<crate::Syntax>>(mut self, v: T) -> Self {
451 self.syntax = v.into();
452 self
453 }
454}
455
456impl wkt::message::Message for Method {
457 fn typename() -> &'static str {
458 "type.googleapis.com/google.protobuf.Method"
459 }
460}
461
462#[doc(hidden)]
463impl<'de> serde::de::Deserialize<'de> for Method {
464 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
465 where
466 D: serde::Deserializer<'de>,
467 {
468 #[allow(non_camel_case_types)]
469 #[doc(hidden)]
470 #[derive(PartialEq, Eq, Hash)]
471 enum __FieldTag {
472 __name,
473 __request_type_url,
474 __request_streaming,
475 __response_type_url,
476 __response_streaming,
477 __options,
478 __syntax,
479 Unknown(std::string::String),
480 }
481 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
482 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
483 where
484 D: serde::Deserializer<'de>,
485 {
486 struct Visitor;
487 impl<'de> serde::de::Visitor<'de> for Visitor {
488 type Value = __FieldTag;
489 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
490 formatter.write_str("a field name for Method")
491 }
492 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
493 where
494 E: serde::de::Error,
495 {
496 use std::result::Result::Ok;
497 use std::string::ToString;
498 match value {
499 "name" => Ok(__FieldTag::__name),
500 "requestTypeUrl" => Ok(__FieldTag::__request_type_url),
501 "request_type_url" => Ok(__FieldTag::__request_type_url),
502 "requestStreaming" => Ok(__FieldTag::__request_streaming),
503 "request_streaming" => Ok(__FieldTag::__request_streaming),
504 "responseTypeUrl" => Ok(__FieldTag::__response_type_url),
505 "response_type_url" => Ok(__FieldTag::__response_type_url),
506 "responseStreaming" => Ok(__FieldTag::__response_streaming),
507 "response_streaming" => Ok(__FieldTag::__response_streaming),
508 "options" => Ok(__FieldTag::__options),
509 "syntax" => Ok(__FieldTag::__syntax),
510 _ => Ok(__FieldTag::Unknown(value.to_string())),
511 }
512 }
513 }
514 deserializer.deserialize_identifier(Visitor)
515 }
516 }
517 struct Visitor;
518 impl<'de> serde::de::Visitor<'de> for Visitor {
519 type Value = Method;
520 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
521 formatter.write_str("struct Method")
522 }
523 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
524 where
525 A: serde::de::MapAccess<'de>,
526 {
527 #[allow(unused_imports)]
528 use serde::de::Error;
529 use std::option::Option::Some;
530 let mut fields = std::collections::HashSet::new();
531 let mut result = Self::Value::new();
532 while let Some(tag) = map.next_key::<__FieldTag>()? {
533 #[allow(clippy::match_single_binding)]
534 match tag {
535 __FieldTag::__name => {
536 if !fields.insert(__FieldTag::__name) {
537 return std::result::Result::Err(A::Error::duplicate_field(
538 "multiple values for name",
539 ));
540 }
541 result.name = map
542 .next_value::<std::option::Option<std::string::String>>()?
543 .unwrap_or_default();
544 }
545 __FieldTag::__request_type_url => {
546 if !fields.insert(__FieldTag::__request_type_url) {
547 return std::result::Result::Err(A::Error::duplicate_field(
548 "multiple values for request_type_url",
549 ));
550 }
551 result.request_type_url = map
552 .next_value::<std::option::Option<std::string::String>>()?
553 .unwrap_or_default();
554 }
555 __FieldTag::__request_streaming => {
556 if !fields.insert(__FieldTag::__request_streaming) {
557 return std::result::Result::Err(A::Error::duplicate_field(
558 "multiple values for request_streaming",
559 ));
560 }
561 result.request_streaming = map
562 .next_value::<std::option::Option<bool>>()?
563 .unwrap_or_default();
564 }
565 __FieldTag::__response_type_url => {
566 if !fields.insert(__FieldTag::__response_type_url) {
567 return std::result::Result::Err(A::Error::duplicate_field(
568 "multiple values for response_type_url",
569 ));
570 }
571 result.response_type_url = map
572 .next_value::<std::option::Option<std::string::String>>()?
573 .unwrap_or_default();
574 }
575 __FieldTag::__response_streaming => {
576 if !fields.insert(__FieldTag::__response_streaming) {
577 return std::result::Result::Err(A::Error::duplicate_field(
578 "multiple values for response_streaming",
579 ));
580 }
581 result.response_streaming = map
582 .next_value::<std::option::Option<bool>>()?
583 .unwrap_or_default();
584 }
585 __FieldTag::__options => {
586 if !fields.insert(__FieldTag::__options) {
587 return std::result::Result::Err(A::Error::duplicate_field(
588 "multiple values for options",
589 ));
590 }
591 result.options = map
592 .next_value::<std::option::Option<std::vec::Vec<crate::Option>>>()?
593 .unwrap_or_default();
594 }
595 __FieldTag::__syntax => {
596 if !fields.insert(__FieldTag::__syntax) {
597 return std::result::Result::Err(A::Error::duplicate_field(
598 "multiple values for syntax",
599 ));
600 }
601 result.syntax = map
602 .next_value::<std::option::Option<crate::Syntax>>()?
603 .unwrap_or_default();
604 }
605 __FieldTag::Unknown(key) => {
606 let value = map.next_value::<serde_json::Value>()?;
607 result._unknown_fields.insert(key, value);
608 }
609 }
610 }
611 std::result::Result::Ok(result)
612 }
613 }
614 deserializer.deserialize_any(Visitor)
615 }
616}
617
618#[doc(hidden)]
619impl serde::ser::Serialize for Method {
620 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
621 where
622 S: serde::ser::Serializer,
623 {
624 use serde::ser::SerializeMap;
625 #[allow(unused_imports)]
626 use std::option::Option::Some;
627 let mut state = serializer.serialize_map(std::option::Option::None)?;
628 if !self.name.is_empty() {
629 state.serialize_entry("name", &self.name)?;
630 }
631 if !self.request_type_url.is_empty() {
632 state.serialize_entry("requestTypeUrl", &self.request_type_url)?;
633 }
634 if !wkt::internal::is_default(&self.request_streaming) {
635 state.serialize_entry("requestStreaming", &self.request_streaming)?;
636 }
637 if !self.response_type_url.is_empty() {
638 state.serialize_entry("responseTypeUrl", &self.response_type_url)?;
639 }
640 if !wkt::internal::is_default(&self.response_streaming) {
641 state.serialize_entry("responseStreaming", &self.response_streaming)?;
642 }
643 if !self.options.is_empty() {
644 state.serialize_entry("options", &self.options)?;
645 }
646 if !wkt::internal::is_default(&self.syntax) {
647 state.serialize_entry("syntax", &self.syntax)?;
648 }
649 if !self._unknown_fields.is_empty() {
650 for (key, value) in self._unknown_fields.iter() {
651 state.serialize_entry(key, &value)?;
652 }
653 }
654 state.end()
655 }
656}
657
658impl std::fmt::Debug for Method {
659 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
660 let mut debug_struct = f.debug_struct("Method");
661 debug_struct.field("name", &self.name);
662 debug_struct.field("request_type_url", &self.request_type_url);
663 debug_struct.field("request_streaming", &self.request_streaming);
664 debug_struct.field("response_type_url", &self.response_type_url);
665 debug_struct.field("response_streaming", &self.response_streaming);
666 debug_struct.field("options", &self.options);
667 debug_struct.field("syntax", &self.syntax);
668 if !self._unknown_fields.is_empty() {
669 debug_struct.field("_unknown_fields", &self._unknown_fields);
670 }
671 debug_struct.finish()
672 }
673}
674
675#[derive(Clone, Default, PartialEq)]
767#[non_exhaustive]
768pub struct Mixin {
769 pub name: std::string::String,
771
772 pub root: std::string::String,
775
776 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
777}
778
779impl Mixin {
780 pub fn new() -> Self {
781 std::default::Default::default()
782 }
783
784 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
786 self.name = v.into();
787 self
788 }
789
790 pub fn set_root<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
792 self.root = v.into();
793 self
794 }
795}
796
797impl wkt::message::Message for Mixin {
798 fn typename() -> &'static str {
799 "type.googleapis.com/google.protobuf.Mixin"
800 }
801}
802
803#[doc(hidden)]
804impl<'de> serde::de::Deserialize<'de> for Mixin {
805 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
806 where
807 D: serde::Deserializer<'de>,
808 {
809 #[allow(non_camel_case_types)]
810 #[doc(hidden)]
811 #[derive(PartialEq, Eq, Hash)]
812 enum __FieldTag {
813 __name,
814 __root,
815 Unknown(std::string::String),
816 }
817 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
818 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
819 where
820 D: serde::Deserializer<'de>,
821 {
822 struct Visitor;
823 impl<'de> serde::de::Visitor<'de> for Visitor {
824 type Value = __FieldTag;
825 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
826 formatter.write_str("a field name for Mixin")
827 }
828 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
829 where
830 E: serde::de::Error,
831 {
832 use std::result::Result::Ok;
833 use std::string::ToString;
834 match value {
835 "name" => Ok(__FieldTag::__name),
836 "root" => Ok(__FieldTag::__root),
837 _ => Ok(__FieldTag::Unknown(value.to_string())),
838 }
839 }
840 }
841 deserializer.deserialize_identifier(Visitor)
842 }
843 }
844 struct Visitor;
845 impl<'de> serde::de::Visitor<'de> for Visitor {
846 type Value = Mixin;
847 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
848 formatter.write_str("struct Mixin")
849 }
850 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
851 where
852 A: serde::de::MapAccess<'de>,
853 {
854 #[allow(unused_imports)]
855 use serde::de::Error;
856 use std::option::Option::Some;
857 let mut fields = std::collections::HashSet::new();
858 let mut result = Self::Value::new();
859 while let Some(tag) = map.next_key::<__FieldTag>()? {
860 #[allow(clippy::match_single_binding)]
861 match tag {
862 __FieldTag::__name => {
863 if !fields.insert(__FieldTag::__name) {
864 return std::result::Result::Err(A::Error::duplicate_field(
865 "multiple values for name",
866 ));
867 }
868 result.name = map
869 .next_value::<std::option::Option<std::string::String>>()?
870 .unwrap_or_default();
871 }
872 __FieldTag::__root => {
873 if !fields.insert(__FieldTag::__root) {
874 return std::result::Result::Err(A::Error::duplicate_field(
875 "multiple values for root",
876 ));
877 }
878 result.root = map
879 .next_value::<std::option::Option<std::string::String>>()?
880 .unwrap_or_default();
881 }
882 __FieldTag::Unknown(key) => {
883 let value = map.next_value::<serde_json::Value>()?;
884 result._unknown_fields.insert(key, value);
885 }
886 }
887 }
888 std::result::Result::Ok(result)
889 }
890 }
891 deserializer.deserialize_any(Visitor)
892 }
893}
894
895#[doc(hidden)]
896impl serde::ser::Serialize for Mixin {
897 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
898 where
899 S: serde::ser::Serializer,
900 {
901 use serde::ser::SerializeMap;
902 #[allow(unused_imports)]
903 use std::option::Option::Some;
904 let mut state = serializer.serialize_map(std::option::Option::None)?;
905 if !self.name.is_empty() {
906 state.serialize_entry("name", &self.name)?;
907 }
908 if !self.root.is_empty() {
909 state.serialize_entry("root", &self.root)?;
910 }
911 if !self._unknown_fields.is_empty() {
912 for (key, value) in self._unknown_fields.iter() {
913 state.serialize_entry(key, &value)?;
914 }
915 }
916 state.end()
917 }
918}
919
920impl std::fmt::Debug for Mixin {
921 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
922 let mut debug_struct = f.debug_struct("Mixin");
923 debug_struct.field("name", &self.name);
924 debug_struct.field("root", &self.root);
925 if !self._unknown_fields.is_empty() {
926 debug_struct.field("_unknown_fields", &self._unknown_fields);
927 }
928 debug_struct.finish()
929 }
930}
931
932#[derive(Clone, Default, PartialEq)]
935#[non_exhaustive]
936pub struct FileDescriptorSet {
937 pub file: std::vec::Vec<crate::FileDescriptorProto>,
938
939 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
940}
941
942impl FileDescriptorSet {
943 pub fn new() -> Self {
944 std::default::Default::default()
945 }
946
947 pub fn set_file<T, V>(mut self, v: T) -> Self
949 where
950 T: std::iter::IntoIterator<Item = V>,
951 V: std::convert::Into<crate::FileDescriptorProto>,
952 {
953 use std::iter::Iterator;
954 self.file = v.into_iter().map(|i| i.into()).collect();
955 self
956 }
957}
958
959impl wkt::message::Message for FileDescriptorSet {
960 fn typename() -> &'static str {
961 "type.googleapis.com/google.protobuf.FileDescriptorSet"
962 }
963}
964
965#[doc(hidden)]
966impl<'de> serde::de::Deserialize<'de> for FileDescriptorSet {
967 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
968 where
969 D: serde::Deserializer<'de>,
970 {
971 #[allow(non_camel_case_types)]
972 #[doc(hidden)]
973 #[derive(PartialEq, Eq, Hash)]
974 enum __FieldTag {
975 __file,
976 Unknown(std::string::String),
977 }
978 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
979 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
980 where
981 D: serde::Deserializer<'de>,
982 {
983 struct Visitor;
984 impl<'de> serde::de::Visitor<'de> for Visitor {
985 type Value = __FieldTag;
986 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
987 formatter.write_str("a field name for FileDescriptorSet")
988 }
989 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
990 where
991 E: serde::de::Error,
992 {
993 use std::result::Result::Ok;
994 use std::string::ToString;
995 match value {
996 "file" => Ok(__FieldTag::__file),
997 _ => Ok(__FieldTag::Unknown(value.to_string())),
998 }
999 }
1000 }
1001 deserializer.deserialize_identifier(Visitor)
1002 }
1003 }
1004 struct Visitor;
1005 impl<'de> serde::de::Visitor<'de> for Visitor {
1006 type Value = FileDescriptorSet;
1007 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1008 formatter.write_str("struct FileDescriptorSet")
1009 }
1010 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1011 where
1012 A: serde::de::MapAccess<'de>,
1013 {
1014 #[allow(unused_imports)]
1015 use serde::de::Error;
1016 use std::option::Option::Some;
1017 let mut fields = std::collections::HashSet::new();
1018 let mut result = Self::Value::new();
1019 while let Some(tag) = map.next_key::<__FieldTag>()? {
1020 #[allow(clippy::match_single_binding)]
1021 match tag {
1022 __FieldTag::__file => {
1023 if !fields.insert(__FieldTag::__file) {
1024 return std::result::Result::Err(A::Error::duplicate_field(
1025 "multiple values for file",
1026 ));
1027 }
1028 result.file = map.next_value::<std::option::Option<std::vec::Vec<crate::FileDescriptorProto>>>()?.unwrap_or_default();
1029 }
1030 __FieldTag::Unknown(key) => {
1031 let value = map.next_value::<serde_json::Value>()?;
1032 result._unknown_fields.insert(key, value);
1033 }
1034 }
1035 }
1036 std::result::Result::Ok(result)
1037 }
1038 }
1039 deserializer.deserialize_any(Visitor)
1040 }
1041}
1042
1043#[doc(hidden)]
1044impl serde::ser::Serialize for FileDescriptorSet {
1045 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1046 where
1047 S: serde::ser::Serializer,
1048 {
1049 use serde::ser::SerializeMap;
1050 #[allow(unused_imports)]
1051 use std::option::Option::Some;
1052 let mut state = serializer.serialize_map(std::option::Option::None)?;
1053 if !self.file.is_empty() {
1054 state.serialize_entry("file", &self.file)?;
1055 }
1056 if !self._unknown_fields.is_empty() {
1057 for (key, value) in self._unknown_fields.iter() {
1058 state.serialize_entry(key, &value)?;
1059 }
1060 }
1061 state.end()
1062 }
1063}
1064
1065impl std::fmt::Debug for FileDescriptorSet {
1066 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1067 let mut debug_struct = f.debug_struct("FileDescriptorSet");
1068 debug_struct.field("file", &self.file);
1069 if !self._unknown_fields.is_empty() {
1070 debug_struct.field("_unknown_fields", &self._unknown_fields);
1071 }
1072 debug_struct.finish()
1073 }
1074}
1075
1076#[derive(Clone, Default, PartialEq)]
1078#[non_exhaustive]
1079pub struct FileDescriptorProto {
1080 pub name: std::string::String,
1081
1082 pub package: std::string::String,
1083
1084 pub dependency: std::vec::Vec<std::string::String>,
1086
1087 pub public_dependency: std::vec::Vec<i32>,
1089
1090 pub weak_dependency: std::vec::Vec<i32>,
1093
1094 pub message_type: std::vec::Vec<crate::DescriptorProto>,
1096
1097 pub enum_type: std::vec::Vec<crate::EnumDescriptorProto>,
1098
1099 pub service: std::vec::Vec<crate::ServiceDescriptorProto>,
1100
1101 pub extension: std::vec::Vec<crate::FieldDescriptorProto>,
1102
1103 pub options: std::option::Option<crate::FileOptions>,
1104
1105 pub source_code_info: std::option::Option<crate::SourceCodeInfo>,
1110
1111 pub syntax: std::string::String,
1116
1117 pub edition: crate::Edition,
1119
1120 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1121}
1122
1123impl FileDescriptorProto {
1124 pub fn new() -> Self {
1125 std::default::Default::default()
1126 }
1127
1128 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1130 self.name = v.into();
1131 self
1132 }
1133
1134 pub fn set_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1136 self.package = v.into();
1137 self
1138 }
1139
1140 pub fn set_dependency<T, V>(mut self, v: T) -> Self
1142 where
1143 T: std::iter::IntoIterator<Item = V>,
1144 V: std::convert::Into<std::string::String>,
1145 {
1146 use std::iter::Iterator;
1147 self.dependency = v.into_iter().map(|i| i.into()).collect();
1148 self
1149 }
1150
1151 pub fn set_public_dependency<T, V>(mut self, v: T) -> Self
1153 where
1154 T: std::iter::IntoIterator<Item = V>,
1155 V: std::convert::Into<i32>,
1156 {
1157 use std::iter::Iterator;
1158 self.public_dependency = v.into_iter().map(|i| i.into()).collect();
1159 self
1160 }
1161
1162 pub fn set_weak_dependency<T, V>(mut self, v: T) -> Self
1164 where
1165 T: std::iter::IntoIterator<Item = V>,
1166 V: std::convert::Into<i32>,
1167 {
1168 use std::iter::Iterator;
1169 self.weak_dependency = v.into_iter().map(|i| i.into()).collect();
1170 self
1171 }
1172
1173 pub fn set_message_type<T, V>(mut self, v: T) -> Self
1175 where
1176 T: std::iter::IntoIterator<Item = V>,
1177 V: std::convert::Into<crate::DescriptorProto>,
1178 {
1179 use std::iter::Iterator;
1180 self.message_type = v.into_iter().map(|i| i.into()).collect();
1181 self
1182 }
1183
1184 pub fn set_enum_type<T, V>(mut self, v: T) -> Self
1186 where
1187 T: std::iter::IntoIterator<Item = V>,
1188 V: std::convert::Into<crate::EnumDescriptorProto>,
1189 {
1190 use std::iter::Iterator;
1191 self.enum_type = v.into_iter().map(|i| i.into()).collect();
1192 self
1193 }
1194
1195 pub fn set_service<T, V>(mut self, v: T) -> Self
1197 where
1198 T: std::iter::IntoIterator<Item = V>,
1199 V: std::convert::Into<crate::ServiceDescriptorProto>,
1200 {
1201 use std::iter::Iterator;
1202 self.service = v.into_iter().map(|i| i.into()).collect();
1203 self
1204 }
1205
1206 pub fn set_extension<T, V>(mut self, v: T) -> Self
1208 where
1209 T: std::iter::IntoIterator<Item = V>,
1210 V: std::convert::Into<crate::FieldDescriptorProto>,
1211 {
1212 use std::iter::Iterator;
1213 self.extension = v.into_iter().map(|i| i.into()).collect();
1214 self
1215 }
1216
1217 pub fn set_options<T>(mut self, v: T) -> Self
1219 where
1220 T: std::convert::Into<crate::FileOptions>,
1221 {
1222 self.options = std::option::Option::Some(v.into());
1223 self
1224 }
1225
1226 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1228 where
1229 T: std::convert::Into<crate::FileOptions>,
1230 {
1231 self.options = v.map(|x| x.into());
1232 self
1233 }
1234
1235 pub fn set_source_code_info<T>(mut self, v: T) -> Self
1237 where
1238 T: std::convert::Into<crate::SourceCodeInfo>,
1239 {
1240 self.source_code_info = std::option::Option::Some(v.into());
1241 self
1242 }
1243
1244 pub fn set_or_clear_source_code_info<T>(mut self, v: std::option::Option<T>) -> Self
1246 where
1247 T: std::convert::Into<crate::SourceCodeInfo>,
1248 {
1249 self.source_code_info = v.map(|x| x.into());
1250 self
1251 }
1252
1253 pub fn set_syntax<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1255 self.syntax = v.into();
1256 self
1257 }
1258
1259 pub fn set_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
1261 self.edition = v.into();
1262 self
1263 }
1264}
1265
1266impl wkt::message::Message for FileDescriptorProto {
1267 fn typename() -> &'static str {
1268 "type.googleapis.com/google.protobuf.FileDescriptorProto"
1269 }
1270}
1271
1272#[doc(hidden)]
1273impl<'de> serde::de::Deserialize<'de> for FileDescriptorProto {
1274 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1275 where
1276 D: serde::Deserializer<'de>,
1277 {
1278 #[allow(non_camel_case_types)]
1279 #[doc(hidden)]
1280 #[derive(PartialEq, Eq, Hash)]
1281 enum __FieldTag {
1282 __name,
1283 __package,
1284 __dependency,
1285 __public_dependency,
1286 __weak_dependency,
1287 __message_type,
1288 __enum_type,
1289 __service,
1290 __extension,
1291 __options,
1292 __source_code_info,
1293 __syntax,
1294 __edition,
1295 Unknown(std::string::String),
1296 }
1297 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1298 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1299 where
1300 D: serde::Deserializer<'de>,
1301 {
1302 struct Visitor;
1303 impl<'de> serde::de::Visitor<'de> for Visitor {
1304 type Value = __FieldTag;
1305 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1306 formatter.write_str("a field name for FileDescriptorProto")
1307 }
1308 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1309 where
1310 E: serde::de::Error,
1311 {
1312 use std::result::Result::Ok;
1313 use std::string::ToString;
1314 match value {
1315 "name" => Ok(__FieldTag::__name),
1316 "package" => Ok(__FieldTag::__package),
1317 "dependency" => Ok(__FieldTag::__dependency),
1318 "publicDependency" => Ok(__FieldTag::__public_dependency),
1319 "public_dependency" => Ok(__FieldTag::__public_dependency),
1320 "weakDependency" => Ok(__FieldTag::__weak_dependency),
1321 "weak_dependency" => Ok(__FieldTag::__weak_dependency),
1322 "messageType" => Ok(__FieldTag::__message_type),
1323 "message_type" => Ok(__FieldTag::__message_type),
1324 "enumType" => Ok(__FieldTag::__enum_type),
1325 "enum_type" => Ok(__FieldTag::__enum_type),
1326 "service" => Ok(__FieldTag::__service),
1327 "extension" => Ok(__FieldTag::__extension),
1328 "options" => Ok(__FieldTag::__options),
1329 "sourceCodeInfo" => Ok(__FieldTag::__source_code_info),
1330 "source_code_info" => Ok(__FieldTag::__source_code_info),
1331 "syntax" => Ok(__FieldTag::__syntax),
1332 "edition" => Ok(__FieldTag::__edition),
1333 _ => Ok(__FieldTag::Unknown(value.to_string())),
1334 }
1335 }
1336 }
1337 deserializer.deserialize_identifier(Visitor)
1338 }
1339 }
1340 struct Visitor;
1341 impl<'de> serde::de::Visitor<'de> for Visitor {
1342 type Value = FileDescriptorProto;
1343 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1344 formatter.write_str("struct FileDescriptorProto")
1345 }
1346 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1347 where
1348 A: serde::de::MapAccess<'de>,
1349 {
1350 #[allow(unused_imports)]
1351 use serde::de::Error;
1352 use std::option::Option::Some;
1353 let mut fields = std::collections::HashSet::new();
1354 let mut result = Self::Value::new();
1355 while let Some(tag) = map.next_key::<__FieldTag>()? {
1356 #[allow(clippy::match_single_binding)]
1357 match tag {
1358 __FieldTag::__name => {
1359 if !fields.insert(__FieldTag::__name) {
1360 return std::result::Result::Err(A::Error::duplicate_field(
1361 "multiple values for name",
1362 ));
1363 }
1364 result.name = map
1365 .next_value::<std::option::Option<std::string::String>>()?
1366 .unwrap_or_default();
1367 }
1368 __FieldTag::__package => {
1369 if !fields.insert(__FieldTag::__package) {
1370 return std::result::Result::Err(A::Error::duplicate_field(
1371 "multiple values for package",
1372 ));
1373 }
1374 result.package = map
1375 .next_value::<std::option::Option<std::string::String>>()?
1376 .unwrap_or_default();
1377 }
1378 __FieldTag::__dependency => {
1379 if !fields.insert(__FieldTag::__dependency) {
1380 return std::result::Result::Err(A::Error::duplicate_field(
1381 "multiple values for dependency",
1382 ));
1383 }
1384 result.dependency = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
1385 }
1386 __FieldTag::__public_dependency => {
1387 if !fields.insert(__FieldTag::__public_dependency) {
1388 return std::result::Result::Err(A::Error::duplicate_field(
1389 "multiple values for public_dependency",
1390 ));
1391 }
1392 struct __With(std::option::Option<std::vec::Vec<i32>>);
1393 impl<'de> serde::de::Deserialize<'de> for __With {
1394 fn deserialize<D>(
1395 deserializer: D,
1396 ) -> std::result::Result<Self, D::Error>
1397 where
1398 D: serde::de::Deserializer<'de>,
1399 {
1400 serde_with::As::<
1401 std::option::Option<std::vec::Vec<wkt::internal::I32>>,
1402 >::deserialize(deserializer)
1403 .map(__With)
1404 }
1405 }
1406 result.public_dependency =
1407 map.next_value::<__With>()?.0.unwrap_or_default();
1408 }
1409 __FieldTag::__weak_dependency => {
1410 if !fields.insert(__FieldTag::__weak_dependency) {
1411 return std::result::Result::Err(A::Error::duplicate_field(
1412 "multiple values for weak_dependency",
1413 ));
1414 }
1415 struct __With(std::option::Option<std::vec::Vec<i32>>);
1416 impl<'de> serde::de::Deserialize<'de> for __With {
1417 fn deserialize<D>(
1418 deserializer: D,
1419 ) -> std::result::Result<Self, D::Error>
1420 where
1421 D: serde::de::Deserializer<'de>,
1422 {
1423 serde_with::As::<
1424 std::option::Option<std::vec::Vec<wkt::internal::I32>>,
1425 >::deserialize(deserializer)
1426 .map(__With)
1427 }
1428 }
1429 result.weak_dependency =
1430 map.next_value::<__With>()?.0.unwrap_or_default();
1431 }
1432 __FieldTag::__message_type => {
1433 if !fields.insert(__FieldTag::__message_type) {
1434 return std::result::Result::Err(A::Error::duplicate_field(
1435 "multiple values for message_type",
1436 ));
1437 }
1438 result.message_type = map.next_value::<std::option::Option<std::vec::Vec<crate::DescriptorProto>>>()?.unwrap_or_default();
1439 }
1440 __FieldTag::__enum_type => {
1441 if !fields.insert(__FieldTag::__enum_type) {
1442 return std::result::Result::Err(A::Error::duplicate_field(
1443 "multiple values for enum_type",
1444 ));
1445 }
1446 result.enum_type = map.next_value::<std::option::Option<std::vec::Vec<crate::EnumDescriptorProto>>>()?.unwrap_or_default();
1447 }
1448 __FieldTag::__service => {
1449 if !fields.insert(__FieldTag::__service) {
1450 return std::result::Result::Err(A::Error::duplicate_field(
1451 "multiple values for service",
1452 ));
1453 }
1454 result.service =
1455 map.next_value::<std::option::Option<
1456 std::vec::Vec<crate::ServiceDescriptorProto>,
1457 >>()?
1458 .unwrap_or_default();
1459 }
1460 __FieldTag::__extension => {
1461 if !fields.insert(__FieldTag::__extension) {
1462 return std::result::Result::Err(A::Error::duplicate_field(
1463 "multiple values for extension",
1464 ));
1465 }
1466 result.extension = map.next_value::<std::option::Option<std::vec::Vec<crate::FieldDescriptorProto>>>()?.unwrap_or_default();
1467 }
1468 __FieldTag::__options => {
1469 if !fields.insert(__FieldTag::__options) {
1470 return std::result::Result::Err(A::Error::duplicate_field(
1471 "multiple values for options",
1472 ));
1473 }
1474 result.options =
1475 map.next_value::<std::option::Option<crate::FileOptions>>()?;
1476 }
1477 __FieldTag::__source_code_info => {
1478 if !fields.insert(__FieldTag::__source_code_info) {
1479 return std::result::Result::Err(A::Error::duplicate_field(
1480 "multiple values for source_code_info",
1481 ));
1482 }
1483 result.source_code_info =
1484 map.next_value::<std::option::Option<crate::SourceCodeInfo>>()?;
1485 }
1486 __FieldTag::__syntax => {
1487 if !fields.insert(__FieldTag::__syntax) {
1488 return std::result::Result::Err(A::Error::duplicate_field(
1489 "multiple values for syntax",
1490 ));
1491 }
1492 result.syntax = map
1493 .next_value::<std::option::Option<std::string::String>>()?
1494 .unwrap_or_default();
1495 }
1496 __FieldTag::__edition => {
1497 if !fields.insert(__FieldTag::__edition) {
1498 return std::result::Result::Err(A::Error::duplicate_field(
1499 "multiple values for edition",
1500 ));
1501 }
1502 result.edition = map
1503 .next_value::<std::option::Option<crate::Edition>>()?
1504 .unwrap_or_default();
1505 }
1506 __FieldTag::Unknown(key) => {
1507 let value = map.next_value::<serde_json::Value>()?;
1508 result._unknown_fields.insert(key, value);
1509 }
1510 }
1511 }
1512 std::result::Result::Ok(result)
1513 }
1514 }
1515 deserializer.deserialize_any(Visitor)
1516 }
1517}
1518
1519#[doc(hidden)]
1520impl serde::ser::Serialize for FileDescriptorProto {
1521 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1522 where
1523 S: serde::ser::Serializer,
1524 {
1525 use serde::ser::SerializeMap;
1526 #[allow(unused_imports)]
1527 use std::option::Option::Some;
1528 let mut state = serializer.serialize_map(std::option::Option::None)?;
1529 if !self.name.is_empty() {
1530 state.serialize_entry("name", &self.name)?;
1531 }
1532 if !self.package.is_empty() {
1533 state.serialize_entry("package", &self.package)?;
1534 }
1535 if !self.dependency.is_empty() {
1536 state.serialize_entry("dependency", &self.dependency)?;
1537 }
1538 if !self.public_dependency.is_empty() {
1539 struct __With<'a>(&'a std::vec::Vec<i32>);
1540 impl<'a> serde::ser::Serialize for __With<'a> {
1541 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1542 where
1543 S: serde::ser::Serializer,
1544 {
1545 serde_with::As::<std::vec::Vec<wkt::internal::I32>>::serialize(
1546 self.0, serializer,
1547 )
1548 }
1549 }
1550 state.serialize_entry("publicDependency", &__With(&self.public_dependency))?;
1551 }
1552 if !self.weak_dependency.is_empty() {
1553 struct __With<'a>(&'a std::vec::Vec<i32>);
1554 impl<'a> serde::ser::Serialize for __With<'a> {
1555 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1556 where
1557 S: serde::ser::Serializer,
1558 {
1559 serde_with::As::<std::vec::Vec<wkt::internal::I32>>::serialize(
1560 self.0, serializer,
1561 )
1562 }
1563 }
1564 state.serialize_entry("weakDependency", &__With(&self.weak_dependency))?;
1565 }
1566 if !self.message_type.is_empty() {
1567 state.serialize_entry("messageType", &self.message_type)?;
1568 }
1569 if !self.enum_type.is_empty() {
1570 state.serialize_entry("enumType", &self.enum_type)?;
1571 }
1572 if !self.service.is_empty() {
1573 state.serialize_entry("service", &self.service)?;
1574 }
1575 if !self.extension.is_empty() {
1576 state.serialize_entry("extension", &self.extension)?;
1577 }
1578 if self.options.is_some() {
1579 state.serialize_entry("options", &self.options)?;
1580 }
1581 if self.source_code_info.is_some() {
1582 state.serialize_entry("sourceCodeInfo", &self.source_code_info)?;
1583 }
1584 if !self.syntax.is_empty() {
1585 state.serialize_entry("syntax", &self.syntax)?;
1586 }
1587 if !wkt::internal::is_default(&self.edition) {
1588 state.serialize_entry("edition", &self.edition)?;
1589 }
1590 if !self._unknown_fields.is_empty() {
1591 for (key, value) in self._unknown_fields.iter() {
1592 state.serialize_entry(key, &value)?;
1593 }
1594 }
1595 state.end()
1596 }
1597}
1598
1599impl std::fmt::Debug for FileDescriptorProto {
1600 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1601 let mut debug_struct = f.debug_struct("FileDescriptorProto");
1602 debug_struct.field("name", &self.name);
1603 debug_struct.field("package", &self.package);
1604 debug_struct.field("dependency", &self.dependency);
1605 debug_struct.field("public_dependency", &self.public_dependency);
1606 debug_struct.field("weak_dependency", &self.weak_dependency);
1607 debug_struct.field("message_type", &self.message_type);
1608 debug_struct.field("enum_type", &self.enum_type);
1609 debug_struct.field("service", &self.service);
1610 debug_struct.field("extension", &self.extension);
1611 debug_struct.field("options", &self.options);
1612 debug_struct.field("source_code_info", &self.source_code_info);
1613 debug_struct.field("syntax", &self.syntax);
1614 debug_struct.field("edition", &self.edition);
1615 if !self._unknown_fields.is_empty() {
1616 debug_struct.field("_unknown_fields", &self._unknown_fields);
1617 }
1618 debug_struct.finish()
1619 }
1620}
1621
1622#[derive(Clone, Default, PartialEq)]
1624#[non_exhaustive]
1625pub struct DescriptorProto {
1626 pub name: std::string::String,
1627
1628 pub field: std::vec::Vec<crate::FieldDescriptorProto>,
1629
1630 pub extension: std::vec::Vec<crate::FieldDescriptorProto>,
1631
1632 pub nested_type: std::vec::Vec<crate::DescriptorProto>,
1633
1634 pub enum_type: std::vec::Vec<crate::EnumDescriptorProto>,
1635
1636 pub extension_range: std::vec::Vec<crate::descriptor_proto::ExtensionRange>,
1637
1638 pub oneof_decl: std::vec::Vec<crate::OneofDescriptorProto>,
1639
1640 pub options: std::option::Option<crate::MessageOptions>,
1641
1642 pub reserved_range: std::vec::Vec<crate::descriptor_proto::ReservedRange>,
1643
1644 pub reserved_name: std::vec::Vec<std::string::String>,
1647
1648 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1649}
1650
1651impl DescriptorProto {
1652 pub fn new() -> Self {
1653 std::default::Default::default()
1654 }
1655
1656 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1658 self.name = v.into();
1659 self
1660 }
1661
1662 pub fn set_field<T, V>(mut self, v: T) -> Self
1664 where
1665 T: std::iter::IntoIterator<Item = V>,
1666 V: std::convert::Into<crate::FieldDescriptorProto>,
1667 {
1668 use std::iter::Iterator;
1669 self.field = v.into_iter().map(|i| i.into()).collect();
1670 self
1671 }
1672
1673 pub fn set_extension<T, V>(mut self, v: T) -> Self
1675 where
1676 T: std::iter::IntoIterator<Item = V>,
1677 V: std::convert::Into<crate::FieldDescriptorProto>,
1678 {
1679 use std::iter::Iterator;
1680 self.extension = v.into_iter().map(|i| i.into()).collect();
1681 self
1682 }
1683
1684 pub fn set_nested_type<T, V>(mut self, v: T) -> Self
1686 where
1687 T: std::iter::IntoIterator<Item = V>,
1688 V: std::convert::Into<crate::DescriptorProto>,
1689 {
1690 use std::iter::Iterator;
1691 self.nested_type = v.into_iter().map(|i| i.into()).collect();
1692 self
1693 }
1694
1695 pub fn set_enum_type<T, V>(mut self, v: T) -> Self
1697 where
1698 T: std::iter::IntoIterator<Item = V>,
1699 V: std::convert::Into<crate::EnumDescriptorProto>,
1700 {
1701 use std::iter::Iterator;
1702 self.enum_type = v.into_iter().map(|i| i.into()).collect();
1703 self
1704 }
1705
1706 pub fn set_extension_range<T, V>(mut self, v: T) -> Self
1708 where
1709 T: std::iter::IntoIterator<Item = V>,
1710 V: std::convert::Into<crate::descriptor_proto::ExtensionRange>,
1711 {
1712 use std::iter::Iterator;
1713 self.extension_range = v.into_iter().map(|i| i.into()).collect();
1714 self
1715 }
1716
1717 pub fn set_oneof_decl<T, V>(mut self, v: T) -> Self
1719 where
1720 T: std::iter::IntoIterator<Item = V>,
1721 V: std::convert::Into<crate::OneofDescriptorProto>,
1722 {
1723 use std::iter::Iterator;
1724 self.oneof_decl = v.into_iter().map(|i| i.into()).collect();
1725 self
1726 }
1727
1728 pub fn set_options<T>(mut self, v: T) -> Self
1730 where
1731 T: std::convert::Into<crate::MessageOptions>,
1732 {
1733 self.options = std::option::Option::Some(v.into());
1734 self
1735 }
1736
1737 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1739 where
1740 T: std::convert::Into<crate::MessageOptions>,
1741 {
1742 self.options = v.map(|x| x.into());
1743 self
1744 }
1745
1746 pub fn set_reserved_range<T, V>(mut self, v: T) -> Self
1748 where
1749 T: std::iter::IntoIterator<Item = V>,
1750 V: std::convert::Into<crate::descriptor_proto::ReservedRange>,
1751 {
1752 use std::iter::Iterator;
1753 self.reserved_range = v.into_iter().map(|i| i.into()).collect();
1754 self
1755 }
1756
1757 pub fn set_reserved_name<T, V>(mut self, v: T) -> Self
1759 where
1760 T: std::iter::IntoIterator<Item = V>,
1761 V: std::convert::Into<std::string::String>,
1762 {
1763 use std::iter::Iterator;
1764 self.reserved_name = v.into_iter().map(|i| i.into()).collect();
1765 self
1766 }
1767}
1768
1769impl wkt::message::Message for DescriptorProto {
1770 fn typename() -> &'static str {
1771 "type.googleapis.com/google.protobuf.DescriptorProto"
1772 }
1773}
1774
1775#[doc(hidden)]
1776impl<'de> serde::de::Deserialize<'de> for DescriptorProto {
1777 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1778 where
1779 D: serde::Deserializer<'de>,
1780 {
1781 #[allow(non_camel_case_types)]
1782 #[doc(hidden)]
1783 #[derive(PartialEq, Eq, Hash)]
1784 enum __FieldTag {
1785 __name,
1786 __field,
1787 __extension,
1788 __nested_type,
1789 __enum_type,
1790 __extension_range,
1791 __oneof_decl,
1792 __options,
1793 __reserved_range,
1794 __reserved_name,
1795 Unknown(std::string::String),
1796 }
1797 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
1798 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1799 where
1800 D: serde::Deserializer<'de>,
1801 {
1802 struct Visitor;
1803 impl<'de> serde::de::Visitor<'de> for Visitor {
1804 type Value = __FieldTag;
1805 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1806 formatter.write_str("a field name for DescriptorProto")
1807 }
1808 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
1809 where
1810 E: serde::de::Error,
1811 {
1812 use std::result::Result::Ok;
1813 use std::string::ToString;
1814 match value {
1815 "name" => Ok(__FieldTag::__name),
1816 "field" => Ok(__FieldTag::__field),
1817 "extension" => Ok(__FieldTag::__extension),
1818 "nestedType" => Ok(__FieldTag::__nested_type),
1819 "nested_type" => Ok(__FieldTag::__nested_type),
1820 "enumType" => Ok(__FieldTag::__enum_type),
1821 "enum_type" => Ok(__FieldTag::__enum_type),
1822 "extensionRange" => Ok(__FieldTag::__extension_range),
1823 "extension_range" => Ok(__FieldTag::__extension_range),
1824 "oneofDecl" => Ok(__FieldTag::__oneof_decl),
1825 "oneof_decl" => Ok(__FieldTag::__oneof_decl),
1826 "options" => Ok(__FieldTag::__options),
1827 "reservedRange" => Ok(__FieldTag::__reserved_range),
1828 "reserved_range" => Ok(__FieldTag::__reserved_range),
1829 "reservedName" => Ok(__FieldTag::__reserved_name),
1830 "reserved_name" => Ok(__FieldTag::__reserved_name),
1831 _ => Ok(__FieldTag::Unknown(value.to_string())),
1832 }
1833 }
1834 }
1835 deserializer.deserialize_identifier(Visitor)
1836 }
1837 }
1838 struct Visitor;
1839 impl<'de> serde::de::Visitor<'de> for Visitor {
1840 type Value = DescriptorProto;
1841 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
1842 formatter.write_str("struct DescriptorProto")
1843 }
1844 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
1845 where
1846 A: serde::de::MapAccess<'de>,
1847 {
1848 #[allow(unused_imports)]
1849 use serde::de::Error;
1850 use std::option::Option::Some;
1851 let mut fields = std::collections::HashSet::new();
1852 let mut result = Self::Value::new();
1853 while let Some(tag) = map.next_key::<__FieldTag>()? {
1854 #[allow(clippy::match_single_binding)]
1855 match tag {
1856 __FieldTag::__name => {
1857 if !fields.insert(__FieldTag::__name) {
1858 return std::result::Result::Err(A::Error::duplicate_field(
1859 "multiple values for name",
1860 ));
1861 }
1862 result.name = map
1863 .next_value::<std::option::Option<std::string::String>>()?
1864 .unwrap_or_default();
1865 }
1866 __FieldTag::__field => {
1867 if !fields.insert(__FieldTag::__field) {
1868 return std::result::Result::Err(A::Error::duplicate_field(
1869 "multiple values for field",
1870 ));
1871 }
1872 result.field = map.next_value::<std::option::Option<std::vec::Vec<crate::FieldDescriptorProto>>>()?.unwrap_or_default();
1873 }
1874 __FieldTag::__extension => {
1875 if !fields.insert(__FieldTag::__extension) {
1876 return std::result::Result::Err(A::Error::duplicate_field(
1877 "multiple values for extension",
1878 ));
1879 }
1880 result.extension = map.next_value::<std::option::Option<std::vec::Vec<crate::FieldDescriptorProto>>>()?.unwrap_or_default();
1881 }
1882 __FieldTag::__nested_type => {
1883 if !fields.insert(__FieldTag::__nested_type) {
1884 return std::result::Result::Err(A::Error::duplicate_field(
1885 "multiple values for nested_type",
1886 ));
1887 }
1888 result.nested_type = map.next_value::<std::option::Option<std::vec::Vec<crate::DescriptorProto>>>()?.unwrap_or_default();
1889 }
1890 __FieldTag::__enum_type => {
1891 if !fields.insert(__FieldTag::__enum_type) {
1892 return std::result::Result::Err(A::Error::duplicate_field(
1893 "multiple values for enum_type",
1894 ));
1895 }
1896 result.enum_type = map.next_value::<std::option::Option<std::vec::Vec<crate::EnumDescriptorProto>>>()?.unwrap_or_default();
1897 }
1898 __FieldTag::__extension_range => {
1899 if !fields.insert(__FieldTag::__extension_range) {
1900 return std::result::Result::Err(A::Error::duplicate_field(
1901 "multiple values for extension_range",
1902 ));
1903 }
1904 result.extension_range = map
1905 .next_value::<std::option::Option<
1906 std::vec::Vec<crate::descriptor_proto::ExtensionRange>,
1907 >>()?
1908 .unwrap_or_default();
1909 }
1910 __FieldTag::__oneof_decl => {
1911 if !fields.insert(__FieldTag::__oneof_decl) {
1912 return std::result::Result::Err(A::Error::duplicate_field(
1913 "multiple values for oneof_decl",
1914 ));
1915 }
1916 result.oneof_decl = map.next_value::<std::option::Option<std::vec::Vec<crate::OneofDescriptorProto>>>()?.unwrap_or_default();
1917 }
1918 __FieldTag::__options => {
1919 if !fields.insert(__FieldTag::__options) {
1920 return std::result::Result::Err(A::Error::duplicate_field(
1921 "multiple values for options",
1922 ));
1923 }
1924 result.options =
1925 map.next_value::<std::option::Option<crate::MessageOptions>>()?;
1926 }
1927 __FieldTag::__reserved_range => {
1928 if !fields.insert(__FieldTag::__reserved_range) {
1929 return std::result::Result::Err(A::Error::duplicate_field(
1930 "multiple values for reserved_range",
1931 ));
1932 }
1933 result.reserved_range = map
1934 .next_value::<std::option::Option<
1935 std::vec::Vec<crate::descriptor_proto::ReservedRange>,
1936 >>()?
1937 .unwrap_or_default();
1938 }
1939 __FieldTag::__reserved_name => {
1940 if !fields.insert(__FieldTag::__reserved_name) {
1941 return std::result::Result::Err(A::Error::duplicate_field(
1942 "multiple values for reserved_name",
1943 ));
1944 }
1945 result.reserved_name = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
1946 }
1947 __FieldTag::Unknown(key) => {
1948 let value = map.next_value::<serde_json::Value>()?;
1949 result._unknown_fields.insert(key, value);
1950 }
1951 }
1952 }
1953 std::result::Result::Ok(result)
1954 }
1955 }
1956 deserializer.deserialize_any(Visitor)
1957 }
1958}
1959
1960#[doc(hidden)]
1961impl serde::ser::Serialize for DescriptorProto {
1962 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1963 where
1964 S: serde::ser::Serializer,
1965 {
1966 use serde::ser::SerializeMap;
1967 #[allow(unused_imports)]
1968 use std::option::Option::Some;
1969 let mut state = serializer.serialize_map(std::option::Option::None)?;
1970 if !self.name.is_empty() {
1971 state.serialize_entry("name", &self.name)?;
1972 }
1973 if !self.field.is_empty() {
1974 state.serialize_entry("field", &self.field)?;
1975 }
1976 if !self.extension.is_empty() {
1977 state.serialize_entry("extension", &self.extension)?;
1978 }
1979 if !self.nested_type.is_empty() {
1980 state.serialize_entry("nestedType", &self.nested_type)?;
1981 }
1982 if !self.enum_type.is_empty() {
1983 state.serialize_entry("enumType", &self.enum_type)?;
1984 }
1985 if !self.extension_range.is_empty() {
1986 state.serialize_entry("extensionRange", &self.extension_range)?;
1987 }
1988 if !self.oneof_decl.is_empty() {
1989 state.serialize_entry("oneofDecl", &self.oneof_decl)?;
1990 }
1991 if self.options.is_some() {
1992 state.serialize_entry("options", &self.options)?;
1993 }
1994 if !self.reserved_range.is_empty() {
1995 state.serialize_entry("reservedRange", &self.reserved_range)?;
1996 }
1997 if !self.reserved_name.is_empty() {
1998 state.serialize_entry("reservedName", &self.reserved_name)?;
1999 }
2000 if !self._unknown_fields.is_empty() {
2001 for (key, value) in self._unknown_fields.iter() {
2002 state.serialize_entry(key, &value)?;
2003 }
2004 }
2005 state.end()
2006 }
2007}
2008
2009impl std::fmt::Debug for DescriptorProto {
2010 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2011 let mut debug_struct = f.debug_struct("DescriptorProto");
2012 debug_struct.field("name", &self.name);
2013 debug_struct.field("field", &self.field);
2014 debug_struct.field("extension", &self.extension);
2015 debug_struct.field("nested_type", &self.nested_type);
2016 debug_struct.field("enum_type", &self.enum_type);
2017 debug_struct.field("extension_range", &self.extension_range);
2018 debug_struct.field("oneof_decl", &self.oneof_decl);
2019 debug_struct.field("options", &self.options);
2020 debug_struct.field("reserved_range", &self.reserved_range);
2021 debug_struct.field("reserved_name", &self.reserved_name);
2022 if !self._unknown_fields.is_empty() {
2023 debug_struct.field("_unknown_fields", &self._unknown_fields);
2024 }
2025 debug_struct.finish()
2026 }
2027}
2028
2029pub mod descriptor_proto {
2031 #[allow(unused_imports)]
2032 use super::*;
2033
2034 #[derive(Clone, Default, PartialEq)]
2035 #[non_exhaustive]
2036 pub struct ExtensionRange {
2037 pub start: i32,
2038
2039 pub end: i32,
2040
2041 pub options: std::option::Option<crate::ExtensionRangeOptions>,
2042
2043 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2044 }
2045
2046 impl ExtensionRange {
2047 pub fn new() -> Self {
2048 std::default::Default::default()
2049 }
2050
2051 pub fn set_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2053 self.start = v.into();
2054 self
2055 }
2056
2057 pub fn set_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2059 self.end = v.into();
2060 self
2061 }
2062
2063 pub fn set_options<T>(mut self, v: T) -> Self
2065 where
2066 T: std::convert::Into<crate::ExtensionRangeOptions>,
2067 {
2068 self.options = std::option::Option::Some(v.into());
2069 self
2070 }
2071
2072 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
2074 where
2075 T: std::convert::Into<crate::ExtensionRangeOptions>,
2076 {
2077 self.options = v.map(|x| x.into());
2078 self
2079 }
2080 }
2081
2082 impl wkt::message::Message for ExtensionRange {
2083 fn typename() -> &'static str {
2084 "type.googleapis.com/google.protobuf.DescriptorProto.ExtensionRange"
2085 }
2086 }
2087
2088 #[doc(hidden)]
2089 impl<'de> serde::de::Deserialize<'de> for ExtensionRange {
2090 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2091 where
2092 D: serde::Deserializer<'de>,
2093 {
2094 #[allow(non_camel_case_types)]
2095 #[doc(hidden)]
2096 #[derive(PartialEq, Eq, Hash)]
2097 enum __FieldTag {
2098 __start,
2099 __end,
2100 __options,
2101 Unknown(std::string::String),
2102 }
2103 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2104 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2105 where
2106 D: serde::Deserializer<'de>,
2107 {
2108 struct Visitor;
2109 impl<'de> serde::de::Visitor<'de> for Visitor {
2110 type Value = __FieldTag;
2111 fn expecting(
2112 &self,
2113 formatter: &mut std::fmt::Formatter,
2114 ) -> std::fmt::Result {
2115 formatter.write_str("a field name for ExtensionRange")
2116 }
2117 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2118 where
2119 E: serde::de::Error,
2120 {
2121 use std::result::Result::Ok;
2122 use std::string::ToString;
2123 match value {
2124 "start" => Ok(__FieldTag::__start),
2125 "end" => Ok(__FieldTag::__end),
2126 "options" => Ok(__FieldTag::__options),
2127 _ => Ok(__FieldTag::Unknown(value.to_string())),
2128 }
2129 }
2130 }
2131 deserializer.deserialize_identifier(Visitor)
2132 }
2133 }
2134 struct Visitor;
2135 impl<'de> serde::de::Visitor<'de> for Visitor {
2136 type Value = ExtensionRange;
2137 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2138 formatter.write_str("struct ExtensionRange")
2139 }
2140 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2141 where
2142 A: serde::de::MapAccess<'de>,
2143 {
2144 #[allow(unused_imports)]
2145 use serde::de::Error;
2146 use std::option::Option::Some;
2147 let mut fields = std::collections::HashSet::new();
2148 let mut result = Self::Value::new();
2149 while let Some(tag) = map.next_key::<__FieldTag>()? {
2150 #[allow(clippy::match_single_binding)]
2151 match tag {
2152 __FieldTag::__start => {
2153 if !fields.insert(__FieldTag::__start) {
2154 return std::result::Result::Err(A::Error::duplicate_field(
2155 "multiple values for start",
2156 ));
2157 }
2158 struct __With(std::option::Option<i32>);
2159 impl<'de> serde::de::Deserialize<'de> for __With {
2160 fn deserialize<D>(
2161 deserializer: D,
2162 ) -> std::result::Result<Self, D::Error>
2163 where
2164 D: serde::de::Deserializer<'de>,
2165 {
2166 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2167 }
2168 }
2169 result.start = map.next_value::<__With>()?.0.unwrap_or_default();
2170 }
2171 __FieldTag::__end => {
2172 if !fields.insert(__FieldTag::__end) {
2173 return std::result::Result::Err(A::Error::duplicate_field(
2174 "multiple values for end",
2175 ));
2176 }
2177 struct __With(std::option::Option<i32>);
2178 impl<'de> serde::de::Deserialize<'de> for __With {
2179 fn deserialize<D>(
2180 deserializer: D,
2181 ) -> std::result::Result<Self, D::Error>
2182 where
2183 D: serde::de::Deserializer<'de>,
2184 {
2185 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2186 }
2187 }
2188 result.end = map.next_value::<__With>()?.0.unwrap_or_default();
2189 }
2190 __FieldTag::__options => {
2191 if !fields.insert(__FieldTag::__options) {
2192 return std::result::Result::Err(A::Error::duplicate_field(
2193 "multiple values for options",
2194 ));
2195 }
2196 result.options = map.next_value::<std::option::Option<crate::ExtensionRangeOptions>>()?
2197 ;
2198 }
2199 __FieldTag::Unknown(key) => {
2200 let value = map.next_value::<serde_json::Value>()?;
2201 result._unknown_fields.insert(key, value);
2202 }
2203 }
2204 }
2205 std::result::Result::Ok(result)
2206 }
2207 }
2208 deserializer.deserialize_any(Visitor)
2209 }
2210 }
2211
2212 #[doc(hidden)]
2213 impl serde::ser::Serialize for ExtensionRange {
2214 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2215 where
2216 S: serde::ser::Serializer,
2217 {
2218 use serde::ser::SerializeMap;
2219 #[allow(unused_imports)]
2220 use std::option::Option::Some;
2221 let mut state = serializer.serialize_map(std::option::Option::None)?;
2222 if !wkt::internal::is_default(&self.start) {
2223 struct __With<'a>(&'a i32);
2224 impl<'a> serde::ser::Serialize for __With<'a> {
2225 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2226 where
2227 S: serde::ser::Serializer,
2228 {
2229 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2230 }
2231 }
2232 state.serialize_entry("start", &__With(&self.start))?;
2233 }
2234 if !wkt::internal::is_default(&self.end) {
2235 struct __With<'a>(&'a i32);
2236 impl<'a> serde::ser::Serialize for __With<'a> {
2237 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2238 where
2239 S: serde::ser::Serializer,
2240 {
2241 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2242 }
2243 }
2244 state.serialize_entry("end", &__With(&self.end))?;
2245 }
2246 if self.options.is_some() {
2247 state.serialize_entry("options", &self.options)?;
2248 }
2249 if !self._unknown_fields.is_empty() {
2250 for (key, value) in self._unknown_fields.iter() {
2251 state.serialize_entry(key, &value)?;
2252 }
2253 }
2254 state.end()
2255 }
2256 }
2257
2258 impl std::fmt::Debug for ExtensionRange {
2259 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2260 let mut debug_struct = f.debug_struct("ExtensionRange");
2261 debug_struct.field("start", &self.start);
2262 debug_struct.field("end", &self.end);
2263 debug_struct.field("options", &self.options);
2264 if !self._unknown_fields.is_empty() {
2265 debug_struct.field("_unknown_fields", &self._unknown_fields);
2266 }
2267 debug_struct.finish()
2268 }
2269 }
2270
2271 #[derive(Clone, Default, PartialEq)]
2275 #[non_exhaustive]
2276 pub struct ReservedRange {
2277 pub start: i32,
2278
2279 pub end: i32,
2280
2281 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2282 }
2283
2284 impl ReservedRange {
2285 pub fn new() -> Self {
2286 std::default::Default::default()
2287 }
2288
2289 pub fn set_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2291 self.start = v.into();
2292 self
2293 }
2294
2295 pub fn set_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2297 self.end = v.into();
2298 self
2299 }
2300 }
2301
2302 impl wkt::message::Message for ReservedRange {
2303 fn typename() -> &'static str {
2304 "type.googleapis.com/google.protobuf.DescriptorProto.ReservedRange"
2305 }
2306 }
2307
2308 #[doc(hidden)]
2309 impl<'de> serde::de::Deserialize<'de> for ReservedRange {
2310 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2311 where
2312 D: serde::Deserializer<'de>,
2313 {
2314 #[allow(non_camel_case_types)]
2315 #[doc(hidden)]
2316 #[derive(PartialEq, Eq, Hash)]
2317 enum __FieldTag {
2318 __start,
2319 __end,
2320 Unknown(std::string::String),
2321 }
2322 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2323 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2324 where
2325 D: serde::Deserializer<'de>,
2326 {
2327 struct Visitor;
2328 impl<'de> serde::de::Visitor<'de> for Visitor {
2329 type Value = __FieldTag;
2330 fn expecting(
2331 &self,
2332 formatter: &mut std::fmt::Formatter,
2333 ) -> std::fmt::Result {
2334 formatter.write_str("a field name for ReservedRange")
2335 }
2336 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2337 where
2338 E: serde::de::Error,
2339 {
2340 use std::result::Result::Ok;
2341 use std::string::ToString;
2342 match value {
2343 "start" => Ok(__FieldTag::__start),
2344 "end" => Ok(__FieldTag::__end),
2345 _ => Ok(__FieldTag::Unknown(value.to_string())),
2346 }
2347 }
2348 }
2349 deserializer.deserialize_identifier(Visitor)
2350 }
2351 }
2352 struct Visitor;
2353 impl<'de> serde::de::Visitor<'de> for Visitor {
2354 type Value = ReservedRange;
2355 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2356 formatter.write_str("struct ReservedRange")
2357 }
2358 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2359 where
2360 A: serde::de::MapAccess<'de>,
2361 {
2362 #[allow(unused_imports)]
2363 use serde::de::Error;
2364 use std::option::Option::Some;
2365 let mut fields = std::collections::HashSet::new();
2366 let mut result = Self::Value::new();
2367 while let Some(tag) = map.next_key::<__FieldTag>()? {
2368 #[allow(clippy::match_single_binding)]
2369 match tag {
2370 __FieldTag::__start => {
2371 if !fields.insert(__FieldTag::__start) {
2372 return std::result::Result::Err(A::Error::duplicate_field(
2373 "multiple values for start",
2374 ));
2375 }
2376 struct __With(std::option::Option<i32>);
2377 impl<'de> serde::de::Deserialize<'de> for __With {
2378 fn deserialize<D>(
2379 deserializer: D,
2380 ) -> std::result::Result<Self, D::Error>
2381 where
2382 D: serde::de::Deserializer<'de>,
2383 {
2384 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2385 }
2386 }
2387 result.start = map.next_value::<__With>()?.0.unwrap_or_default();
2388 }
2389 __FieldTag::__end => {
2390 if !fields.insert(__FieldTag::__end) {
2391 return std::result::Result::Err(A::Error::duplicate_field(
2392 "multiple values for end",
2393 ));
2394 }
2395 struct __With(std::option::Option<i32>);
2396 impl<'de> serde::de::Deserialize<'de> for __With {
2397 fn deserialize<D>(
2398 deserializer: D,
2399 ) -> std::result::Result<Self, D::Error>
2400 where
2401 D: serde::de::Deserializer<'de>,
2402 {
2403 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2404 }
2405 }
2406 result.end = map.next_value::<__With>()?.0.unwrap_or_default();
2407 }
2408 __FieldTag::Unknown(key) => {
2409 let value = map.next_value::<serde_json::Value>()?;
2410 result._unknown_fields.insert(key, value);
2411 }
2412 }
2413 }
2414 std::result::Result::Ok(result)
2415 }
2416 }
2417 deserializer.deserialize_any(Visitor)
2418 }
2419 }
2420
2421 #[doc(hidden)]
2422 impl serde::ser::Serialize for ReservedRange {
2423 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2424 where
2425 S: serde::ser::Serializer,
2426 {
2427 use serde::ser::SerializeMap;
2428 #[allow(unused_imports)]
2429 use std::option::Option::Some;
2430 let mut state = serializer.serialize_map(std::option::Option::None)?;
2431 if !wkt::internal::is_default(&self.start) {
2432 struct __With<'a>(&'a i32);
2433 impl<'a> serde::ser::Serialize for __With<'a> {
2434 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2435 where
2436 S: serde::ser::Serializer,
2437 {
2438 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2439 }
2440 }
2441 state.serialize_entry("start", &__With(&self.start))?;
2442 }
2443 if !wkt::internal::is_default(&self.end) {
2444 struct __With<'a>(&'a i32);
2445 impl<'a> serde::ser::Serialize for __With<'a> {
2446 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2447 where
2448 S: serde::ser::Serializer,
2449 {
2450 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2451 }
2452 }
2453 state.serialize_entry("end", &__With(&self.end))?;
2454 }
2455 if !self._unknown_fields.is_empty() {
2456 for (key, value) in self._unknown_fields.iter() {
2457 state.serialize_entry(key, &value)?;
2458 }
2459 }
2460 state.end()
2461 }
2462 }
2463
2464 impl std::fmt::Debug for ReservedRange {
2465 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2466 let mut debug_struct = f.debug_struct("ReservedRange");
2467 debug_struct.field("start", &self.start);
2468 debug_struct.field("end", &self.end);
2469 if !self._unknown_fields.is_empty() {
2470 debug_struct.field("_unknown_fields", &self._unknown_fields);
2471 }
2472 debug_struct.finish()
2473 }
2474 }
2475}
2476
2477#[derive(Clone, Default, PartialEq)]
2478#[non_exhaustive]
2479pub struct ExtensionRangeOptions {
2480 pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
2482
2483 pub declaration: std::vec::Vec<crate::extension_range_options::Declaration>,
2487
2488 pub features: std::option::Option<crate::FeatureSet>,
2490
2491 pub verification: crate::extension_range_options::VerificationState,
2495
2496 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2497}
2498
2499impl ExtensionRangeOptions {
2500 pub fn new() -> Self {
2501 std::default::Default::default()
2502 }
2503
2504 pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
2506 where
2507 T: std::iter::IntoIterator<Item = V>,
2508 V: std::convert::Into<crate::UninterpretedOption>,
2509 {
2510 use std::iter::Iterator;
2511 self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
2512 self
2513 }
2514
2515 pub fn set_declaration<T, V>(mut self, v: T) -> Self
2517 where
2518 T: std::iter::IntoIterator<Item = V>,
2519 V: std::convert::Into<crate::extension_range_options::Declaration>,
2520 {
2521 use std::iter::Iterator;
2522 self.declaration = v.into_iter().map(|i| i.into()).collect();
2523 self
2524 }
2525
2526 pub fn set_features<T>(mut self, v: T) -> Self
2528 where
2529 T: std::convert::Into<crate::FeatureSet>,
2530 {
2531 self.features = std::option::Option::Some(v.into());
2532 self
2533 }
2534
2535 pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
2537 where
2538 T: std::convert::Into<crate::FeatureSet>,
2539 {
2540 self.features = v.map(|x| x.into());
2541 self
2542 }
2543
2544 pub fn set_verification<
2546 T: std::convert::Into<crate::extension_range_options::VerificationState>,
2547 >(
2548 mut self,
2549 v: T,
2550 ) -> Self {
2551 self.verification = v.into();
2552 self
2553 }
2554}
2555
2556impl wkt::message::Message for ExtensionRangeOptions {
2557 fn typename() -> &'static str {
2558 "type.googleapis.com/google.protobuf.ExtensionRangeOptions"
2559 }
2560}
2561
2562#[doc(hidden)]
2563impl<'de> serde::de::Deserialize<'de> for ExtensionRangeOptions {
2564 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2565 where
2566 D: serde::Deserializer<'de>,
2567 {
2568 #[allow(non_camel_case_types)]
2569 #[doc(hidden)]
2570 #[derive(PartialEq, Eq, Hash)]
2571 enum __FieldTag {
2572 __uninterpreted_option,
2573 __declaration,
2574 __features,
2575 __verification,
2576 Unknown(std::string::String),
2577 }
2578 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2579 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2580 where
2581 D: serde::Deserializer<'de>,
2582 {
2583 struct Visitor;
2584 impl<'de> serde::de::Visitor<'de> for Visitor {
2585 type Value = __FieldTag;
2586 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2587 formatter.write_str("a field name for ExtensionRangeOptions")
2588 }
2589 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2590 where
2591 E: serde::de::Error,
2592 {
2593 use std::result::Result::Ok;
2594 use std::string::ToString;
2595 match value {
2596 "uninterpretedOption" => Ok(__FieldTag::__uninterpreted_option),
2597 "uninterpreted_option" => Ok(__FieldTag::__uninterpreted_option),
2598 "declaration" => Ok(__FieldTag::__declaration),
2599 "features" => Ok(__FieldTag::__features),
2600 "verification" => Ok(__FieldTag::__verification),
2601 _ => Ok(__FieldTag::Unknown(value.to_string())),
2602 }
2603 }
2604 }
2605 deserializer.deserialize_identifier(Visitor)
2606 }
2607 }
2608 struct Visitor;
2609 impl<'de> serde::de::Visitor<'de> for Visitor {
2610 type Value = ExtensionRangeOptions;
2611 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2612 formatter.write_str("struct ExtensionRangeOptions")
2613 }
2614 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2615 where
2616 A: serde::de::MapAccess<'de>,
2617 {
2618 #[allow(unused_imports)]
2619 use serde::de::Error;
2620 use std::option::Option::Some;
2621 let mut fields = std::collections::HashSet::new();
2622 let mut result = Self::Value::new();
2623 while let Some(tag) = map.next_key::<__FieldTag>()? {
2624 #[allow(clippy::match_single_binding)]
2625 match tag {
2626 __FieldTag::__uninterpreted_option => {
2627 if !fields.insert(__FieldTag::__uninterpreted_option) {
2628 return std::result::Result::Err(A::Error::duplicate_field(
2629 "multiple values for uninterpreted_option",
2630 ));
2631 }
2632 result.uninterpreted_option = map.next_value::<std::option::Option<std::vec::Vec<crate::UninterpretedOption>>>()?.unwrap_or_default();
2633 }
2634 __FieldTag::__declaration => {
2635 if !fields.insert(__FieldTag::__declaration) {
2636 return std::result::Result::Err(A::Error::duplicate_field(
2637 "multiple values for declaration",
2638 ));
2639 }
2640 result.declaration = map
2641 .next_value::<std::option::Option<
2642 std::vec::Vec<crate::extension_range_options::Declaration>,
2643 >>()?
2644 .unwrap_or_default();
2645 }
2646 __FieldTag::__features => {
2647 if !fields.insert(__FieldTag::__features) {
2648 return std::result::Result::Err(A::Error::duplicate_field(
2649 "multiple values for features",
2650 ));
2651 }
2652 result.features =
2653 map.next_value::<std::option::Option<crate::FeatureSet>>()?;
2654 }
2655 __FieldTag::__verification => {
2656 if !fields.insert(__FieldTag::__verification) {
2657 return std::result::Result::Err(A::Error::duplicate_field(
2658 "multiple values for verification",
2659 ));
2660 }
2661 result.verification = map
2662 .next_value::<std::option::Option<
2663 crate::extension_range_options::VerificationState,
2664 >>()?
2665 .unwrap_or_default();
2666 }
2667 __FieldTag::Unknown(key) => {
2668 let value = map.next_value::<serde_json::Value>()?;
2669 result._unknown_fields.insert(key, value);
2670 }
2671 }
2672 }
2673 std::result::Result::Ok(result)
2674 }
2675 }
2676 deserializer.deserialize_any(Visitor)
2677 }
2678}
2679
2680#[doc(hidden)]
2681impl serde::ser::Serialize for ExtensionRangeOptions {
2682 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2683 where
2684 S: serde::ser::Serializer,
2685 {
2686 use serde::ser::SerializeMap;
2687 #[allow(unused_imports)]
2688 use std::option::Option::Some;
2689 let mut state = serializer.serialize_map(std::option::Option::None)?;
2690 if !self.uninterpreted_option.is_empty() {
2691 state.serialize_entry("uninterpretedOption", &self.uninterpreted_option)?;
2692 }
2693 if !self.declaration.is_empty() {
2694 state.serialize_entry("declaration", &self.declaration)?;
2695 }
2696 if self.features.is_some() {
2697 state.serialize_entry("features", &self.features)?;
2698 }
2699 if !wkt::internal::is_default(&self.verification) {
2700 state.serialize_entry("verification", &self.verification)?;
2701 }
2702 if !self._unknown_fields.is_empty() {
2703 for (key, value) in self._unknown_fields.iter() {
2704 state.serialize_entry(key, &value)?;
2705 }
2706 }
2707 state.end()
2708 }
2709}
2710
2711impl std::fmt::Debug for ExtensionRangeOptions {
2712 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2713 let mut debug_struct = f.debug_struct("ExtensionRangeOptions");
2714 debug_struct.field("uninterpreted_option", &self.uninterpreted_option);
2715 debug_struct.field("declaration", &self.declaration);
2716 debug_struct.field("features", &self.features);
2717 debug_struct.field("verification", &self.verification);
2718 if !self._unknown_fields.is_empty() {
2719 debug_struct.field("_unknown_fields", &self._unknown_fields);
2720 }
2721 debug_struct.finish()
2722 }
2723}
2724
2725pub mod extension_range_options {
2727 #[allow(unused_imports)]
2728 use super::*;
2729
2730 #[derive(Clone, Default, PartialEq)]
2731 #[non_exhaustive]
2732 pub struct Declaration {
2733 pub number: i32,
2735
2736 pub full_name: std::string::String,
2739
2740 pub r#type: std::string::String,
2744
2745 pub reserved: bool,
2749
2750 pub repeated: bool,
2753
2754 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2755 }
2756
2757 impl Declaration {
2758 pub fn new() -> Self {
2759 std::default::Default::default()
2760 }
2761
2762 pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2764 self.number = v.into();
2765 self
2766 }
2767
2768 pub fn set_full_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2770 self.full_name = v.into();
2771 self
2772 }
2773
2774 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2776 self.r#type = v.into();
2777 self
2778 }
2779
2780 pub fn set_reserved<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2782 self.reserved = v.into();
2783 self
2784 }
2785
2786 pub fn set_repeated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2788 self.repeated = v.into();
2789 self
2790 }
2791 }
2792
2793 impl wkt::message::Message for Declaration {
2794 fn typename() -> &'static str {
2795 "type.googleapis.com/google.protobuf.ExtensionRangeOptions.Declaration"
2796 }
2797 }
2798
2799 #[doc(hidden)]
2800 impl<'de> serde::de::Deserialize<'de> for Declaration {
2801 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2802 where
2803 D: serde::Deserializer<'de>,
2804 {
2805 #[allow(non_camel_case_types)]
2806 #[doc(hidden)]
2807 #[derive(PartialEq, Eq, Hash)]
2808 enum __FieldTag {
2809 __number,
2810 __full_name,
2811 __type,
2812 __reserved,
2813 __repeated,
2814 Unknown(std::string::String),
2815 }
2816 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2817 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2818 where
2819 D: serde::Deserializer<'de>,
2820 {
2821 struct Visitor;
2822 impl<'de> serde::de::Visitor<'de> for Visitor {
2823 type Value = __FieldTag;
2824 fn expecting(
2825 &self,
2826 formatter: &mut std::fmt::Formatter,
2827 ) -> std::fmt::Result {
2828 formatter.write_str("a field name for Declaration")
2829 }
2830 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2831 where
2832 E: serde::de::Error,
2833 {
2834 use std::result::Result::Ok;
2835 use std::string::ToString;
2836 match value {
2837 "number" => Ok(__FieldTag::__number),
2838 "fullName" => Ok(__FieldTag::__full_name),
2839 "full_name" => Ok(__FieldTag::__full_name),
2840 "type" => Ok(__FieldTag::__type),
2841 "reserved" => Ok(__FieldTag::__reserved),
2842 "repeated" => Ok(__FieldTag::__repeated),
2843 _ => Ok(__FieldTag::Unknown(value.to_string())),
2844 }
2845 }
2846 }
2847 deserializer.deserialize_identifier(Visitor)
2848 }
2849 }
2850 struct Visitor;
2851 impl<'de> serde::de::Visitor<'de> for Visitor {
2852 type Value = Declaration;
2853 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2854 formatter.write_str("struct Declaration")
2855 }
2856 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2857 where
2858 A: serde::de::MapAccess<'de>,
2859 {
2860 #[allow(unused_imports)]
2861 use serde::de::Error;
2862 use std::option::Option::Some;
2863 let mut fields = std::collections::HashSet::new();
2864 let mut result = Self::Value::new();
2865 while let Some(tag) = map.next_key::<__FieldTag>()? {
2866 #[allow(clippy::match_single_binding)]
2867 match tag {
2868 __FieldTag::__number => {
2869 if !fields.insert(__FieldTag::__number) {
2870 return std::result::Result::Err(A::Error::duplicate_field(
2871 "multiple values for number",
2872 ));
2873 }
2874 struct __With(std::option::Option<i32>);
2875 impl<'de> serde::de::Deserialize<'de> for __With {
2876 fn deserialize<D>(
2877 deserializer: D,
2878 ) -> std::result::Result<Self, D::Error>
2879 where
2880 D: serde::de::Deserializer<'de>,
2881 {
2882 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
2883 }
2884 }
2885 result.number = map.next_value::<__With>()?.0.unwrap_or_default();
2886 }
2887 __FieldTag::__full_name => {
2888 if !fields.insert(__FieldTag::__full_name) {
2889 return std::result::Result::Err(A::Error::duplicate_field(
2890 "multiple values for full_name",
2891 ));
2892 }
2893 result.full_name = map
2894 .next_value::<std::option::Option<std::string::String>>()?
2895 .unwrap_or_default();
2896 }
2897 __FieldTag::__type => {
2898 if !fields.insert(__FieldTag::__type) {
2899 return std::result::Result::Err(A::Error::duplicate_field(
2900 "multiple values for type",
2901 ));
2902 }
2903 result.r#type = map
2904 .next_value::<std::option::Option<std::string::String>>()?
2905 .unwrap_or_default();
2906 }
2907 __FieldTag::__reserved => {
2908 if !fields.insert(__FieldTag::__reserved) {
2909 return std::result::Result::Err(A::Error::duplicate_field(
2910 "multiple values for reserved",
2911 ));
2912 }
2913 result.reserved = map
2914 .next_value::<std::option::Option<bool>>()?
2915 .unwrap_or_default();
2916 }
2917 __FieldTag::__repeated => {
2918 if !fields.insert(__FieldTag::__repeated) {
2919 return std::result::Result::Err(A::Error::duplicate_field(
2920 "multiple values for repeated",
2921 ));
2922 }
2923 result.repeated = map
2924 .next_value::<std::option::Option<bool>>()?
2925 .unwrap_or_default();
2926 }
2927 __FieldTag::Unknown(key) => {
2928 let value = map.next_value::<serde_json::Value>()?;
2929 result._unknown_fields.insert(key, value);
2930 }
2931 }
2932 }
2933 std::result::Result::Ok(result)
2934 }
2935 }
2936 deserializer.deserialize_any(Visitor)
2937 }
2938 }
2939
2940 #[doc(hidden)]
2941 impl serde::ser::Serialize for Declaration {
2942 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2943 where
2944 S: serde::ser::Serializer,
2945 {
2946 use serde::ser::SerializeMap;
2947 #[allow(unused_imports)]
2948 use std::option::Option::Some;
2949 let mut state = serializer.serialize_map(std::option::Option::None)?;
2950 if !wkt::internal::is_default(&self.number) {
2951 struct __With<'a>(&'a i32);
2952 impl<'a> serde::ser::Serialize for __With<'a> {
2953 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2954 where
2955 S: serde::ser::Serializer,
2956 {
2957 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
2958 }
2959 }
2960 state.serialize_entry("number", &__With(&self.number))?;
2961 }
2962 if !self.full_name.is_empty() {
2963 state.serialize_entry("fullName", &self.full_name)?;
2964 }
2965 if !self.r#type.is_empty() {
2966 state.serialize_entry("type", &self.r#type)?;
2967 }
2968 if !wkt::internal::is_default(&self.reserved) {
2969 state.serialize_entry("reserved", &self.reserved)?;
2970 }
2971 if !wkt::internal::is_default(&self.repeated) {
2972 state.serialize_entry("repeated", &self.repeated)?;
2973 }
2974 if !self._unknown_fields.is_empty() {
2975 for (key, value) in self._unknown_fields.iter() {
2976 state.serialize_entry(key, &value)?;
2977 }
2978 }
2979 state.end()
2980 }
2981 }
2982
2983 impl std::fmt::Debug for Declaration {
2984 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2985 let mut debug_struct = f.debug_struct("Declaration");
2986 debug_struct.field("number", &self.number);
2987 debug_struct.field("full_name", &self.full_name);
2988 debug_struct.field("r#type", &self.r#type);
2989 debug_struct.field("reserved", &self.reserved);
2990 debug_struct.field("repeated", &self.repeated);
2991 if !self._unknown_fields.is_empty() {
2992 debug_struct.field("_unknown_fields", &self._unknown_fields);
2993 }
2994 debug_struct.finish()
2995 }
2996 }
2997
2998 #[derive(Clone, Debug, PartialEq)]
3014 #[non_exhaustive]
3015 pub enum VerificationState {
3016 Declaration,
3018 Unverified,
3019 UnknownValue(verification_state::UnknownValue),
3024 }
3025
3026 #[doc(hidden)]
3027 pub mod verification_state {
3028 #[allow(unused_imports)]
3029 use super::*;
3030 #[derive(Clone, Debug, PartialEq)]
3031 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3032 }
3033
3034 impl VerificationState {
3035 pub fn value(&self) -> std::option::Option<i32> {
3040 match self {
3041 Self::Declaration => std::option::Option::Some(0),
3042 Self::Unverified => std::option::Option::Some(1),
3043 Self::UnknownValue(u) => u.0.value(),
3044 }
3045 }
3046
3047 pub fn name(&self) -> std::option::Option<&str> {
3052 match self {
3053 Self::Declaration => std::option::Option::Some("DECLARATION"),
3054 Self::Unverified => std::option::Option::Some("UNVERIFIED"),
3055 Self::UnknownValue(u) => u.0.name(),
3056 }
3057 }
3058 }
3059
3060 impl std::default::Default for VerificationState {
3061 fn default() -> Self {
3062 use std::convert::From;
3063 Self::from(0)
3064 }
3065 }
3066
3067 impl std::fmt::Display for VerificationState {
3068 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3069 wkt::internal::display_enum(f, self.name(), self.value())
3070 }
3071 }
3072
3073 impl std::convert::From<i32> for VerificationState {
3074 fn from(value: i32) -> Self {
3075 match value {
3076 0 => Self::Declaration,
3077 1 => Self::Unverified,
3078 _ => Self::UnknownValue(verification_state::UnknownValue(
3079 wkt::internal::UnknownEnumValue::Integer(value),
3080 )),
3081 }
3082 }
3083 }
3084
3085 impl std::convert::From<&str> for VerificationState {
3086 fn from(value: &str) -> Self {
3087 use std::string::ToString;
3088 match value {
3089 "DECLARATION" => Self::Declaration,
3090 "UNVERIFIED" => Self::Unverified,
3091 _ => Self::UnknownValue(verification_state::UnknownValue(
3092 wkt::internal::UnknownEnumValue::String(value.to_string()),
3093 )),
3094 }
3095 }
3096 }
3097
3098 impl serde::ser::Serialize for VerificationState {
3099 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3100 where
3101 S: serde::Serializer,
3102 {
3103 match self {
3104 Self::Declaration => serializer.serialize_i32(0),
3105 Self::Unverified => serializer.serialize_i32(1),
3106 Self::UnknownValue(u) => u.0.serialize(serializer),
3107 }
3108 }
3109 }
3110
3111 impl<'de> serde::de::Deserialize<'de> for VerificationState {
3112 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3113 where
3114 D: serde::Deserializer<'de>,
3115 {
3116 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VerificationState>::new(
3117 ".google.protobuf.ExtensionRangeOptions.VerificationState",
3118 ))
3119 }
3120 }
3121}
3122
3123#[derive(Clone, Default, PartialEq)]
3125#[non_exhaustive]
3126pub struct FieldDescriptorProto {
3127 pub name: std::string::String,
3128
3129 pub number: i32,
3130
3131 pub label: crate::field_descriptor_proto::Label,
3132
3133 pub r#type: crate::field_descriptor_proto::Type,
3136
3137 pub type_name: std::string::String,
3143
3144 pub extendee: std::string::String,
3147
3148 pub default_value: std::string::String,
3153
3154 pub oneof_index: i32,
3157
3158 pub json_name: std::string::String,
3163
3164 pub options: std::option::Option<crate::FieldOptions>,
3165
3166 pub proto3_optional: bool,
3188
3189 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3190}
3191
3192impl FieldDescriptorProto {
3193 pub fn new() -> Self {
3194 std::default::Default::default()
3195 }
3196
3197 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3199 self.name = v.into();
3200 self
3201 }
3202
3203 pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3205 self.number = v.into();
3206 self
3207 }
3208
3209 pub fn set_label<T: std::convert::Into<crate::field_descriptor_proto::Label>>(
3211 mut self,
3212 v: T,
3213 ) -> Self {
3214 self.label = v.into();
3215 self
3216 }
3217
3218 pub fn set_type<T: std::convert::Into<crate::field_descriptor_proto::Type>>(
3220 mut self,
3221 v: T,
3222 ) -> Self {
3223 self.r#type = v.into();
3224 self
3225 }
3226
3227 pub fn set_type_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3229 self.type_name = v.into();
3230 self
3231 }
3232
3233 pub fn set_extendee<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3235 self.extendee = v.into();
3236 self
3237 }
3238
3239 pub fn set_default_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3241 self.default_value = v.into();
3242 self
3243 }
3244
3245 pub fn set_oneof_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3247 self.oneof_index = v.into();
3248 self
3249 }
3250
3251 pub fn set_json_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3253 self.json_name = v.into();
3254 self
3255 }
3256
3257 pub fn set_options<T>(mut self, v: T) -> Self
3259 where
3260 T: std::convert::Into<crate::FieldOptions>,
3261 {
3262 self.options = std::option::Option::Some(v.into());
3263 self
3264 }
3265
3266 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3268 where
3269 T: std::convert::Into<crate::FieldOptions>,
3270 {
3271 self.options = v.map(|x| x.into());
3272 self
3273 }
3274
3275 pub fn set_proto3_optional<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3277 self.proto3_optional = v.into();
3278 self
3279 }
3280}
3281
3282impl wkt::message::Message for FieldDescriptorProto {
3283 fn typename() -> &'static str {
3284 "type.googleapis.com/google.protobuf.FieldDescriptorProto"
3285 }
3286}
3287
3288#[doc(hidden)]
3289impl<'de> serde::de::Deserialize<'de> for FieldDescriptorProto {
3290 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3291 where
3292 D: serde::Deserializer<'de>,
3293 {
3294 #[allow(non_camel_case_types)]
3295 #[doc(hidden)]
3296 #[derive(PartialEq, Eq, Hash)]
3297 enum __FieldTag {
3298 __name,
3299 __number,
3300 __label,
3301 __type,
3302 __type_name,
3303 __extendee,
3304 __default_value,
3305 __oneof_index,
3306 __json_name,
3307 __options,
3308 __proto3_optional,
3309 Unknown(std::string::String),
3310 }
3311 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3312 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3313 where
3314 D: serde::Deserializer<'de>,
3315 {
3316 struct Visitor;
3317 impl<'de> serde::de::Visitor<'de> for Visitor {
3318 type Value = __FieldTag;
3319 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3320 formatter.write_str("a field name for FieldDescriptorProto")
3321 }
3322 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3323 where
3324 E: serde::de::Error,
3325 {
3326 use std::result::Result::Ok;
3327 use std::string::ToString;
3328 match value {
3329 "name" => Ok(__FieldTag::__name),
3330 "number" => Ok(__FieldTag::__number),
3331 "label" => Ok(__FieldTag::__label),
3332 "type" => Ok(__FieldTag::__type),
3333 "typeName" => Ok(__FieldTag::__type_name),
3334 "type_name" => Ok(__FieldTag::__type_name),
3335 "extendee" => Ok(__FieldTag::__extendee),
3336 "defaultValue" => Ok(__FieldTag::__default_value),
3337 "default_value" => Ok(__FieldTag::__default_value),
3338 "oneofIndex" => Ok(__FieldTag::__oneof_index),
3339 "oneof_index" => Ok(__FieldTag::__oneof_index),
3340 "jsonName" => Ok(__FieldTag::__json_name),
3341 "json_name" => Ok(__FieldTag::__json_name),
3342 "options" => Ok(__FieldTag::__options),
3343 "proto3Optional" => Ok(__FieldTag::__proto3_optional),
3344 "proto3_optional" => Ok(__FieldTag::__proto3_optional),
3345 _ => Ok(__FieldTag::Unknown(value.to_string())),
3346 }
3347 }
3348 }
3349 deserializer.deserialize_identifier(Visitor)
3350 }
3351 }
3352 struct Visitor;
3353 impl<'de> serde::de::Visitor<'de> for Visitor {
3354 type Value = FieldDescriptorProto;
3355 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3356 formatter.write_str("struct FieldDescriptorProto")
3357 }
3358 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3359 where
3360 A: serde::de::MapAccess<'de>,
3361 {
3362 #[allow(unused_imports)]
3363 use serde::de::Error;
3364 use std::option::Option::Some;
3365 let mut fields = std::collections::HashSet::new();
3366 let mut result = Self::Value::new();
3367 while let Some(tag) = map.next_key::<__FieldTag>()? {
3368 #[allow(clippy::match_single_binding)]
3369 match tag {
3370 __FieldTag::__name => {
3371 if !fields.insert(__FieldTag::__name) {
3372 return std::result::Result::Err(A::Error::duplicate_field(
3373 "multiple values for name",
3374 ));
3375 }
3376 result.name = map
3377 .next_value::<std::option::Option<std::string::String>>()?
3378 .unwrap_or_default();
3379 }
3380 __FieldTag::__number => {
3381 if !fields.insert(__FieldTag::__number) {
3382 return std::result::Result::Err(A::Error::duplicate_field(
3383 "multiple values for number",
3384 ));
3385 }
3386 struct __With(std::option::Option<i32>);
3387 impl<'de> serde::de::Deserialize<'de> for __With {
3388 fn deserialize<D>(
3389 deserializer: D,
3390 ) -> std::result::Result<Self, D::Error>
3391 where
3392 D: serde::de::Deserializer<'de>,
3393 {
3394 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3395 }
3396 }
3397 result.number = map.next_value::<__With>()?.0.unwrap_or_default();
3398 }
3399 __FieldTag::__label => {
3400 if !fields.insert(__FieldTag::__label) {
3401 return std::result::Result::Err(A::Error::duplicate_field(
3402 "multiple values for label",
3403 ));
3404 }
3405 result.label = map.next_value::<std::option::Option<crate::field_descriptor_proto::Label>>()?.unwrap_or_default();
3406 }
3407 __FieldTag::__type => {
3408 if !fields.insert(__FieldTag::__type) {
3409 return std::result::Result::Err(A::Error::duplicate_field(
3410 "multiple values for type",
3411 ));
3412 }
3413 result.r#type = map.next_value::<std::option::Option<crate::field_descriptor_proto::Type>>()?.unwrap_or_default();
3414 }
3415 __FieldTag::__type_name => {
3416 if !fields.insert(__FieldTag::__type_name) {
3417 return std::result::Result::Err(A::Error::duplicate_field(
3418 "multiple values for type_name",
3419 ));
3420 }
3421 result.type_name = map
3422 .next_value::<std::option::Option<std::string::String>>()?
3423 .unwrap_or_default();
3424 }
3425 __FieldTag::__extendee => {
3426 if !fields.insert(__FieldTag::__extendee) {
3427 return std::result::Result::Err(A::Error::duplicate_field(
3428 "multiple values for extendee",
3429 ));
3430 }
3431 result.extendee = map
3432 .next_value::<std::option::Option<std::string::String>>()?
3433 .unwrap_or_default();
3434 }
3435 __FieldTag::__default_value => {
3436 if !fields.insert(__FieldTag::__default_value) {
3437 return std::result::Result::Err(A::Error::duplicate_field(
3438 "multiple values for default_value",
3439 ));
3440 }
3441 result.default_value = map
3442 .next_value::<std::option::Option<std::string::String>>()?
3443 .unwrap_or_default();
3444 }
3445 __FieldTag::__oneof_index => {
3446 if !fields.insert(__FieldTag::__oneof_index) {
3447 return std::result::Result::Err(A::Error::duplicate_field(
3448 "multiple values for oneof_index",
3449 ));
3450 }
3451 struct __With(std::option::Option<i32>);
3452 impl<'de> serde::de::Deserialize<'de> for __With {
3453 fn deserialize<D>(
3454 deserializer: D,
3455 ) -> std::result::Result<Self, D::Error>
3456 where
3457 D: serde::de::Deserializer<'de>,
3458 {
3459 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
3460 }
3461 }
3462 result.oneof_index = map.next_value::<__With>()?.0.unwrap_or_default();
3463 }
3464 __FieldTag::__json_name => {
3465 if !fields.insert(__FieldTag::__json_name) {
3466 return std::result::Result::Err(A::Error::duplicate_field(
3467 "multiple values for json_name",
3468 ));
3469 }
3470 result.json_name = map
3471 .next_value::<std::option::Option<std::string::String>>()?
3472 .unwrap_or_default();
3473 }
3474 __FieldTag::__options => {
3475 if !fields.insert(__FieldTag::__options) {
3476 return std::result::Result::Err(A::Error::duplicate_field(
3477 "multiple values for options",
3478 ));
3479 }
3480 result.options =
3481 map.next_value::<std::option::Option<crate::FieldOptions>>()?;
3482 }
3483 __FieldTag::__proto3_optional => {
3484 if !fields.insert(__FieldTag::__proto3_optional) {
3485 return std::result::Result::Err(A::Error::duplicate_field(
3486 "multiple values for proto3_optional",
3487 ));
3488 }
3489 result.proto3_optional = map
3490 .next_value::<std::option::Option<bool>>()?
3491 .unwrap_or_default();
3492 }
3493 __FieldTag::Unknown(key) => {
3494 let value = map.next_value::<serde_json::Value>()?;
3495 result._unknown_fields.insert(key, value);
3496 }
3497 }
3498 }
3499 std::result::Result::Ok(result)
3500 }
3501 }
3502 deserializer.deserialize_any(Visitor)
3503 }
3504}
3505
3506#[doc(hidden)]
3507impl serde::ser::Serialize for FieldDescriptorProto {
3508 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3509 where
3510 S: serde::ser::Serializer,
3511 {
3512 use serde::ser::SerializeMap;
3513 #[allow(unused_imports)]
3514 use std::option::Option::Some;
3515 let mut state = serializer.serialize_map(std::option::Option::None)?;
3516 if !self.name.is_empty() {
3517 state.serialize_entry("name", &self.name)?;
3518 }
3519 if !wkt::internal::is_default(&self.number) {
3520 struct __With<'a>(&'a i32);
3521 impl<'a> serde::ser::Serialize for __With<'a> {
3522 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3523 where
3524 S: serde::ser::Serializer,
3525 {
3526 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3527 }
3528 }
3529 state.serialize_entry("number", &__With(&self.number))?;
3530 }
3531 if !wkt::internal::is_default(&self.label) {
3532 state.serialize_entry("label", &self.label)?;
3533 }
3534 if !wkt::internal::is_default(&self.r#type) {
3535 state.serialize_entry("type", &self.r#type)?;
3536 }
3537 if !self.type_name.is_empty() {
3538 state.serialize_entry("typeName", &self.type_name)?;
3539 }
3540 if !self.extendee.is_empty() {
3541 state.serialize_entry("extendee", &self.extendee)?;
3542 }
3543 if !self.default_value.is_empty() {
3544 state.serialize_entry("defaultValue", &self.default_value)?;
3545 }
3546 if !wkt::internal::is_default(&self.oneof_index) {
3547 struct __With<'a>(&'a i32);
3548 impl<'a> serde::ser::Serialize for __With<'a> {
3549 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3550 where
3551 S: serde::ser::Serializer,
3552 {
3553 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
3554 }
3555 }
3556 state.serialize_entry("oneofIndex", &__With(&self.oneof_index))?;
3557 }
3558 if !self.json_name.is_empty() {
3559 state.serialize_entry("jsonName", &self.json_name)?;
3560 }
3561 if self.options.is_some() {
3562 state.serialize_entry("options", &self.options)?;
3563 }
3564 if !wkt::internal::is_default(&self.proto3_optional) {
3565 state.serialize_entry("proto3Optional", &self.proto3_optional)?;
3566 }
3567 if !self._unknown_fields.is_empty() {
3568 for (key, value) in self._unknown_fields.iter() {
3569 state.serialize_entry(key, &value)?;
3570 }
3571 }
3572 state.end()
3573 }
3574}
3575
3576impl std::fmt::Debug for FieldDescriptorProto {
3577 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3578 let mut debug_struct = f.debug_struct("FieldDescriptorProto");
3579 debug_struct.field("name", &self.name);
3580 debug_struct.field("number", &self.number);
3581 debug_struct.field("label", &self.label);
3582 debug_struct.field("r#type", &self.r#type);
3583 debug_struct.field("type_name", &self.type_name);
3584 debug_struct.field("extendee", &self.extendee);
3585 debug_struct.field("default_value", &self.default_value);
3586 debug_struct.field("oneof_index", &self.oneof_index);
3587 debug_struct.field("json_name", &self.json_name);
3588 debug_struct.field("options", &self.options);
3589 debug_struct.field("proto3_optional", &self.proto3_optional);
3590 if !self._unknown_fields.is_empty() {
3591 debug_struct.field("_unknown_fields", &self._unknown_fields);
3592 }
3593 debug_struct.finish()
3594 }
3595}
3596
3597pub mod field_descriptor_proto {
3599 #[allow(unused_imports)]
3600 use super::*;
3601
3602 #[derive(Clone, Debug, PartialEq)]
3617 #[non_exhaustive]
3618 pub enum Type {
3619 Double,
3622 Float,
3623 Int64,
3626 Uint64,
3627 Int32,
3630 Fixed64,
3631 Fixed32,
3632 Bool,
3633 String,
3634 Group,
3640 Message,
3641 Bytes,
3643 Uint32,
3644 Enum,
3645 Sfixed32,
3646 Sfixed64,
3647 Sint32,
3648 Sint64,
3649 UnknownValue(r#type::UnknownValue),
3654 }
3655
3656 #[doc(hidden)]
3657 pub mod r#type {
3658 #[allow(unused_imports)]
3659 use super::*;
3660 #[derive(Clone, Debug, PartialEq)]
3661 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3662 }
3663
3664 impl Type {
3665 pub fn value(&self) -> std::option::Option<i32> {
3670 match self {
3671 Self::Double => std::option::Option::Some(1),
3672 Self::Float => std::option::Option::Some(2),
3673 Self::Int64 => std::option::Option::Some(3),
3674 Self::Uint64 => std::option::Option::Some(4),
3675 Self::Int32 => std::option::Option::Some(5),
3676 Self::Fixed64 => std::option::Option::Some(6),
3677 Self::Fixed32 => std::option::Option::Some(7),
3678 Self::Bool => std::option::Option::Some(8),
3679 Self::String => std::option::Option::Some(9),
3680 Self::Group => std::option::Option::Some(10),
3681 Self::Message => std::option::Option::Some(11),
3682 Self::Bytes => std::option::Option::Some(12),
3683 Self::Uint32 => std::option::Option::Some(13),
3684 Self::Enum => std::option::Option::Some(14),
3685 Self::Sfixed32 => std::option::Option::Some(15),
3686 Self::Sfixed64 => std::option::Option::Some(16),
3687 Self::Sint32 => std::option::Option::Some(17),
3688 Self::Sint64 => std::option::Option::Some(18),
3689 Self::UnknownValue(u) => u.0.value(),
3690 }
3691 }
3692
3693 pub fn name(&self) -> std::option::Option<&str> {
3698 match self {
3699 Self::Double => std::option::Option::Some("TYPE_DOUBLE"),
3700 Self::Float => std::option::Option::Some("TYPE_FLOAT"),
3701 Self::Int64 => std::option::Option::Some("TYPE_INT64"),
3702 Self::Uint64 => std::option::Option::Some("TYPE_UINT64"),
3703 Self::Int32 => std::option::Option::Some("TYPE_INT32"),
3704 Self::Fixed64 => std::option::Option::Some("TYPE_FIXED64"),
3705 Self::Fixed32 => std::option::Option::Some("TYPE_FIXED32"),
3706 Self::Bool => std::option::Option::Some("TYPE_BOOL"),
3707 Self::String => std::option::Option::Some("TYPE_STRING"),
3708 Self::Group => std::option::Option::Some("TYPE_GROUP"),
3709 Self::Message => std::option::Option::Some("TYPE_MESSAGE"),
3710 Self::Bytes => std::option::Option::Some("TYPE_BYTES"),
3711 Self::Uint32 => std::option::Option::Some("TYPE_UINT32"),
3712 Self::Enum => std::option::Option::Some("TYPE_ENUM"),
3713 Self::Sfixed32 => std::option::Option::Some("TYPE_SFIXED32"),
3714 Self::Sfixed64 => std::option::Option::Some("TYPE_SFIXED64"),
3715 Self::Sint32 => std::option::Option::Some("TYPE_SINT32"),
3716 Self::Sint64 => std::option::Option::Some("TYPE_SINT64"),
3717 Self::UnknownValue(u) => u.0.name(),
3718 }
3719 }
3720 }
3721
3722 impl std::default::Default for Type {
3723 fn default() -> Self {
3724 use std::convert::From;
3725 Self::from(0)
3726 }
3727 }
3728
3729 impl std::fmt::Display for Type {
3730 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3731 wkt::internal::display_enum(f, self.name(), self.value())
3732 }
3733 }
3734
3735 impl std::convert::From<i32> for Type {
3736 fn from(value: i32) -> Self {
3737 match value {
3738 1 => Self::Double,
3739 2 => Self::Float,
3740 3 => Self::Int64,
3741 4 => Self::Uint64,
3742 5 => Self::Int32,
3743 6 => Self::Fixed64,
3744 7 => Self::Fixed32,
3745 8 => Self::Bool,
3746 9 => Self::String,
3747 10 => Self::Group,
3748 11 => Self::Message,
3749 12 => Self::Bytes,
3750 13 => Self::Uint32,
3751 14 => Self::Enum,
3752 15 => Self::Sfixed32,
3753 16 => Self::Sfixed64,
3754 17 => Self::Sint32,
3755 18 => Self::Sint64,
3756 _ => Self::UnknownValue(r#type::UnknownValue(
3757 wkt::internal::UnknownEnumValue::Integer(value),
3758 )),
3759 }
3760 }
3761 }
3762
3763 impl std::convert::From<&str> for Type {
3764 fn from(value: &str) -> Self {
3765 use std::string::ToString;
3766 match value {
3767 "TYPE_DOUBLE" => Self::Double,
3768 "TYPE_FLOAT" => Self::Float,
3769 "TYPE_INT64" => Self::Int64,
3770 "TYPE_UINT64" => Self::Uint64,
3771 "TYPE_INT32" => Self::Int32,
3772 "TYPE_FIXED64" => Self::Fixed64,
3773 "TYPE_FIXED32" => Self::Fixed32,
3774 "TYPE_BOOL" => Self::Bool,
3775 "TYPE_STRING" => Self::String,
3776 "TYPE_GROUP" => Self::Group,
3777 "TYPE_MESSAGE" => Self::Message,
3778 "TYPE_BYTES" => Self::Bytes,
3779 "TYPE_UINT32" => Self::Uint32,
3780 "TYPE_ENUM" => Self::Enum,
3781 "TYPE_SFIXED32" => Self::Sfixed32,
3782 "TYPE_SFIXED64" => Self::Sfixed64,
3783 "TYPE_SINT32" => Self::Sint32,
3784 "TYPE_SINT64" => Self::Sint64,
3785 _ => Self::UnknownValue(r#type::UnknownValue(
3786 wkt::internal::UnknownEnumValue::String(value.to_string()),
3787 )),
3788 }
3789 }
3790 }
3791
3792 impl serde::ser::Serialize for Type {
3793 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3794 where
3795 S: serde::Serializer,
3796 {
3797 match self {
3798 Self::Double => serializer.serialize_i32(1),
3799 Self::Float => serializer.serialize_i32(2),
3800 Self::Int64 => serializer.serialize_i32(3),
3801 Self::Uint64 => serializer.serialize_i32(4),
3802 Self::Int32 => serializer.serialize_i32(5),
3803 Self::Fixed64 => serializer.serialize_i32(6),
3804 Self::Fixed32 => serializer.serialize_i32(7),
3805 Self::Bool => serializer.serialize_i32(8),
3806 Self::String => serializer.serialize_i32(9),
3807 Self::Group => serializer.serialize_i32(10),
3808 Self::Message => serializer.serialize_i32(11),
3809 Self::Bytes => serializer.serialize_i32(12),
3810 Self::Uint32 => serializer.serialize_i32(13),
3811 Self::Enum => serializer.serialize_i32(14),
3812 Self::Sfixed32 => serializer.serialize_i32(15),
3813 Self::Sfixed64 => serializer.serialize_i32(16),
3814 Self::Sint32 => serializer.serialize_i32(17),
3815 Self::Sint64 => serializer.serialize_i32(18),
3816 Self::UnknownValue(u) => u.0.serialize(serializer),
3817 }
3818 }
3819 }
3820
3821 impl<'de> serde::de::Deserialize<'de> for Type {
3822 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3823 where
3824 D: serde::Deserializer<'de>,
3825 {
3826 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
3827 ".google.protobuf.FieldDescriptorProto.Type",
3828 ))
3829 }
3830 }
3831
3832 #[derive(Clone, Debug, PartialEq)]
3847 #[non_exhaustive]
3848 pub enum Label {
3849 Optional,
3851 Repeated,
3852 Required,
3856 UnknownValue(label::UnknownValue),
3861 }
3862
3863 #[doc(hidden)]
3864 pub mod label {
3865 #[allow(unused_imports)]
3866 use super::*;
3867 #[derive(Clone, Debug, PartialEq)]
3868 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3869 }
3870
3871 impl Label {
3872 pub fn value(&self) -> std::option::Option<i32> {
3877 match self {
3878 Self::Optional => std::option::Option::Some(1),
3879 Self::Repeated => std::option::Option::Some(3),
3880 Self::Required => std::option::Option::Some(2),
3881 Self::UnknownValue(u) => u.0.value(),
3882 }
3883 }
3884
3885 pub fn name(&self) -> std::option::Option<&str> {
3890 match self {
3891 Self::Optional => std::option::Option::Some("LABEL_OPTIONAL"),
3892 Self::Repeated => std::option::Option::Some("LABEL_REPEATED"),
3893 Self::Required => std::option::Option::Some("LABEL_REQUIRED"),
3894 Self::UnknownValue(u) => u.0.name(),
3895 }
3896 }
3897 }
3898
3899 impl std::default::Default for Label {
3900 fn default() -> Self {
3901 use std::convert::From;
3902 Self::from(0)
3903 }
3904 }
3905
3906 impl std::fmt::Display for Label {
3907 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3908 wkt::internal::display_enum(f, self.name(), self.value())
3909 }
3910 }
3911
3912 impl std::convert::From<i32> for Label {
3913 fn from(value: i32) -> Self {
3914 match value {
3915 1 => Self::Optional,
3916 2 => Self::Required,
3917 3 => Self::Repeated,
3918 _ => Self::UnknownValue(label::UnknownValue(
3919 wkt::internal::UnknownEnumValue::Integer(value),
3920 )),
3921 }
3922 }
3923 }
3924
3925 impl std::convert::From<&str> for Label {
3926 fn from(value: &str) -> Self {
3927 use std::string::ToString;
3928 match value {
3929 "LABEL_OPTIONAL" => Self::Optional,
3930 "LABEL_REPEATED" => Self::Repeated,
3931 "LABEL_REQUIRED" => Self::Required,
3932 _ => Self::UnknownValue(label::UnknownValue(
3933 wkt::internal::UnknownEnumValue::String(value.to_string()),
3934 )),
3935 }
3936 }
3937 }
3938
3939 impl serde::ser::Serialize for Label {
3940 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3941 where
3942 S: serde::Serializer,
3943 {
3944 match self {
3945 Self::Optional => serializer.serialize_i32(1),
3946 Self::Repeated => serializer.serialize_i32(3),
3947 Self::Required => serializer.serialize_i32(2),
3948 Self::UnknownValue(u) => u.0.serialize(serializer),
3949 }
3950 }
3951 }
3952
3953 impl<'de> serde::de::Deserialize<'de> for Label {
3954 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3955 where
3956 D: serde::Deserializer<'de>,
3957 {
3958 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Label>::new(
3959 ".google.protobuf.FieldDescriptorProto.Label",
3960 ))
3961 }
3962 }
3963}
3964
3965#[derive(Clone, Default, PartialEq)]
3967#[non_exhaustive]
3968pub struct OneofDescriptorProto {
3969 pub name: std::string::String,
3970
3971 pub options: std::option::Option<crate::OneofOptions>,
3972
3973 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3974}
3975
3976impl OneofDescriptorProto {
3977 pub fn new() -> Self {
3978 std::default::Default::default()
3979 }
3980
3981 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3983 self.name = v.into();
3984 self
3985 }
3986
3987 pub fn set_options<T>(mut self, v: T) -> Self
3989 where
3990 T: std::convert::Into<crate::OneofOptions>,
3991 {
3992 self.options = std::option::Option::Some(v.into());
3993 self
3994 }
3995
3996 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3998 where
3999 T: std::convert::Into<crate::OneofOptions>,
4000 {
4001 self.options = v.map(|x| x.into());
4002 self
4003 }
4004}
4005
4006impl wkt::message::Message for OneofDescriptorProto {
4007 fn typename() -> &'static str {
4008 "type.googleapis.com/google.protobuf.OneofDescriptorProto"
4009 }
4010}
4011
4012#[doc(hidden)]
4013impl<'de> serde::de::Deserialize<'de> for OneofDescriptorProto {
4014 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4015 where
4016 D: serde::Deserializer<'de>,
4017 {
4018 #[allow(non_camel_case_types)]
4019 #[doc(hidden)]
4020 #[derive(PartialEq, Eq, Hash)]
4021 enum __FieldTag {
4022 __name,
4023 __options,
4024 Unknown(std::string::String),
4025 }
4026 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4027 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4028 where
4029 D: serde::Deserializer<'de>,
4030 {
4031 struct Visitor;
4032 impl<'de> serde::de::Visitor<'de> for Visitor {
4033 type Value = __FieldTag;
4034 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4035 formatter.write_str("a field name for OneofDescriptorProto")
4036 }
4037 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4038 where
4039 E: serde::de::Error,
4040 {
4041 use std::result::Result::Ok;
4042 use std::string::ToString;
4043 match value {
4044 "name" => Ok(__FieldTag::__name),
4045 "options" => Ok(__FieldTag::__options),
4046 _ => Ok(__FieldTag::Unknown(value.to_string())),
4047 }
4048 }
4049 }
4050 deserializer.deserialize_identifier(Visitor)
4051 }
4052 }
4053 struct Visitor;
4054 impl<'de> serde::de::Visitor<'de> for Visitor {
4055 type Value = OneofDescriptorProto;
4056 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4057 formatter.write_str("struct OneofDescriptorProto")
4058 }
4059 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4060 where
4061 A: serde::de::MapAccess<'de>,
4062 {
4063 #[allow(unused_imports)]
4064 use serde::de::Error;
4065 use std::option::Option::Some;
4066 let mut fields = std::collections::HashSet::new();
4067 let mut result = Self::Value::new();
4068 while let Some(tag) = map.next_key::<__FieldTag>()? {
4069 #[allow(clippy::match_single_binding)]
4070 match tag {
4071 __FieldTag::__name => {
4072 if !fields.insert(__FieldTag::__name) {
4073 return std::result::Result::Err(A::Error::duplicate_field(
4074 "multiple values for name",
4075 ));
4076 }
4077 result.name = map
4078 .next_value::<std::option::Option<std::string::String>>()?
4079 .unwrap_or_default();
4080 }
4081 __FieldTag::__options => {
4082 if !fields.insert(__FieldTag::__options) {
4083 return std::result::Result::Err(A::Error::duplicate_field(
4084 "multiple values for options",
4085 ));
4086 }
4087 result.options =
4088 map.next_value::<std::option::Option<crate::OneofOptions>>()?;
4089 }
4090 __FieldTag::Unknown(key) => {
4091 let value = map.next_value::<serde_json::Value>()?;
4092 result._unknown_fields.insert(key, value);
4093 }
4094 }
4095 }
4096 std::result::Result::Ok(result)
4097 }
4098 }
4099 deserializer.deserialize_any(Visitor)
4100 }
4101}
4102
4103#[doc(hidden)]
4104impl serde::ser::Serialize for OneofDescriptorProto {
4105 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4106 where
4107 S: serde::ser::Serializer,
4108 {
4109 use serde::ser::SerializeMap;
4110 #[allow(unused_imports)]
4111 use std::option::Option::Some;
4112 let mut state = serializer.serialize_map(std::option::Option::None)?;
4113 if !self.name.is_empty() {
4114 state.serialize_entry("name", &self.name)?;
4115 }
4116 if self.options.is_some() {
4117 state.serialize_entry("options", &self.options)?;
4118 }
4119 if !self._unknown_fields.is_empty() {
4120 for (key, value) in self._unknown_fields.iter() {
4121 state.serialize_entry(key, &value)?;
4122 }
4123 }
4124 state.end()
4125 }
4126}
4127
4128impl std::fmt::Debug for OneofDescriptorProto {
4129 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4130 let mut debug_struct = f.debug_struct("OneofDescriptorProto");
4131 debug_struct.field("name", &self.name);
4132 debug_struct.field("options", &self.options);
4133 if !self._unknown_fields.is_empty() {
4134 debug_struct.field("_unknown_fields", &self._unknown_fields);
4135 }
4136 debug_struct.finish()
4137 }
4138}
4139
4140#[derive(Clone, Default, PartialEq)]
4142#[non_exhaustive]
4143pub struct EnumDescriptorProto {
4144 pub name: std::string::String,
4145
4146 pub value: std::vec::Vec<crate::EnumValueDescriptorProto>,
4147
4148 pub options: std::option::Option<crate::EnumOptions>,
4149
4150 pub reserved_range: std::vec::Vec<crate::enum_descriptor_proto::EnumReservedRange>,
4154
4155 pub reserved_name: std::vec::Vec<std::string::String>,
4158
4159 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4160}
4161
4162impl EnumDescriptorProto {
4163 pub fn new() -> Self {
4164 std::default::Default::default()
4165 }
4166
4167 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4169 self.name = v.into();
4170 self
4171 }
4172
4173 pub fn set_value<T, V>(mut self, v: T) -> Self
4175 where
4176 T: std::iter::IntoIterator<Item = V>,
4177 V: std::convert::Into<crate::EnumValueDescriptorProto>,
4178 {
4179 use std::iter::Iterator;
4180 self.value = v.into_iter().map(|i| i.into()).collect();
4181 self
4182 }
4183
4184 pub fn set_options<T>(mut self, v: T) -> Self
4186 where
4187 T: std::convert::Into<crate::EnumOptions>,
4188 {
4189 self.options = std::option::Option::Some(v.into());
4190 self
4191 }
4192
4193 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
4195 where
4196 T: std::convert::Into<crate::EnumOptions>,
4197 {
4198 self.options = v.map(|x| x.into());
4199 self
4200 }
4201
4202 pub fn set_reserved_range<T, V>(mut self, v: T) -> Self
4204 where
4205 T: std::iter::IntoIterator<Item = V>,
4206 V: std::convert::Into<crate::enum_descriptor_proto::EnumReservedRange>,
4207 {
4208 use std::iter::Iterator;
4209 self.reserved_range = v.into_iter().map(|i| i.into()).collect();
4210 self
4211 }
4212
4213 pub fn set_reserved_name<T, V>(mut self, v: T) -> Self
4215 where
4216 T: std::iter::IntoIterator<Item = V>,
4217 V: std::convert::Into<std::string::String>,
4218 {
4219 use std::iter::Iterator;
4220 self.reserved_name = v.into_iter().map(|i| i.into()).collect();
4221 self
4222 }
4223}
4224
4225impl wkt::message::Message for EnumDescriptorProto {
4226 fn typename() -> &'static str {
4227 "type.googleapis.com/google.protobuf.EnumDescriptorProto"
4228 }
4229}
4230
4231#[doc(hidden)]
4232impl<'de> serde::de::Deserialize<'de> for EnumDescriptorProto {
4233 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4234 where
4235 D: serde::Deserializer<'de>,
4236 {
4237 #[allow(non_camel_case_types)]
4238 #[doc(hidden)]
4239 #[derive(PartialEq, Eq, Hash)]
4240 enum __FieldTag {
4241 __name,
4242 __value,
4243 __options,
4244 __reserved_range,
4245 __reserved_name,
4246 Unknown(std::string::String),
4247 }
4248 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4249 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4250 where
4251 D: serde::Deserializer<'de>,
4252 {
4253 struct Visitor;
4254 impl<'de> serde::de::Visitor<'de> for Visitor {
4255 type Value = __FieldTag;
4256 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4257 formatter.write_str("a field name for EnumDescriptorProto")
4258 }
4259 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4260 where
4261 E: serde::de::Error,
4262 {
4263 use std::result::Result::Ok;
4264 use std::string::ToString;
4265 match value {
4266 "name" => Ok(__FieldTag::__name),
4267 "value" => Ok(__FieldTag::__value),
4268 "options" => Ok(__FieldTag::__options),
4269 "reservedRange" => Ok(__FieldTag::__reserved_range),
4270 "reserved_range" => Ok(__FieldTag::__reserved_range),
4271 "reservedName" => Ok(__FieldTag::__reserved_name),
4272 "reserved_name" => Ok(__FieldTag::__reserved_name),
4273 _ => Ok(__FieldTag::Unknown(value.to_string())),
4274 }
4275 }
4276 }
4277 deserializer.deserialize_identifier(Visitor)
4278 }
4279 }
4280 struct Visitor;
4281 impl<'de> serde::de::Visitor<'de> for Visitor {
4282 type Value = EnumDescriptorProto;
4283 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4284 formatter.write_str("struct EnumDescriptorProto")
4285 }
4286 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4287 where
4288 A: serde::de::MapAccess<'de>,
4289 {
4290 #[allow(unused_imports)]
4291 use serde::de::Error;
4292 use std::option::Option::Some;
4293 let mut fields = std::collections::HashSet::new();
4294 let mut result = Self::Value::new();
4295 while let Some(tag) = map.next_key::<__FieldTag>()? {
4296 #[allow(clippy::match_single_binding)]
4297 match tag {
4298 __FieldTag::__name => {
4299 if !fields.insert(__FieldTag::__name) {
4300 return std::result::Result::Err(A::Error::duplicate_field(
4301 "multiple values for name",
4302 ));
4303 }
4304 result.name = map
4305 .next_value::<std::option::Option<std::string::String>>()?
4306 .unwrap_or_default();
4307 }
4308 __FieldTag::__value => {
4309 if !fields.insert(__FieldTag::__value) {
4310 return std::result::Result::Err(A::Error::duplicate_field(
4311 "multiple values for value",
4312 ));
4313 }
4314 result.value =
4315 map.next_value::<std::option::Option<
4316 std::vec::Vec<crate::EnumValueDescriptorProto>,
4317 >>()?
4318 .unwrap_or_default();
4319 }
4320 __FieldTag::__options => {
4321 if !fields.insert(__FieldTag::__options) {
4322 return std::result::Result::Err(A::Error::duplicate_field(
4323 "multiple values for options",
4324 ));
4325 }
4326 result.options =
4327 map.next_value::<std::option::Option<crate::EnumOptions>>()?;
4328 }
4329 __FieldTag::__reserved_range => {
4330 if !fields.insert(__FieldTag::__reserved_range) {
4331 return std::result::Result::Err(A::Error::duplicate_field(
4332 "multiple values for reserved_range",
4333 ));
4334 }
4335 result.reserved_range = map
4336 .next_value::<std::option::Option<
4337 std::vec::Vec<crate::enum_descriptor_proto::EnumReservedRange>,
4338 >>()?
4339 .unwrap_or_default();
4340 }
4341 __FieldTag::__reserved_name => {
4342 if !fields.insert(__FieldTag::__reserved_name) {
4343 return std::result::Result::Err(A::Error::duplicate_field(
4344 "multiple values for reserved_name",
4345 ));
4346 }
4347 result.reserved_name = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
4348 }
4349 __FieldTag::Unknown(key) => {
4350 let value = map.next_value::<serde_json::Value>()?;
4351 result._unknown_fields.insert(key, value);
4352 }
4353 }
4354 }
4355 std::result::Result::Ok(result)
4356 }
4357 }
4358 deserializer.deserialize_any(Visitor)
4359 }
4360}
4361
4362#[doc(hidden)]
4363impl serde::ser::Serialize for EnumDescriptorProto {
4364 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4365 where
4366 S: serde::ser::Serializer,
4367 {
4368 use serde::ser::SerializeMap;
4369 #[allow(unused_imports)]
4370 use std::option::Option::Some;
4371 let mut state = serializer.serialize_map(std::option::Option::None)?;
4372 if !self.name.is_empty() {
4373 state.serialize_entry("name", &self.name)?;
4374 }
4375 if !self.value.is_empty() {
4376 state.serialize_entry("value", &self.value)?;
4377 }
4378 if self.options.is_some() {
4379 state.serialize_entry("options", &self.options)?;
4380 }
4381 if !self.reserved_range.is_empty() {
4382 state.serialize_entry("reservedRange", &self.reserved_range)?;
4383 }
4384 if !self.reserved_name.is_empty() {
4385 state.serialize_entry("reservedName", &self.reserved_name)?;
4386 }
4387 if !self._unknown_fields.is_empty() {
4388 for (key, value) in self._unknown_fields.iter() {
4389 state.serialize_entry(key, &value)?;
4390 }
4391 }
4392 state.end()
4393 }
4394}
4395
4396impl std::fmt::Debug for EnumDescriptorProto {
4397 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4398 let mut debug_struct = f.debug_struct("EnumDescriptorProto");
4399 debug_struct.field("name", &self.name);
4400 debug_struct.field("value", &self.value);
4401 debug_struct.field("options", &self.options);
4402 debug_struct.field("reserved_range", &self.reserved_range);
4403 debug_struct.field("reserved_name", &self.reserved_name);
4404 if !self._unknown_fields.is_empty() {
4405 debug_struct.field("_unknown_fields", &self._unknown_fields);
4406 }
4407 debug_struct.finish()
4408 }
4409}
4410
4411pub mod enum_descriptor_proto {
4413 #[allow(unused_imports)]
4414 use super::*;
4415
4416 #[derive(Clone, Default, PartialEq)]
4423 #[non_exhaustive]
4424 pub struct EnumReservedRange {
4425 pub start: i32,
4426
4427 pub end: i32,
4428
4429 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4430 }
4431
4432 impl EnumReservedRange {
4433 pub fn new() -> Self {
4434 std::default::Default::default()
4435 }
4436
4437 pub fn set_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4439 self.start = v.into();
4440 self
4441 }
4442
4443 pub fn set_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4445 self.end = v.into();
4446 self
4447 }
4448 }
4449
4450 impl wkt::message::Message for EnumReservedRange {
4451 fn typename() -> &'static str {
4452 "type.googleapis.com/google.protobuf.EnumDescriptorProto.EnumReservedRange"
4453 }
4454 }
4455
4456 #[doc(hidden)]
4457 impl<'de> serde::de::Deserialize<'de> for EnumReservedRange {
4458 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4459 where
4460 D: serde::Deserializer<'de>,
4461 {
4462 #[allow(non_camel_case_types)]
4463 #[doc(hidden)]
4464 #[derive(PartialEq, Eq, Hash)]
4465 enum __FieldTag {
4466 __start,
4467 __end,
4468 Unknown(std::string::String),
4469 }
4470 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4471 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4472 where
4473 D: serde::Deserializer<'de>,
4474 {
4475 struct Visitor;
4476 impl<'de> serde::de::Visitor<'de> for Visitor {
4477 type Value = __FieldTag;
4478 fn expecting(
4479 &self,
4480 formatter: &mut std::fmt::Formatter,
4481 ) -> std::fmt::Result {
4482 formatter.write_str("a field name for EnumReservedRange")
4483 }
4484 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4485 where
4486 E: serde::de::Error,
4487 {
4488 use std::result::Result::Ok;
4489 use std::string::ToString;
4490 match value {
4491 "start" => Ok(__FieldTag::__start),
4492 "end" => Ok(__FieldTag::__end),
4493 _ => Ok(__FieldTag::Unknown(value.to_string())),
4494 }
4495 }
4496 }
4497 deserializer.deserialize_identifier(Visitor)
4498 }
4499 }
4500 struct Visitor;
4501 impl<'de> serde::de::Visitor<'de> for Visitor {
4502 type Value = EnumReservedRange;
4503 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4504 formatter.write_str("struct EnumReservedRange")
4505 }
4506 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4507 where
4508 A: serde::de::MapAccess<'de>,
4509 {
4510 #[allow(unused_imports)]
4511 use serde::de::Error;
4512 use std::option::Option::Some;
4513 let mut fields = std::collections::HashSet::new();
4514 let mut result = Self::Value::new();
4515 while let Some(tag) = map.next_key::<__FieldTag>()? {
4516 #[allow(clippy::match_single_binding)]
4517 match tag {
4518 __FieldTag::__start => {
4519 if !fields.insert(__FieldTag::__start) {
4520 return std::result::Result::Err(A::Error::duplicate_field(
4521 "multiple values for start",
4522 ));
4523 }
4524 struct __With(std::option::Option<i32>);
4525 impl<'de> serde::de::Deserialize<'de> for __With {
4526 fn deserialize<D>(
4527 deserializer: D,
4528 ) -> std::result::Result<Self, D::Error>
4529 where
4530 D: serde::de::Deserializer<'de>,
4531 {
4532 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4533 }
4534 }
4535 result.start = map.next_value::<__With>()?.0.unwrap_or_default();
4536 }
4537 __FieldTag::__end => {
4538 if !fields.insert(__FieldTag::__end) {
4539 return std::result::Result::Err(A::Error::duplicate_field(
4540 "multiple values for end",
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.end = map.next_value::<__With>()?.0.unwrap_or_default();
4555 }
4556 __FieldTag::Unknown(key) => {
4557 let value = map.next_value::<serde_json::Value>()?;
4558 result._unknown_fields.insert(key, value);
4559 }
4560 }
4561 }
4562 std::result::Result::Ok(result)
4563 }
4564 }
4565 deserializer.deserialize_any(Visitor)
4566 }
4567 }
4568
4569 #[doc(hidden)]
4570 impl serde::ser::Serialize for EnumReservedRange {
4571 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4572 where
4573 S: serde::ser::Serializer,
4574 {
4575 use serde::ser::SerializeMap;
4576 #[allow(unused_imports)]
4577 use std::option::Option::Some;
4578 let mut state = serializer.serialize_map(std::option::Option::None)?;
4579 if !wkt::internal::is_default(&self.start) {
4580 struct __With<'a>(&'a i32);
4581 impl<'a> serde::ser::Serialize for __With<'a> {
4582 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4583 where
4584 S: serde::ser::Serializer,
4585 {
4586 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4587 }
4588 }
4589 state.serialize_entry("start", &__With(&self.start))?;
4590 }
4591 if !wkt::internal::is_default(&self.end) {
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("end", &__With(&self.end))?;
4602 }
4603 if !self._unknown_fields.is_empty() {
4604 for (key, value) in self._unknown_fields.iter() {
4605 state.serialize_entry(key, &value)?;
4606 }
4607 }
4608 state.end()
4609 }
4610 }
4611
4612 impl std::fmt::Debug for EnumReservedRange {
4613 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4614 let mut debug_struct = f.debug_struct("EnumReservedRange");
4615 debug_struct.field("start", &self.start);
4616 debug_struct.field("end", &self.end);
4617 if !self._unknown_fields.is_empty() {
4618 debug_struct.field("_unknown_fields", &self._unknown_fields);
4619 }
4620 debug_struct.finish()
4621 }
4622 }
4623}
4624
4625#[derive(Clone, Default, PartialEq)]
4627#[non_exhaustive]
4628pub struct EnumValueDescriptorProto {
4629 pub name: std::string::String,
4630
4631 pub number: i32,
4632
4633 pub options: std::option::Option<crate::EnumValueOptions>,
4634
4635 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4636}
4637
4638impl EnumValueDescriptorProto {
4639 pub fn new() -> Self {
4640 std::default::Default::default()
4641 }
4642
4643 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4645 self.name = v.into();
4646 self
4647 }
4648
4649 pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4651 self.number = v.into();
4652 self
4653 }
4654
4655 pub fn set_options<T>(mut self, v: T) -> Self
4657 where
4658 T: std::convert::Into<crate::EnumValueOptions>,
4659 {
4660 self.options = std::option::Option::Some(v.into());
4661 self
4662 }
4663
4664 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
4666 where
4667 T: std::convert::Into<crate::EnumValueOptions>,
4668 {
4669 self.options = v.map(|x| x.into());
4670 self
4671 }
4672}
4673
4674impl wkt::message::Message for EnumValueDescriptorProto {
4675 fn typename() -> &'static str {
4676 "type.googleapis.com/google.protobuf.EnumValueDescriptorProto"
4677 }
4678}
4679
4680#[doc(hidden)]
4681impl<'de> serde::de::Deserialize<'de> for EnumValueDescriptorProto {
4682 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4683 where
4684 D: serde::Deserializer<'de>,
4685 {
4686 #[allow(non_camel_case_types)]
4687 #[doc(hidden)]
4688 #[derive(PartialEq, Eq, Hash)]
4689 enum __FieldTag {
4690 __name,
4691 __number,
4692 __options,
4693 Unknown(std::string::String),
4694 }
4695 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4696 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4697 where
4698 D: serde::Deserializer<'de>,
4699 {
4700 struct Visitor;
4701 impl<'de> serde::de::Visitor<'de> for Visitor {
4702 type Value = __FieldTag;
4703 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4704 formatter.write_str("a field name for EnumValueDescriptorProto")
4705 }
4706 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4707 where
4708 E: serde::de::Error,
4709 {
4710 use std::result::Result::Ok;
4711 use std::string::ToString;
4712 match value {
4713 "name" => Ok(__FieldTag::__name),
4714 "number" => Ok(__FieldTag::__number),
4715 "options" => Ok(__FieldTag::__options),
4716 _ => Ok(__FieldTag::Unknown(value.to_string())),
4717 }
4718 }
4719 }
4720 deserializer.deserialize_identifier(Visitor)
4721 }
4722 }
4723 struct Visitor;
4724 impl<'de> serde::de::Visitor<'de> for Visitor {
4725 type Value = EnumValueDescriptorProto;
4726 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4727 formatter.write_str("struct EnumValueDescriptorProto")
4728 }
4729 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4730 where
4731 A: serde::de::MapAccess<'de>,
4732 {
4733 #[allow(unused_imports)]
4734 use serde::de::Error;
4735 use std::option::Option::Some;
4736 let mut fields = std::collections::HashSet::new();
4737 let mut result = Self::Value::new();
4738 while let Some(tag) = map.next_key::<__FieldTag>()? {
4739 #[allow(clippy::match_single_binding)]
4740 match tag {
4741 __FieldTag::__name => {
4742 if !fields.insert(__FieldTag::__name) {
4743 return std::result::Result::Err(A::Error::duplicate_field(
4744 "multiple values for name",
4745 ));
4746 }
4747 result.name = map
4748 .next_value::<std::option::Option<std::string::String>>()?
4749 .unwrap_or_default();
4750 }
4751 __FieldTag::__number => {
4752 if !fields.insert(__FieldTag::__number) {
4753 return std::result::Result::Err(A::Error::duplicate_field(
4754 "multiple values for number",
4755 ));
4756 }
4757 struct __With(std::option::Option<i32>);
4758 impl<'de> serde::de::Deserialize<'de> for __With {
4759 fn deserialize<D>(
4760 deserializer: D,
4761 ) -> std::result::Result<Self, D::Error>
4762 where
4763 D: serde::de::Deserializer<'de>,
4764 {
4765 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4766 }
4767 }
4768 result.number = map.next_value::<__With>()?.0.unwrap_or_default();
4769 }
4770 __FieldTag::__options => {
4771 if !fields.insert(__FieldTag::__options) {
4772 return std::result::Result::Err(A::Error::duplicate_field(
4773 "multiple values for options",
4774 ));
4775 }
4776 result.options =
4777 map.next_value::<std::option::Option<crate::EnumValueOptions>>()?;
4778 }
4779 __FieldTag::Unknown(key) => {
4780 let value = map.next_value::<serde_json::Value>()?;
4781 result._unknown_fields.insert(key, value);
4782 }
4783 }
4784 }
4785 std::result::Result::Ok(result)
4786 }
4787 }
4788 deserializer.deserialize_any(Visitor)
4789 }
4790}
4791
4792#[doc(hidden)]
4793impl serde::ser::Serialize for EnumValueDescriptorProto {
4794 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4795 where
4796 S: serde::ser::Serializer,
4797 {
4798 use serde::ser::SerializeMap;
4799 #[allow(unused_imports)]
4800 use std::option::Option::Some;
4801 let mut state = serializer.serialize_map(std::option::Option::None)?;
4802 if !self.name.is_empty() {
4803 state.serialize_entry("name", &self.name)?;
4804 }
4805 if !wkt::internal::is_default(&self.number) {
4806 struct __With<'a>(&'a i32);
4807 impl<'a> serde::ser::Serialize for __With<'a> {
4808 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4809 where
4810 S: serde::ser::Serializer,
4811 {
4812 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4813 }
4814 }
4815 state.serialize_entry("number", &__With(&self.number))?;
4816 }
4817 if self.options.is_some() {
4818 state.serialize_entry("options", &self.options)?;
4819 }
4820 if !self._unknown_fields.is_empty() {
4821 for (key, value) in self._unknown_fields.iter() {
4822 state.serialize_entry(key, &value)?;
4823 }
4824 }
4825 state.end()
4826 }
4827}
4828
4829impl std::fmt::Debug for EnumValueDescriptorProto {
4830 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4831 let mut debug_struct = f.debug_struct("EnumValueDescriptorProto");
4832 debug_struct.field("name", &self.name);
4833 debug_struct.field("number", &self.number);
4834 debug_struct.field("options", &self.options);
4835 if !self._unknown_fields.is_empty() {
4836 debug_struct.field("_unknown_fields", &self._unknown_fields);
4837 }
4838 debug_struct.finish()
4839 }
4840}
4841
4842#[derive(Clone, Default, PartialEq)]
4844#[non_exhaustive]
4845pub struct ServiceDescriptorProto {
4846 pub name: std::string::String,
4847
4848 pub method: std::vec::Vec<crate::MethodDescriptorProto>,
4849
4850 pub options: std::option::Option<crate::ServiceOptions>,
4851
4852 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4853}
4854
4855impl ServiceDescriptorProto {
4856 pub fn new() -> Self {
4857 std::default::Default::default()
4858 }
4859
4860 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4862 self.name = v.into();
4863 self
4864 }
4865
4866 pub fn set_method<T, V>(mut self, v: T) -> Self
4868 where
4869 T: std::iter::IntoIterator<Item = V>,
4870 V: std::convert::Into<crate::MethodDescriptorProto>,
4871 {
4872 use std::iter::Iterator;
4873 self.method = v.into_iter().map(|i| i.into()).collect();
4874 self
4875 }
4876
4877 pub fn set_options<T>(mut self, v: T) -> Self
4879 where
4880 T: std::convert::Into<crate::ServiceOptions>,
4881 {
4882 self.options = std::option::Option::Some(v.into());
4883 self
4884 }
4885
4886 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
4888 where
4889 T: std::convert::Into<crate::ServiceOptions>,
4890 {
4891 self.options = v.map(|x| x.into());
4892 self
4893 }
4894}
4895
4896impl wkt::message::Message for ServiceDescriptorProto {
4897 fn typename() -> &'static str {
4898 "type.googleapis.com/google.protobuf.ServiceDescriptorProto"
4899 }
4900}
4901
4902#[doc(hidden)]
4903impl<'de> serde::de::Deserialize<'de> for ServiceDescriptorProto {
4904 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4905 where
4906 D: serde::Deserializer<'de>,
4907 {
4908 #[allow(non_camel_case_types)]
4909 #[doc(hidden)]
4910 #[derive(PartialEq, Eq, Hash)]
4911 enum __FieldTag {
4912 __name,
4913 __method,
4914 __options,
4915 Unknown(std::string::String),
4916 }
4917 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4918 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4919 where
4920 D: serde::Deserializer<'de>,
4921 {
4922 struct Visitor;
4923 impl<'de> serde::de::Visitor<'de> for Visitor {
4924 type Value = __FieldTag;
4925 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4926 formatter.write_str("a field name for ServiceDescriptorProto")
4927 }
4928 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4929 where
4930 E: serde::de::Error,
4931 {
4932 use std::result::Result::Ok;
4933 use std::string::ToString;
4934 match value {
4935 "name" => Ok(__FieldTag::__name),
4936 "method" => Ok(__FieldTag::__method),
4937 "options" => Ok(__FieldTag::__options),
4938 _ => Ok(__FieldTag::Unknown(value.to_string())),
4939 }
4940 }
4941 }
4942 deserializer.deserialize_identifier(Visitor)
4943 }
4944 }
4945 struct Visitor;
4946 impl<'de> serde::de::Visitor<'de> for Visitor {
4947 type Value = ServiceDescriptorProto;
4948 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4949 formatter.write_str("struct ServiceDescriptorProto")
4950 }
4951 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4952 where
4953 A: serde::de::MapAccess<'de>,
4954 {
4955 #[allow(unused_imports)]
4956 use serde::de::Error;
4957 use std::option::Option::Some;
4958 let mut fields = std::collections::HashSet::new();
4959 let mut result = Self::Value::new();
4960 while let Some(tag) = map.next_key::<__FieldTag>()? {
4961 #[allow(clippy::match_single_binding)]
4962 match tag {
4963 __FieldTag::__name => {
4964 if !fields.insert(__FieldTag::__name) {
4965 return std::result::Result::Err(A::Error::duplicate_field(
4966 "multiple values for name",
4967 ));
4968 }
4969 result.name = map
4970 .next_value::<std::option::Option<std::string::String>>()?
4971 .unwrap_or_default();
4972 }
4973 __FieldTag::__method => {
4974 if !fields.insert(__FieldTag::__method) {
4975 return std::result::Result::Err(A::Error::duplicate_field(
4976 "multiple values for method",
4977 ));
4978 }
4979 result.method =
4980 map.next_value::<std::option::Option<
4981 std::vec::Vec<crate::MethodDescriptorProto>,
4982 >>()?
4983 .unwrap_or_default();
4984 }
4985 __FieldTag::__options => {
4986 if !fields.insert(__FieldTag::__options) {
4987 return std::result::Result::Err(A::Error::duplicate_field(
4988 "multiple values for options",
4989 ));
4990 }
4991 result.options =
4992 map.next_value::<std::option::Option<crate::ServiceOptions>>()?;
4993 }
4994 __FieldTag::Unknown(key) => {
4995 let value = map.next_value::<serde_json::Value>()?;
4996 result._unknown_fields.insert(key, value);
4997 }
4998 }
4999 }
5000 std::result::Result::Ok(result)
5001 }
5002 }
5003 deserializer.deserialize_any(Visitor)
5004 }
5005}
5006
5007#[doc(hidden)]
5008impl serde::ser::Serialize for ServiceDescriptorProto {
5009 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5010 where
5011 S: serde::ser::Serializer,
5012 {
5013 use serde::ser::SerializeMap;
5014 #[allow(unused_imports)]
5015 use std::option::Option::Some;
5016 let mut state = serializer.serialize_map(std::option::Option::None)?;
5017 if !self.name.is_empty() {
5018 state.serialize_entry("name", &self.name)?;
5019 }
5020 if !self.method.is_empty() {
5021 state.serialize_entry("method", &self.method)?;
5022 }
5023 if self.options.is_some() {
5024 state.serialize_entry("options", &self.options)?;
5025 }
5026 if !self._unknown_fields.is_empty() {
5027 for (key, value) in self._unknown_fields.iter() {
5028 state.serialize_entry(key, &value)?;
5029 }
5030 }
5031 state.end()
5032 }
5033}
5034
5035impl std::fmt::Debug for ServiceDescriptorProto {
5036 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5037 let mut debug_struct = f.debug_struct("ServiceDescriptorProto");
5038 debug_struct.field("name", &self.name);
5039 debug_struct.field("method", &self.method);
5040 debug_struct.field("options", &self.options);
5041 if !self._unknown_fields.is_empty() {
5042 debug_struct.field("_unknown_fields", &self._unknown_fields);
5043 }
5044 debug_struct.finish()
5045 }
5046}
5047
5048#[derive(Clone, Default, PartialEq)]
5050#[non_exhaustive]
5051pub struct MethodDescriptorProto {
5052 pub name: std::string::String,
5053
5054 pub input_type: std::string::String,
5057
5058 pub output_type: std::string::String,
5059
5060 pub options: std::option::Option<crate::MethodOptions>,
5061
5062 pub client_streaming: bool,
5064
5065 pub server_streaming: bool,
5067
5068 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5069}
5070
5071impl MethodDescriptorProto {
5072 pub fn new() -> Self {
5073 std::default::Default::default()
5074 }
5075
5076 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5078 self.name = v.into();
5079 self
5080 }
5081
5082 pub fn set_input_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5084 self.input_type = v.into();
5085 self
5086 }
5087
5088 pub fn set_output_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5090 self.output_type = v.into();
5091 self
5092 }
5093
5094 pub fn set_options<T>(mut self, v: T) -> Self
5096 where
5097 T: std::convert::Into<crate::MethodOptions>,
5098 {
5099 self.options = std::option::Option::Some(v.into());
5100 self
5101 }
5102
5103 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
5105 where
5106 T: std::convert::Into<crate::MethodOptions>,
5107 {
5108 self.options = v.map(|x| x.into());
5109 self
5110 }
5111
5112 pub fn set_client_streaming<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5114 self.client_streaming = v.into();
5115 self
5116 }
5117
5118 pub fn set_server_streaming<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5120 self.server_streaming = v.into();
5121 self
5122 }
5123}
5124
5125impl wkt::message::Message for MethodDescriptorProto {
5126 fn typename() -> &'static str {
5127 "type.googleapis.com/google.protobuf.MethodDescriptorProto"
5128 }
5129}
5130
5131#[doc(hidden)]
5132impl<'de> serde::de::Deserialize<'de> for MethodDescriptorProto {
5133 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5134 where
5135 D: serde::Deserializer<'de>,
5136 {
5137 #[allow(non_camel_case_types)]
5138 #[doc(hidden)]
5139 #[derive(PartialEq, Eq, Hash)]
5140 enum __FieldTag {
5141 __name,
5142 __input_type,
5143 __output_type,
5144 __options,
5145 __client_streaming,
5146 __server_streaming,
5147 Unknown(std::string::String),
5148 }
5149 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5150 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5151 where
5152 D: serde::Deserializer<'de>,
5153 {
5154 struct Visitor;
5155 impl<'de> serde::de::Visitor<'de> for Visitor {
5156 type Value = __FieldTag;
5157 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5158 formatter.write_str("a field name for MethodDescriptorProto")
5159 }
5160 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5161 where
5162 E: serde::de::Error,
5163 {
5164 use std::result::Result::Ok;
5165 use std::string::ToString;
5166 match value {
5167 "name" => Ok(__FieldTag::__name),
5168 "inputType" => Ok(__FieldTag::__input_type),
5169 "input_type" => Ok(__FieldTag::__input_type),
5170 "outputType" => Ok(__FieldTag::__output_type),
5171 "output_type" => Ok(__FieldTag::__output_type),
5172 "options" => Ok(__FieldTag::__options),
5173 "clientStreaming" => Ok(__FieldTag::__client_streaming),
5174 "client_streaming" => Ok(__FieldTag::__client_streaming),
5175 "serverStreaming" => Ok(__FieldTag::__server_streaming),
5176 "server_streaming" => Ok(__FieldTag::__server_streaming),
5177 _ => Ok(__FieldTag::Unknown(value.to_string())),
5178 }
5179 }
5180 }
5181 deserializer.deserialize_identifier(Visitor)
5182 }
5183 }
5184 struct Visitor;
5185 impl<'de> serde::de::Visitor<'de> for Visitor {
5186 type Value = MethodDescriptorProto;
5187 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5188 formatter.write_str("struct MethodDescriptorProto")
5189 }
5190 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5191 where
5192 A: serde::de::MapAccess<'de>,
5193 {
5194 #[allow(unused_imports)]
5195 use serde::de::Error;
5196 use std::option::Option::Some;
5197 let mut fields = std::collections::HashSet::new();
5198 let mut result = Self::Value::new();
5199 while let Some(tag) = map.next_key::<__FieldTag>()? {
5200 #[allow(clippy::match_single_binding)]
5201 match tag {
5202 __FieldTag::__name => {
5203 if !fields.insert(__FieldTag::__name) {
5204 return std::result::Result::Err(A::Error::duplicate_field(
5205 "multiple values for name",
5206 ));
5207 }
5208 result.name = map
5209 .next_value::<std::option::Option<std::string::String>>()?
5210 .unwrap_or_default();
5211 }
5212 __FieldTag::__input_type => {
5213 if !fields.insert(__FieldTag::__input_type) {
5214 return std::result::Result::Err(A::Error::duplicate_field(
5215 "multiple values for input_type",
5216 ));
5217 }
5218 result.input_type = map
5219 .next_value::<std::option::Option<std::string::String>>()?
5220 .unwrap_or_default();
5221 }
5222 __FieldTag::__output_type => {
5223 if !fields.insert(__FieldTag::__output_type) {
5224 return std::result::Result::Err(A::Error::duplicate_field(
5225 "multiple values for output_type",
5226 ));
5227 }
5228 result.output_type = map
5229 .next_value::<std::option::Option<std::string::String>>()?
5230 .unwrap_or_default();
5231 }
5232 __FieldTag::__options => {
5233 if !fields.insert(__FieldTag::__options) {
5234 return std::result::Result::Err(A::Error::duplicate_field(
5235 "multiple values for options",
5236 ));
5237 }
5238 result.options =
5239 map.next_value::<std::option::Option<crate::MethodOptions>>()?;
5240 }
5241 __FieldTag::__client_streaming => {
5242 if !fields.insert(__FieldTag::__client_streaming) {
5243 return std::result::Result::Err(A::Error::duplicate_field(
5244 "multiple values for client_streaming",
5245 ));
5246 }
5247 result.client_streaming = map
5248 .next_value::<std::option::Option<bool>>()?
5249 .unwrap_or_default();
5250 }
5251 __FieldTag::__server_streaming => {
5252 if !fields.insert(__FieldTag::__server_streaming) {
5253 return std::result::Result::Err(A::Error::duplicate_field(
5254 "multiple values for server_streaming",
5255 ));
5256 }
5257 result.server_streaming = map
5258 .next_value::<std::option::Option<bool>>()?
5259 .unwrap_or_default();
5260 }
5261 __FieldTag::Unknown(key) => {
5262 let value = map.next_value::<serde_json::Value>()?;
5263 result._unknown_fields.insert(key, value);
5264 }
5265 }
5266 }
5267 std::result::Result::Ok(result)
5268 }
5269 }
5270 deserializer.deserialize_any(Visitor)
5271 }
5272}
5273
5274#[doc(hidden)]
5275impl serde::ser::Serialize for MethodDescriptorProto {
5276 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5277 where
5278 S: serde::ser::Serializer,
5279 {
5280 use serde::ser::SerializeMap;
5281 #[allow(unused_imports)]
5282 use std::option::Option::Some;
5283 let mut state = serializer.serialize_map(std::option::Option::None)?;
5284 if !self.name.is_empty() {
5285 state.serialize_entry("name", &self.name)?;
5286 }
5287 if !self.input_type.is_empty() {
5288 state.serialize_entry("inputType", &self.input_type)?;
5289 }
5290 if !self.output_type.is_empty() {
5291 state.serialize_entry("outputType", &self.output_type)?;
5292 }
5293 if self.options.is_some() {
5294 state.serialize_entry("options", &self.options)?;
5295 }
5296 if !wkt::internal::is_default(&self.client_streaming) {
5297 state.serialize_entry("clientStreaming", &self.client_streaming)?;
5298 }
5299 if !wkt::internal::is_default(&self.server_streaming) {
5300 state.serialize_entry("serverStreaming", &self.server_streaming)?;
5301 }
5302 if !self._unknown_fields.is_empty() {
5303 for (key, value) in self._unknown_fields.iter() {
5304 state.serialize_entry(key, &value)?;
5305 }
5306 }
5307 state.end()
5308 }
5309}
5310
5311impl std::fmt::Debug for MethodDescriptorProto {
5312 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5313 let mut debug_struct = f.debug_struct("MethodDescriptorProto");
5314 debug_struct.field("name", &self.name);
5315 debug_struct.field("input_type", &self.input_type);
5316 debug_struct.field("output_type", &self.output_type);
5317 debug_struct.field("options", &self.options);
5318 debug_struct.field("client_streaming", &self.client_streaming);
5319 debug_struct.field("server_streaming", &self.server_streaming);
5320 if !self._unknown_fields.is_empty() {
5321 debug_struct.field("_unknown_fields", &self._unknown_fields);
5322 }
5323 debug_struct.finish()
5324 }
5325}
5326
5327#[derive(Clone, Default, PartialEq)]
5328#[non_exhaustive]
5329pub struct FileOptions {
5330 pub java_package: std::string::String,
5335
5336 pub java_outer_classname: std::string::String,
5342
5343 pub java_multiple_files: bool,
5350
5351 #[deprecated]
5353 pub java_generate_equals_and_hash: bool,
5354
5355 pub java_string_check_utf8: bool,
5366
5367 pub optimize_for: crate::file_options::OptimizeMode,
5368
5369 pub go_package: std::string::String,
5376
5377 pub cc_generic_services: bool,
5388
5389 pub java_generic_services: bool,
5390
5391 pub py_generic_services: bool,
5392
5393 pub deprecated: bool,
5398
5399 pub cc_enable_arenas: bool,
5402
5403 pub objc_class_prefix: std::string::String,
5406
5407 pub csharp_namespace: std::string::String,
5409
5410 pub swift_prefix: std::string::String,
5415
5416 pub php_class_prefix: std::string::String,
5419
5420 pub php_namespace: std::string::String,
5424
5425 pub php_metadata_namespace: std::string::String,
5429
5430 pub ruby_package: std::string::String,
5434
5435 pub features: std::option::Option<crate::FeatureSet>,
5437
5438 pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
5441
5442 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5443}
5444
5445impl FileOptions {
5446 pub fn new() -> Self {
5447 std::default::Default::default()
5448 }
5449
5450 pub fn set_java_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5452 self.java_package = v.into();
5453 self
5454 }
5455
5456 pub fn set_java_outer_classname<T: std::convert::Into<std::string::String>>(
5458 mut self,
5459 v: T,
5460 ) -> Self {
5461 self.java_outer_classname = v.into();
5462 self
5463 }
5464
5465 pub fn set_java_multiple_files<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5467 self.java_multiple_files = v.into();
5468 self
5469 }
5470
5471 #[deprecated]
5473 pub fn set_java_generate_equals_and_hash<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5474 self.java_generate_equals_and_hash = v.into();
5475 self
5476 }
5477
5478 pub fn set_java_string_check_utf8<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5480 self.java_string_check_utf8 = v.into();
5481 self
5482 }
5483
5484 pub fn set_optimize_for<T: std::convert::Into<crate::file_options::OptimizeMode>>(
5486 mut self,
5487 v: T,
5488 ) -> Self {
5489 self.optimize_for = v.into();
5490 self
5491 }
5492
5493 pub fn set_go_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5495 self.go_package = v.into();
5496 self
5497 }
5498
5499 pub fn set_cc_generic_services<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5501 self.cc_generic_services = v.into();
5502 self
5503 }
5504
5505 pub fn set_java_generic_services<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5507 self.java_generic_services = v.into();
5508 self
5509 }
5510
5511 pub fn set_py_generic_services<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5513 self.py_generic_services = v.into();
5514 self
5515 }
5516
5517 pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5519 self.deprecated = v.into();
5520 self
5521 }
5522
5523 pub fn set_cc_enable_arenas<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5525 self.cc_enable_arenas = v.into();
5526 self
5527 }
5528
5529 pub fn set_objc_class_prefix<T: std::convert::Into<std::string::String>>(
5531 mut self,
5532 v: T,
5533 ) -> Self {
5534 self.objc_class_prefix = v.into();
5535 self
5536 }
5537
5538 pub fn set_csharp_namespace<T: std::convert::Into<std::string::String>>(
5540 mut self,
5541 v: T,
5542 ) -> Self {
5543 self.csharp_namespace = v.into();
5544 self
5545 }
5546
5547 pub fn set_swift_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5549 self.swift_prefix = v.into();
5550 self
5551 }
5552
5553 pub fn set_php_class_prefix<T: std::convert::Into<std::string::String>>(
5555 mut self,
5556 v: T,
5557 ) -> Self {
5558 self.php_class_prefix = v.into();
5559 self
5560 }
5561
5562 pub fn set_php_namespace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5564 self.php_namespace = v.into();
5565 self
5566 }
5567
5568 pub fn set_php_metadata_namespace<T: std::convert::Into<std::string::String>>(
5570 mut self,
5571 v: T,
5572 ) -> Self {
5573 self.php_metadata_namespace = v.into();
5574 self
5575 }
5576
5577 pub fn set_ruby_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5579 self.ruby_package = v.into();
5580 self
5581 }
5582
5583 pub fn set_features<T>(mut self, v: T) -> Self
5585 where
5586 T: std::convert::Into<crate::FeatureSet>,
5587 {
5588 self.features = std::option::Option::Some(v.into());
5589 self
5590 }
5591
5592 pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
5594 where
5595 T: std::convert::Into<crate::FeatureSet>,
5596 {
5597 self.features = v.map(|x| x.into());
5598 self
5599 }
5600
5601 pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
5603 where
5604 T: std::iter::IntoIterator<Item = V>,
5605 V: std::convert::Into<crate::UninterpretedOption>,
5606 {
5607 use std::iter::Iterator;
5608 self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
5609 self
5610 }
5611}
5612
5613impl wkt::message::Message for FileOptions {
5614 fn typename() -> &'static str {
5615 "type.googleapis.com/google.protobuf.FileOptions"
5616 }
5617}
5618
5619#[doc(hidden)]
5620impl<'de> serde::de::Deserialize<'de> for FileOptions {
5621 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5622 where
5623 D: serde::Deserializer<'de>,
5624 {
5625 #[allow(non_camel_case_types)]
5626 #[doc(hidden)]
5627 #[derive(PartialEq, Eq, Hash)]
5628 enum __FieldTag {
5629 __java_package,
5630 __java_outer_classname,
5631 __java_multiple_files,
5632 __java_generate_equals_and_hash,
5633 __java_string_check_utf8,
5634 __optimize_for,
5635 __go_package,
5636 __cc_generic_services,
5637 __java_generic_services,
5638 __py_generic_services,
5639 __deprecated,
5640 __cc_enable_arenas,
5641 __objc_class_prefix,
5642 __csharp_namespace,
5643 __swift_prefix,
5644 __php_class_prefix,
5645 __php_namespace,
5646 __php_metadata_namespace,
5647 __ruby_package,
5648 __features,
5649 __uninterpreted_option,
5650 Unknown(std::string::String),
5651 }
5652 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5653 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5654 where
5655 D: serde::Deserializer<'de>,
5656 {
5657 struct Visitor;
5658 impl<'de> serde::de::Visitor<'de> for Visitor {
5659 type Value = __FieldTag;
5660 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5661 formatter.write_str("a field name for FileOptions")
5662 }
5663 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5664 where
5665 E: serde::de::Error,
5666 {
5667 use std::result::Result::Ok;
5668 use std::string::ToString;
5669 match value {
5670 "javaPackage" => Ok(__FieldTag::__java_package),
5671 "java_package" => Ok(__FieldTag::__java_package),
5672 "javaOuterClassname" => Ok(__FieldTag::__java_outer_classname),
5673 "java_outer_classname" => Ok(__FieldTag::__java_outer_classname),
5674 "javaMultipleFiles" => Ok(__FieldTag::__java_multiple_files),
5675 "java_multiple_files" => Ok(__FieldTag::__java_multiple_files),
5676 "javaGenerateEqualsAndHash" => {
5677 Ok(__FieldTag::__java_generate_equals_and_hash)
5678 }
5679 "java_generate_equals_and_hash" => {
5680 Ok(__FieldTag::__java_generate_equals_and_hash)
5681 }
5682 "javaStringCheckUtf8" => Ok(__FieldTag::__java_string_check_utf8),
5683 "java_string_check_utf8" => Ok(__FieldTag::__java_string_check_utf8),
5684 "optimizeFor" => Ok(__FieldTag::__optimize_for),
5685 "optimize_for" => Ok(__FieldTag::__optimize_for),
5686 "goPackage" => Ok(__FieldTag::__go_package),
5687 "go_package" => Ok(__FieldTag::__go_package),
5688 "ccGenericServices" => Ok(__FieldTag::__cc_generic_services),
5689 "cc_generic_services" => Ok(__FieldTag::__cc_generic_services),
5690 "javaGenericServices" => Ok(__FieldTag::__java_generic_services),
5691 "java_generic_services" => Ok(__FieldTag::__java_generic_services),
5692 "pyGenericServices" => Ok(__FieldTag::__py_generic_services),
5693 "py_generic_services" => Ok(__FieldTag::__py_generic_services),
5694 "deprecated" => Ok(__FieldTag::__deprecated),
5695 "ccEnableArenas" => Ok(__FieldTag::__cc_enable_arenas),
5696 "cc_enable_arenas" => Ok(__FieldTag::__cc_enable_arenas),
5697 "objcClassPrefix" => Ok(__FieldTag::__objc_class_prefix),
5698 "objc_class_prefix" => Ok(__FieldTag::__objc_class_prefix),
5699 "csharpNamespace" => Ok(__FieldTag::__csharp_namespace),
5700 "csharp_namespace" => Ok(__FieldTag::__csharp_namespace),
5701 "swiftPrefix" => Ok(__FieldTag::__swift_prefix),
5702 "swift_prefix" => Ok(__FieldTag::__swift_prefix),
5703 "phpClassPrefix" => Ok(__FieldTag::__php_class_prefix),
5704 "php_class_prefix" => Ok(__FieldTag::__php_class_prefix),
5705 "phpNamespace" => Ok(__FieldTag::__php_namespace),
5706 "php_namespace" => Ok(__FieldTag::__php_namespace),
5707 "phpMetadataNamespace" => Ok(__FieldTag::__php_metadata_namespace),
5708 "php_metadata_namespace" => Ok(__FieldTag::__php_metadata_namespace),
5709 "rubyPackage" => Ok(__FieldTag::__ruby_package),
5710 "ruby_package" => Ok(__FieldTag::__ruby_package),
5711 "features" => Ok(__FieldTag::__features),
5712 "uninterpretedOption" => Ok(__FieldTag::__uninterpreted_option),
5713 "uninterpreted_option" => Ok(__FieldTag::__uninterpreted_option),
5714 _ => Ok(__FieldTag::Unknown(value.to_string())),
5715 }
5716 }
5717 }
5718 deserializer.deserialize_identifier(Visitor)
5719 }
5720 }
5721 struct Visitor;
5722 impl<'de> serde::de::Visitor<'de> for Visitor {
5723 type Value = FileOptions;
5724 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5725 formatter.write_str("struct FileOptions")
5726 }
5727 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5728 where
5729 A: serde::de::MapAccess<'de>,
5730 {
5731 #[allow(unused_imports)]
5732 use serde::de::Error;
5733 use std::option::Option::Some;
5734 let mut fields = std::collections::HashSet::new();
5735 let mut result = Self::Value::new();
5736 while let Some(tag) = map.next_key::<__FieldTag>()? {
5737 #[allow(clippy::match_single_binding)]
5738 match tag {
5739 __FieldTag::__java_package => {
5740 if !fields.insert(__FieldTag::__java_package) {
5741 return std::result::Result::Err(A::Error::duplicate_field(
5742 "multiple values for java_package",
5743 ));
5744 }
5745 result.java_package = map
5746 .next_value::<std::option::Option<std::string::String>>()?
5747 .unwrap_or_default();
5748 }
5749 __FieldTag::__java_outer_classname => {
5750 if !fields.insert(__FieldTag::__java_outer_classname) {
5751 return std::result::Result::Err(A::Error::duplicate_field(
5752 "multiple values for java_outer_classname",
5753 ));
5754 }
5755 result.java_outer_classname = map
5756 .next_value::<std::option::Option<std::string::String>>()?
5757 .unwrap_or_default();
5758 }
5759 __FieldTag::__java_multiple_files => {
5760 if !fields.insert(__FieldTag::__java_multiple_files) {
5761 return std::result::Result::Err(A::Error::duplicate_field(
5762 "multiple values for java_multiple_files",
5763 ));
5764 }
5765 result.java_multiple_files = map
5766 .next_value::<std::option::Option<bool>>()?
5767 .unwrap_or_default();
5768 }
5769 __FieldTag::__java_generate_equals_and_hash => {
5770 if !fields.insert(__FieldTag::__java_generate_equals_and_hash) {
5771 return std::result::Result::Err(A::Error::duplicate_field(
5772 "multiple values for java_generate_equals_and_hash",
5773 ));
5774 }
5775 result.java_generate_equals_and_hash = map
5776 .next_value::<std::option::Option<bool>>()?
5777 .unwrap_or_default();
5778 }
5779 __FieldTag::__java_string_check_utf8 => {
5780 if !fields.insert(__FieldTag::__java_string_check_utf8) {
5781 return std::result::Result::Err(A::Error::duplicate_field(
5782 "multiple values for java_string_check_utf8",
5783 ));
5784 }
5785 result.java_string_check_utf8 = map
5786 .next_value::<std::option::Option<bool>>()?
5787 .unwrap_or_default();
5788 }
5789 __FieldTag::__optimize_for => {
5790 if !fields.insert(__FieldTag::__optimize_for) {
5791 return std::result::Result::Err(A::Error::duplicate_field(
5792 "multiple values for optimize_for",
5793 ));
5794 }
5795 result.optimize_for = map.next_value::<std::option::Option<crate::file_options::OptimizeMode>>()?.unwrap_or_default();
5796 }
5797 __FieldTag::__go_package => {
5798 if !fields.insert(__FieldTag::__go_package) {
5799 return std::result::Result::Err(A::Error::duplicate_field(
5800 "multiple values for go_package",
5801 ));
5802 }
5803 result.go_package = map
5804 .next_value::<std::option::Option<std::string::String>>()?
5805 .unwrap_or_default();
5806 }
5807 __FieldTag::__cc_generic_services => {
5808 if !fields.insert(__FieldTag::__cc_generic_services) {
5809 return std::result::Result::Err(A::Error::duplicate_field(
5810 "multiple values for cc_generic_services",
5811 ));
5812 }
5813 result.cc_generic_services = map
5814 .next_value::<std::option::Option<bool>>()?
5815 .unwrap_or_default();
5816 }
5817 __FieldTag::__java_generic_services => {
5818 if !fields.insert(__FieldTag::__java_generic_services) {
5819 return std::result::Result::Err(A::Error::duplicate_field(
5820 "multiple values for java_generic_services",
5821 ));
5822 }
5823 result.java_generic_services = map
5824 .next_value::<std::option::Option<bool>>()?
5825 .unwrap_or_default();
5826 }
5827 __FieldTag::__py_generic_services => {
5828 if !fields.insert(__FieldTag::__py_generic_services) {
5829 return std::result::Result::Err(A::Error::duplicate_field(
5830 "multiple values for py_generic_services",
5831 ));
5832 }
5833 result.py_generic_services = map
5834 .next_value::<std::option::Option<bool>>()?
5835 .unwrap_or_default();
5836 }
5837 __FieldTag::__deprecated => {
5838 if !fields.insert(__FieldTag::__deprecated) {
5839 return std::result::Result::Err(A::Error::duplicate_field(
5840 "multiple values for deprecated",
5841 ));
5842 }
5843 result.deprecated = map
5844 .next_value::<std::option::Option<bool>>()?
5845 .unwrap_or_default();
5846 }
5847 __FieldTag::__cc_enable_arenas => {
5848 if !fields.insert(__FieldTag::__cc_enable_arenas) {
5849 return std::result::Result::Err(A::Error::duplicate_field(
5850 "multiple values for cc_enable_arenas",
5851 ));
5852 }
5853 result.cc_enable_arenas = map
5854 .next_value::<std::option::Option<bool>>()?
5855 .unwrap_or_default();
5856 }
5857 __FieldTag::__objc_class_prefix => {
5858 if !fields.insert(__FieldTag::__objc_class_prefix) {
5859 return std::result::Result::Err(A::Error::duplicate_field(
5860 "multiple values for objc_class_prefix",
5861 ));
5862 }
5863 result.objc_class_prefix = map
5864 .next_value::<std::option::Option<std::string::String>>()?
5865 .unwrap_or_default();
5866 }
5867 __FieldTag::__csharp_namespace => {
5868 if !fields.insert(__FieldTag::__csharp_namespace) {
5869 return std::result::Result::Err(A::Error::duplicate_field(
5870 "multiple values for csharp_namespace",
5871 ));
5872 }
5873 result.csharp_namespace = map
5874 .next_value::<std::option::Option<std::string::String>>()?
5875 .unwrap_or_default();
5876 }
5877 __FieldTag::__swift_prefix => {
5878 if !fields.insert(__FieldTag::__swift_prefix) {
5879 return std::result::Result::Err(A::Error::duplicate_field(
5880 "multiple values for swift_prefix",
5881 ));
5882 }
5883 result.swift_prefix = map
5884 .next_value::<std::option::Option<std::string::String>>()?
5885 .unwrap_or_default();
5886 }
5887 __FieldTag::__php_class_prefix => {
5888 if !fields.insert(__FieldTag::__php_class_prefix) {
5889 return std::result::Result::Err(A::Error::duplicate_field(
5890 "multiple values for php_class_prefix",
5891 ));
5892 }
5893 result.php_class_prefix = map
5894 .next_value::<std::option::Option<std::string::String>>()?
5895 .unwrap_or_default();
5896 }
5897 __FieldTag::__php_namespace => {
5898 if !fields.insert(__FieldTag::__php_namespace) {
5899 return std::result::Result::Err(A::Error::duplicate_field(
5900 "multiple values for php_namespace",
5901 ));
5902 }
5903 result.php_namespace = map
5904 .next_value::<std::option::Option<std::string::String>>()?
5905 .unwrap_or_default();
5906 }
5907 __FieldTag::__php_metadata_namespace => {
5908 if !fields.insert(__FieldTag::__php_metadata_namespace) {
5909 return std::result::Result::Err(A::Error::duplicate_field(
5910 "multiple values for php_metadata_namespace",
5911 ));
5912 }
5913 result.php_metadata_namespace = map
5914 .next_value::<std::option::Option<std::string::String>>()?
5915 .unwrap_or_default();
5916 }
5917 __FieldTag::__ruby_package => {
5918 if !fields.insert(__FieldTag::__ruby_package) {
5919 return std::result::Result::Err(A::Error::duplicate_field(
5920 "multiple values for ruby_package",
5921 ));
5922 }
5923 result.ruby_package = map
5924 .next_value::<std::option::Option<std::string::String>>()?
5925 .unwrap_or_default();
5926 }
5927 __FieldTag::__features => {
5928 if !fields.insert(__FieldTag::__features) {
5929 return std::result::Result::Err(A::Error::duplicate_field(
5930 "multiple values for features",
5931 ));
5932 }
5933 result.features =
5934 map.next_value::<std::option::Option<crate::FeatureSet>>()?;
5935 }
5936 __FieldTag::__uninterpreted_option => {
5937 if !fields.insert(__FieldTag::__uninterpreted_option) {
5938 return std::result::Result::Err(A::Error::duplicate_field(
5939 "multiple values for uninterpreted_option",
5940 ));
5941 }
5942 result.uninterpreted_option = map.next_value::<std::option::Option<std::vec::Vec<crate::UninterpretedOption>>>()?.unwrap_or_default();
5943 }
5944 __FieldTag::Unknown(key) => {
5945 let value = map.next_value::<serde_json::Value>()?;
5946 result._unknown_fields.insert(key, value);
5947 }
5948 }
5949 }
5950 std::result::Result::Ok(result)
5951 }
5952 }
5953 deserializer.deserialize_any(Visitor)
5954 }
5955}
5956
5957#[doc(hidden)]
5958impl serde::ser::Serialize for FileOptions {
5959 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5960 where
5961 S: serde::ser::Serializer,
5962 {
5963 use serde::ser::SerializeMap;
5964 #[allow(unused_imports)]
5965 use std::option::Option::Some;
5966 let mut state = serializer.serialize_map(std::option::Option::None)?;
5967 if !self.java_package.is_empty() {
5968 state.serialize_entry("javaPackage", &self.java_package)?;
5969 }
5970 if !self.java_outer_classname.is_empty() {
5971 state.serialize_entry("javaOuterClassname", &self.java_outer_classname)?;
5972 }
5973 if !wkt::internal::is_default(&self.java_multiple_files) {
5974 state.serialize_entry("javaMultipleFiles", &self.java_multiple_files)?;
5975 }
5976 if !wkt::internal::is_default(&self.java_generate_equals_and_hash) {
5977 state.serialize_entry(
5978 "javaGenerateEqualsAndHash",
5979 &self.java_generate_equals_and_hash,
5980 )?;
5981 }
5982 if !wkt::internal::is_default(&self.java_string_check_utf8) {
5983 state.serialize_entry("javaStringCheckUtf8", &self.java_string_check_utf8)?;
5984 }
5985 if !wkt::internal::is_default(&self.optimize_for) {
5986 state.serialize_entry("optimizeFor", &self.optimize_for)?;
5987 }
5988 if !self.go_package.is_empty() {
5989 state.serialize_entry("goPackage", &self.go_package)?;
5990 }
5991 if !wkt::internal::is_default(&self.cc_generic_services) {
5992 state.serialize_entry("ccGenericServices", &self.cc_generic_services)?;
5993 }
5994 if !wkt::internal::is_default(&self.java_generic_services) {
5995 state.serialize_entry("javaGenericServices", &self.java_generic_services)?;
5996 }
5997 if !wkt::internal::is_default(&self.py_generic_services) {
5998 state.serialize_entry("pyGenericServices", &self.py_generic_services)?;
5999 }
6000 if !wkt::internal::is_default(&self.deprecated) {
6001 state.serialize_entry("deprecated", &self.deprecated)?;
6002 }
6003 if !wkt::internal::is_default(&self.cc_enable_arenas) {
6004 state.serialize_entry("ccEnableArenas", &self.cc_enable_arenas)?;
6005 }
6006 if !self.objc_class_prefix.is_empty() {
6007 state.serialize_entry("objcClassPrefix", &self.objc_class_prefix)?;
6008 }
6009 if !self.csharp_namespace.is_empty() {
6010 state.serialize_entry("csharpNamespace", &self.csharp_namespace)?;
6011 }
6012 if !self.swift_prefix.is_empty() {
6013 state.serialize_entry("swiftPrefix", &self.swift_prefix)?;
6014 }
6015 if !self.php_class_prefix.is_empty() {
6016 state.serialize_entry("phpClassPrefix", &self.php_class_prefix)?;
6017 }
6018 if !self.php_namespace.is_empty() {
6019 state.serialize_entry("phpNamespace", &self.php_namespace)?;
6020 }
6021 if !self.php_metadata_namespace.is_empty() {
6022 state.serialize_entry("phpMetadataNamespace", &self.php_metadata_namespace)?;
6023 }
6024 if !self.ruby_package.is_empty() {
6025 state.serialize_entry("rubyPackage", &self.ruby_package)?;
6026 }
6027 if self.features.is_some() {
6028 state.serialize_entry("features", &self.features)?;
6029 }
6030 if !self.uninterpreted_option.is_empty() {
6031 state.serialize_entry("uninterpretedOption", &self.uninterpreted_option)?;
6032 }
6033 if !self._unknown_fields.is_empty() {
6034 for (key, value) in self._unknown_fields.iter() {
6035 state.serialize_entry(key, &value)?;
6036 }
6037 }
6038 state.end()
6039 }
6040}
6041
6042impl std::fmt::Debug for FileOptions {
6043 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6044 let mut debug_struct = f.debug_struct("FileOptions");
6045 debug_struct.field("java_package", &self.java_package);
6046 debug_struct.field("java_outer_classname", &self.java_outer_classname);
6047 debug_struct.field("java_multiple_files", &self.java_multiple_files);
6048 debug_struct.field(
6049 "java_generate_equals_and_hash",
6050 &self.java_generate_equals_and_hash,
6051 );
6052 debug_struct.field("java_string_check_utf8", &self.java_string_check_utf8);
6053 debug_struct.field("optimize_for", &self.optimize_for);
6054 debug_struct.field("go_package", &self.go_package);
6055 debug_struct.field("cc_generic_services", &self.cc_generic_services);
6056 debug_struct.field("java_generic_services", &self.java_generic_services);
6057 debug_struct.field("py_generic_services", &self.py_generic_services);
6058 debug_struct.field("deprecated", &self.deprecated);
6059 debug_struct.field("cc_enable_arenas", &self.cc_enable_arenas);
6060 debug_struct.field("objc_class_prefix", &self.objc_class_prefix);
6061 debug_struct.field("csharp_namespace", &self.csharp_namespace);
6062 debug_struct.field("swift_prefix", &self.swift_prefix);
6063 debug_struct.field("php_class_prefix", &self.php_class_prefix);
6064 debug_struct.field("php_namespace", &self.php_namespace);
6065 debug_struct.field("php_metadata_namespace", &self.php_metadata_namespace);
6066 debug_struct.field("ruby_package", &self.ruby_package);
6067 debug_struct.field("features", &self.features);
6068 debug_struct.field("uninterpreted_option", &self.uninterpreted_option);
6069 if !self._unknown_fields.is_empty() {
6070 debug_struct.field("_unknown_fields", &self._unknown_fields);
6071 }
6072 debug_struct.finish()
6073 }
6074}
6075
6076pub mod file_options {
6078 #[allow(unused_imports)]
6079 use super::*;
6080
6081 #[derive(Clone, Debug, PartialEq)]
6097 #[non_exhaustive]
6098 pub enum OptimizeMode {
6099 Speed,
6100 CodeSize,
6102 LiteRuntime,
6103 UnknownValue(optimize_mode::UnknownValue),
6108 }
6109
6110 #[doc(hidden)]
6111 pub mod optimize_mode {
6112 #[allow(unused_imports)]
6113 use super::*;
6114 #[derive(Clone, Debug, PartialEq)]
6115 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6116 }
6117
6118 impl OptimizeMode {
6119 pub fn value(&self) -> std::option::Option<i32> {
6124 match self {
6125 Self::Speed => std::option::Option::Some(1),
6126 Self::CodeSize => std::option::Option::Some(2),
6127 Self::LiteRuntime => std::option::Option::Some(3),
6128 Self::UnknownValue(u) => u.0.value(),
6129 }
6130 }
6131
6132 pub fn name(&self) -> std::option::Option<&str> {
6137 match self {
6138 Self::Speed => std::option::Option::Some("SPEED"),
6139 Self::CodeSize => std::option::Option::Some("CODE_SIZE"),
6140 Self::LiteRuntime => std::option::Option::Some("LITE_RUNTIME"),
6141 Self::UnknownValue(u) => u.0.name(),
6142 }
6143 }
6144 }
6145
6146 impl std::default::Default for OptimizeMode {
6147 fn default() -> Self {
6148 use std::convert::From;
6149 Self::from(0)
6150 }
6151 }
6152
6153 impl std::fmt::Display for OptimizeMode {
6154 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6155 wkt::internal::display_enum(f, self.name(), self.value())
6156 }
6157 }
6158
6159 impl std::convert::From<i32> for OptimizeMode {
6160 fn from(value: i32) -> Self {
6161 match value {
6162 1 => Self::Speed,
6163 2 => Self::CodeSize,
6164 3 => Self::LiteRuntime,
6165 _ => Self::UnknownValue(optimize_mode::UnknownValue(
6166 wkt::internal::UnknownEnumValue::Integer(value),
6167 )),
6168 }
6169 }
6170 }
6171
6172 impl std::convert::From<&str> for OptimizeMode {
6173 fn from(value: &str) -> Self {
6174 use std::string::ToString;
6175 match value {
6176 "SPEED" => Self::Speed,
6177 "CODE_SIZE" => Self::CodeSize,
6178 "LITE_RUNTIME" => Self::LiteRuntime,
6179 _ => Self::UnknownValue(optimize_mode::UnknownValue(
6180 wkt::internal::UnknownEnumValue::String(value.to_string()),
6181 )),
6182 }
6183 }
6184 }
6185
6186 impl serde::ser::Serialize for OptimizeMode {
6187 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6188 where
6189 S: serde::Serializer,
6190 {
6191 match self {
6192 Self::Speed => serializer.serialize_i32(1),
6193 Self::CodeSize => serializer.serialize_i32(2),
6194 Self::LiteRuntime => serializer.serialize_i32(3),
6195 Self::UnknownValue(u) => u.0.serialize(serializer),
6196 }
6197 }
6198 }
6199
6200 impl<'de> serde::de::Deserialize<'de> for OptimizeMode {
6201 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6202 where
6203 D: serde::Deserializer<'de>,
6204 {
6205 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OptimizeMode>::new(
6206 ".google.protobuf.FileOptions.OptimizeMode",
6207 ))
6208 }
6209 }
6210}
6211
6212#[derive(Clone, Default, PartialEq)]
6213#[non_exhaustive]
6214pub struct MessageOptions {
6215 pub message_set_wire_format: bool,
6234
6235 pub no_standard_descriptor_accessor: bool,
6239
6240 pub deprecated: bool,
6245
6246 pub map_entry: bool,
6268
6269 #[deprecated]
6280 pub deprecated_legacy_json_field_conflicts: bool,
6281
6282 pub features: std::option::Option<crate::FeatureSet>,
6284
6285 pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
6287
6288 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6289}
6290
6291impl MessageOptions {
6292 pub fn new() -> Self {
6293 std::default::Default::default()
6294 }
6295
6296 pub fn set_message_set_wire_format<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6298 self.message_set_wire_format = v.into();
6299 self
6300 }
6301
6302 pub fn set_no_standard_descriptor_accessor<T: std::convert::Into<bool>>(
6304 mut self,
6305 v: T,
6306 ) -> Self {
6307 self.no_standard_descriptor_accessor = v.into();
6308 self
6309 }
6310
6311 pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6313 self.deprecated = v.into();
6314 self
6315 }
6316
6317 pub fn set_map_entry<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6319 self.map_entry = v.into();
6320 self
6321 }
6322
6323 #[deprecated]
6325 pub fn set_deprecated_legacy_json_field_conflicts<T: std::convert::Into<bool>>(
6326 mut self,
6327 v: T,
6328 ) -> Self {
6329 self.deprecated_legacy_json_field_conflicts = v.into();
6330 self
6331 }
6332
6333 pub fn set_features<T>(mut self, v: T) -> Self
6335 where
6336 T: std::convert::Into<crate::FeatureSet>,
6337 {
6338 self.features = std::option::Option::Some(v.into());
6339 self
6340 }
6341
6342 pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
6344 where
6345 T: std::convert::Into<crate::FeatureSet>,
6346 {
6347 self.features = v.map(|x| x.into());
6348 self
6349 }
6350
6351 pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
6353 where
6354 T: std::iter::IntoIterator<Item = V>,
6355 V: std::convert::Into<crate::UninterpretedOption>,
6356 {
6357 use std::iter::Iterator;
6358 self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
6359 self
6360 }
6361}
6362
6363impl wkt::message::Message for MessageOptions {
6364 fn typename() -> &'static str {
6365 "type.googleapis.com/google.protobuf.MessageOptions"
6366 }
6367}
6368
6369#[doc(hidden)]
6370impl<'de> serde::de::Deserialize<'de> for MessageOptions {
6371 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6372 where
6373 D: serde::Deserializer<'de>,
6374 {
6375 #[allow(non_camel_case_types)]
6376 #[doc(hidden)]
6377 #[derive(PartialEq, Eq, Hash)]
6378 enum __FieldTag {
6379 __message_set_wire_format,
6380 __no_standard_descriptor_accessor,
6381 __deprecated,
6382 __map_entry,
6383 __deprecated_legacy_json_field_conflicts,
6384 __features,
6385 __uninterpreted_option,
6386 Unknown(std::string::String),
6387 }
6388 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6389 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6390 where
6391 D: serde::Deserializer<'de>,
6392 {
6393 struct Visitor;
6394 impl<'de> serde::de::Visitor<'de> for Visitor {
6395 type Value = __FieldTag;
6396 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6397 formatter.write_str("a field name for MessageOptions")
6398 }
6399 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6400 where
6401 E: serde::de::Error,
6402 {
6403 use std::result::Result::Ok;
6404 use std::string::ToString;
6405 match value {
6406 "messageSetWireFormat" => Ok(__FieldTag::__message_set_wire_format),
6407 "message_set_wire_format" => Ok(__FieldTag::__message_set_wire_format),
6408 "noStandardDescriptorAccessor" => {
6409 Ok(__FieldTag::__no_standard_descriptor_accessor)
6410 }
6411 "no_standard_descriptor_accessor" => {
6412 Ok(__FieldTag::__no_standard_descriptor_accessor)
6413 }
6414 "deprecated" => Ok(__FieldTag::__deprecated),
6415 "mapEntry" => Ok(__FieldTag::__map_entry),
6416 "map_entry" => Ok(__FieldTag::__map_entry),
6417 "deprecatedLegacyJsonFieldConflicts" => {
6418 Ok(__FieldTag::__deprecated_legacy_json_field_conflicts)
6419 }
6420 "deprecated_legacy_json_field_conflicts" => {
6421 Ok(__FieldTag::__deprecated_legacy_json_field_conflicts)
6422 }
6423 "features" => Ok(__FieldTag::__features),
6424 "uninterpretedOption" => Ok(__FieldTag::__uninterpreted_option),
6425 "uninterpreted_option" => Ok(__FieldTag::__uninterpreted_option),
6426 _ => Ok(__FieldTag::Unknown(value.to_string())),
6427 }
6428 }
6429 }
6430 deserializer.deserialize_identifier(Visitor)
6431 }
6432 }
6433 struct Visitor;
6434 impl<'de> serde::de::Visitor<'de> for Visitor {
6435 type Value = MessageOptions;
6436 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6437 formatter.write_str("struct MessageOptions")
6438 }
6439 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6440 where
6441 A: serde::de::MapAccess<'de>,
6442 {
6443 #[allow(unused_imports)]
6444 use serde::de::Error;
6445 use std::option::Option::Some;
6446 let mut fields = std::collections::HashSet::new();
6447 let mut result = Self::Value::new();
6448 while let Some(tag) = map.next_key::<__FieldTag>()? {
6449 #[allow(clippy::match_single_binding)]
6450 match tag {
6451 __FieldTag::__message_set_wire_format => {
6452 if !fields.insert(__FieldTag::__message_set_wire_format) {
6453 return std::result::Result::Err(A::Error::duplicate_field(
6454 "multiple values for message_set_wire_format",
6455 ));
6456 }
6457 result.message_set_wire_format = map
6458 .next_value::<std::option::Option<bool>>()?
6459 .unwrap_or_default();
6460 }
6461 __FieldTag::__no_standard_descriptor_accessor => {
6462 if !fields.insert(__FieldTag::__no_standard_descriptor_accessor) {
6463 return std::result::Result::Err(A::Error::duplicate_field(
6464 "multiple values for no_standard_descriptor_accessor",
6465 ));
6466 }
6467 result.no_standard_descriptor_accessor = map
6468 .next_value::<std::option::Option<bool>>()?
6469 .unwrap_or_default();
6470 }
6471 __FieldTag::__deprecated => {
6472 if !fields.insert(__FieldTag::__deprecated) {
6473 return std::result::Result::Err(A::Error::duplicate_field(
6474 "multiple values for deprecated",
6475 ));
6476 }
6477 result.deprecated = map
6478 .next_value::<std::option::Option<bool>>()?
6479 .unwrap_or_default();
6480 }
6481 __FieldTag::__map_entry => {
6482 if !fields.insert(__FieldTag::__map_entry) {
6483 return std::result::Result::Err(A::Error::duplicate_field(
6484 "multiple values for map_entry",
6485 ));
6486 }
6487 result.map_entry = map
6488 .next_value::<std::option::Option<bool>>()?
6489 .unwrap_or_default();
6490 }
6491 __FieldTag::__deprecated_legacy_json_field_conflicts => {
6492 if !fields.insert(__FieldTag::__deprecated_legacy_json_field_conflicts)
6493 {
6494 return std::result::Result::Err(A::Error::duplicate_field(
6495 "multiple values for deprecated_legacy_json_field_conflicts",
6496 ));
6497 }
6498 result.deprecated_legacy_json_field_conflicts = map
6499 .next_value::<std::option::Option<bool>>()?
6500 .unwrap_or_default();
6501 }
6502 __FieldTag::__features => {
6503 if !fields.insert(__FieldTag::__features) {
6504 return std::result::Result::Err(A::Error::duplicate_field(
6505 "multiple values for features",
6506 ));
6507 }
6508 result.features =
6509 map.next_value::<std::option::Option<crate::FeatureSet>>()?;
6510 }
6511 __FieldTag::__uninterpreted_option => {
6512 if !fields.insert(__FieldTag::__uninterpreted_option) {
6513 return std::result::Result::Err(A::Error::duplicate_field(
6514 "multiple values for uninterpreted_option",
6515 ));
6516 }
6517 result.uninterpreted_option = map.next_value::<std::option::Option<std::vec::Vec<crate::UninterpretedOption>>>()?.unwrap_or_default();
6518 }
6519 __FieldTag::Unknown(key) => {
6520 let value = map.next_value::<serde_json::Value>()?;
6521 result._unknown_fields.insert(key, value);
6522 }
6523 }
6524 }
6525 std::result::Result::Ok(result)
6526 }
6527 }
6528 deserializer.deserialize_any(Visitor)
6529 }
6530}
6531
6532#[doc(hidden)]
6533impl serde::ser::Serialize for MessageOptions {
6534 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6535 where
6536 S: serde::ser::Serializer,
6537 {
6538 use serde::ser::SerializeMap;
6539 #[allow(unused_imports)]
6540 use std::option::Option::Some;
6541 let mut state = serializer.serialize_map(std::option::Option::None)?;
6542 if !wkt::internal::is_default(&self.message_set_wire_format) {
6543 state.serialize_entry("messageSetWireFormat", &self.message_set_wire_format)?;
6544 }
6545 if !wkt::internal::is_default(&self.no_standard_descriptor_accessor) {
6546 state.serialize_entry(
6547 "noStandardDescriptorAccessor",
6548 &self.no_standard_descriptor_accessor,
6549 )?;
6550 }
6551 if !wkt::internal::is_default(&self.deprecated) {
6552 state.serialize_entry("deprecated", &self.deprecated)?;
6553 }
6554 if !wkt::internal::is_default(&self.map_entry) {
6555 state.serialize_entry("mapEntry", &self.map_entry)?;
6556 }
6557 if !wkt::internal::is_default(&self.deprecated_legacy_json_field_conflicts) {
6558 state.serialize_entry(
6559 "deprecatedLegacyJsonFieldConflicts",
6560 &self.deprecated_legacy_json_field_conflicts,
6561 )?;
6562 }
6563 if self.features.is_some() {
6564 state.serialize_entry("features", &self.features)?;
6565 }
6566 if !self.uninterpreted_option.is_empty() {
6567 state.serialize_entry("uninterpretedOption", &self.uninterpreted_option)?;
6568 }
6569 if !self._unknown_fields.is_empty() {
6570 for (key, value) in self._unknown_fields.iter() {
6571 state.serialize_entry(key, &value)?;
6572 }
6573 }
6574 state.end()
6575 }
6576}
6577
6578impl std::fmt::Debug for MessageOptions {
6579 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6580 let mut debug_struct = f.debug_struct("MessageOptions");
6581 debug_struct.field("message_set_wire_format", &self.message_set_wire_format);
6582 debug_struct.field(
6583 "no_standard_descriptor_accessor",
6584 &self.no_standard_descriptor_accessor,
6585 );
6586 debug_struct.field("deprecated", &self.deprecated);
6587 debug_struct.field("map_entry", &self.map_entry);
6588 debug_struct.field(
6589 "deprecated_legacy_json_field_conflicts",
6590 &self.deprecated_legacy_json_field_conflicts,
6591 );
6592 debug_struct.field("features", &self.features);
6593 debug_struct.field("uninterpreted_option", &self.uninterpreted_option);
6594 if !self._unknown_fields.is_empty() {
6595 debug_struct.field("_unknown_fields", &self._unknown_fields);
6596 }
6597 debug_struct.finish()
6598 }
6599}
6600
6601#[derive(Clone, Default, PartialEq)]
6602#[non_exhaustive]
6603pub struct FieldOptions {
6604 pub ctype: crate::field_options::CType,
6612
6613 pub packed: bool,
6621
6622 pub jstype: crate::field_options::JSType,
6634
6635 pub lazy: bool,
6658
6659 pub unverified_lazy: bool,
6663
6664 pub deprecated: bool,
6669
6670 pub weak: bool,
6672
6673 pub debug_redact: bool,
6676
6677 pub retention: crate::field_options::OptionRetention,
6678
6679 pub targets: std::vec::Vec<crate::field_options::OptionTargetType>,
6680
6681 pub edition_defaults: std::vec::Vec<crate::field_options::EditionDefault>,
6682
6683 pub features: std::option::Option<crate::FeatureSet>,
6685
6686 pub feature_support: std::option::Option<crate::field_options::FeatureSupport>,
6687
6688 pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
6690
6691 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6692}
6693
6694impl FieldOptions {
6695 pub fn new() -> Self {
6696 std::default::Default::default()
6697 }
6698
6699 pub fn set_ctype<T: std::convert::Into<crate::field_options::CType>>(mut self, v: T) -> Self {
6701 self.ctype = v.into();
6702 self
6703 }
6704
6705 pub fn set_packed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6707 self.packed = v.into();
6708 self
6709 }
6710
6711 pub fn set_jstype<T: std::convert::Into<crate::field_options::JSType>>(mut self, v: T) -> Self {
6713 self.jstype = v.into();
6714 self
6715 }
6716
6717 pub fn set_lazy<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6719 self.lazy = v.into();
6720 self
6721 }
6722
6723 pub fn set_unverified_lazy<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6725 self.unverified_lazy = v.into();
6726 self
6727 }
6728
6729 pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6731 self.deprecated = v.into();
6732 self
6733 }
6734
6735 pub fn set_weak<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6737 self.weak = v.into();
6738 self
6739 }
6740
6741 pub fn set_debug_redact<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6743 self.debug_redact = v.into();
6744 self
6745 }
6746
6747 pub fn set_retention<T: std::convert::Into<crate::field_options::OptionRetention>>(
6749 mut self,
6750 v: T,
6751 ) -> Self {
6752 self.retention = v.into();
6753 self
6754 }
6755
6756 pub fn set_targets<T, V>(mut self, v: T) -> Self
6758 where
6759 T: std::iter::IntoIterator<Item = V>,
6760 V: std::convert::Into<crate::field_options::OptionTargetType>,
6761 {
6762 use std::iter::Iterator;
6763 self.targets = v.into_iter().map(|i| i.into()).collect();
6764 self
6765 }
6766
6767 pub fn set_edition_defaults<T, V>(mut self, v: T) -> Self
6769 where
6770 T: std::iter::IntoIterator<Item = V>,
6771 V: std::convert::Into<crate::field_options::EditionDefault>,
6772 {
6773 use std::iter::Iterator;
6774 self.edition_defaults = v.into_iter().map(|i| i.into()).collect();
6775 self
6776 }
6777
6778 pub fn set_features<T>(mut self, v: T) -> Self
6780 where
6781 T: std::convert::Into<crate::FeatureSet>,
6782 {
6783 self.features = std::option::Option::Some(v.into());
6784 self
6785 }
6786
6787 pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
6789 where
6790 T: std::convert::Into<crate::FeatureSet>,
6791 {
6792 self.features = v.map(|x| x.into());
6793 self
6794 }
6795
6796 pub fn set_feature_support<T>(mut self, v: T) -> Self
6798 where
6799 T: std::convert::Into<crate::field_options::FeatureSupport>,
6800 {
6801 self.feature_support = std::option::Option::Some(v.into());
6802 self
6803 }
6804
6805 pub fn set_or_clear_feature_support<T>(mut self, v: std::option::Option<T>) -> Self
6807 where
6808 T: std::convert::Into<crate::field_options::FeatureSupport>,
6809 {
6810 self.feature_support = v.map(|x| x.into());
6811 self
6812 }
6813
6814 pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
6816 where
6817 T: std::iter::IntoIterator<Item = V>,
6818 V: std::convert::Into<crate::UninterpretedOption>,
6819 {
6820 use std::iter::Iterator;
6821 self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
6822 self
6823 }
6824}
6825
6826impl wkt::message::Message for FieldOptions {
6827 fn typename() -> &'static str {
6828 "type.googleapis.com/google.protobuf.FieldOptions"
6829 }
6830}
6831
6832#[doc(hidden)]
6833impl<'de> serde::de::Deserialize<'de> for FieldOptions {
6834 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6835 where
6836 D: serde::Deserializer<'de>,
6837 {
6838 #[allow(non_camel_case_types)]
6839 #[doc(hidden)]
6840 #[derive(PartialEq, Eq, Hash)]
6841 enum __FieldTag {
6842 __ctype,
6843 __packed,
6844 __jstype,
6845 __lazy,
6846 __unverified_lazy,
6847 __deprecated,
6848 __weak,
6849 __debug_redact,
6850 __retention,
6851 __targets,
6852 __edition_defaults,
6853 __features,
6854 __feature_support,
6855 __uninterpreted_option,
6856 Unknown(std::string::String),
6857 }
6858 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6859 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6860 where
6861 D: serde::Deserializer<'de>,
6862 {
6863 struct Visitor;
6864 impl<'de> serde::de::Visitor<'de> for Visitor {
6865 type Value = __FieldTag;
6866 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6867 formatter.write_str("a field name for FieldOptions")
6868 }
6869 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6870 where
6871 E: serde::de::Error,
6872 {
6873 use std::result::Result::Ok;
6874 use std::string::ToString;
6875 match value {
6876 "ctype" => Ok(__FieldTag::__ctype),
6877 "packed" => Ok(__FieldTag::__packed),
6878 "jstype" => Ok(__FieldTag::__jstype),
6879 "lazy" => Ok(__FieldTag::__lazy),
6880 "unverifiedLazy" => Ok(__FieldTag::__unverified_lazy),
6881 "unverified_lazy" => Ok(__FieldTag::__unverified_lazy),
6882 "deprecated" => Ok(__FieldTag::__deprecated),
6883 "weak" => Ok(__FieldTag::__weak),
6884 "debugRedact" => Ok(__FieldTag::__debug_redact),
6885 "debug_redact" => Ok(__FieldTag::__debug_redact),
6886 "retention" => Ok(__FieldTag::__retention),
6887 "targets" => Ok(__FieldTag::__targets),
6888 "editionDefaults" => Ok(__FieldTag::__edition_defaults),
6889 "edition_defaults" => Ok(__FieldTag::__edition_defaults),
6890 "features" => Ok(__FieldTag::__features),
6891 "featureSupport" => Ok(__FieldTag::__feature_support),
6892 "feature_support" => Ok(__FieldTag::__feature_support),
6893 "uninterpretedOption" => Ok(__FieldTag::__uninterpreted_option),
6894 "uninterpreted_option" => Ok(__FieldTag::__uninterpreted_option),
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 = FieldOptions;
6905 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6906 formatter.write_str("struct FieldOptions")
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::__ctype => {
6921 if !fields.insert(__FieldTag::__ctype) {
6922 return std::result::Result::Err(A::Error::duplicate_field(
6923 "multiple values for ctype",
6924 ));
6925 }
6926 result.ctype = map
6927 .next_value::<std::option::Option<crate::field_options::CType>>()?
6928 .unwrap_or_default();
6929 }
6930 __FieldTag::__packed => {
6931 if !fields.insert(__FieldTag::__packed) {
6932 return std::result::Result::Err(A::Error::duplicate_field(
6933 "multiple values for packed",
6934 ));
6935 }
6936 result.packed = map
6937 .next_value::<std::option::Option<bool>>()?
6938 .unwrap_or_default();
6939 }
6940 __FieldTag::__jstype => {
6941 if !fields.insert(__FieldTag::__jstype) {
6942 return std::result::Result::Err(A::Error::duplicate_field(
6943 "multiple values for jstype",
6944 ));
6945 }
6946 result.jstype = map
6947 .next_value::<std::option::Option<crate::field_options::JSType>>()?
6948 .unwrap_or_default();
6949 }
6950 __FieldTag::__lazy => {
6951 if !fields.insert(__FieldTag::__lazy) {
6952 return std::result::Result::Err(A::Error::duplicate_field(
6953 "multiple values for lazy",
6954 ));
6955 }
6956 result.lazy = map
6957 .next_value::<std::option::Option<bool>>()?
6958 .unwrap_or_default();
6959 }
6960 __FieldTag::__unverified_lazy => {
6961 if !fields.insert(__FieldTag::__unverified_lazy) {
6962 return std::result::Result::Err(A::Error::duplicate_field(
6963 "multiple values for unverified_lazy",
6964 ));
6965 }
6966 result.unverified_lazy = map
6967 .next_value::<std::option::Option<bool>>()?
6968 .unwrap_or_default();
6969 }
6970 __FieldTag::__deprecated => {
6971 if !fields.insert(__FieldTag::__deprecated) {
6972 return std::result::Result::Err(A::Error::duplicate_field(
6973 "multiple values for deprecated",
6974 ));
6975 }
6976 result.deprecated = map
6977 .next_value::<std::option::Option<bool>>()?
6978 .unwrap_or_default();
6979 }
6980 __FieldTag::__weak => {
6981 if !fields.insert(__FieldTag::__weak) {
6982 return std::result::Result::Err(A::Error::duplicate_field(
6983 "multiple values for weak",
6984 ));
6985 }
6986 result.weak = map
6987 .next_value::<std::option::Option<bool>>()?
6988 .unwrap_or_default();
6989 }
6990 __FieldTag::__debug_redact => {
6991 if !fields.insert(__FieldTag::__debug_redact) {
6992 return std::result::Result::Err(A::Error::duplicate_field(
6993 "multiple values for debug_redact",
6994 ));
6995 }
6996 result.debug_redact = map
6997 .next_value::<std::option::Option<bool>>()?
6998 .unwrap_or_default();
6999 }
7000 __FieldTag::__retention => {
7001 if !fields.insert(__FieldTag::__retention) {
7002 return std::result::Result::Err(A::Error::duplicate_field(
7003 "multiple values for retention",
7004 ));
7005 }
7006 result.retention = map.next_value::<std::option::Option<crate::field_options::OptionRetention>>()?.unwrap_or_default();
7007 }
7008 __FieldTag::__targets => {
7009 if !fields.insert(__FieldTag::__targets) {
7010 return std::result::Result::Err(A::Error::duplicate_field(
7011 "multiple values for targets",
7012 ));
7013 }
7014 result.targets = map
7015 .next_value::<std::option::Option<
7016 std::vec::Vec<crate::field_options::OptionTargetType>,
7017 >>()?
7018 .unwrap_or_default();
7019 }
7020 __FieldTag::__edition_defaults => {
7021 if !fields.insert(__FieldTag::__edition_defaults) {
7022 return std::result::Result::Err(A::Error::duplicate_field(
7023 "multiple values for edition_defaults",
7024 ));
7025 }
7026 result.edition_defaults = map
7027 .next_value::<std::option::Option<
7028 std::vec::Vec<crate::field_options::EditionDefault>,
7029 >>()?
7030 .unwrap_or_default();
7031 }
7032 __FieldTag::__features => {
7033 if !fields.insert(__FieldTag::__features) {
7034 return std::result::Result::Err(A::Error::duplicate_field(
7035 "multiple values for features",
7036 ));
7037 }
7038 result.features =
7039 map.next_value::<std::option::Option<crate::FeatureSet>>()?;
7040 }
7041 __FieldTag::__feature_support => {
7042 if !fields.insert(__FieldTag::__feature_support) {
7043 return std::result::Result::Err(A::Error::duplicate_field(
7044 "multiple values for feature_support",
7045 ));
7046 }
7047 result.feature_support = map.next_value::<std::option::Option<crate::field_options::FeatureSupport>>()?
7048 ;
7049 }
7050 __FieldTag::__uninterpreted_option => {
7051 if !fields.insert(__FieldTag::__uninterpreted_option) {
7052 return std::result::Result::Err(A::Error::duplicate_field(
7053 "multiple values for uninterpreted_option",
7054 ));
7055 }
7056 result.uninterpreted_option = map.next_value::<std::option::Option<std::vec::Vec<crate::UninterpretedOption>>>()?.unwrap_or_default();
7057 }
7058 __FieldTag::Unknown(key) => {
7059 let value = map.next_value::<serde_json::Value>()?;
7060 result._unknown_fields.insert(key, value);
7061 }
7062 }
7063 }
7064 std::result::Result::Ok(result)
7065 }
7066 }
7067 deserializer.deserialize_any(Visitor)
7068 }
7069}
7070
7071#[doc(hidden)]
7072impl serde::ser::Serialize for FieldOptions {
7073 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7074 where
7075 S: serde::ser::Serializer,
7076 {
7077 use serde::ser::SerializeMap;
7078 #[allow(unused_imports)]
7079 use std::option::Option::Some;
7080 let mut state = serializer.serialize_map(std::option::Option::None)?;
7081 if !wkt::internal::is_default(&self.ctype) {
7082 state.serialize_entry("ctype", &self.ctype)?;
7083 }
7084 if !wkt::internal::is_default(&self.packed) {
7085 state.serialize_entry("packed", &self.packed)?;
7086 }
7087 if !wkt::internal::is_default(&self.jstype) {
7088 state.serialize_entry("jstype", &self.jstype)?;
7089 }
7090 if !wkt::internal::is_default(&self.lazy) {
7091 state.serialize_entry("lazy", &self.lazy)?;
7092 }
7093 if !wkt::internal::is_default(&self.unverified_lazy) {
7094 state.serialize_entry("unverifiedLazy", &self.unverified_lazy)?;
7095 }
7096 if !wkt::internal::is_default(&self.deprecated) {
7097 state.serialize_entry("deprecated", &self.deprecated)?;
7098 }
7099 if !wkt::internal::is_default(&self.weak) {
7100 state.serialize_entry("weak", &self.weak)?;
7101 }
7102 if !wkt::internal::is_default(&self.debug_redact) {
7103 state.serialize_entry("debugRedact", &self.debug_redact)?;
7104 }
7105 if !wkt::internal::is_default(&self.retention) {
7106 state.serialize_entry("retention", &self.retention)?;
7107 }
7108 if !self.targets.is_empty() {
7109 state.serialize_entry("targets", &self.targets)?;
7110 }
7111 if !self.edition_defaults.is_empty() {
7112 state.serialize_entry("editionDefaults", &self.edition_defaults)?;
7113 }
7114 if self.features.is_some() {
7115 state.serialize_entry("features", &self.features)?;
7116 }
7117 if self.feature_support.is_some() {
7118 state.serialize_entry("featureSupport", &self.feature_support)?;
7119 }
7120 if !self.uninterpreted_option.is_empty() {
7121 state.serialize_entry("uninterpretedOption", &self.uninterpreted_option)?;
7122 }
7123 if !self._unknown_fields.is_empty() {
7124 for (key, value) in self._unknown_fields.iter() {
7125 state.serialize_entry(key, &value)?;
7126 }
7127 }
7128 state.end()
7129 }
7130}
7131
7132impl std::fmt::Debug for FieldOptions {
7133 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7134 let mut debug_struct = f.debug_struct("FieldOptions");
7135 debug_struct.field("ctype", &self.ctype);
7136 debug_struct.field("packed", &self.packed);
7137 debug_struct.field("jstype", &self.jstype);
7138 debug_struct.field("lazy", &self.lazy);
7139 debug_struct.field("unverified_lazy", &self.unverified_lazy);
7140 debug_struct.field("deprecated", &self.deprecated);
7141 debug_struct.field("weak", &self.weak);
7142 debug_struct.field("debug_redact", &self.debug_redact);
7143 debug_struct.field("retention", &self.retention);
7144 debug_struct.field("targets", &self.targets);
7145 debug_struct.field("edition_defaults", &self.edition_defaults);
7146 debug_struct.field("features", &self.features);
7147 debug_struct.field("feature_support", &self.feature_support);
7148 debug_struct.field("uninterpreted_option", &self.uninterpreted_option);
7149 if !self._unknown_fields.is_empty() {
7150 debug_struct.field("_unknown_fields", &self._unknown_fields);
7151 }
7152 debug_struct.finish()
7153 }
7154}
7155
7156pub mod field_options {
7158 #[allow(unused_imports)]
7159 use super::*;
7160
7161 #[derive(Clone, Default, PartialEq)]
7162 #[non_exhaustive]
7163 pub struct EditionDefault {
7164 pub edition: crate::Edition,
7165
7166 pub value: std::string::String,
7167
7168 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7169 }
7170
7171 impl EditionDefault {
7172 pub fn new() -> Self {
7173 std::default::Default::default()
7174 }
7175
7176 pub fn set_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
7178 self.edition = v.into();
7179 self
7180 }
7181
7182 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7184 self.value = v.into();
7185 self
7186 }
7187 }
7188
7189 impl wkt::message::Message for EditionDefault {
7190 fn typename() -> &'static str {
7191 "type.googleapis.com/google.protobuf.FieldOptions.EditionDefault"
7192 }
7193 }
7194
7195 #[doc(hidden)]
7196 impl<'de> serde::de::Deserialize<'de> for EditionDefault {
7197 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7198 where
7199 D: serde::Deserializer<'de>,
7200 {
7201 #[allow(non_camel_case_types)]
7202 #[doc(hidden)]
7203 #[derive(PartialEq, Eq, Hash)]
7204 enum __FieldTag {
7205 __edition,
7206 __value,
7207 Unknown(std::string::String),
7208 }
7209 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7210 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7211 where
7212 D: serde::Deserializer<'de>,
7213 {
7214 struct Visitor;
7215 impl<'de> serde::de::Visitor<'de> for Visitor {
7216 type Value = __FieldTag;
7217 fn expecting(
7218 &self,
7219 formatter: &mut std::fmt::Formatter,
7220 ) -> std::fmt::Result {
7221 formatter.write_str("a field name for EditionDefault")
7222 }
7223 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7224 where
7225 E: serde::de::Error,
7226 {
7227 use std::result::Result::Ok;
7228 use std::string::ToString;
7229 match value {
7230 "edition" => Ok(__FieldTag::__edition),
7231 "value" => Ok(__FieldTag::__value),
7232 _ => Ok(__FieldTag::Unknown(value.to_string())),
7233 }
7234 }
7235 }
7236 deserializer.deserialize_identifier(Visitor)
7237 }
7238 }
7239 struct Visitor;
7240 impl<'de> serde::de::Visitor<'de> for Visitor {
7241 type Value = EditionDefault;
7242 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7243 formatter.write_str("struct EditionDefault")
7244 }
7245 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7246 where
7247 A: serde::de::MapAccess<'de>,
7248 {
7249 #[allow(unused_imports)]
7250 use serde::de::Error;
7251 use std::option::Option::Some;
7252 let mut fields = std::collections::HashSet::new();
7253 let mut result = Self::Value::new();
7254 while let Some(tag) = map.next_key::<__FieldTag>()? {
7255 #[allow(clippy::match_single_binding)]
7256 match tag {
7257 __FieldTag::__edition => {
7258 if !fields.insert(__FieldTag::__edition) {
7259 return std::result::Result::Err(A::Error::duplicate_field(
7260 "multiple values for edition",
7261 ));
7262 }
7263 result.edition = map
7264 .next_value::<std::option::Option<crate::Edition>>()?
7265 .unwrap_or_default();
7266 }
7267 __FieldTag::__value => {
7268 if !fields.insert(__FieldTag::__value) {
7269 return std::result::Result::Err(A::Error::duplicate_field(
7270 "multiple values for value",
7271 ));
7272 }
7273 result.value = map
7274 .next_value::<std::option::Option<std::string::String>>()?
7275 .unwrap_or_default();
7276 }
7277 __FieldTag::Unknown(key) => {
7278 let value = map.next_value::<serde_json::Value>()?;
7279 result._unknown_fields.insert(key, value);
7280 }
7281 }
7282 }
7283 std::result::Result::Ok(result)
7284 }
7285 }
7286 deserializer.deserialize_any(Visitor)
7287 }
7288 }
7289
7290 #[doc(hidden)]
7291 impl serde::ser::Serialize for EditionDefault {
7292 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7293 where
7294 S: serde::ser::Serializer,
7295 {
7296 use serde::ser::SerializeMap;
7297 #[allow(unused_imports)]
7298 use std::option::Option::Some;
7299 let mut state = serializer.serialize_map(std::option::Option::None)?;
7300 if !wkt::internal::is_default(&self.edition) {
7301 state.serialize_entry("edition", &self.edition)?;
7302 }
7303 if !self.value.is_empty() {
7304 state.serialize_entry("value", &self.value)?;
7305 }
7306 if !self._unknown_fields.is_empty() {
7307 for (key, value) in self._unknown_fields.iter() {
7308 state.serialize_entry(key, &value)?;
7309 }
7310 }
7311 state.end()
7312 }
7313 }
7314
7315 impl std::fmt::Debug for EditionDefault {
7316 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7317 let mut debug_struct = f.debug_struct("EditionDefault");
7318 debug_struct.field("edition", &self.edition);
7319 debug_struct.field("value", &self.value);
7320 if !self._unknown_fields.is_empty() {
7321 debug_struct.field("_unknown_fields", &self._unknown_fields);
7322 }
7323 debug_struct.finish()
7324 }
7325 }
7326
7327 #[derive(Clone, Default, PartialEq)]
7329 #[non_exhaustive]
7330 pub struct FeatureSupport {
7331 pub edition_introduced: crate::Edition,
7335
7336 pub edition_deprecated: crate::Edition,
7339
7340 pub deprecation_warning: std::string::String,
7343
7344 pub edition_removed: crate::Edition,
7348
7349 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7350 }
7351
7352 impl FeatureSupport {
7353 pub fn new() -> Self {
7354 std::default::Default::default()
7355 }
7356
7357 pub fn set_edition_introduced<T: std::convert::Into<crate::Edition>>(
7359 mut self,
7360 v: T,
7361 ) -> Self {
7362 self.edition_introduced = v.into();
7363 self
7364 }
7365
7366 pub fn set_edition_deprecated<T: std::convert::Into<crate::Edition>>(
7368 mut self,
7369 v: T,
7370 ) -> Self {
7371 self.edition_deprecated = v.into();
7372 self
7373 }
7374
7375 pub fn set_deprecation_warning<T: std::convert::Into<std::string::String>>(
7377 mut self,
7378 v: T,
7379 ) -> Self {
7380 self.deprecation_warning = v.into();
7381 self
7382 }
7383
7384 pub fn set_edition_removed<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
7386 self.edition_removed = v.into();
7387 self
7388 }
7389 }
7390
7391 impl wkt::message::Message for FeatureSupport {
7392 fn typename() -> &'static str {
7393 "type.googleapis.com/google.protobuf.FieldOptions.FeatureSupport"
7394 }
7395 }
7396
7397 #[doc(hidden)]
7398 impl<'de> serde::de::Deserialize<'de> for FeatureSupport {
7399 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7400 where
7401 D: serde::Deserializer<'de>,
7402 {
7403 #[allow(non_camel_case_types)]
7404 #[doc(hidden)]
7405 #[derive(PartialEq, Eq, Hash)]
7406 enum __FieldTag {
7407 __edition_introduced,
7408 __edition_deprecated,
7409 __deprecation_warning,
7410 __edition_removed,
7411 Unknown(std::string::String),
7412 }
7413 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7414 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7415 where
7416 D: serde::Deserializer<'de>,
7417 {
7418 struct Visitor;
7419 impl<'de> serde::de::Visitor<'de> for Visitor {
7420 type Value = __FieldTag;
7421 fn expecting(
7422 &self,
7423 formatter: &mut std::fmt::Formatter,
7424 ) -> std::fmt::Result {
7425 formatter.write_str("a field name for FeatureSupport")
7426 }
7427 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7428 where
7429 E: serde::de::Error,
7430 {
7431 use std::result::Result::Ok;
7432 use std::string::ToString;
7433 match value {
7434 "editionIntroduced" => Ok(__FieldTag::__edition_introduced),
7435 "edition_introduced" => Ok(__FieldTag::__edition_introduced),
7436 "editionDeprecated" => Ok(__FieldTag::__edition_deprecated),
7437 "edition_deprecated" => Ok(__FieldTag::__edition_deprecated),
7438 "deprecationWarning" => Ok(__FieldTag::__deprecation_warning),
7439 "deprecation_warning" => Ok(__FieldTag::__deprecation_warning),
7440 "editionRemoved" => Ok(__FieldTag::__edition_removed),
7441 "edition_removed" => Ok(__FieldTag::__edition_removed),
7442 _ => Ok(__FieldTag::Unknown(value.to_string())),
7443 }
7444 }
7445 }
7446 deserializer.deserialize_identifier(Visitor)
7447 }
7448 }
7449 struct Visitor;
7450 impl<'de> serde::de::Visitor<'de> for Visitor {
7451 type Value = FeatureSupport;
7452 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7453 formatter.write_str("struct FeatureSupport")
7454 }
7455 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7456 where
7457 A: serde::de::MapAccess<'de>,
7458 {
7459 #[allow(unused_imports)]
7460 use serde::de::Error;
7461 use std::option::Option::Some;
7462 let mut fields = std::collections::HashSet::new();
7463 let mut result = Self::Value::new();
7464 while let Some(tag) = map.next_key::<__FieldTag>()? {
7465 #[allow(clippy::match_single_binding)]
7466 match tag {
7467 __FieldTag::__edition_introduced => {
7468 if !fields.insert(__FieldTag::__edition_introduced) {
7469 return std::result::Result::Err(A::Error::duplicate_field(
7470 "multiple values for edition_introduced",
7471 ));
7472 }
7473 result.edition_introduced = map
7474 .next_value::<std::option::Option<crate::Edition>>()?
7475 .unwrap_or_default();
7476 }
7477 __FieldTag::__edition_deprecated => {
7478 if !fields.insert(__FieldTag::__edition_deprecated) {
7479 return std::result::Result::Err(A::Error::duplicate_field(
7480 "multiple values for edition_deprecated",
7481 ));
7482 }
7483 result.edition_deprecated = map
7484 .next_value::<std::option::Option<crate::Edition>>()?
7485 .unwrap_or_default();
7486 }
7487 __FieldTag::__deprecation_warning => {
7488 if !fields.insert(__FieldTag::__deprecation_warning) {
7489 return std::result::Result::Err(A::Error::duplicate_field(
7490 "multiple values for deprecation_warning",
7491 ));
7492 }
7493 result.deprecation_warning = map
7494 .next_value::<std::option::Option<std::string::String>>()?
7495 .unwrap_or_default();
7496 }
7497 __FieldTag::__edition_removed => {
7498 if !fields.insert(__FieldTag::__edition_removed) {
7499 return std::result::Result::Err(A::Error::duplicate_field(
7500 "multiple values for edition_removed",
7501 ));
7502 }
7503 result.edition_removed = map
7504 .next_value::<std::option::Option<crate::Edition>>()?
7505 .unwrap_or_default();
7506 }
7507 __FieldTag::Unknown(key) => {
7508 let value = map.next_value::<serde_json::Value>()?;
7509 result._unknown_fields.insert(key, value);
7510 }
7511 }
7512 }
7513 std::result::Result::Ok(result)
7514 }
7515 }
7516 deserializer.deserialize_any(Visitor)
7517 }
7518 }
7519
7520 #[doc(hidden)]
7521 impl serde::ser::Serialize for FeatureSupport {
7522 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7523 where
7524 S: serde::ser::Serializer,
7525 {
7526 use serde::ser::SerializeMap;
7527 #[allow(unused_imports)]
7528 use std::option::Option::Some;
7529 let mut state = serializer.serialize_map(std::option::Option::None)?;
7530 if !wkt::internal::is_default(&self.edition_introduced) {
7531 state.serialize_entry("editionIntroduced", &self.edition_introduced)?;
7532 }
7533 if !wkt::internal::is_default(&self.edition_deprecated) {
7534 state.serialize_entry("editionDeprecated", &self.edition_deprecated)?;
7535 }
7536 if !self.deprecation_warning.is_empty() {
7537 state.serialize_entry("deprecationWarning", &self.deprecation_warning)?;
7538 }
7539 if !wkt::internal::is_default(&self.edition_removed) {
7540 state.serialize_entry("editionRemoved", &self.edition_removed)?;
7541 }
7542 if !self._unknown_fields.is_empty() {
7543 for (key, value) in self._unknown_fields.iter() {
7544 state.serialize_entry(key, &value)?;
7545 }
7546 }
7547 state.end()
7548 }
7549 }
7550
7551 impl std::fmt::Debug for FeatureSupport {
7552 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7553 let mut debug_struct = f.debug_struct("FeatureSupport");
7554 debug_struct.field("edition_introduced", &self.edition_introduced);
7555 debug_struct.field("edition_deprecated", &self.edition_deprecated);
7556 debug_struct.field("deprecation_warning", &self.deprecation_warning);
7557 debug_struct.field("edition_removed", &self.edition_removed);
7558 if !self._unknown_fields.is_empty() {
7559 debug_struct.field("_unknown_fields", &self._unknown_fields);
7560 }
7561 debug_struct.finish()
7562 }
7563 }
7564
7565 #[derive(Clone, Debug, PartialEq)]
7580 #[non_exhaustive]
7581 pub enum CType {
7582 String,
7584 Cord,
7591 StringPiece,
7592 UnknownValue(c_type::UnknownValue),
7597 }
7598
7599 #[doc(hidden)]
7600 pub mod c_type {
7601 #[allow(unused_imports)]
7602 use super::*;
7603 #[derive(Clone, Debug, PartialEq)]
7604 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7605 }
7606
7607 impl CType {
7608 pub fn value(&self) -> std::option::Option<i32> {
7613 match self {
7614 Self::String => std::option::Option::Some(0),
7615 Self::Cord => std::option::Option::Some(1),
7616 Self::StringPiece => std::option::Option::Some(2),
7617 Self::UnknownValue(u) => u.0.value(),
7618 }
7619 }
7620
7621 pub fn name(&self) -> std::option::Option<&str> {
7626 match self {
7627 Self::String => std::option::Option::Some("STRING"),
7628 Self::Cord => std::option::Option::Some("CORD"),
7629 Self::StringPiece => std::option::Option::Some("STRING_PIECE"),
7630 Self::UnknownValue(u) => u.0.name(),
7631 }
7632 }
7633 }
7634
7635 impl std::default::Default for CType {
7636 fn default() -> Self {
7637 use std::convert::From;
7638 Self::from(0)
7639 }
7640 }
7641
7642 impl std::fmt::Display for CType {
7643 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7644 wkt::internal::display_enum(f, self.name(), self.value())
7645 }
7646 }
7647
7648 impl std::convert::From<i32> for CType {
7649 fn from(value: i32) -> Self {
7650 match value {
7651 0 => Self::String,
7652 1 => Self::Cord,
7653 2 => Self::StringPiece,
7654 _ => Self::UnknownValue(c_type::UnknownValue(
7655 wkt::internal::UnknownEnumValue::Integer(value),
7656 )),
7657 }
7658 }
7659 }
7660
7661 impl std::convert::From<&str> for CType {
7662 fn from(value: &str) -> Self {
7663 use std::string::ToString;
7664 match value {
7665 "STRING" => Self::String,
7666 "CORD" => Self::Cord,
7667 "STRING_PIECE" => Self::StringPiece,
7668 _ => Self::UnknownValue(c_type::UnknownValue(
7669 wkt::internal::UnknownEnumValue::String(value.to_string()),
7670 )),
7671 }
7672 }
7673 }
7674
7675 impl serde::ser::Serialize for CType {
7676 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7677 where
7678 S: serde::Serializer,
7679 {
7680 match self {
7681 Self::String => serializer.serialize_i32(0),
7682 Self::Cord => serializer.serialize_i32(1),
7683 Self::StringPiece => serializer.serialize_i32(2),
7684 Self::UnknownValue(u) => u.0.serialize(serializer),
7685 }
7686 }
7687 }
7688
7689 impl<'de> serde::de::Deserialize<'de> for CType {
7690 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7691 where
7692 D: serde::Deserializer<'de>,
7693 {
7694 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CType>::new(
7695 ".google.protobuf.FieldOptions.CType",
7696 ))
7697 }
7698 }
7699
7700 #[derive(Clone, Debug, PartialEq)]
7715 #[non_exhaustive]
7716 pub enum JSType {
7717 JsNormal,
7719 JsString,
7721 JsNumber,
7723 UnknownValue(js_type::UnknownValue),
7728 }
7729
7730 #[doc(hidden)]
7731 pub mod js_type {
7732 #[allow(unused_imports)]
7733 use super::*;
7734 #[derive(Clone, Debug, PartialEq)]
7735 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7736 }
7737
7738 impl JSType {
7739 pub fn value(&self) -> std::option::Option<i32> {
7744 match self {
7745 Self::JsNormal => std::option::Option::Some(0),
7746 Self::JsString => std::option::Option::Some(1),
7747 Self::JsNumber => std::option::Option::Some(2),
7748 Self::UnknownValue(u) => u.0.value(),
7749 }
7750 }
7751
7752 pub fn name(&self) -> std::option::Option<&str> {
7757 match self {
7758 Self::JsNormal => std::option::Option::Some("JS_NORMAL"),
7759 Self::JsString => std::option::Option::Some("JS_STRING"),
7760 Self::JsNumber => std::option::Option::Some("JS_NUMBER"),
7761 Self::UnknownValue(u) => u.0.name(),
7762 }
7763 }
7764 }
7765
7766 impl std::default::Default for JSType {
7767 fn default() -> Self {
7768 use std::convert::From;
7769 Self::from(0)
7770 }
7771 }
7772
7773 impl std::fmt::Display for JSType {
7774 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7775 wkt::internal::display_enum(f, self.name(), self.value())
7776 }
7777 }
7778
7779 impl std::convert::From<i32> for JSType {
7780 fn from(value: i32) -> Self {
7781 match value {
7782 0 => Self::JsNormal,
7783 1 => Self::JsString,
7784 2 => Self::JsNumber,
7785 _ => Self::UnknownValue(js_type::UnknownValue(
7786 wkt::internal::UnknownEnumValue::Integer(value),
7787 )),
7788 }
7789 }
7790 }
7791
7792 impl std::convert::From<&str> for JSType {
7793 fn from(value: &str) -> Self {
7794 use std::string::ToString;
7795 match value {
7796 "JS_NORMAL" => Self::JsNormal,
7797 "JS_STRING" => Self::JsString,
7798 "JS_NUMBER" => Self::JsNumber,
7799 _ => Self::UnknownValue(js_type::UnknownValue(
7800 wkt::internal::UnknownEnumValue::String(value.to_string()),
7801 )),
7802 }
7803 }
7804 }
7805
7806 impl serde::ser::Serialize for JSType {
7807 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7808 where
7809 S: serde::Serializer,
7810 {
7811 match self {
7812 Self::JsNormal => serializer.serialize_i32(0),
7813 Self::JsString => serializer.serialize_i32(1),
7814 Self::JsNumber => serializer.serialize_i32(2),
7815 Self::UnknownValue(u) => u.0.serialize(serializer),
7816 }
7817 }
7818 }
7819
7820 impl<'de> serde::de::Deserialize<'de> for JSType {
7821 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7822 where
7823 D: serde::Deserializer<'de>,
7824 {
7825 deserializer.deserialize_any(wkt::internal::EnumVisitor::<JSType>::new(
7826 ".google.protobuf.FieldOptions.JSType",
7827 ))
7828 }
7829 }
7830
7831 #[derive(Clone, Debug, PartialEq)]
7847 #[non_exhaustive]
7848 pub enum OptionRetention {
7849 RetentionUnknown,
7850 RetentionRuntime,
7851 RetentionSource,
7852 UnknownValue(option_retention::UnknownValue),
7857 }
7858
7859 #[doc(hidden)]
7860 pub mod option_retention {
7861 #[allow(unused_imports)]
7862 use super::*;
7863 #[derive(Clone, Debug, PartialEq)]
7864 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7865 }
7866
7867 impl OptionRetention {
7868 pub fn value(&self) -> std::option::Option<i32> {
7873 match self {
7874 Self::RetentionUnknown => std::option::Option::Some(0),
7875 Self::RetentionRuntime => std::option::Option::Some(1),
7876 Self::RetentionSource => std::option::Option::Some(2),
7877 Self::UnknownValue(u) => u.0.value(),
7878 }
7879 }
7880
7881 pub fn name(&self) -> std::option::Option<&str> {
7886 match self {
7887 Self::RetentionUnknown => std::option::Option::Some("RETENTION_UNKNOWN"),
7888 Self::RetentionRuntime => std::option::Option::Some("RETENTION_RUNTIME"),
7889 Self::RetentionSource => std::option::Option::Some("RETENTION_SOURCE"),
7890 Self::UnknownValue(u) => u.0.name(),
7891 }
7892 }
7893 }
7894
7895 impl std::default::Default for OptionRetention {
7896 fn default() -> Self {
7897 use std::convert::From;
7898 Self::from(0)
7899 }
7900 }
7901
7902 impl std::fmt::Display for OptionRetention {
7903 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7904 wkt::internal::display_enum(f, self.name(), self.value())
7905 }
7906 }
7907
7908 impl std::convert::From<i32> for OptionRetention {
7909 fn from(value: i32) -> Self {
7910 match value {
7911 0 => Self::RetentionUnknown,
7912 1 => Self::RetentionRuntime,
7913 2 => Self::RetentionSource,
7914 _ => Self::UnknownValue(option_retention::UnknownValue(
7915 wkt::internal::UnknownEnumValue::Integer(value),
7916 )),
7917 }
7918 }
7919 }
7920
7921 impl std::convert::From<&str> for OptionRetention {
7922 fn from(value: &str) -> Self {
7923 use std::string::ToString;
7924 match value {
7925 "RETENTION_UNKNOWN" => Self::RetentionUnknown,
7926 "RETENTION_RUNTIME" => Self::RetentionRuntime,
7927 "RETENTION_SOURCE" => Self::RetentionSource,
7928 _ => Self::UnknownValue(option_retention::UnknownValue(
7929 wkt::internal::UnknownEnumValue::String(value.to_string()),
7930 )),
7931 }
7932 }
7933 }
7934
7935 impl serde::ser::Serialize for OptionRetention {
7936 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7937 where
7938 S: serde::Serializer,
7939 {
7940 match self {
7941 Self::RetentionUnknown => serializer.serialize_i32(0),
7942 Self::RetentionRuntime => serializer.serialize_i32(1),
7943 Self::RetentionSource => serializer.serialize_i32(2),
7944 Self::UnknownValue(u) => u.0.serialize(serializer),
7945 }
7946 }
7947 }
7948
7949 impl<'de> serde::de::Deserialize<'de> for OptionRetention {
7950 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7951 where
7952 D: serde::Deserializer<'de>,
7953 {
7954 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OptionRetention>::new(
7955 ".google.protobuf.FieldOptions.OptionRetention",
7956 ))
7957 }
7958 }
7959
7960 #[derive(Clone, Debug, PartialEq)]
7978 #[non_exhaustive]
7979 pub enum OptionTargetType {
7980 TargetTypeUnknown,
7981 TargetTypeFile,
7982 TargetTypeExtensionRange,
7983 TargetTypeMessage,
7984 TargetTypeField,
7985 TargetTypeOneof,
7986 TargetTypeEnum,
7987 TargetTypeEnumEntry,
7988 TargetTypeService,
7989 TargetTypeMethod,
7990 UnknownValue(option_target_type::UnknownValue),
7995 }
7996
7997 #[doc(hidden)]
7998 pub mod option_target_type {
7999 #[allow(unused_imports)]
8000 use super::*;
8001 #[derive(Clone, Debug, PartialEq)]
8002 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8003 }
8004
8005 impl OptionTargetType {
8006 pub fn value(&self) -> std::option::Option<i32> {
8011 match self {
8012 Self::TargetTypeUnknown => std::option::Option::Some(0),
8013 Self::TargetTypeFile => std::option::Option::Some(1),
8014 Self::TargetTypeExtensionRange => std::option::Option::Some(2),
8015 Self::TargetTypeMessage => std::option::Option::Some(3),
8016 Self::TargetTypeField => std::option::Option::Some(4),
8017 Self::TargetTypeOneof => std::option::Option::Some(5),
8018 Self::TargetTypeEnum => std::option::Option::Some(6),
8019 Self::TargetTypeEnumEntry => std::option::Option::Some(7),
8020 Self::TargetTypeService => std::option::Option::Some(8),
8021 Self::TargetTypeMethod => std::option::Option::Some(9),
8022 Self::UnknownValue(u) => u.0.value(),
8023 }
8024 }
8025
8026 pub fn name(&self) -> std::option::Option<&str> {
8031 match self {
8032 Self::TargetTypeUnknown => std::option::Option::Some("TARGET_TYPE_UNKNOWN"),
8033 Self::TargetTypeFile => std::option::Option::Some("TARGET_TYPE_FILE"),
8034 Self::TargetTypeExtensionRange => {
8035 std::option::Option::Some("TARGET_TYPE_EXTENSION_RANGE")
8036 }
8037 Self::TargetTypeMessage => std::option::Option::Some("TARGET_TYPE_MESSAGE"),
8038 Self::TargetTypeField => std::option::Option::Some("TARGET_TYPE_FIELD"),
8039 Self::TargetTypeOneof => std::option::Option::Some("TARGET_TYPE_ONEOF"),
8040 Self::TargetTypeEnum => std::option::Option::Some("TARGET_TYPE_ENUM"),
8041 Self::TargetTypeEnumEntry => std::option::Option::Some("TARGET_TYPE_ENUM_ENTRY"),
8042 Self::TargetTypeService => std::option::Option::Some("TARGET_TYPE_SERVICE"),
8043 Self::TargetTypeMethod => std::option::Option::Some("TARGET_TYPE_METHOD"),
8044 Self::UnknownValue(u) => u.0.name(),
8045 }
8046 }
8047 }
8048
8049 impl std::default::Default for OptionTargetType {
8050 fn default() -> Self {
8051 use std::convert::From;
8052 Self::from(0)
8053 }
8054 }
8055
8056 impl std::fmt::Display for OptionTargetType {
8057 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8058 wkt::internal::display_enum(f, self.name(), self.value())
8059 }
8060 }
8061
8062 impl std::convert::From<i32> for OptionTargetType {
8063 fn from(value: i32) -> Self {
8064 match value {
8065 0 => Self::TargetTypeUnknown,
8066 1 => Self::TargetTypeFile,
8067 2 => Self::TargetTypeExtensionRange,
8068 3 => Self::TargetTypeMessage,
8069 4 => Self::TargetTypeField,
8070 5 => Self::TargetTypeOneof,
8071 6 => Self::TargetTypeEnum,
8072 7 => Self::TargetTypeEnumEntry,
8073 8 => Self::TargetTypeService,
8074 9 => Self::TargetTypeMethod,
8075 _ => Self::UnknownValue(option_target_type::UnknownValue(
8076 wkt::internal::UnknownEnumValue::Integer(value),
8077 )),
8078 }
8079 }
8080 }
8081
8082 impl std::convert::From<&str> for OptionTargetType {
8083 fn from(value: &str) -> Self {
8084 use std::string::ToString;
8085 match value {
8086 "TARGET_TYPE_UNKNOWN" => Self::TargetTypeUnknown,
8087 "TARGET_TYPE_FILE" => Self::TargetTypeFile,
8088 "TARGET_TYPE_EXTENSION_RANGE" => Self::TargetTypeExtensionRange,
8089 "TARGET_TYPE_MESSAGE" => Self::TargetTypeMessage,
8090 "TARGET_TYPE_FIELD" => Self::TargetTypeField,
8091 "TARGET_TYPE_ONEOF" => Self::TargetTypeOneof,
8092 "TARGET_TYPE_ENUM" => Self::TargetTypeEnum,
8093 "TARGET_TYPE_ENUM_ENTRY" => Self::TargetTypeEnumEntry,
8094 "TARGET_TYPE_SERVICE" => Self::TargetTypeService,
8095 "TARGET_TYPE_METHOD" => Self::TargetTypeMethod,
8096 _ => Self::UnknownValue(option_target_type::UnknownValue(
8097 wkt::internal::UnknownEnumValue::String(value.to_string()),
8098 )),
8099 }
8100 }
8101 }
8102
8103 impl serde::ser::Serialize for OptionTargetType {
8104 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8105 where
8106 S: serde::Serializer,
8107 {
8108 match self {
8109 Self::TargetTypeUnknown => serializer.serialize_i32(0),
8110 Self::TargetTypeFile => serializer.serialize_i32(1),
8111 Self::TargetTypeExtensionRange => serializer.serialize_i32(2),
8112 Self::TargetTypeMessage => serializer.serialize_i32(3),
8113 Self::TargetTypeField => serializer.serialize_i32(4),
8114 Self::TargetTypeOneof => serializer.serialize_i32(5),
8115 Self::TargetTypeEnum => serializer.serialize_i32(6),
8116 Self::TargetTypeEnumEntry => serializer.serialize_i32(7),
8117 Self::TargetTypeService => serializer.serialize_i32(8),
8118 Self::TargetTypeMethod => serializer.serialize_i32(9),
8119 Self::UnknownValue(u) => u.0.serialize(serializer),
8120 }
8121 }
8122 }
8123
8124 impl<'de> serde::de::Deserialize<'de> for OptionTargetType {
8125 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8126 where
8127 D: serde::Deserializer<'de>,
8128 {
8129 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OptionTargetType>::new(
8130 ".google.protobuf.FieldOptions.OptionTargetType",
8131 ))
8132 }
8133 }
8134}
8135
8136#[derive(Clone, Default, PartialEq)]
8137#[non_exhaustive]
8138pub struct OneofOptions {
8139 pub features: std::option::Option<crate::FeatureSet>,
8141
8142 pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
8144
8145 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8146}
8147
8148impl OneofOptions {
8149 pub fn new() -> Self {
8150 std::default::Default::default()
8151 }
8152
8153 pub fn set_features<T>(mut self, v: T) -> Self
8155 where
8156 T: std::convert::Into<crate::FeatureSet>,
8157 {
8158 self.features = std::option::Option::Some(v.into());
8159 self
8160 }
8161
8162 pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
8164 where
8165 T: std::convert::Into<crate::FeatureSet>,
8166 {
8167 self.features = v.map(|x| x.into());
8168 self
8169 }
8170
8171 pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
8173 where
8174 T: std::iter::IntoIterator<Item = V>,
8175 V: std::convert::Into<crate::UninterpretedOption>,
8176 {
8177 use std::iter::Iterator;
8178 self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
8179 self
8180 }
8181}
8182
8183impl wkt::message::Message for OneofOptions {
8184 fn typename() -> &'static str {
8185 "type.googleapis.com/google.protobuf.OneofOptions"
8186 }
8187}
8188
8189#[doc(hidden)]
8190impl<'de> serde::de::Deserialize<'de> for OneofOptions {
8191 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8192 where
8193 D: serde::Deserializer<'de>,
8194 {
8195 #[allow(non_camel_case_types)]
8196 #[doc(hidden)]
8197 #[derive(PartialEq, Eq, Hash)]
8198 enum __FieldTag {
8199 __features,
8200 __uninterpreted_option,
8201 Unknown(std::string::String),
8202 }
8203 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8204 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8205 where
8206 D: serde::Deserializer<'de>,
8207 {
8208 struct Visitor;
8209 impl<'de> serde::de::Visitor<'de> for Visitor {
8210 type Value = __FieldTag;
8211 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8212 formatter.write_str("a field name for OneofOptions")
8213 }
8214 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8215 where
8216 E: serde::de::Error,
8217 {
8218 use std::result::Result::Ok;
8219 use std::string::ToString;
8220 match value {
8221 "features" => Ok(__FieldTag::__features),
8222 "uninterpretedOption" => Ok(__FieldTag::__uninterpreted_option),
8223 "uninterpreted_option" => Ok(__FieldTag::__uninterpreted_option),
8224 _ => Ok(__FieldTag::Unknown(value.to_string())),
8225 }
8226 }
8227 }
8228 deserializer.deserialize_identifier(Visitor)
8229 }
8230 }
8231 struct Visitor;
8232 impl<'de> serde::de::Visitor<'de> for Visitor {
8233 type Value = OneofOptions;
8234 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8235 formatter.write_str("struct OneofOptions")
8236 }
8237 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8238 where
8239 A: serde::de::MapAccess<'de>,
8240 {
8241 #[allow(unused_imports)]
8242 use serde::de::Error;
8243 use std::option::Option::Some;
8244 let mut fields = std::collections::HashSet::new();
8245 let mut result = Self::Value::new();
8246 while let Some(tag) = map.next_key::<__FieldTag>()? {
8247 #[allow(clippy::match_single_binding)]
8248 match tag {
8249 __FieldTag::__features => {
8250 if !fields.insert(__FieldTag::__features) {
8251 return std::result::Result::Err(A::Error::duplicate_field(
8252 "multiple values for features",
8253 ));
8254 }
8255 result.features =
8256 map.next_value::<std::option::Option<crate::FeatureSet>>()?;
8257 }
8258 __FieldTag::__uninterpreted_option => {
8259 if !fields.insert(__FieldTag::__uninterpreted_option) {
8260 return std::result::Result::Err(A::Error::duplicate_field(
8261 "multiple values for uninterpreted_option",
8262 ));
8263 }
8264 result.uninterpreted_option = map.next_value::<std::option::Option<std::vec::Vec<crate::UninterpretedOption>>>()?.unwrap_or_default();
8265 }
8266 __FieldTag::Unknown(key) => {
8267 let value = map.next_value::<serde_json::Value>()?;
8268 result._unknown_fields.insert(key, value);
8269 }
8270 }
8271 }
8272 std::result::Result::Ok(result)
8273 }
8274 }
8275 deserializer.deserialize_any(Visitor)
8276 }
8277}
8278
8279#[doc(hidden)]
8280impl serde::ser::Serialize for OneofOptions {
8281 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8282 where
8283 S: serde::ser::Serializer,
8284 {
8285 use serde::ser::SerializeMap;
8286 #[allow(unused_imports)]
8287 use std::option::Option::Some;
8288 let mut state = serializer.serialize_map(std::option::Option::None)?;
8289 if self.features.is_some() {
8290 state.serialize_entry("features", &self.features)?;
8291 }
8292 if !self.uninterpreted_option.is_empty() {
8293 state.serialize_entry("uninterpretedOption", &self.uninterpreted_option)?;
8294 }
8295 if !self._unknown_fields.is_empty() {
8296 for (key, value) in self._unknown_fields.iter() {
8297 state.serialize_entry(key, &value)?;
8298 }
8299 }
8300 state.end()
8301 }
8302}
8303
8304impl std::fmt::Debug for OneofOptions {
8305 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8306 let mut debug_struct = f.debug_struct("OneofOptions");
8307 debug_struct.field("features", &self.features);
8308 debug_struct.field("uninterpreted_option", &self.uninterpreted_option);
8309 if !self._unknown_fields.is_empty() {
8310 debug_struct.field("_unknown_fields", &self._unknown_fields);
8311 }
8312 debug_struct.finish()
8313 }
8314}
8315
8316#[derive(Clone, Default, PartialEq)]
8317#[non_exhaustive]
8318pub struct EnumOptions {
8319 pub allow_alias: bool,
8322
8323 pub deprecated: bool,
8328
8329 #[deprecated]
8336 pub deprecated_legacy_json_field_conflicts: bool,
8337
8338 pub features: std::option::Option<crate::FeatureSet>,
8340
8341 pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
8343
8344 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8345}
8346
8347impl EnumOptions {
8348 pub fn new() -> Self {
8349 std::default::Default::default()
8350 }
8351
8352 pub fn set_allow_alias<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8354 self.allow_alias = v.into();
8355 self
8356 }
8357
8358 pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8360 self.deprecated = v.into();
8361 self
8362 }
8363
8364 #[deprecated]
8366 pub fn set_deprecated_legacy_json_field_conflicts<T: std::convert::Into<bool>>(
8367 mut self,
8368 v: T,
8369 ) -> Self {
8370 self.deprecated_legacy_json_field_conflicts = v.into();
8371 self
8372 }
8373
8374 pub fn set_features<T>(mut self, v: T) -> Self
8376 where
8377 T: std::convert::Into<crate::FeatureSet>,
8378 {
8379 self.features = std::option::Option::Some(v.into());
8380 self
8381 }
8382
8383 pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
8385 where
8386 T: std::convert::Into<crate::FeatureSet>,
8387 {
8388 self.features = v.map(|x| x.into());
8389 self
8390 }
8391
8392 pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
8394 where
8395 T: std::iter::IntoIterator<Item = V>,
8396 V: std::convert::Into<crate::UninterpretedOption>,
8397 {
8398 use std::iter::Iterator;
8399 self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
8400 self
8401 }
8402}
8403
8404impl wkt::message::Message for EnumOptions {
8405 fn typename() -> &'static str {
8406 "type.googleapis.com/google.protobuf.EnumOptions"
8407 }
8408}
8409
8410#[doc(hidden)]
8411impl<'de> serde::de::Deserialize<'de> for EnumOptions {
8412 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8413 where
8414 D: serde::Deserializer<'de>,
8415 {
8416 #[allow(non_camel_case_types)]
8417 #[doc(hidden)]
8418 #[derive(PartialEq, Eq, Hash)]
8419 enum __FieldTag {
8420 __allow_alias,
8421 __deprecated,
8422 __deprecated_legacy_json_field_conflicts,
8423 __features,
8424 __uninterpreted_option,
8425 Unknown(std::string::String),
8426 }
8427 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8428 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8429 where
8430 D: serde::Deserializer<'de>,
8431 {
8432 struct Visitor;
8433 impl<'de> serde::de::Visitor<'de> for Visitor {
8434 type Value = __FieldTag;
8435 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8436 formatter.write_str("a field name for EnumOptions")
8437 }
8438 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8439 where
8440 E: serde::de::Error,
8441 {
8442 use std::result::Result::Ok;
8443 use std::string::ToString;
8444 match value {
8445 "allowAlias" => Ok(__FieldTag::__allow_alias),
8446 "allow_alias" => Ok(__FieldTag::__allow_alias),
8447 "deprecated" => Ok(__FieldTag::__deprecated),
8448 "deprecatedLegacyJsonFieldConflicts" => {
8449 Ok(__FieldTag::__deprecated_legacy_json_field_conflicts)
8450 }
8451 "deprecated_legacy_json_field_conflicts" => {
8452 Ok(__FieldTag::__deprecated_legacy_json_field_conflicts)
8453 }
8454 "features" => Ok(__FieldTag::__features),
8455 "uninterpretedOption" => Ok(__FieldTag::__uninterpreted_option),
8456 "uninterpreted_option" => Ok(__FieldTag::__uninterpreted_option),
8457 _ => Ok(__FieldTag::Unknown(value.to_string())),
8458 }
8459 }
8460 }
8461 deserializer.deserialize_identifier(Visitor)
8462 }
8463 }
8464 struct Visitor;
8465 impl<'de> serde::de::Visitor<'de> for Visitor {
8466 type Value = EnumOptions;
8467 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8468 formatter.write_str("struct EnumOptions")
8469 }
8470 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8471 where
8472 A: serde::de::MapAccess<'de>,
8473 {
8474 #[allow(unused_imports)]
8475 use serde::de::Error;
8476 use std::option::Option::Some;
8477 let mut fields = std::collections::HashSet::new();
8478 let mut result = Self::Value::new();
8479 while let Some(tag) = map.next_key::<__FieldTag>()? {
8480 #[allow(clippy::match_single_binding)]
8481 match tag {
8482 __FieldTag::__allow_alias => {
8483 if !fields.insert(__FieldTag::__allow_alias) {
8484 return std::result::Result::Err(A::Error::duplicate_field(
8485 "multiple values for allow_alias",
8486 ));
8487 }
8488 result.allow_alias = map
8489 .next_value::<std::option::Option<bool>>()?
8490 .unwrap_or_default();
8491 }
8492 __FieldTag::__deprecated => {
8493 if !fields.insert(__FieldTag::__deprecated) {
8494 return std::result::Result::Err(A::Error::duplicate_field(
8495 "multiple values for deprecated",
8496 ));
8497 }
8498 result.deprecated = map
8499 .next_value::<std::option::Option<bool>>()?
8500 .unwrap_or_default();
8501 }
8502 __FieldTag::__deprecated_legacy_json_field_conflicts => {
8503 if !fields.insert(__FieldTag::__deprecated_legacy_json_field_conflicts)
8504 {
8505 return std::result::Result::Err(A::Error::duplicate_field(
8506 "multiple values for deprecated_legacy_json_field_conflicts",
8507 ));
8508 }
8509 result.deprecated_legacy_json_field_conflicts = map
8510 .next_value::<std::option::Option<bool>>()?
8511 .unwrap_or_default();
8512 }
8513 __FieldTag::__features => {
8514 if !fields.insert(__FieldTag::__features) {
8515 return std::result::Result::Err(A::Error::duplicate_field(
8516 "multiple values for features",
8517 ));
8518 }
8519 result.features =
8520 map.next_value::<std::option::Option<crate::FeatureSet>>()?;
8521 }
8522 __FieldTag::__uninterpreted_option => {
8523 if !fields.insert(__FieldTag::__uninterpreted_option) {
8524 return std::result::Result::Err(A::Error::duplicate_field(
8525 "multiple values for uninterpreted_option",
8526 ));
8527 }
8528 result.uninterpreted_option = map.next_value::<std::option::Option<std::vec::Vec<crate::UninterpretedOption>>>()?.unwrap_or_default();
8529 }
8530 __FieldTag::Unknown(key) => {
8531 let value = map.next_value::<serde_json::Value>()?;
8532 result._unknown_fields.insert(key, value);
8533 }
8534 }
8535 }
8536 std::result::Result::Ok(result)
8537 }
8538 }
8539 deserializer.deserialize_any(Visitor)
8540 }
8541}
8542
8543#[doc(hidden)]
8544impl serde::ser::Serialize for EnumOptions {
8545 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8546 where
8547 S: serde::ser::Serializer,
8548 {
8549 use serde::ser::SerializeMap;
8550 #[allow(unused_imports)]
8551 use std::option::Option::Some;
8552 let mut state = serializer.serialize_map(std::option::Option::None)?;
8553 if !wkt::internal::is_default(&self.allow_alias) {
8554 state.serialize_entry("allowAlias", &self.allow_alias)?;
8555 }
8556 if !wkt::internal::is_default(&self.deprecated) {
8557 state.serialize_entry("deprecated", &self.deprecated)?;
8558 }
8559 if !wkt::internal::is_default(&self.deprecated_legacy_json_field_conflicts) {
8560 state.serialize_entry(
8561 "deprecatedLegacyJsonFieldConflicts",
8562 &self.deprecated_legacy_json_field_conflicts,
8563 )?;
8564 }
8565 if self.features.is_some() {
8566 state.serialize_entry("features", &self.features)?;
8567 }
8568 if !self.uninterpreted_option.is_empty() {
8569 state.serialize_entry("uninterpretedOption", &self.uninterpreted_option)?;
8570 }
8571 if !self._unknown_fields.is_empty() {
8572 for (key, value) in self._unknown_fields.iter() {
8573 state.serialize_entry(key, &value)?;
8574 }
8575 }
8576 state.end()
8577 }
8578}
8579
8580impl std::fmt::Debug for EnumOptions {
8581 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8582 let mut debug_struct = f.debug_struct("EnumOptions");
8583 debug_struct.field("allow_alias", &self.allow_alias);
8584 debug_struct.field("deprecated", &self.deprecated);
8585 debug_struct.field(
8586 "deprecated_legacy_json_field_conflicts",
8587 &self.deprecated_legacy_json_field_conflicts,
8588 );
8589 debug_struct.field("features", &self.features);
8590 debug_struct.field("uninterpreted_option", &self.uninterpreted_option);
8591 if !self._unknown_fields.is_empty() {
8592 debug_struct.field("_unknown_fields", &self._unknown_fields);
8593 }
8594 debug_struct.finish()
8595 }
8596}
8597
8598#[derive(Clone, Default, PartialEq)]
8599#[non_exhaustive]
8600pub struct EnumValueOptions {
8601 pub deprecated: bool,
8606
8607 pub features: std::option::Option<crate::FeatureSet>,
8609
8610 pub debug_redact: bool,
8614
8615 pub feature_support: std::option::Option<crate::field_options::FeatureSupport>,
8617
8618 pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
8620
8621 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8622}
8623
8624impl EnumValueOptions {
8625 pub fn new() -> Self {
8626 std::default::Default::default()
8627 }
8628
8629 pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8631 self.deprecated = v.into();
8632 self
8633 }
8634
8635 pub fn set_features<T>(mut self, v: T) -> Self
8637 where
8638 T: std::convert::Into<crate::FeatureSet>,
8639 {
8640 self.features = std::option::Option::Some(v.into());
8641 self
8642 }
8643
8644 pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
8646 where
8647 T: std::convert::Into<crate::FeatureSet>,
8648 {
8649 self.features = v.map(|x| x.into());
8650 self
8651 }
8652
8653 pub fn set_debug_redact<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8655 self.debug_redact = v.into();
8656 self
8657 }
8658
8659 pub fn set_feature_support<T>(mut self, v: T) -> Self
8661 where
8662 T: std::convert::Into<crate::field_options::FeatureSupport>,
8663 {
8664 self.feature_support = std::option::Option::Some(v.into());
8665 self
8666 }
8667
8668 pub fn set_or_clear_feature_support<T>(mut self, v: std::option::Option<T>) -> Self
8670 where
8671 T: std::convert::Into<crate::field_options::FeatureSupport>,
8672 {
8673 self.feature_support = v.map(|x| x.into());
8674 self
8675 }
8676
8677 pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
8679 where
8680 T: std::iter::IntoIterator<Item = V>,
8681 V: std::convert::Into<crate::UninterpretedOption>,
8682 {
8683 use std::iter::Iterator;
8684 self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
8685 self
8686 }
8687}
8688
8689impl wkt::message::Message for EnumValueOptions {
8690 fn typename() -> &'static str {
8691 "type.googleapis.com/google.protobuf.EnumValueOptions"
8692 }
8693}
8694
8695#[doc(hidden)]
8696impl<'de> serde::de::Deserialize<'de> for EnumValueOptions {
8697 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8698 where
8699 D: serde::Deserializer<'de>,
8700 {
8701 #[allow(non_camel_case_types)]
8702 #[doc(hidden)]
8703 #[derive(PartialEq, Eq, Hash)]
8704 enum __FieldTag {
8705 __deprecated,
8706 __features,
8707 __debug_redact,
8708 __feature_support,
8709 __uninterpreted_option,
8710 Unknown(std::string::String),
8711 }
8712 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8713 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8714 where
8715 D: serde::Deserializer<'de>,
8716 {
8717 struct Visitor;
8718 impl<'de> serde::de::Visitor<'de> for Visitor {
8719 type Value = __FieldTag;
8720 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8721 formatter.write_str("a field name for EnumValueOptions")
8722 }
8723 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8724 where
8725 E: serde::de::Error,
8726 {
8727 use std::result::Result::Ok;
8728 use std::string::ToString;
8729 match value {
8730 "deprecated" => Ok(__FieldTag::__deprecated),
8731 "features" => Ok(__FieldTag::__features),
8732 "debugRedact" => Ok(__FieldTag::__debug_redact),
8733 "debug_redact" => Ok(__FieldTag::__debug_redact),
8734 "featureSupport" => Ok(__FieldTag::__feature_support),
8735 "feature_support" => Ok(__FieldTag::__feature_support),
8736 "uninterpretedOption" => Ok(__FieldTag::__uninterpreted_option),
8737 "uninterpreted_option" => Ok(__FieldTag::__uninterpreted_option),
8738 _ => Ok(__FieldTag::Unknown(value.to_string())),
8739 }
8740 }
8741 }
8742 deserializer.deserialize_identifier(Visitor)
8743 }
8744 }
8745 struct Visitor;
8746 impl<'de> serde::de::Visitor<'de> for Visitor {
8747 type Value = EnumValueOptions;
8748 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8749 formatter.write_str("struct EnumValueOptions")
8750 }
8751 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8752 where
8753 A: serde::de::MapAccess<'de>,
8754 {
8755 #[allow(unused_imports)]
8756 use serde::de::Error;
8757 use std::option::Option::Some;
8758 let mut fields = std::collections::HashSet::new();
8759 let mut result = Self::Value::new();
8760 while let Some(tag) = map.next_key::<__FieldTag>()? {
8761 #[allow(clippy::match_single_binding)]
8762 match tag {
8763 __FieldTag::__deprecated => {
8764 if !fields.insert(__FieldTag::__deprecated) {
8765 return std::result::Result::Err(A::Error::duplicate_field(
8766 "multiple values for deprecated",
8767 ));
8768 }
8769 result.deprecated = map
8770 .next_value::<std::option::Option<bool>>()?
8771 .unwrap_or_default();
8772 }
8773 __FieldTag::__features => {
8774 if !fields.insert(__FieldTag::__features) {
8775 return std::result::Result::Err(A::Error::duplicate_field(
8776 "multiple values for features",
8777 ));
8778 }
8779 result.features =
8780 map.next_value::<std::option::Option<crate::FeatureSet>>()?;
8781 }
8782 __FieldTag::__debug_redact => {
8783 if !fields.insert(__FieldTag::__debug_redact) {
8784 return std::result::Result::Err(A::Error::duplicate_field(
8785 "multiple values for debug_redact",
8786 ));
8787 }
8788 result.debug_redact = map
8789 .next_value::<std::option::Option<bool>>()?
8790 .unwrap_or_default();
8791 }
8792 __FieldTag::__feature_support => {
8793 if !fields.insert(__FieldTag::__feature_support) {
8794 return std::result::Result::Err(A::Error::duplicate_field(
8795 "multiple values for feature_support",
8796 ));
8797 }
8798 result.feature_support = map.next_value::<std::option::Option<crate::field_options::FeatureSupport>>()?
8799 ;
8800 }
8801 __FieldTag::__uninterpreted_option => {
8802 if !fields.insert(__FieldTag::__uninterpreted_option) {
8803 return std::result::Result::Err(A::Error::duplicate_field(
8804 "multiple values for uninterpreted_option",
8805 ));
8806 }
8807 result.uninterpreted_option = map.next_value::<std::option::Option<std::vec::Vec<crate::UninterpretedOption>>>()?.unwrap_or_default();
8808 }
8809 __FieldTag::Unknown(key) => {
8810 let value = map.next_value::<serde_json::Value>()?;
8811 result._unknown_fields.insert(key, value);
8812 }
8813 }
8814 }
8815 std::result::Result::Ok(result)
8816 }
8817 }
8818 deserializer.deserialize_any(Visitor)
8819 }
8820}
8821
8822#[doc(hidden)]
8823impl serde::ser::Serialize for EnumValueOptions {
8824 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8825 where
8826 S: serde::ser::Serializer,
8827 {
8828 use serde::ser::SerializeMap;
8829 #[allow(unused_imports)]
8830 use std::option::Option::Some;
8831 let mut state = serializer.serialize_map(std::option::Option::None)?;
8832 if !wkt::internal::is_default(&self.deprecated) {
8833 state.serialize_entry("deprecated", &self.deprecated)?;
8834 }
8835 if self.features.is_some() {
8836 state.serialize_entry("features", &self.features)?;
8837 }
8838 if !wkt::internal::is_default(&self.debug_redact) {
8839 state.serialize_entry("debugRedact", &self.debug_redact)?;
8840 }
8841 if self.feature_support.is_some() {
8842 state.serialize_entry("featureSupport", &self.feature_support)?;
8843 }
8844 if !self.uninterpreted_option.is_empty() {
8845 state.serialize_entry("uninterpretedOption", &self.uninterpreted_option)?;
8846 }
8847 if !self._unknown_fields.is_empty() {
8848 for (key, value) in self._unknown_fields.iter() {
8849 state.serialize_entry(key, &value)?;
8850 }
8851 }
8852 state.end()
8853 }
8854}
8855
8856impl std::fmt::Debug for EnumValueOptions {
8857 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8858 let mut debug_struct = f.debug_struct("EnumValueOptions");
8859 debug_struct.field("deprecated", &self.deprecated);
8860 debug_struct.field("features", &self.features);
8861 debug_struct.field("debug_redact", &self.debug_redact);
8862 debug_struct.field("feature_support", &self.feature_support);
8863 debug_struct.field("uninterpreted_option", &self.uninterpreted_option);
8864 if !self._unknown_fields.is_empty() {
8865 debug_struct.field("_unknown_fields", &self._unknown_fields);
8866 }
8867 debug_struct.finish()
8868 }
8869}
8870
8871#[derive(Clone, Default, PartialEq)]
8872#[non_exhaustive]
8873pub struct ServiceOptions {
8874 pub features: std::option::Option<crate::FeatureSet>,
8876
8877 pub deprecated: bool,
8882
8883 pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
8885
8886 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8887}
8888
8889impl ServiceOptions {
8890 pub fn new() -> Self {
8891 std::default::Default::default()
8892 }
8893
8894 pub fn set_features<T>(mut self, v: T) -> Self
8896 where
8897 T: std::convert::Into<crate::FeatureSet>,
8898 {
8899 self.features = std::option::Option::Some(v.into());
8900 self
8901 }
8902
8903 pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
8905 where
8906 T: std::convert::Into<crate::FeatureSet>,
8907 {
8908 self.features = v.map(|x| x.into());
8909 self
8910 }
8911
8912 pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8914 self.deprecated = v.into();
8915 self
8916 }
8917
8918 pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
8920 where
8921 T: std::iter::IntoIterator<Item = V>,
8922 V: std::convert::Into<crate::UninterpretedOption>,
8923 {
8924 use std::iter::Iterator;
8925 self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
8926 self
8927 }
8928}
8929
8930impl wkt::message::Message for ServiceOptions {
8931 fn typename() -> &'static str {
8932 "type.googleapis.com/google.protobuf.ServiceOptions"
8933 }
8934}
8935
8936#[doc(hidden)]
8937impl<'de> serde::de::Deserialize<'de> for ServiceOptions {
8938 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8939 where
8940 D: serde::Deserializer<'de>,
8941 {
8942 #[allow(non_camel_case_types)]
8943 #[doc(hidden)]
8944 #[derive(PartialEq, Eq, Hash)]
8945 enum __FieldTag {
8946 __features,
8947 __deprecated,
8948 __uninterpreted_option,
8949 Unknown(std::string::String),
8950 }
8951 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
8952 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8953 where
8954 D: serde::Deserializer<'de>,
8955 {
8956 struct Visitor;
8957 impl<'de> serde::de::Visitor<'de> for Visitor {
8958 type Value = __FieldTag;
8959 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8960 formatter.write_str("a field name for ServiceOptions")
8961 }
8962 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
8963 where
8964 E: serde::de::Error,
8965 {
8966 use std::result::Result::Ok;
8967 use std::string::ToString;
8968 match value {
8969 "features" => Ok(__FieldTag::__features),
8970 "deprecated" => Ok(__FieldTag::__deprecated),
8971 "uninterpretedOption" => Ok(__FieldTag::__uninterpreted_option),
8972 "uninterpreted_option" => Ok(__FieldTag::__uninterpreted_option),
8973 _ => Ok(__FieldTag::Unknown(value.to_string())),
8974 }
8975 }
8976 }
8977 deserializer.deserialize_identifier(Visitor)
8978 }
8979 }
8980 struct Visitor;
8981 impl<'de> serde::de::Visitor<'de> for Visitor {
8982 type Value = ServiceOptions;
8983 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
8984 formatter.write_str("struct ServiceOptions")
8985 }
8986 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
8987 where
8988 A: serde::de::MapAccess<'de>,
8989 {
8990 #[allow(unused_imports)]
8991 use serde::de::Error;
8992 use std::option::Option::Some;
8993 let mut fields = std::collections::HashSet::new();
8994 let mut result = Self::Value::new();
8995 while let Some(tag) = map.next_key::<__FieldTag>()? {
8996 #[allow(clippy::match_single_binding)]
8997 match tag {
8998 __FieldTag::__features => {
8999 if !fields.insert(__FieldTag::__features) {
9000 return std::result::Result::Err(A::Error::duplicate_field(
9001 "multiple values for features",
9002 ));
9003 }
9004 result.features =
9005 map.next_value::<std::option::Option<crate::FeatureSet>>()?;
9006 }
9007 __FieldTag::__deprecated => {
9008 if !fields.insert(__FieldTag::__deprecated) {
9009 return std::result::Result::Err(A::Error::duplicate_field(
9010 "multiple values for deprecated",
9011 ));
9012 }
9013 result.deprecated = map
9014 .next_value::<std::option::Option<bool>>()?
9015 .unwrap_or_default();
9016 }
9017 __FieldTag::__uninterpreted_option => {
9018 if !fields.insert(__FieldTag::__uninterpreted_option) {
9019 return std::result::Result::Err(A::Error::duplicate_field(
9020 "multiple values for uninterpreted_option",
9021 ));
9022 }
9023 result.uninterpreted_option = map.next_value::<std::option::Option<std::vec::Vec<crate::UninterpretedOption>>>()?.unwrap_or_default();
9024 }
9025 __FieldTag::Unknown(key) => {
9026 let value = map.next_value::<serde_json::Value>()?;
9027 result._unknown_fields.insert(key, value);
9028 }
9029 }
9030 }
9031 std::result::Result::Ok(result)
9032 }
9033 }
9034 deserializer.deserialize_any(Visitor)
9035 }
9036}
9037
9038#[doc(hidden)]
9039impl serde::ser::Serialize for ServiceOptions {
9040 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9041 where
9042 S: serde::ser::Serializer,
9043 {
9044 use serde::ser::SerializeMap;
9045 #[allow(unused_imports)]
9046 use std::option::Option::Some;
9047 let mut state = serializer.serialize_map(std::option::Option::None)?;
9048 if self.features.is_some() {
9049 state.serialize_entry("features", &self.features)?;
9050 }
9051 if !wkt::internal::is_default(&self.deprecated) {
9052 state.serialize_entry("deprecated", &self.deprecated)?;
9053 }
9054 if !self.uninterpreted_option.is_empty() {
9055 state.serialize_entry("uninterpretedOption", &self.uninterpreted_option)?;
9056 }
9057 if !self._unknown_fields.is_empty() {
9058 for (key, value) in self._unknown_fields.iter() {
9059 state.serialize_entry(key, &value)?;
9060 }
9061 }
9062 state.end()
9063 }
9064}
9065
9066impl std::fmt::Debug for ServiceOptions {
9067 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9068 let mut debug_struct = f.debug_struct("ServiceOptions");
9069 debug_struct.field("features", &self.features);
9070 debug_struct.field("deprecated", &self.deprecated);
9071 debug_struct.field("uninterpreted_option", &self.uninterpreted_option);
9072 if !self._unknown_fields.is_empty() {
9073 debug_struct.field("_unknown_fields", &self._unknown_fields);
9074 }
9075 debug_struct.finish()
9076 }
9077}
9078
9079#[derive(Clone, Default, PartialEq)]
9080#[non_exhaustive]
9081pub struct MethodOptions {
9082 pub deprecated: bool,
9087
9088 pub idempotency_level: crate::method_options::IdempotencyLevel,
9089
9090 pub features: std::option::Option<crate::FeatureSet>,
9092
9093 pub uninterpreted_option: std::vec::Vec<crate::UninterpretedOption>,
9095
9096 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9097}
9098
9099impl MethodOptions {
9100 pub fn new() -> Self {
9101 std::default::Default::default()
9102 }
9103
9104 pub fn set_deprecated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9106 self.deprecated = v.into();
9107 self
9108 }
9109
9110 pub fn set_idempotency_level<T: std::convert::Into<crate::method_options::IdempotencyLevel>>(
9112 mut self,
9113 v: T,
9114 ) -> Self {
9115 self.idempotency_level = v.into();
9116 self
9117 }
9118
9119 pub fn set_features<T>(mut self, v: T) -> Self
9121 where
9122 T: std::convert::Into<crate::FeatureSet>,
9123 {
9124 self.features = std::option::Option::Some(v.into());
9125 self
9126 }
9127
9128 pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
9130 where
9131 T: std::convert::Into<crate::FeatureSet>,
9132 {
9133 self.features = v.map(|x| x.into());
9134 self
9135 }
9136
9137 pub fn set_uninterpreted_option<T, V>(mut self, v: T) -> Self
9139 where
9140 T: std::iter::IntoIterator<Item = V>,
9141 V: std::convert::Into<crate::UninterpretedOption>,
9142 {
9143 use std::iter::Iterator;
9144 self.uninterpreted_option = v.into_iter().map(|i| i.into()).collect();
9145 self
9146 }
9147}
9148
9149impl wkt::message::Message for MethodOptions {
9150 fn typename() -> &'static str {
9151 "type.googleapis.com/google.protobuf.MethodOptions"
9152 }
9153}
9154
9155#[doc(hidden)]
9156impl<'de> serde::de::Deserialize<'de> for MethodOptions {
9157 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9158 where
9159 D: serde::Deserializer<'de>,
9160 {
9161 #[allow(non_camel_case_types)]
9162 #[doc(hidden)]
9163 #[derive(PartialEq, Eq, Hash)]
9164 enum __FieldTag {
9165 __deprecated,
9166 __idempotency_level,
9167 __features,
9168 __uninterpreted_option,
9169 Unknown(std::string::String),
9170 }
9171 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9172 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9173 where
9174 D: serde::Deserializer<'de>,
9175 {
9176 struct Visitor;
9177 impl<'de> serde::de::Visitor<'de> for Visitor {
9178 type Value = __FieldTag;
9179 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9180 formatter.write_str("a field name for MethodOptions")
9181 }
9182 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9183 where
9184 E: serde::de::Error,
9185 {
9186 use std::result::Result::Ok;
9187 use std::string::ToString;
9188 match value {
9189 "deprecated" => Ok(__FieldTag::__deprecated),
9190 "idempotencyLevel" => Ok(__FieldTag::__idempotency_level),
9191 "idempotency_level" => Ok(__FieldTag::__idempotency_level),
9192 "features" => Ok(__FieldTag::__features),
9193 "uninterpretedOption" => Ok(__FieldTag::__uninterpreted_option),
9194 "uninterpreted_option" => Ok(__FieldTag::__uninterpreted_option),
9195 _ => Ok(__FieldTag::Unknown(value.to_string())),
9196 }
9197 }
9198 }
9199 deserializer.deserialize_identifier(Visitor)
9200 }
9201 }
9202 struct Visitor;
9203 impl<'de> serde::de::Visitor<'de> for Visitor {
9204 type Value = MethodOptions;
9205 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9206 formatter.write_str("struct MethodOptions")
9207 }
9208 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9209 where
9210 A: serde::de::MapAccess<'de>,
9211 {
9212 #[allow(unused_imports)]
9213 use serde::de::Error;
9214 use std::option::Option::Some;
9215 let mut fields = std::collections::HashSet::new();
9216 let mut result = Self::Value::new();
9217 while let Some(tag) = map.next_key::<__FieldTag>()? {
9218 #[allow(clippy::match_single_binding)]
9219 match tag {
9220 __FieldTag::__deprecated => {
9221 if !fields.insert(__FieldTag::__deprecated) {
9222 return std::result::Result::Err(A::Error::duplicate_field(
9223 "multiple values for deprecated",
9224 ));
9225 }
9226 result.deprecated = map
9227 .next_value::<std::option::Option<bool>>()?
9228 .unwrap_or_default();
9229 }
9230 __FieldTag::__idempotency_level => {
9231 if !fields.insert(__FieldTag::__idempotency_level) {
9232 return std::result::Result::Err(A::Error::duplicate_field(
9233 "multiple values for idempotency_level",
9234 ));
9235 }
9236 result.idempotency_level = map.next_value::<std::option::Option<crate::method_options::IdempotencyLevel>>()?.unwrap_or_default();
9237 }
9238 __FieldTag::__features => {
9239 if !fields.insert(__FieldTag::__features) {
9240 return std::result::Result::Err(A::Error::duplicate_field(
9241 "multiple values for features",
9242 ));
9243 }
9244 result.features =
9245 map.next_value::<std::option::Option<crate::FeatureSet>>()?;
9246 }
9247 __FieldTag::__uninterpreted_option => {
9248 if !fields.insert(__FieldTag::__uninterpreted_option) {
9249 return std::result::Result::Err(A::Error::duplicate_field(
9250 "multiple values for uninterpreted_option",
9251 ));
9252 }
9253 result.uninterpreted_option = map.next_value::<std::option::Option<std::vec::Vec<crate::UninterpretedOption>>>()?.unwrap_or_default();
9254 }
9255 __FieldTag::Unknown(key) => {
9256 let value = map.next_value::<serde_json::Value>()?;
9257 result._unknown_fields.insert(key, value);
9258 }
9259 }
9260 }
9261 std::result::Result::Ok(result)
9262 }
9263 }
9264 deserializer.deserialize_any(Visitor)
9265 }
9266}
9267
9268#[doc(hidden)]
9269impl serde::ser::Serialize for MethodOptions {
9270 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9271 where
9272 S: serde::ser::Serializer,
9273 {
9274 use serde::ser::SerializeMap;
9275 #[allow(unused_imports)]
9276 use std::option::Option::Some;
9277 let mut state = serializer.serialize_map(std::option::Option::None)?;
9278 if !wkt::internal::is_default(&self.deprecated) {
9279 state.serialize_entry("deprecated", &self.deprecated)?;
9280 }
9281 if !wkt::internal::is_default(&self.idempotency_level) {
9282 state.serialize_entry("idempotencyLevel", &self.idempotency_level)?;
9283 }
9284 if self.features.is_some() {
9285 state.serialize_entry("features", &self.features)?;
9286 }
9287 if !self.uninterpreted_option.is_empty() {
9288 state.serialize_entry("uninterpretedOption", &self.uninterpreted_option)?;
9289 }
9290 if !self._unknown_fields.is_empty() {
9291 for (key, value) in self._unknown_fields.iter() {
9292 state.serialize_entry(key, &value)?;
9293 }
9294 }
9295 state.end()
9296 }
9297}
9298
9299impl std::fmt::Debug for MethodOptions {
9300 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9301 let mut debug_struct = f.debug_struct("MethodOptions");
9302 debug_struct.field("deprecated", &self.deprecated);
9303 debug_struct.field("idempotency_level", &self.idempotency_level);
9304 debug_struct.field("features", &self.features);
9305 debug_struct.field("uninterpreted_option", &self.uninterpreted_option);
9306 if !self._unknown_fields.is_empty() {
9307 debug_struct.field("_unknown_fields", &self._unknown_fields);
9308 }
9309 debug_struct.finish()
9310 }
9311}
9312
9313pub mod method_options {
9315 #[allow(unused_imports)]
9316 use super::*;
9317
9318 #[derive(Clone, Debug, PartialEq)]
9336 #[non_exhaustive]
9337 pub enum IdempotencyLevel {
9338 IdempotencyUnknown,
9339 NoSideEffects,
9340 Idempotent,
9341 UnknownValue(idempotency_level::UnknownValue),
9346 }
9347
9348 #[doc(hidden)]
9349 pub mod idempotency_level {
9350 #[allow(unused_imports)]
9351 use super::*;
9352 #[derive(Clone, Debug, PartialEq)]
9353 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9354 }
9355
9356 impl IdempotencyLevel {
9357 pub fn value(&self) -> std::option::Option<i32> {
9362 match self {
9363 Self::IdempotencyUnknown => std::option::Option::Some(0),
9364 Self::NoSideEffects => std::option::Option::Some(1),
9365 Self::Idempotent => std::option::Option::Some(2),
9366 Self::UnknownValue(u) => u.0.value(),
9367 }
9368 }
9369
9370 pub fn name(&self) -> std::option::Option<&str> {
9375 match self {
9376 Self::IdempotencyUnknown => std::option::Option::Some("IDEMPOTENCY_UNKNOWN"),
9377 Self::NoSideEffects => std::option::Option::Some("NO_SIDE_EFFECTS"),
9378 Self::Idempotent => std::option::Option::Some("IDEMPOTENT"),
9379 Self::UnknownValue(u) => u.0.name(),
9380 }
9381 }
9382 }
9383
9384 impl std::default::Default for IdempotencyLevel {
9385 fn default() -> Self {
9386 use std::convert::From;
9387 Self::from(0)
9388 }
9389 }
9390
9391 impl std::fmt::Display for IdempotencyLevel {
9392 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9393 wkt::internal::display_enum(f, self.name(), self.value())
9394 }
9395 }
9396
9397 impl std::convert::From<i32> for IdempotencyLevel {
9398 fn from(value: i32) -> Self {
9399 match value {
9400 0 => Self::IdempotencyUnknown,
9401 1 => Self::NoSideEffects,
9402 2 => Self::Idempotent,
9403 _ => Self::UnknownValue(idempotency_level::UnknownValue(
9404 wkt::internal::UnknownEnumValue::Integer(value),
9405 )),
9406 }
9407 }
9408 }
9409
9410 impl std::convert::From<&str> for IdempotencyLevel {
9411 fn from(value: &str) -> Self {
9412 use std::string::ToString;
9413 match value {
9414 "IDEMPOTENCY_UNKNOWN" => Self::IdempotencyUnknown,
9415 "NO_SIDE_EFFECTS" => Self::NoSideEffects,
9416 "IDEMPOTENT" => Self::Idempotent,
9417 _ => Self::UnknownValue(idempotency_level::UnknownValue(
9418 wkt::internal::UnknownEnumValue::String(value.to_string()),
9419 )),
9420 }
9421 }
9422 }
9423
9424 impl serde::ser::Serialize for IdempotencyLevel {
9425 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9426 where
9427 S: serde::Serializer,
9428 {
9429 match self {
9430 Self::IdempotencyUnknown => serializer.serialize_i32(0),
9431 Self::NoSideEffects => serializer.serialize_i32(1),
9432 Self::Idempotent => serializer.serialize_i32(2),
9433 Self::UnknownValue(u) => u.0.serialize(serializer),
9434 }
9435 }
9436 }
9437
9438 impl<'de> serde::de::Deserialize<'de> for IdempotencyLevel {
9439 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9440 where
9441 D: serde::Deserializer<'de>,
9442 {
9443 deserializer.deserialize_any(wkt::internal::EnumVisitor::<IdempotencyLevel>::new(
9444 ".google.protobuf.MethodOptions.IdempotencyLevel",
9445 ))
9446 }
9447 }
9448}
9449
9450#[derive(Clone, Default, PartialEq)]
9457#[non_exhaustive]
9458pub struct UninterpretedOption {
9459 pub name: std::vec::Vec<crate::uninterpreted_option::NamePart>,
9460
9461 pub identifier_value: std::string::String,
9464
9465 pub positive_int_value: u64,
9466
9467 pub negative_int_value: i64,
9468
9469 pub double_value: f64,
9470
9471 pub string_value: ::bytes::Bytes,
9472
9473 pub aggregate_value: std::string::String,
9474
9475 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9476}
9477
9478impl UninterpretedOption {
9479 pub fn new() -> Self {
9480 std::default::Default::default()
9481 }
9482
9483 pub fn set_name<T, V>(mut self, v: T) -> Self
9485 where
9486 T: std::iter::IntoIterator<Item = V>,
9487 V: std::convert::Into<crate::uninterpreted_option::NamePart>,
9488 {
9489 use std::iter::Iterator;
9490 self.name = v.into_iter().map(|i| i.into()).collect();
9491 self
9492 }
9493
9494 pub fn set_identifier_value<T: std::convert::Into<std::string::String>>(
9496 mut self,
9497 v: T,
9498 ) -> Self {
9499 self.identifier_value = v.into();
9500 self
9501 }
9502
9503 pub fn set_positive_int_value<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
9505 self.positive_int_value = v.into();
9506 self
9507 }
9508
9509 pub fn set_negative_int_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9511 self.negative_int_value = v.into();
9512 self
9513 }
9514
9515 pub fn set_double_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
9517 self.double_value = v.into();
9518 self
9519 }
9520
9521 pub fn set_string_value<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9523 self.string_value = v.into();
9524 self
9525 }
9526
9527 pub fn set_aggregate_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9529 self.aggregate_value = v.into();
9530 self
9531 }
9532}
9533
9534impl wkt::message::Message for UninterpretedOption {
9535 fn typename() -> &'static str {
9536 "type.googleapis.com/google.protobuf.UninterpretedOption"
9537 }
9538}
9539
9540#[doc(hidden)]
9541impl<'de> serde::de::Deserialize<'de> for UninterpretedOption {
9542 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9543 where
9544 D: serde::Deserializer<'de>,
9545 {
9546 #[allow(non_camel_case_types)]
9547 #[doc(hidden)]
9548 #[derive(PartialEq, Eq, Hash)]
9549 enum __FieldTag {
9550 __name,
9551 __identifier_value,
9552 __positive_int_value,
9553 __negative_int_value,
9554 __double_value,
9555 __string_value,
9556 __aggregate_value,
9557 Unknown(std::string::String),
9558 }
9559 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9560 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9561 where
9562 D: serde::Deserializer<'de>,
9563 {
9564 struct Visitor;
9565 impl<'de> serde::de::Visitor<'de> for Visitor {
9566 type Value = __FieldTag;
9567 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9568 formatter.write_str("a field name for UninterpretedOption")
9569 }
9570 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9571 where
9572 E: serde::de::Error,
9573 {
9574 use std::result::Result::Ok;
9575 use std::string::ToString;
9576 match value {
9577 "name" => Ok(__FieldTag::__name),
9578 "identifierValue" => Ok(__FieldTag::__identifier_value),
9579 "identifier_value" => Ok(__FieldTag::__identifier_value),
9580 "positiveIntValue" => Ok(__FieldTag::__positive_int_value),
9581 "positive_int_value" => Ok(__FieldTag::__positive_int_value),
9582 "negativeIntValue" => Ok(__FieldTag::__negative_int_value),
9583 "negative_int_value" => Ok(__FieldTag::__negative_int_value),
9584 "doubleValue" => Ok(__FieldTag::__double_value),
9585 "double_value" => Ok(__FieldTag::__double_value),
9586 "stringValue" => Ok(__FieldTag::__string_value),
9587 "string_value" => Ok(__FieldTag::__string_value),
9588 "aggregateValue" => Ok(__FieldTag::__aggregate_value),
9589 "aggregate_value" => Ok(__FieldTag::__aggregate_value),
9590 _ => Ok(__FieldTag::Unknown(value.to_string())),
9591 }
9592 }
9593 }
9594 deserializer.deserialize_identifier(Visitor)
9595 }
9596 }
9597 struct Visitor;
9598 impl<'de> serde::de::Visitor<'de> for Visitor {
9599 type Value = UninterpretedOption;
9600 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9601 formatter.write_str("struct UninterpretedOption")
9602 }
9603 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9604 where
9605 A: serde::de::MapAccess<'de>,
9606 {
9607 #[allow(unused_imports)]
9608 use serde::de::Error;
9609 use std::option::Option::Some;
9610 let mut fields = std::collections::HashSet::new();
9611 let mut result = Self::Value::new();
9612 while let Some(tag) = map.next_key::<__FieldTag>()? {
9613 #[allow(clippy::match_single_binding)]
9614 match tag {
9615 __FieldTag::__name => {
9616 if !fields.insert(__FieldTag::__name) {
9617 return std::result::Result::Err(A::Error::duplicate_field(
9618 "multiple values for name",
9619 ));
9620 }
9621 result.name = map
9622 .next_value::<std::option::Option<
9623 std::vec::Vec<crate::uninterpreted_option::NamePart>,
9624 >>()?
9625 .unwrap_or_default();
9626 }
9627 __FieldTag::__identifier_value => {
9628 if !fields.insert(__FieldTag::__identifier_value) {
9629 return std::result::Result::Err(A::Error::duplicate_field(
9630 "multiple values for identifier_value",
9631 ));
9632 }
9633 result.identifier_value = map
9634 .next_value::<std::option::Option<std::string::String>>()?
9635 .unwrap_or_default();
9636 }
9637 __FieldTag::__positive_int_value => {
9638 if !fields.insert(__FieldTag::__positive_int_value) {
9639 return std::result::Result::Err(A::Error::duplicate_field(
9640 "multiple values for positive_int_value",
9641 ));
9642 }
9643 struct __With(std::option::Option<u64>);
9644 impl<'de> serde::de::Deserialize<'de> for __With {
9645 fn deserialize<D>(
9646 deserializer: D,
9647 ) -> std::result::Result<Self, D::Error>
9648 where
9649 D: serde::de::Deserializer<'de>,
9650 {
9651 serde_with::As::< std::option::Option<wkt::internal::U64> >::deserialize(deserializer).map(__With)
9652 }
9653 }
9654 result.positive_int_value =
9655 map.next_value::<__With>()?.0.unwrap_or_default();
9656 }
9657 __FieldTag::__negative_int_value => {
9658 if !fields.insert(__FieldTag::__negative_int_value) {
9659 return std::result::Result::Err(A::Error::duplicate_field(
9660 "multiple values for negative_int_value",
9661 ));
9662 }
9663 struct __With(std::option::Option<i64>);
9664 impl<'de> serde::de::Deserialize<'de> for __With {
9665 fn deserialize<D>(
9666 deserializer: D,
9667 ) -> std::result::Result<Self, D::Error>
9668 where
9669 D: serde::de::Deserializer<'de>,
9670 {
9671 serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
9672 }
9673 }
9674 result.negative_int_value =
9675 map.next_value::<__With>()?.0.unwrap_or_default();
9676 }
9677 __FieldTag::__double_value => {
9678 if !fields.insert(__FieldTag::__double_value) {
9679 return std::result::Result::Err(A::Error::duplicate_field(
9680 "multiple values for double_value",
9681 ));
9682 }
9683 struct __With(std::option::Option<f64>);
9684 impl<'de> serde::de::Deserialize<'de> for __With {
9685 fn deserialize<D>(
9686 deserializer: D,
9687 ) -> std::result::Result<Self, D::Error>
9688 where
9689 D: serde::de::Deserializer<'de>,
9690 {
9691 serde_with::As::< std::option::Option<wkt::internal::F64> >::deserialize(deserializer).map(__With)
9692 }
9693 }
9694 result.double_value = map.next_value::<__With>()?.0.unwrap_or_default();
9695 }
9696 __FieldTag::__string_value => {
9697 if !fields.insert(__FieldTag::__string_value) {
9698 return std::result::Result::Err(A::Error::duplicate_field(
9699 "multiple values for string_value",
9700 ));
9701 }
9702 struct __With(std::option::Option<::bytes::Bytes>);
9703 impl<'de> serde::de::Deserialize<'de> for __With {
9704 fn deserialize<D>(
9705 deserializer: D,
9706 ) -> std::result::Result<Self, D::Error>
9707 where
9708 D: serde::de::Deserializer<'de>,
9709 {
9710 serde_with::As::< std::option::Option<serde_with::base64::Base64> >::deserialize(deserializer).map(__With)
9711 }
9712 }
9713 result.string_value = map.next_value::<__With>()?.0.unwrap_or_default();
9714 }
9715 __FieldTag::__aggregate_value => {
9716 if !fields.insert(__FieldTag::__aggregate_value) {
9717 return std::result::Result::Err(A::Error::duplicate_field(
9718 "multiple values for aggregate_value",
9719 ));
9720 }
9721 result.aggregate_value = map
9722 .next_value::<std::option::Option<std::string::String>>()?
9723 .unwrap_or_default();
9724 }
9725 __FieldTag::Unknown(key) => {
9726 let value = map.next_value::<serde_json::Value>()?;
9727 result._unknown_fields.insert(key, value);
9728 }
9729 }
9730 }
9731 std::result::Result::Ok(result)
9732 }
9733 }
9734 deserializer.deserialize_any(Visitor)
9735 }
9736}
9737
9738#[doc(hidden)]
9739impl serde::ser::Serialize for UninterpretedOption {
9740 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9741 where
9742 S: serde::ser::Serializer,
9743 {
9744 use serde::ser::SerializeMap;
9745 #[allow(unused_imports)]
9746 use std::option::Option::Some;
9747 let mut state = serializer.serialize_map(std::option::Option::None)?;
9748 if !self.name.is_empty() {
9749 state.serialize_entry("name", &self.name)?;
9750 }
9751 if !self.identifier_value.is_empty() {
9752 state.serialize_entry("identifierValue", &self.identifier_value)?;
9753 }
9754 if !wkt::internal::is_default(&self.positive_int_value) {
9755 struct __With<'a>(&'a u64);
9756 impl<'a> serde::ser::Serialize for __With<'a> {
9757 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9758 where
9759 S: serde::ser::Serializer,
9760 {
9761 serde_with::As::<wkt::internal::U64>::serialize(self.0, serializer)
9762 }
9763 }
9764 state.serialize_entry("positiveIntValue", &__With(&self.positive_int_value))?;
9765 }
9766 if !wkt::internal::is_default(&self.negative_int_value) {
9767 struct __With<'a>(&'a i64);
9768 impl<'a> serde::ser::Serialize for __With<'a> {
9769 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9770 where
9771 S: serde::ser::Serializer,
9772 {
9773 serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
9774 }
9775 }
9776 state.serialize_entry("negativeIntValue", &__With(&self.negative_int_value))?;
9777 }
9778 if !wkt::internal::is_default(&self.double_value) {
9779 struct __With<'a>(&'a f64);
9780 impl<'a> serde::ser::Serialize for __With<'a> {
9781 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9782 where
9783 S: serde::ser::Serializer,
9784 {
9785 serde_with::As::<wkt::internal::F64>::serialize(self.0, serializer)
9786 }
9787 }
9788 state.serialize_entry("doubleValue", &__With(&self.double_value))?;
9789 }
9790 if !self.string_value.is_empty() {
9791 struct __With<'a>(&'a ::bytes::Bytes);
9792 impl<'a> serde::ser::Serialize for __With<'a> {
9793 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9794 where
9795 S: serde::ser::Serializer,
9796 {
9797 serde_with::As::<serde_with::base64::Base64>::serialize(self.0, serializer)
9798 }
9799 }
9800 state.serialize_entry("stringValue", &__With(&self.string_value))?;
9801 }
9802 if !self.aggregate_value.is_empty() {
9803 state.serialize_entry("aggregateValue", &self.aggregate_value)?;
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
9814impl std::fmt::Debug for UninterpretedOption {
9815 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9816 let mut debug_struct = f.debug_struct("UninterpretedOption");
9817 debug_struct.field("name", &self.name);
9818 debug_struct.field("identifier_value", &self.identifier_value);
9819 debug_struct.field("positive_int_value", &self.positive_int_value);
9820 debug_struct.field("negative_int_value", &self.negative_int_value);
9821 debug_struct.field("double_value", &self.double_value);
9822 debug_struct.field("string_value", &self.string_value);
9823 debug_struct.field("aggregate_value", &self.aggregate_value);
9824 if !self._unknown_fields.is_empty() {
9825 debug_struct.field("_unknown_fields", &self._unknown_fields);
9826 }
9827 debug_struct.finish()
9828 }
9829}
9830
9831pub mod uninterpreted_option {
9833 #[allow(unused_imports)]
9834 use super::*;
9835
9836 #[derive(Clone, Default, PartialEq)]
9842 #[non_exhaustive]
9843 pub struct NamePart {
9844 pub name_part: std::string::String,
9845
9846 pub is_extension: bool,
9847
9848 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9849 }
9850
9851 impl NamePart {
9852 pub fn new() -> Self {
9853 std::default::Default::default()
9854 }
9855
9856 pub fn set_name_part<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9858 self.name_part = v.into();
9859 self
9860 }
9861
9862 pub fn set_is_extension<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9864 self.is_extension = v.into();
9865 self
9866 }
9867 }
9868
9869 impl wkt::message::Message for NamePart {
9870 fn typename() -> &'static str {
9871 "type.googleapis.com/google.protobuf.UninterpretedOption.NamePart"
9872 }
9873 }
9874
9875 #[doc(hidden)]
9876 impl<'de> serde::de::Deserialize<'de> for NamePart {
9877 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9878 where
9879 D: serde::Deserializer<'de>,
9880 {
9881 #[allow(non_camel_case_types)]
9882 #[doc(hidden)]
9883 #[derive(PartialEq, Eq, Hash)]
9884 enum __FieldTag {
9885 __name_part,
9886 __is_extension,
9887 Unknown(std::string::String),
9888 }
9889 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
9890 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9891 where
9892 D: serde::Deserializer<'de>,
9893 {
9894 struct Visitor;
9895 impl<'de> serde::de::Visitor<'de> for Visitor {
9896 type Value = __FieldTag;
9897 fn expecting(
9898 &self,
9899 formatter: &mut std::fmt::Formatter,
9900 ) -> std::fmt::Result {
9901 formatter.write_str("a field name for NamePart")
9902 }
9903 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
9904 where
9905 E: serde::de::Error,
9906 {
9907 use std::result::Result::Ok;
9908 use std::string::ToString;
9909 match value {
9910 "namePart" => Ok(__FieldTag::__name_part),
9911 "name_part" => Ok(__FieldTag::__name_part),
9912 "isExtension" => Ok(__FieldTag::__is_extension),
9913 "is_extension" => Ok(__FieldTag::__is_extension),
9914 _ => Ok(__FieldTag::Unknown(value.to_string())),
9915 }
9916 }
9917 }
9918 deserializer.deserialize_identifier(Visitor)
9919 }
9920 }
9921 struct Visitor;
9922 impl<'de> serde::de::Visitor<'de> for Visitor {
9923 type Value = NamePart;
9924 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
9925 formatter.write_str("struct NamePart")
9926 }
9927 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
9928 where
9929 A: serde::de::MapAccess<'de>,
9930 {
9931 #[allow(unused_imports)]
9932 use serde::de::Error;
9933 use std::option::Option::Some;
9934 let mut fields = std::collections::HashSet::new();
9935 let mut result = Self::Value::new();
9936 while let Some(tag) = map.next_key::<__FieldTag>()? {
9937 #[allow(clippy::match_single_binding)]
9938 match tag {
9939 __FieldTag::__name_part => {
9940 if !fields.insert(__FieldTag::__name_part) {
9941 return std::result::Result::Err(A::Error::duplicate_field(
9942 "multiple values for name_part",
9943 ));
9944 }
9945 result.name_part = map
9946 .next_value::<std::option::Option<std::string::String>>()?
9947 .unwrap_or_default();
9948 }
9949 __FieldTag::__is_extension => {
9950 if !fields.insert(__FieldTag::__is_extension) {
9951 return std::result::Result::Err(A::Error::duplicate_field(
9952 "multiple values for is_extension",
9953 ));
9954 }
9955 result.is_extension = map
9956 .next_value::<std::option::Option<bool>>()?
9957 .unwrap_or_default();
9958 }
9959 __FieldTag::Unknown(key) => {
9960 let value = map.next_value::<serde_json::Value>()?;
9961 result._unknown_fields.insert(key, value);
9962 }
9963 }
9964 }
9965 std::result::Result::Ok(result)
9966 }
9967 }
9968 deserializer.deserialize_any(Visitor)
9969 }
9970 }
9971
9972 #[doc(hidden)]
9973 impl serde::ser::Serialize for NamePart {
9974 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9975 where
9976 S: serde::ser::Serializer,
9977 {
9978 use serde::ser::SerializeMap;
9979 #[allow(unused_imports)]
9980 use std::option::Option::Some;
9981 let mut state = serializer.serialize_map(std::option::Option::None)?;
9982 if !self.name_part.is_empty() {
9983 state.serialize_entry("namePart", &self.name_part)?;
9984 }
9985 if !wkt::internal::is_default(&self.is_extension) {
9986 state.serialize_entry("isExtension", &self.is_extension)?;
9987 }
9988 if !self._unknown_fields.is_empty() {
9989 for (key, value) in self._unknown_fields.iter() {
9990 state.serialize_entry(key, &value)?;
9991 }
9992 }
9993 state.end()
9994 }
9995 }
9996
9997 impl std::fmt::Debug for NamePart {
9998 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9999 let mut debug_struct = f.debug_struct("NamePart");
10000 debug_struct.field("name_part", &self.name_part);
10001 debug_struct.field("is_extension", &self.is_extension);
10002 if !self._unknown_fields.is_empty() {
10003 debug_struct.field("_unknown_fields", &self._unknown_fields);
10004 }
10005 debug_struct.finish()
10006 }
10007 }
10008}
10009
10010#[derive(Clone, Default, PartialEq)]
10017#[non_exhaustive]
10018pub struct FeatureSet {
10019 pub field_presence: crate::feature_set::FieldPresence,
10020
10021 pub enum_type: crate::feature_set::EnumType,
10022
10023 pub repeated_field_encoding: crate::feature_set::RepeatedFieldEncoding,
10024
10025 pub utf8_validation: crate::feature_set::Utf8Validation,
10026
10027 pub message_encoding: crate::feature_set::MessageEncoding,
10028
10029 pub json_format: crate::feature_set::JsonFormat,
10030
10031 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10032}
10033
10034impl FeatureSet {
10035 pub fn new() -> Self {
10036 std::default::Default::default()
10037 }
10038
10039 pub fn set_field_presence<T: std::convert::Into<crate::feature_set::FieldPresence>>(
10041 mut self,
10042 v: T,
10043 ) -> Self {
10044 self.field_presence = v.into();
10045 self
10046 }
10047
10048 pub fn set_enum_type<T: std::convert::Into<crate::feature_set::EnumType>>(
10050 mut self,
10051 v: T,
10052 ) -> Self {
10053 self.enum_type = v.into();
10054 self
10055 }
10056
10057 pub fn set_repeated_field_encoding<
10059 T: std::convert::Into<crate::feature_set::RepeatedFieldEncoding>,
10060 >(
10061 mut self,
10062 v: T,
10063 ) -> Self {
10064 self.repeated_field_encoding = v.into();
10065 self
10066 }
10067
10068 pub fn set_utf8_validation<T: std::convert::Into<crate::feature_set::Utf8Validation>>(
10070 mut self,
10071 v: T,
10072 ) -> Self {
10073 self.utf8_validation = v.into();
10074 self
10075 }
10076
10077 pub fn set_message_encoding<T: std::convert::Into<crate::feature_set::MessageEncoding>>(
10079 mut self,
10080 v: T,
10081 ) -> Self {
10082 self.message_encoding = v.into();
10083 self
10084 }
10085
10086 pub fn set_json_format<T: std::convert::Into<crate::feature_set::JsonFormat>>(
10088 mut self,
10089 v: T,
10090 ) -> Self {
10091 self.json_format = v.into();
10092 self
10093 }
10094}
10095
10096impl wkt::message::Message for FeatureSet {
10097 fn typename() -> &'static str {
10098 "type.googleapis.com/google.protobuf.FeatureSet"
10099 }
10100}
10101
10102#[doc(hidden)]
10103impl<'de> serde::de::Deserialize<'de> for FeatureSet {
10104 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10105 where
10106 D: serde::Deserializer<'de>,
10107 {
10108 #[allow(non_camel_case_types)]
10109 #[doc(hidden)]
10110 #[derive(PartialEq, Eq, Hash)]
10111 enum __FieldTag {
10112 __field_presence,
10113 __enum_type,
10114 __repeated_field_encoding,
10115 __utf8_validation,
10116 __message_encoding,
10117 __json_format,
10118 Unknown(std::string::String),
10119 }
10120 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
10121 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10122 where
10123 D: serde::Deserializer<'de>,
10124 {
10125 struct Visitor;
10126 impl<'de> serde::de::Visitor<'de> for Visitor {
10127 type Value = __FieldTag;
10128 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10129 formatter.write_str("a field name for FeatureSet")
10130 }
10131 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
10132 where
10133 E: serde::de::Error,
10134 {
10135 use std::result::Result::Ok;
10136 use std::string::ToString;
10137 match value {
10138 "fieldPresence" => Ok(__FieldTag::__field_presence),
10139 "field_presence" => Ok(__FieldTag::__field_presence),
10140 "enumType" => Ok(__FieldTag::__enum_type),
10141 "enum_type" => Ok(__FieldTag::__enum_type),
10142 "repeatedFieldEncoding" => Ok(__FieldTag::__repeated_field_encoding),
10143 "repeated_field_encoding" => Ok(__FieldTag::__repeated_field_encoding),
10144 "utf8Validation" => Ok(__FieldTag::__utf8_validation),
10145 "utf8_validation" => Ok(__FieldTag::__utf8_validation),
10146 "messageEncoding" => Ok(__FieldTag::__message_encoding),
10147 "message_encoding" => Ok(__FieldTag::__message_encoding),
10148 "jsonFormat" => Ok(__FieldTag::__json_format),
10149 "json_format" => Ok(__FieldTag::__json_format),
10150 _ => Ok(__FieldTag::Unknown(value.to_string())),
10151 }
10152 }
10153 }
10154 deserializer.deserialize_identifier(Visitor)
10155 }
10156 }
10157 struct Visitor;
10158 impl<'de> serde::de::Visitor<'de> for Visitor {
10159 type Value = FeatureSet;
10160 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
10161 formatter.write_str("struct FeatureSet")
10162 }
10163 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
10164 where
10165 A: serde::de::MapAccess<'de>,
10166 {
10167 #[allow(unused_imports)]
10168 use serde::de::Error;
10169 use std::option::Option::Some;
10170 let mut fields = std::collections::HashSet::new();
10171 let mut result = Self::Value::new();
10172 while let Some(tag) = map.next_key::<__FieldTag>()? {
10173 #[allow(clippy::match_single_binding)]
10174 match tag {
10175 __FieldTag::__field_presence => {
10176 if !fields.insert(__FieldTag::__field_presence) {
10177 return std::result::Result::Err(A::Error::duplicate_field(
10178 "multiple values for field_presence",
10179 ));
10180 }
10181 result.field_presence = map.next_value::<std::option::Option<crate::feature_set::FieldPresence>>()?.unwrap_or_default();
10182 }
10183 __FieldTag::__enum_type => {
10184 if !fields.insert(__FieldTag::__enum_type) {
10185 return std::result::Result::Err(A::Error::duplicate_field(
10186 "multiple values for enum_type",
10187 ));
10188 }
10189 result.enum_type = map
10190 .next_value::<std::option::Option<crate::feature_set::EnumType>>()?
10191 .unwrap_or_default();
10192 }
10193 __FieldTag::__repeated_field_encoding => {
10194 if !fields.insert(__FieldTag::__repeated_field_encoding) {
10195 return std::result::Result::Err(A::Error::duplicate_field(
10196 "multiple values for repeated_field_encoding",
10197 ));
10198 }
10199 result.repeated_field_encoding = map.next_value::<std::option::Option<crate::feature_set::RepeatedFieldEncoding>>()?.unwrap_or_default();
10200 }
10201 __FieldTag::__utf8_validation => {
10202 if !fields.insert(__FieldTag::__utf8_validation) {
10203 return std::result::Result::Err(A::Error::duplicate_field(
10204 "multiple values for utf8_validation",
10205 ));
10206 }
10207 result.utf8_validation = map.next_value::<std::option::Option<crate::feature_set::Utf8Validation>>()?.unwrap_or_default();
10208 }
10209 __FieldTag::__message_encoding => {
10210 if !fields.insert(__FieldTag::__message_encoding) {
10211 return std::result::Result::Err(A::Error::duplicate_field(
10212 "multiple values for message_encoding",
10213 ));
10214 }
10215 result.message_encoding = map.next_value::<std::option::Option<crate::feature_set::MessageEncoding>>()?.unwrap_or_default();
10216 }
10217 __FieldTag::__json_format => {
10218 if !fields.insert(__FieldTag::__json_format) {
10219 return std::result::Result::Err(A::Error::duplicate_field(
10220 "multiple values for json_format",
10221 ));
10222 }
10223 result.json_format = map
10224 .next_value::<std::option::Option<crate::feature_set::JsonFormat>>(
10225 )?
10226 .unwrap_or_default();
10227 }
10228 __FieldTag::Unknown(key) => {
10229 let value = map.next_value::<serde_json::Value>()?;
10230 result._unknown_fields.insert(key, value);
10231 }
10232 }
10233 }
10234 std::result::Result::Ok(result)
10235 }
10236 }
10237 deserializer.deserialize_any(Visitor)
10238 }
10239}
10240
10241#[doc(hidden)]
10242impl serde::ser::Serialize for FeatureSet {
10243 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10244 where
10245 S: serde::ser::Serializer,
10246 {
10247 use serde::ser::SerializeMap;
10248 #[allow(unused_imports)]
10249 use std::option::Option::Some;
10250 let mut state = serializer.serialize_map(std::option::Option::None)?;
10251 if !wkt::internal::is_default(&self.field_presence) {
10252 state.serialize_entry("fieldPresence", &self.field_presence)?;
10253 }
10254 if !wkt::internal::is_default(&self.enum_type) {
10255 state.serialize_entry("enumType", &self.enum_type)?;
10256 }
10257 if !wkt::internal::is_default(&self.repeated_field_encoding) {
10258 state.serialize_entry("repeatedFieldEncoding", &self.repeated_field_encoding)?;
10259 }
10260 if !wkt::internal::is_default(&self.utf8_validation) {
10261 state.serialize_entry("utf8Validation", &self.utf8_validation)?;
10262 }
10263 if !wkt::internal::is_default(&self.message_encoding) {
10264 state.serialize_entry("messageEncoding", &self.message_encoding)?;
10265 }
10266 if !wkt::internal::is_default(&self.json_format) {
10267 state.serialize_entry("jsonFormat", &self.json_format)?;
10268 }
10269 if !self._unknown_fields.is_empty() {
10270 for (key, value) in self._unknown_fields.iter() {
10271 state.serialize_entry(key, &value)?;
10272 }
10273 }
10274 state.end()
10275 }
10276}
10277
10278impl std::fmt::Debug for FeatureSet {
10279 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10280 let mut debug_struct = f.debug_struct("FeatureSet");
10281 debug_struct.field("field_presence", &self.field_presence);
10282 debug_struct.field("enum_type", &self.enum_type);
10283 debug_struct.field("repeated_field_encoding", &self.repeated_field_encoding);
10284 debug_struct.field("utf8_validation", &self.utf8_validation);
10285 debug_struct.field("message_encoding", &self.message_encoding);
10286 debug_struct.field("json_format", &self.json_format);
10287 if !self._unknown_fields.is_empty() {
10288 debug_struct.field("_unknown_fields", &self._unknown_fields);
10289 }
10290 debug_struct.finish()
10291 }
10292}
10293
10294pub mod feature_set {
10296 #[allow(unused_imports)]
10297 use super::*;
10298
10299 #[derive(Clone, Debug, PartialEq)]
10314 #[non_exhaustive]
10315 pub enum FieldPresence {
10316 Unknown,
10317 Explicit,
10318 Implicit,
10319 LegacyRequired,
10320 UnknownValue(field_presence::UnknownValue),
10325 }
10326
10327 #[doc(hidden)]
10328 pub mod field_presence {
10329 #[allow(unused_imports)]
10330 use super::*;
10331 #[derive(Clone, Debug, PartialEq)]
10332 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10333 }
10334
10335 impl FieldPresence {
10336 pub fn value(&self) -> std::option::Option<i32> {
10341 match self {
10342 Self::Unknown => std::option::Option::Some(0),
10343 Self::Explicit => std::option::Option::Some(1),
10344 Self::Implicit => std::option::Option::Some(2),
10345 Self::LegacyRequired => std::option::Option::Some(3),
10346 Self::UnknownValue(u) => u.0.value(),
10347 }
10348 }
10349
10350 pub fn name(&self) -> std::option::Option<&str> {
10355 match self {
10356 Self::Unknown => std::option::Option::Some("FIELD_PRESENCE_UNKNOWN"),
10357 Self::Explicit => std::option::Option::Some("EXPLICIT"),
10358 Self::Implicit => std::option::Option::Some("IMPLICIT"),
10359 Self::LegacyRequired => std::option::Option::Some("LEGACY_REQUIRED"),
10360 Self::UnknownValue(u) => u.0.name(),
10361 }
10362 }
10363 }
10364
10365 impl std::default::Default for FieldPresence {
10366 fn default() -> Self {
10367 use std::convert::From;
10368 Self::from(0)
10369 }
10370 }
10371
10372 impl std::fmt::Display for FieldPresence {
10373 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10374 wkt::internal::display_enum(f, self.name(), self.value())
10375 }
10376 }
10377
10378 impl std::convert::From<i32> for FieldPresence {
10379 fn from(value: i32) -> Self {
10380 match value {
10381 0 => Self::Unknown,
10382 1 => Self::Explicit,
10383 2 => Self::Implicit,
10384 3 => Self::LegacyRequired,
10385 _ => Self::UnknownValue(field_presence::UnknownValue(
10386 wkt::internal::UnknownEnumValue::Integer(value),
10387 )),
10388 }
10389 }
10390 }
10391
10392 impl std::convert::From<&str> for FieldPresence {
10393 fn from(value: &str) -> Self {
10394 use std::string::ToString;
10395 match value {
10396 "FIELD_PRESENCE_UNKNOWN" => Self::Unknown,
10397 "EXPLICIT" => Self::Explicit,
10398 "IMPLICIT" => Self::Implicit,
10399 "LEGACY_REQUIRED" => Self::LegacyRequired,
10400 _ => Self::UnknownValue(field_presence::UnknownValue(
10401 wkt::internal::UnknownEnumValue::String(value.to_string()),
10402 )),
10403 }
10404 }
10405 }
10406
10407 impl serde::ser::Serialize for FieldPresence {
10408 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10409 where
10410 S: serde::Serializer,
10411 {
10412 match self {
10413 Self::Unknown => serializer.serialize_i32(0),
10414 Self::Explicit => serializer.serialize_i32(1),
10415 Self::Implicit => serializer.serialize_i32(2),
10416 Self::LegacyRequired => serializer.serialize_i32(3),
10417 Self::UnknownValue(u) => u.0.serialize(serializer),
10418 }
10419 }
10420 }
10421
10422 impl<'de> serde::de::Deserialize<'de> for FieldPresence {
10423 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10424 where
10425 D: serde::Deserializer<'de>,
10426 {
10427 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FieldPresence>::new(
10428 ".google.protobuf.FeatureSet.FieldPresence",
10429 ))
10430 }
10431 }
10432
10433 #[derive(Clone, Debug, PartialEq)]
10448 #[non_exhaustive]
10449 pub enum EnumType {
10450 Unknown,
10451 Open,
10452 Closed,
10453 UnknownValue(enum_type::UnknownValue),
10458 }
10459
10460 #[doc(hidden)]
10461 pub mod enum_type {
10462 #[allow(unused_imports)]
10463 use super::*;
10464 #[derive(Clone, Debug, PartialEq)]
10465 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10466 }
10467
10468 impl EnumType {
10469 pub fn value(&self) -> std::option::Option<i32> {
10474 match self {
10475 Self::Unknown => std::option::Option::Some(0),
10476 Self::Open => std::option::Option::Some(1),
10477 Self::Closed => std::option::Option::Some(2),
10478 Self::UnknownValue(u) => u.0.value(),
10479 }
10480 }
10481
10482 pub fn name(&self) -> std::option::Option<&str> {
10487 match self {
10488 Self::Unknown => std::option::Option::Some("ENUM_TYPE_UNKNOWN"),
10489 Self::Open => std::option::Option::Some("OPEN"),
10490 Self::Closed => std::option::Option::Some("CLOSED"),
10491 Self::UnknownValue(u) => u.0.name(),
10492 }
10493 }
10494 }
10495
10496 impl std::default::Default for EnumType {
10497 fn default() -> Self {
10498 use std::convert::From;
10499 Self::from(0)
10500 }
10501 }
10502
10503 impl std::fmt::Display for EnumType {
10504 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10505 wkt::internal::display_enum(f, self.name(), self.value())
10506 }
10507 }
10508
10509 impl std::convert::From<i32> for EnumType {
10510 fn from(value: i32) -> Self {
10511 match value {
10512 0 => Self::Unknown,
10513 1 => Self::Open,
10514 2 => Self::Closed,
10515 _ => Self::UnknownValue(enum_type::UnknownValue(
10516 wkt::internal::UnknownEnumValue::Integer(value),
10517 )),
10518 }
10519 }
10520 }
10521
10522 impl std::convert::From<&str> for EnumType {
10523 fn from(value: &str) -> Self {
10524 use std::string::ToString;
10525 match value {
10526 "ENUM_TYPE_UNKNOWN" => Self::Unknown,
10527 "OPEN" => Self::Open,
10528 "CLOSED" => Self::Closed,
10529 _ => Self::UnknownValue(enum_type::UnknownValue(
10530 wkt::internal::UnknownEnumValue::String(value.to_string()),
10531 )),
10532 }
10533 }
10534 }
10535
10536 impl serde::ser::Serialize for EnumType {
10537 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10538 where
10539 S: serde::Serializer,
10540 {
10541 match self {
10542 Self::Unknown => serializer.serialize_i32(0),
10543 Self::Open => serializer.serialize_i32(1),
10544 Self::Closed => serializer.serialize_i32(2),
10545 Self::UnknownValue(u) => u.0.serialize(serializer),
10546 }
10547 }
10548 }
10549
10550 impl<'de> serde::de::Deserialize<'de> for EnumType {
10551 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10552 where
10553 D: serde::Deserializer<'de>,
10554 {
10555 deserializer.deserialize_any(wkt::internal::EnumVisitor::<EnumType>::new(
10556 ".google.protobuf.FeatureSet.EnumType",
10557 ))
10558 }
10559 }
10560
10561 #[derive(Clone, Debug, PartialEq)]
10576 #[non_exhaustive]
10577 pub enum RepeatedFieldEncoding {
10578 Unknown,
10579 Packed,
10580 Expanded,
10581 UnknownValue(repeated_field_encoding::UnknownValue),
10586 }
10587
10588 #[doc(hidden)]
10589 pub mod repeated_field_encoding {
10590 #[allow(unused_imports)]
10591 use super::*;
10592 #[derive(Clone, Debug, PartialEq)]
10593 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10594 }
10595
10596 impl RepeatedFieldEncoding {
10597 pub fn value(&self) -> std::option::Option<i32> {
10602 match self {
10603 Self::Unknown => std::option::Option::Some(0),
10604 Self::Packed => std::option::Option::Some(1),
10605 Self::Expanded => std::option::Option::Some(2),
10606 Self::UnknownValue(u) => u.0.value(),
10607 }
10608 }
10609
10610 pub fn name(&self) -> std::option::Option<&str> {
10615 match self {
10616 Self::Unknown => std::option::Option::Some("REPEATED_FIELD_ENCODING_UNKNOWN"),
10617 Self::Packed => std::option::Option::Some("PACKED"),
10618 Self::Expanded => std::option::Option::Some("EXPANDED"),
10619 Self::UnknownValue(u) => u.0.name(),
10620 }
10621 }
10622 }
10623
10624 impl std::default::Default for RepeatedFieldEncoding {
10625 fn default() -> Self {
10626 use std::convert::From;
10627 Self::from(0)
10628 }
10629 }
10630
10631 impl std::fmt::Display for RepeatedFieldEncoding {
10632 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10633 wkt::internal::display_enum(f, self.name(), self.value())
10634 }
10635 }
10636
10637 impl std::convert::From<i32> for RepeatedFieldEncoding {
10638 fn from(value: i32) -> Self {
10639 match value {
10640 0 => Self::Unknown,
10641 1 => Self::Packed,
10642 2 => Self::Expanded,
10643 _ => Self::UnknownValue(repeated_field_encoding::UnknownValue(
10644 wkt::internal::UnknownEnumValue::Integer(value),
10645 )),
10646 }
10647 }
10648 }
10649
10650 impl std::convert::From<&str> for RepeatedFieldEncoding {
10651 fn from(value: &str) -> Self {
10652 use std::string::ToString;
10653 match value {
10654 "REPEATED_FIELD_ENCODING_UNKNOWN" => Self::Unknown,
10655 "PACKED" => Self::Packed,
10656 "EXPANDED" => Self::Expanded,
10657 _ => Self::UnknownValue(repeated_field_encoding::UnknownValue(
10658 wkt::internal::UnknownEnumValue::String(value.to_string()),
10659 )),
10660 }
10661 }
10662 }
10663
10664 impl serde::ser::Serialize for RepeatedFieldEncoding {
10665 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10666 where
10667 S: serde::Serializer,
10668 {
10669 match self {
10670 Self::Unknown => serializer.serialize_i32(0),
10671 Self::Packed => serializer.serialize_i32(1),
10672 Self::Expanded => serializer.serialize_i32(2),
10673 Self::UnknownValue(u) => u.0.serialize(serializer),
10674 }
10675 }
10676 }
10677
10678 impl<'de> serde::de::Deserialize<'de> for RepeatedFieldEncoding {
10679 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10680 where
10681 D: serde::Deserializer<'de>,
10682 {
10683 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RepeatedFieldEncoding>::new(
10684 ".google.protobuf.FeatureSet.RepeatedFieldEncoding",
10685 ))
10686 }
10687 }
10688
10689 #[derive(Clone, Debug, PartialEq)]
10704 #[non_exhaustive]
10705 pub enum Utf8Validation {
10706 Unknown,
10707 Verify,
10708 None,
10709 UnknownValue(utf_8_validation::UnknownValue),
10714 }
10715
10716 #[doc(hidden)]
10717 pub mod utf_8_validation {
10718 #[allow(unused_imports)]
10719 use super::*;
10720 #[derive(Clone, Debug, PartialEq)]
10721 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10722 }
10723
10724 impl Utf8Validation {
10725 pub fn value(&self) -> std::option::Option<i32> {
10730 match self {
10731 Self::Unknown => std::option::Option::Some(0),
10732 Self::Verify => std::option::Option::Some(2),
10733 Self::None => std::option::Option::Some(3),
10734 Self::UnknownValue(u) => u.0.value(),
10735 }
10736 }
10737
10738 pub fn name(&self) -> std::option::Option<&str> {
10743 match self {
10744 Self::Unknown => std::option::Option::Some("UTF8_VALIDATION_UNKNOWN"),
10745 Self::Verify => std::option::Option::Some("VERIFY"),
10746 Self::None => std::option::Option::Some("NONE"),
10747 Self::UnknownValue(u) => u.0.name(),
10748 }
10749 }
10750 }
10751
10752 impl std::default::Default for Utf8Validation {
10753 fn default() -> Self {
10754 use std::convert::From;
10755 Self::from(0)
10756 }
10757 }
10758
10759 impl std::fmt::Display for Utf8Validation {
10760 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10761 wkt::internal::display_enum(f, self.name(), self.value())
10762 }
10763 }
10764
10765 impl std::convert::From<i32> for Utf8Validation {
10766 fn from(value: i32) -> Self {
10767 match value {
10768 0 => Self::Unknown,
10769 2 => Self::Verify,
10770 3 => Self::None,
10771 _ => Self::UnknownValue(utf_8_validation::UnknownValue(
10772 wkt::internal::UnknownEnumValue::Integer(value),
10773 )),
10774 }
10775 }
10776 }
10777
10778 impl std::convert::From<&str> for Utf8Validation {
10779 fn from(value: &str) -> Self {
10780 use std::string::ToString;
10781 match value {
10782 "UTF8_VALIDATION_UNKNOWN" => Self::Unknown,
10783 "VERIFY" => Self::Verify,
10784 "NONE" => Self::None,
10785 _ => Self::UnknownValue(utf_8_validation::UnknownValue(
10786 wkt::internal::UnknownEnumValue::String(value.to_string()),
10787 )),
10788 }
10789 }
10790 }
10791
10792 impl serde::ser::Serialize for Utf8Validation {
10793 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10794 where
10795 S: serde::Serializer,
10796 {
10797 match self {
10798 Self::Unknown => serializer.serialize_i32(0),
10799 Self::Verify => serializer.serialize_i32(2),
10800 Self::None => serializer.serialize_i32(3),
10801 Self::UnknownValue(u) => u.0.serialize(serializer),
10802 }
10803 }
10804 }
10805
10806 impl<'de> serde::de::Deserialize<'de> for Utf8Validation {
10807 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10808 where
10809 D: serde::Deserializer<'de>,
10810 {
10811 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Utf8Validation>::new(
10812 ".google.protobuf.FeatureSet.Utf8Validation",
10813 ))
10814 }
10815 }
10816
10817 #[derive(Clone, Debug, PartialEq)]
10832 #[non_exhaustive]
10833 pub enum MessageEncoding {
10834 Unknown,
10835 LengthPrefixed,
10836 Delimited,
10837 UnknownValue(message_encoding::UnknownValue),
10842 }
10843
10844 #[doc(hidden)]
10845 pub mod message_encoding {
10846 #[allow(unused_imports)]
10847 use super::*;
10848 #[derive(Clone, Debug, PartialEq)]
10849 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10850 }
10851
10852 impl MessageEncoding {
10853 pub fn value(&self) -> std::option::Option<i32> {
10858 match self {
10859 Self::Unknown => std::option::Option::Some(0),
10860 Self::LengthPrefixed => std::option::Option::Some(1),
10861 Self::Delimited => std::option::Option::Some(2),
10862 Self::UnknownValue(u) => u.0.value(),
10863 }
10864 }
10865
10866 pub fn name(&self) -> std::option::Option<&str> {
10871 match self {
10872 Self::Unknown => std::option::Option::Some("MESSAGE_ENCODING_UNKNOWN"),
10873 Self::LengthPrefixed => std::option::Option::Some("LENGTH_PREFIXED"),
10874 Self::Delimited => std::option::Option::Some("DELIMITED"),
10875 Self::UnknownValue(u) => u.0.name(),
10876 }
10877 }
10878 }
10879
10880 impl std::default::Default for MessageEncoding {
10881 fn default() -> Self {
10882 use std::convert::From;
10883 Self::from(0)
10884 }
10885 }
10886
10887 impl std::fmt::Display for MessageEncoding {
10888 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10889 wkt::internal::display_enum(f, self.name(), self.value())
10890 }
10891 }
10892
10893 impl std::convert::From<i32> for MessageEncoding {
10894 fn from(value: i32) -> Self {
10895 match value {
10896 0 => Self::Unknown,
10897 1 => Self::LengthPrefixed,
10898 2 => Self::Delimited,
10899 _ => Self::UnknownValue(message_encoding::UnknownValue(
10900 wkt::internal::UnknownEnumValue::Integer(value),
10901 )),
10902 }
10903 }
10904 }
10905
10906 impl std::convert::From<&str> for MessageEncoding {
10907 fn from(value: &str) -> Self {
10908 use std::string::ToString;
10909 match value {
10910 "MESSAGE_ENCODING_UNKNOWN" => Self::Unknown,
10911 "LENGTH_PREFIXED" => Self::LengthPrefixed,
10912 "DELIMITED" => Self::Delimited,
10913 _ => Self::UnknownValue(message_encoding::UnknownValue(
10914 wkt::internal::UnknownEnumValue::String(value.to_string()),
10915 )),
10916 }
10917 }
10918 }
10919
10920 impl serde::ser::Serialize for MessageEncoding {
10921 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10922 where
10923 S: serde::Serializer,
10924 {
10925 match self {
10926 Self::Unknown => serializer.serialize_i32(0),
10927 Self::LengthPrefixed => serializer.serialize_i32(1),
10928 Self::Delimited => serializer.serialize_i32(2),
10929 Self::UnknownValue(u) => u.0.serialize(serializer),
10930 }
10931 }
10932 }
10933
10934 impl<'de> serde::de::Deserialize<'de> for MessageEncoding {
10935 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10936 where
10937 D: serde::Deserializer<'de>,
10938 {
10939 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MessageEncoding>::new(
10940 ".google.protobuf.FeatureSet.MessageEncoding",
10941 ))
10942 }
10943 }
10944
10945 #[derive(Clone, Debug, PartialEq)]
10960 #[non_exhaustive]
10961 pub enum JsonFormat {
10962 Unknown,
10963 Allow,
10964 LegacyBestEffort,
10965 UnknownValue(json_format::UnknownValue),
10970 }
10971
10972 #[doc(hidden)]
10973 pub mod json_format {
10974 #[allow(unused_imports)]
10975 use super::*;
10976 #[derive(Clone, Debug, PartialEq)]
10977 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10978 }
10979
10980 impl JsonFormat {
10981 pub fn value(&self) -> std::option::Option<i32> {
10986 match self {
10987 Self::Unknown => std::option::Option::Some(0),
10988 Self::Allow => std::option::Option::Some(1),
10989 Self::LegacyBestEffort => std::option::Option::Some(2),
10990 Self::UnknownValue(u) => u.0.value(),
10991 }
10992 }
10993
10994 pub fn name(&self) -> std::option::Option<&str> {
10999 match self {
11000 Self::Unknown => std::option::Option::Some("JSON_FORMAT_UNKNOWN"),
11001 Self::Allow => std::option::Option::Some("ALLOW"),
11002 Self::LegacyBestEffort => std::option::Option::Some("LEGACY_BEST_EFFORT"),
11003 Self::UnknownValue(u) => u.0.name(),
11004 }
11005 }
11006 }
11007
11008 impl std::default::Default for JsonFormat {
11009 fn default() -> Self {
11010 use std::convert::From;
11011 Self::from(0)
11012 }
11013 }
11014
11015 impl std::fmt::Display for JsonFormat {
11016 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11017 wkt::internal::display_enum(f, self.name(), self.value())
11018 }
11019 }
11020
11021 impl std::convert::From<i32> for JsonFormat {
11022 fn from(value: i32) -> Self {
11023 match value {
11024 0 => Self::Unknown,
11025 1 => Self::Allow,
11026 2 => Self::LegacyBestEffort,
11027 _ => Self::UnknownValue(json_format::UnknownValue(
11028 wkt::internal::UnknownEnumValue::Integer(value),
11029 )),
11030 }
11031 }
11032 }
11033
11034 impl std::convert::From<&str> for JsonFormat {
11035 fn from(value: &str) -> Self {
11036 use std::string::ToString;
11037 match value {
11038 "JSON_FORMAT_UNKNOWN" => Self::Unknown,
11039 "ALLOW" => Self::Allow,
11040 "LEGACY_BEST_EFFORT" => Self::LegacyBestEffort,
11041 _ => Self::UnknownValue(json_format::UnknownValue(
11042 wkt::internal::UnknownEnumValue::String(value.to_string()),
11043 )),
11044 }
11045 }
11046 }
11047
11048 impl serde::ser::Serialize for JsonFormat {
11049 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11050 where
11051 S: serde::Serializer,
11052 {
11053 match self {
11054 Self::Unknown => serializer.serialize_i32(0),
11055 Self::Allow => serializer.serialize_i32(1),
11056 Self::LegacyBestEffort => serializer.serialize_i32(2),
11057 Self::UnknownValue(u) => u.0.serialize(serializer),
11058 }
11059 }
11060 }
11061
11062 impl<'de> serde::de::Deserialize<'de> for JsonFormat {
11063 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11064 where
11065 D: serde::Deserializer<'de>,
11066 {
11067 deserializer.deserialize_any(wkt::internal::EnumVisitor::<JsonFormat>::new(
11068 ".google.protobuf.FeatureSet.JsonFormat",
11069 ))
11070 }
11071 }
11072}
11073
11074#[derive(Clone, Default, PartialEq)]
11079#[non_exhaustive]
11080pub struct FeatureSetDefaults {
11081 pub defaults: std::vec::Vec<crate::feature_set_defaults::FeatureSetEditionDefault>,
11082
11083 pub minimum_edition: crate::Edition,
11086
11087 pub maximum_edition: crate::Edition,
11090
11091 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11092}
11093
11094impl FeatureSetDefaults {
11095 pub fn new() -> Self {
11096 std::default::Default::default()
11097 }
11098
11099 pub fn set_defaults<T, V>(mut self, v: T) -> Self
11101 where
11102 T: std::iter::IntoIterator<Item = V>,
11103 V: std::convert::Into<crate::feature_set_defaults::FeatureSetEditionDefault>,
11104 {
11105 use std::iter::Iterator;
11106 self.defaults = v.into_iter().map(|i| i.into()).collect();
11107 self
11108 }
11109
11110 pub fn set_minimum_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
11112 self.minimum_edition = v.into();
11113 self
11114 }
11115
11116 pub fn set_maximum_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
11118 self.maximum_edition = v.into();
11119 self
11120 }
11121}
11122
11123impl wkt::message::Message for FeatureSetDefaults {
11124 fn typename() -> &'static str {
11125 "type.googleapis.com/google.protobuf.FeatureSetDefaults"
11126 }
11127}
11128
11129#[doc(hidden)]
11130impl<'de> serde::de::Deserialize<'de> for FeatureSetDefaults {
11131 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11132 where
11133 D: serde::Deserializer<'de>,
11134 {
11135 #[allow(non_camel_case_types)]
11136 #[doc(hidden)]
11137 #[derive(PartialEq, Eq, Hash)]
11138 enum __FieldTag {
11139 __defaults,
11140 __minimum_edition,
11141 __maximum_edition,
11142 Unknown(std::string::String),
11143 }
11144 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11145 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11146 where
11147 D: serde::Deserializer<'de>,
11148 {
11149 struct Visitor;
11150 impl<'de> serde::de::Visitor<'de> for Visitor {
11151 type Value = __FieldTag;
11152 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11153 formatter.write_str("a field name for FeatureSetDefaults")
11154 }
11155 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11156 where
11157 E: serde::de::Error,
11158 {
11159 use std::result::Result::Ok;
11160 use std::string::ToString;
11161 match value {
11162 "defaults" => Ok(__FieldTag::__defaults),
11163 "minimumEdition" => Ok(__FieldTag::__minimum_edition),
11164 "minimum_edition" => Ok(__FieldTag::__minimum_edition),
11165 "maximumEdition" => Ok(__FieldTag::__maximum_edition),
11166 "maximum_edition" => Ok(__FieldTag::__maximum_edition),
11167 _ => Ok(__FieldTag::Unknown(value.to_string())),
11168 }
11169 }
11170 }
11171 deserializer.deserialize_identifier(Visitor)
11172 }
11173 }
11174 struct Visitor;
11175 impl<'de> serde::de::Visitor<'de> for Visitor {
11176 type Value = FeatureSetDefaults;
11177 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11178 formatter.write_str("struct FeatureSetDefaults")
11179 }
11180 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11181 where
11182 A: serde::de::MapAccess<'de>,
11183 {
11184 #[allow(unused_imports)]
11185 use serde::de::Error;
11186 use std::option::Option::Some;
11187 let mut fields = std::collections::HashSet::new();
11188 let mut result = Self::Value::new();
11189 while let Some(tag) = map.next_key::<__FieldTag>()? {
11190 #[allow(clippy::match_single_binding)]
11191 match tag {
11192 __FieldTag::__defaults => {
11193 if !fields.insert(__FieldTag::__defaults) {
11194 return std::result::Result::Err(A::Error::duplicate_field(
11195 "multiple values for defaults",
11196 ));
11197 }
11198 result.defaults = map
11199 .next_value::<std::option::Option<
11200 std::vec::Vec<
11201 crate::feature_set_defaults::FeatureSetEditionDefault,
11202 >,
11203 >>()?
11204 .unwrap_or_default();
11205 }
11206 __FieldTag::__minimum_edition => {
11207 if !fields.insert(__FieldTag::__minimum_edition) {
11208 return std::result::Result::Err(A::Error::duplicate_field(
11209 "multiple values for minimum_edition",
11210 ));
11211 }
11212 result.minimum_edition = map
11213 .next_value::<std::option::Option<crate::Edition>>()?
11214 .unwrap_or_default();
11215 }
11216 __FieldTag::__maximum_edition => {
11217 if !fields.insert(__FieldTag::__maximum_edition) {
11218 return std::result::Result::Err(A::Error::duplicate_field(
11219 "multiple values for maximum_edition",
11220 ));
11221 }
11222 result.maximum_edition = map
11223 .next_value::<std::option::Option<crate::Edition>>()?
11224 .unwrap_or_default();
11225 }
11226 __FieldTag::Unknown(key) => {
11227 let value = map.next_value::<serde_json::Value>()?;
11228 result._unknown_fields.insert(key, value);
11229 }
11230 }
11231 }
11232 std::result::Result::Ok(result)
11233 }
11234 }
11235 deserializer.deserialize_any(Visitor)
11236 }
11237}
11238
11239#[doc(hidden)]
11240impl serde::ser::Serialize for FeatureSetDefaults {
11241 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11242 where
11243 S: serde::ser::Serializer,
11244 {
11245 use serde::ser::SerializeMap;
11246 #[allow(unused_imports)]
11247 use std::option::Option::Some;
11248 let mut state = serializer.serialize_map(std::option::Option::None)?;
11249 if !self.defaults.is_empty() {
11250 state.serialize_entry("defaults", &self.defaults)?;
11251 }
11252 if !wkt::internal::is_default(&self.minimum_edition) {
11253 state.serialize_entry("minimumEdition", &self.minimum_edition)?;
11254 }
11255 if !wkt::internal::is_default(&self.maximum_edition) {
11256 state.serialize_entry("maximumEdition", &self.maximum_edition)?;
11257 }
11258 if !self._unknown_fields.is_empty() {
11259 for (key, value) in self._unknown_fields.iter() {
11260 state.serialize_entry(key, &value)?;
11261 }
11262 }
11263 state.end()
11264 }
11265}
11266
11267impl std::fmt::Debug for FeatureSetDefaults {
11268 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11269 let mut debug_struct = f.debug_struct("FeatureSetDefaults");
11270 debug_struct.field("defaults", &self.defaults);
11271 debug_struct.field("minimum_edition", &self.minimum_edition);
11272 debug_struct.field("maximum_edition", &self.maximum_edition);
11273 if !self._unknown_fields.is_empty() {
11274 debug_struct.field("_unknown_fields", &self._unknown_fields);
11275 }
11276 debug_struct.finish()
11277 }
11278}
11279
11280pub mod feature_set_defaults {
11282 #[allow(unused_imports)]
11283 use super::*;
11284
11285 #[derive(Clone, Default, PartialEq)]
11290 #[non_exhaustive]
11291 pub struct FeatureSetEditionDefault {
11292 pub edition: crate::Edition,
11293
11294 pub overridable_features: std::option::Option<crate::FeatureSet>,
11296
11297 pub fixed_features: std::option::Option<crate::FeatureSet>,
11299
11300 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11301 }
11302
11303 impl FeatureSetEditionDefault {
11304 pub fn new() -> Self {
11305 std::default::Default::default()
11306 }
11307
11308 pub fn set_edition<T: std::convert::Into<crate::Edition>>(mut self, v: T) -> Self {
11310 self.edition = v.into();
11311 self
11312 }
11313
11314 pub fn set_overridable_features<T>(mut self, v: T) -> Self
11316 where
11317 T: std::convert::Into<crate::FeatureSet>,
11318 {
11319 self.overridable_features = std::option::Option::Some(v.into());
11320 self
11321 }
11322
11323 pub fn set_or_clear_overridable_features<T>(mut self, v: std::option::Option<T>) -> Self
11325 where
11326 T: std::convert::Into<crate::FeatureSet>,
11327 {
11328 self.overridable_features = v.map(|x| x.into());
11329 self
11330 }
11331
11332 pub fn set_fixed_features<T>(mut self, v: T) -> Self
11334 where
11335 T: std::convert::Into<crate::FeatureSet>,
11336 {
11337 self.fixed_features = std::option::Option::Some(v.into());
11338 self
11339 }
11340
11341 pub fn set_or_clear_fixed_features<T>(mut self, v: std::option::Option<T>) -> Self
11343 where
11344 T: std::convert::Into<crate::FeatureSet>,
11345 {
11346 self.fixed_features = v.map(|x| x.into());
11347 self
11348 }
11349 }
11350
11351 impl wkt::message::Message for FeatureSetEditionDefault {
11352 fn typename() -> &'static str {
11353 "type.googleapis.com/google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"
11354 }
11355 }
11356
11357 #[doc(hidden)]
11358 impl<'de> serde::de::Deserialize<'de> for FeatureSetEditionDefault {
11359 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11360 where
11361 D: serde::Deserializer<'de>,
11362 {
11363 #[allow(non_camel_case_types)]
11364 #[doc(hidden)]
11365 #[derive(PartialEq, Eq, Hash)]
11366 enum __FieldTag {
11367 __edition,
11368 __overridable_features,
11369 __fixed_features,
11370 Unknown(std::string::String),
11371 }
11372 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11373 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11374 where
11375 D: serde::Deserializer<'de>,
11376 {
11377 struct Visitor;
11378 impl<'de> serde::de::Visitor<'de> for Visitor {
11379 type Value = __FieldTag;
11380 fn expecting(
11381 &self,
11382 formatter: &mut std::fmt::Formatter,
11383 ) -> std::fmt::Result {
11384 formatter.write_str("a field name for FeatureSetEditionDefault")
11385 }
11386 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11387 where
11388 E: serde::de::Error,
11389 {
11390 use std::result::Result::Ok;
11391 use std::string::ToString;
11392 match value {
11393 "edition" => Ok(__FieldTag::__edition),
11394 "overridableFeatures" => Ok(__FieldTag::__overridable_features),
11395 "overridable_features" => Ok(__FieldTag::__overridable_features),
11396 "fixedFeatures" => Ok(__FieldTag::__fixed_features),
11397 "fixed_features" => Ok(__FieldTag::__fixed_features),
11398 _ => Ok(__FieldTag::Unknown(value.to_string())),
11399 }
11400 }
11401 }
11402 deserializer.deserialize_identifier(Visitor)
11403 }
11404 }
11405 struct Visitor;
11406 impl<'de> serde::de::Visitor<'de> for Visitor {
11407 type Value = FeatureSetEditionDefault;
11408 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11409 formatter.write_str("struct FeatureSetEditionDefault")
11410 }
11411 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11412 where
11413 A: serde::de::MapAccess<'de>,
11414 {
11415 #[allow(unused_imports)]
11416 use serde::de::Error;
11417 use std::option::Option::Some;
11418 let mut fields = std::collections::HashSet::new();
11419 let mut result = Self::Value::new();
11420 while let Some(tag) = map.next_key::<__FieldTag>()? {
11421 #[allow(clippy::match_single_binding)]
11422 match tag {
11423 __FieldTag::__edition => {
11424 if !fields.insert(__FieldTag::__edition) {
11425 return std::result::Result::Err(A::Error::duplicate_field(
11426 "multiple values for edition",
11427 ));
11428 }
11429 result.edition = map
11430 .next_value::<std::option::Option<crate::Edition>>()?
11431 .unwrap_or_default();
11432 }
11433 __FieldTag::__overridable_features => {
11434 if !fields.insert(__FieldTag::__overridable_features) {
11435 return std::result::Result::Err(A::Error::duplicate_field(
11436 "multiple values for overridable_features",
11437 ));
11438 }
11439 result.overridable_features =
11440 map.next_value::<std::option::Option<crate::FeatureSet>>()?;
11441 }
11442 __FieldTag::__fixed_features => {
11443 if !fields.insert(__FieldTag::__fixed_features) {
11444 return std::result::Result::Err(A::Error::duplicate_field(
11445 "multiple values for fixed_features",
11446 ));
11447 }
11448 result.fixed_features =
11449 map.next_value::<std::option::Option<crate::FeatureSet>>()?;
11450 }
11451 __FieldTag::Unknown(key) => {
11452 let value = map.next_value::<serde_json::Value>()?;
11453 result._unknown_fields.insert(key, value);
11454 }
11455 }
11456 }
11457 std::result::Result::Ok(result)
11458 }
11459 }
11460 deserializer.deserialize_any(Visitor)
11461 }
11462 }
11463
11464 #[doc(hidden)]
11465 impl serde::ser::Serialize for FeatureSetEditionDefault {
11466 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11467 where
11468 S: serde::ser::Serializer,
11469 {
11470 use serde::ser::SerializeMap;
11471 #[allow(unused_imports)]
11472 use std::option::Option::Some;
11473 let mut state = serializer.serialize_map(std::option::Option::None)?;
11474 if !wkt::internal::is_default(&self.edition) {
11475 state.serialize_entry("edition", &self.edition)?;
11476 }
11477 if self.overridable_features.is_some() {
11478 state.serialize_entry("overridableFeatures", &self.overridable_features)?;
11479 }
11480 if self.fixed_features.is_some() {
11481 state.serialize_entry("fixedFeatures", &self.fixed_features)?;
11482 }
11483 if !self._unknown_fields.is_empty() {
11484 for (key, value) in self._unknown_fields.iter() {
11485 state.serialize_entry(key, &value)?;
11486 }
11487 }
11488 state.end()
11489 }
11490 }
11491
11492 impl std::fmt::Debug for FeatureSetEditionDefault {
11493 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11494 let mut debug_struct = f.debug_struct("FeatureSetEditionDefault");
11495 debug_struct.field("edition", &self.edition);
11496 debug_struct.field("overridable_features", &self.overridable_features);
11497 debug_struct.field("fixed_features", &self.fixed_features);
11498 if !self._unknown_fields.is_empty() {
11499 debug_struct.field("_unknown_fields", &self._unknown_fields);
11500 }
11501 debug_struct.finish()
11502 }
11503 }
11504}
11505
11506#[derive(Clone, Default, PartialEq)]
11509#[non_exhaustive]
11510pub struct SourceCodeInfo {
11511 pub location: std::vec::Vec<crate::source_code_info::Location>,
11556
11557 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11558}
11559
11560impl SourceCodeInfo {
11561 pub fn new() -> Self {
11562 std::default::Default::default()
11563 }
11564
11565 pub fn set_location<T, V>(mut self, v: T) -> Self
11567 where
11568 T: std::iter::IntoIterator<Item = V>,
11569 V: std::convert::Into<crate::source_code_info::Location>,
11570 {
11571 use std::iter::Iterator;
11572 self.location = v.into_iter().map(|i| i.into()).collect();
11573 self
11574 }
11575}
11576
11577impl wkt::message::Message for SourceCodeInfo {
11578 fn typename() -> &'static str {
11579 "type.googleapis.com/google.protobuf.SourceCodeInfo"
11580 }
11581}
11582
11583#[doc(hidden)]
11584impl<'de> serde::de::Deserialize<'de> for SourceCodeInfo {
11585 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11586 where
11587 D: serde::Deserializer<'de>,
11588 {
11589 #[allow(non_camel_case_types)]
11590 #[doc(hidden)]
11591 #[derive(PartialEq, Eq, Hash)]
11592 enum __FieldTag {
11593 __location,
11594 Unknown(std::string::String),
11595 }
11596 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11597 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11598 where
11599 D: serde::Deserializer<'de>,
11600 {
11601 struct Visitor;
11602 impl<'de> serde::de::Visitor<'de> for Visitor {
11603 type Value = __FieldTag;
11604 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11605 formatter.write_str("a field name for SourceCodeInfo")
11606 }
11607 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11608 where
11609 E: serde::de::Error,
11610 {
11611 use std::result::Result::Ok;
11612 use std::string::ToString;
11613 match value {
11614 "location" => Ok(__FieldTag::__location),
11615 _ => Ok(__FieldTag::Unknown(value.to_string())),
11616 }
11617 }
11618 }
11619 deserializer.deserialize_identifier(Visitor)
11620 }
11621 }
11622 struct Visitor;
11623 impl<'de> serde::de::Visitor<'de> for Visitor {
11624 type Value = SourceCodeInfo;
11625 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11626 formatter.write_str("struct SourceCodeInfo")
11627 }
11628 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11629 where
11630 A: serde::de::MapAccess<'de>,
11631 {
11632 #[allow(unused_imports)]
11633 use serde::de::Error;
11634 use std::option::Option::Some;
11635 let mut fields = std::collections::HashSet::new();
11636 let mut result = Self::Value::new();
11637 while let Some(tag) = map.next_key::<__FieldTag>()? {
11638 #[allow(clippy::match_single_binding)]
11639 match tag {
11640 __FieldTag::__location => {
11641 if !fields.insert(__FieldTag::__location) {
11642 return std::result::Result::Err(A::Error::duplicate_field(
11643 "multiple values for location",
11644 ));
11645 }
11646 result.location = map
11647 .next_value::<std::option::Option<
11648 std::vec::Vec<crate::source_code_info::Location>,
11649 >>()?
11650 .unwrap_or_default();
11651 }
11652 __FieldTag::Unknown(key) => {
11653 let value = map.next_value::<serde_json::Value>()?;
11654 result._unknown_fields.insert(key, value);
11655 }
11656 }
11657 }
11658 std::result::Result::Ok(result)
11659 }
11660 }
11661 deserializer.deserialize_any(Visitor)
11662 }
11663}
11664
11665#[doc(hidden)]
11666impl serde::ser::Serialize for SourceCodeInfo {
11667 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11668 where
11669 S: serde::ser::Serializer,
11670 {
11671 use serde::ser::SerializeMap;
11672 #[allow(unused_imports)]
11673 use std::option::Option::Some;
11674 let mut state = serializer.serialize_map(std::option::Option::None)?;
11675 if !self.location.is_empty() {
11676 state.serialize_entry("location", &self.location)?;
11677 }
11678 if !self._unknown_fields.is_empty() {
11679 for (key, value) in self._unknown_fields.iter() {
11680 state.serialize_entry(key, &value)?;
11681 }
11682 }
11683 state.end()
11684 }
11685}
11686
11687impl std::fmt::Debug for SourceCodeInfo {
11688 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11689 let mut debug_struct = f.debug_struct("SourceCodeInfo");
11690 debug_struct.field("location", &self.location);
11691 if !self._unknown_fields.is_empty() {
11692 debug_struct.field("_unknown_fields", &self._unknown_fields);
11693 }
11694 debug_struct.finish()
11695 }
11696}
11697
11698pub mod source_code_info {
11700 #[allow(unused_imports)]
11701 use super::*;
11702
11703 #[derive(Clone, Default, PartialEq)]
11704 #[non_exhaustive]
11705 pub struct Location {
11706 pub path: std::vec::Vec<i32>,
11730
11731 pub span: std::vec::Vec<i32>,
11737
11738 pub leading_comments: std::string::String,
11787
11788 pub trailing_comments: std::string::String,
11789
11790 pub leading_detached_comments: std::vec::Vec<std::string::String>,
11791
11792 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11793 }
11794
11795 impl Location {
11796 pub fn new() -> Self {
11797 std::default::Default::default()
11798 }
11799
11800 pub fn set_path<T, V>(mut self, v: T) -> Self
11802 where
11803 T: std::iter::IntoIterator<Item = V>,
11804 V: std::convert::Into<i32>,
11805 {
11806 use std::iter::Iterator;
11807 self.path = v.into_iter().map(|i| i.into()).collect();
11808 self
11809 }
11810
11811 pub fn set_span<T, V>(mut self, v: T) -> Self
11813 where
11814 T: std::iter::IntoIterator<Item = V>,
11815 V: std::convert::Into<i32>,
11816 {
11817 use std::iter::Iterator;
11818 self.span = v.into_iter().map(|i| i.into()).collect();
11819 self
11820 }
11821
11822 pub fn set_leading_comments<T: std::convert::Into<std::string::String>>(
11824 mut self,
11825 v: T,
11826 ) -> Self {
11827 self.leading_comments = v.into();
11828 self
11829 }
11830
11831 pub fn set_trailing_comments<T: std::convert::Into<std::string::String>>(
11833 mut self,
11834 v: T,
11835 ) -> Self {
11836 self.trailing_comments = v.into();
11837 self
11838 }
11839
11840 pub fn set_leading_detached_comments<T, V>(mut self, v: T) -> Self
11842 where
11843 T: std::iter::IntoIterator<Item = V>,
11844 V: std::convert::Into<std::string::String>,
11845 {
11846 use std::iter::Iterator;
11847 self.leading_detached_comments = v.into_iter().map(|i| i.into()).collect();
11848 self
11849 }
11850 }
11851
11852 impl wkt::message::Message for Location {
11853 fn typename() -> &'static str {
11854 "type.googleapis.com/google.protobuf.SourceCodeInfo.Location"
11855 }
11856 }
11857
11858 #[doc(hidden)]
11859 impl<'de> serde::de::Deserialize<'de> for Location {
11860 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11861 where
11862 D: serde::Deserializer<'de>,
11863 {
11864 #[allow(non_camel_case_types)]
11865 #[doc(hidden)]
11866 #[derive(PartialEq, Eq, Hash)]
11867 enum __FieldTag {
11868 __path,
11869 __span,
11870 __leading_comments,
11871 __trailing_comments,
11872 __leading_detached_comments,
11873 Unknown(std::string::String),
11874 }
11875 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
11876 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11877 where
11878 D: serde::Deserializer<'de>,
11879 {
11880 struct Visitor;
11881 impl<'de> serde::de::Visitor<'de> for Visitor {
11882 type Value = __FieldTag;
11883 fn expecting(
11884 &self,
11885 formatter: &mut std::fmt::Formatter,
11886 ) -> std::fmt::Result {
11887 formatter.write_str("a field name for Location")
11888 }
11889 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
11890 where
11891 E: serde::de::Error,
11892 {
11893 use std::result::Result::Ok;
11894 use std::string::ToString;
11895 match value {
11896 "path" => Ok(__FieldTag::__path),
11897 "span" => Ok(__FieldTag::__span),
11898 "leadingComments" => Ok(__FieldTag::__leading_comments),
11899 "leading_comments" => Ok(__FieldTag::__leading_comments),
11900 "trailingComments" => Ok(__FieldTag::__trailing_comments),
11901 "trailing_comments" => Ok(__FieldTag::__trailing_comments),
11902 "leadingDetachedComments" => {
11903 Ok(__FieldTag::__leading_detached_comments)
11904 }
11905 "leading_detached_comments" => {
11906 Ok(__FieldTag::__leading_detached_comments)
11907 }
11908 _ => Ok(__FieldTag::Unknown(value.to_string())),
11909 }
11910 }
11911 }
11912 deserializer.deserialize_identifier(Visitor)
11913 }
11914 }
11915 struct Visitor;
11916 impl<'de> serde::de::Visitor<'de> for Visitor {
11917 type Value = Location;
11918 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
11919 formatter.write_str("struct Location")
11920 }
11921 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
11922 where
11923 A: serde::de::MapAccess<'de>,
11924 {
11925 #[allow(unused_imports)]
11926 use serde::de::Error;
11927 use std::option::Option::Some;
11928 let mut fields = std::collections::HashSet::new();
11929 let mut result = Self::Value::new();
11930 while let Some(tag) = map.next_key::<__FieldTag>()? {
11931 #[allow(clippy::match_single_binding)]
11932 match tag {
11933 __FieldTag::__path => {
11934 if !fields.insert(__FieldTag::__path) {
11935 return std::result::Result::Err(A::Error::duplicate_field(
11936 "multiple values for path",
11937 ));
11938 }
11939 struct __With(std::option::Option<std::vec::Vec<i32>>);
11940 impl<'de> serde::de::Deserialize<'de> for __With {
11941 fn deserialize<D>(
11942 deserializer: D,
11943 ) -> std::result::Result<Self, D::Error>
11944 where
11945 D: serde::de::Deserializer<'de>,
11946 {
11947 serde_with::As::<
11948 std::option::Option<std::vec::Vec<wkt::internal::I32>>,
11949 >::deserialize(
11950 deserializer
11951 )
11952 .map(__With)
11953 }
11954 }
11955 result.path = map.next_value::<__With>()?.0.unwrap_or_default();
11956 }
11957 __FieldTag::__span => {
11958 if !fields.insert(__FieldTag::__span) {
11959 return std::result::Result::Err(A::Error::duplicate_field(
11960 "multiple values for span",
11961 ));
11962 }
11963 struct __With(std::option::Option<std::vec::Vec<i32>>);
11964 impl<'de> serde::de::Deserialize<'de> for __With {
11965 fn deserialize<D>(
11966 deserializer: D,
11967 ) -> std::result::Result<Self, D::Error>
11968 where
11969 D: serde::de::Deserializer<'de>,
11970 {
11971 serde_with::As::<
11972 std::option::Option<std::vec::Vec<wkt::internal::I32>>,
11973 >::deserialize(
11974 deserializer
11975 )
11976 .map(__With)
11977 }
11978 }
11979 result.span = map.next_value::<__With>()?.0.unwrap_or_default();
11980 }
11981 __FieldTag::__leading_comments => {
11982 if !fields.insert(__FieldTag::__leading_comments) {
11983 return std::result::Result::Err(A::Error::duplicate_field(
11984 "multiple values for leading_comments",
11985 ));
11986 }
11987 result.leading_comments = map
11988 .next_value::<std::option::Option<std::string::String>>()?
11989 .unwrap_or_default();
11990 }
11991 __FieldTag::__trailing_comments => {
11992 if !fields.insert(__FieldTag::__trailing_comments) {
11993 return std::result::Result::Err(A::Error::duplicate_field(
11994 "multiple values for trailing_comments",
11995 ));
11996 }
11997 result.trailing_comments = map
11998 .next_value::<std::option::Option<std::string::String>>()?
11999 .unwrap_or_default();
12000 }
12001 __FieldTag::__leading_detached_comments => {
12002 if !fields.insert(__FieldTag::__leading_detached_comments) {
12003 return std::result::Result::Err(A::Error::duplicate_field(
12004 "multiple values for leading_detached_comments",
12005 ));
12006 }
12007 result.leading_detached_comments = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
12008 }
12009 __FieldTag::Unknown(key) => {
12010 let value = map.next_value::<serde_json::Value>()?;
12011 result._unknown_fields.insert(key, value);
12012 }
12013 }
12014 }
12015 std::result::Result::Ok(result)
12016 }
12017 }
12018 deserializer.deserialize_any(Visitor)
12019 }
12020 }
12021
12022 #[doc(hidden)]
12023 impl serde::ser::Serialize for Location {
12024 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12025 where
12026 S: serde::ser::Serializer,
12027 {
12028 use serde::ser::SerializeMap;
12029 #[allow(unused_imports)]
12030 use std::option::Option::Some;
12031 let mut state = serializer.serialize_map(std::option::Option::None)?;
12032 if !self.path.is_empty() {
12033 struct __With<'a>(&'a std::vec::Vec<i32>);
12034 impl<'a> serde::ser::Serialize for __With<'a> {
12035 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12036 where
12037 S: serde::ser::Serializer,
12038 {
12039 serde_with::As::<std::vec::Vec<wkt::internal::I32>>::serialize(
12040 self.0, serializer,
12041 )
12042 }
12043 }
12044 state.serialize_entry("path", &__With(&self.path))?;
12045 }
12046 if !self.span.is_empty() {
12047 struct __With<'a>(&'a std::vec::Vec<i32>);
12048 impl<'a> serde::ser::Serialize for __With<'a> {
12049 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12050 where
12051 S: serde::ser::Serializer,
12052 {
12053 serde_with::As::<std::vec::Vec<wkt::internal::I32>>::serialize(
12054 self.0, serializer,
12055 )
12056 }
12057 }
12058 state.serialize_entry("span", &__With(&self.span))?;
12059 }
12060 if !self.leading_comments.is_empty() {
12061 state.serialize_entry("leadingComments", &self.leading_comments)?;
12062 }
12063 if !self.trailing_comments.is_empty() {
12064 state.serialize_entry("trailingComments", &self.trailing_comments)?;
12065 }
12066 if !self.leading_detached_comments.is_empty() {
12067 state
12068 .serialize_entry("leadingDetachedComments", &self.leading_detached_comments)?;
12069 }
12070 if !self._unknown_fields.is_empty() {
12071 for (key, value) in self._unknown_fields.iter() {
12072 state.serialize_entry(key, &value)?;
12073 }
12074 }
12075 state.end()
12076 }
12077 }
12078
12079 impl std::fmt::Debug for Location {
12080 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12081 let mut debug_struct = f.debug_struct("Location");
12082 debug_struct.field("path", &self.path);
12083 debug_struct.field("span", &self.span);
12084 debug_struct.field("leading_comments", &self.leading_comments);
12085 debug_struct.field("trailing_comments", &self.trailing_comments);
12086 debug_struct.field("leading_detached_comments", &self.leading_detached_comments);
12087 if !self._unknown_fields.is_empty() {
12088 debug_struct.field("_unknown_fields", &self._unknown_fields);
12089 }
12090 debug_struct.finish()
12091 }
12092 }
12093}
12094
12095#[derive(Clone, Default, PartialEq)]
12099#[non_exhaustive]
12100pub struct GeneratedCodeInfo {
12101 pub annotation: std::vec::Vec<crate::generated_code_info::Annotation>,
12104
12105 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12106}
12107
12108impl GeneratedCodeInfo {
12109 pub fn new() -> Self {
12110 std::default::Default::default()
12111 }
12112
12113 pub fn set_annotation<T, V>(mut self, v: T) -> Self
12115 where
12116 T: std::iter::IntoIterator<Item = V>,
12117 V: std::convert::Into<crate::generated_code_info::Annotation>,
12118 {
12119 use std::iter::Iterator;
12120 self.annotation = v.into_iter().map(|i| i.into()).collect();
12121 self
12122 }
12123}
12124
12125impl wkt::message::Message for GeneratedCodeInfo {
12126 fn typename() -> &'static str {
12127 "type.googleapis.com/google.protobuf.GeneratedCodeInfo"
12128 }
12129}
12130
12131#[doc(hidden)]
12132impl<'de> serde::de::Deserialize<'de> for GeneratedCodeInfo {
12133 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12134 where
12135 D: serde::Deserializer<'de>,
12136 {
12137 #[allow(non_camel_case_types)]
12138 #[doc(hidden)]
12139 #[derive(PartialEq, Eq, Hash)]
12140 enum __FieldTag {
12141 __annotation,
12142 Unknown(std::string::String),
12143 }
12144 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12145 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12146 where
12147 D: serde::Deserializer<'de>,
12148 {
12149 struct Visitor;
12150 impl<'de> serde::de::Visitor<'de> for Visitor {
12151 type Value = __FieldTag;
12152 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12153 formatter.write_str("a field name for GeneratedCodeInfo")
12154 }
12155 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12156 where
12157 E: serde::de::Error,
12158 {
12159 use std::result::Result::Ok;
12160 use std::string::ToString;
12161 match value {
12162 "annotation" => Ok(__FieldTag::__annotation),
12163 _ => Ok(__FieldTag::Unknown(value.to_string())),
12164 }
12165 }
12166 }
12167 deserializer.deserialize_identifier(Visitor)
12168 }
12169 }
12170 struct Visitor;
12171 impl<'de> serde::de::Visitor<'de> for Visitor {
12172 type Value = GeneratedCodeInfo;
12173 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12174 formatter.write_str("struct GeneratedCodeInfo")
12175 }
12176 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12177 where
12178 A: serde::de::MapAccess<'de>,
12179 {
12180 #[allow(unused_imports)]
12181 use serde::de::Error;
12182 use std::option::Option::Some;
12183 let mut fields = std::collections::HashSet::new();
12184 let mut result = Self::Value::new();
12185 while let Some(tag) = map.next_key::<__FieldTag>()? {
12186 #[allow(clippy::match_single_binding)]
12187 match tag {
12188 __FieldTag::__annotation => {
12189 if !fields.insert(__FieldTag::__annotation) {
12190 return std::result::Result::Err(A::Error::duplicate_field(
12191 "multiple values for annotation",
12192 ));
12193 }
12194 result.annotation = map
12195 .next_value::<std::option::Option<
12196 std::vec::Vec<crate::generated_code_info::Annotation>,
12197 >>()?
12198 .unwrap_or_default();
12199 }
12200 __FieldTag::Unknown(key) => {
12201 let value = map.next_value::<serde_json::Value>()?;
12202 result._unknown_fields.insert(key, value);
12203 }
12204 }
12205 }
12206 std::result::Result::Ok(result)
12207 }
12208 }
12209 deserializer.deserialize_any(Visitor)
12210 }
12211}
12212
12213#[doc(hidden)]
12214impl serde::ser::Serialize for GeneratedCodeInfo {
12215 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12216 where
12217 S: serde::ser::Serializer,
12218 {
12219 use serde::ser::SerializeMap;
12220 #[allow(unused_imports)]
12221 use std::option::Option::Some;
12222 let mut state = serializer.serialize_map(std::option::Option::None)?;
12223 if !self.annotation.is_empty() {
12224 state.serialize_entry("annotation", &self.annotation)?;
12225 }
12226 if !self._unknown_fields.is_empty() {
12227 for (key, value) in self._unknown_fields.iter() {
12228 state.serialize_entry(key, &value)?;
12229 }
12230 }
12231 state.end()
12232 }
12233}
12234
12235impl std::fmt::Debug for GeneratedCodeInfo {
12236 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12237 let mut debug_struct = f.debug_struct("GeneratedCodeInfo");
12238 debug_struct.field("annotation", &self.annotation);
12239 if !self._unknown_fields.is_empty() {
12240 debug_struct.field("_unknown_fields", &self._unknown_fields);
12241 }
12242 debug_struct.finish()
12243 }
12244}
12245
12246pub mod generated_code_info {
12248 #[allow(unused_imports)]
12249 use super::*;
12250
12251 #[derive(Clone, Default, PartialEq)]
12252 #[non_exhaustive]
12253 pub struct Annotation {
12254 pub path: std::vec::Vec<i32>,
12257
12258 pub source_file: std::string::String,
12260
12261 pub begin: i32,
12264
12265 pub end: i32,
12269
12270 pub semantic: crate::generated_code_info::annotation::Semantic,
12271
12272 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12273 }
12274
12275 impl Annotation {
12276 pub fn new() -> Self {
12277 std::default::Default::default()
12278 }
12279
12280 pub fn set_path<T, V>(mut self, v: T) -> Self
12282 where
12283 T: std::iter::IntoIterator<Item = V>,
12284 V: std::convert::Into<i32>,
12285 {
12286 use std::iter::Iterator;
12287 self.path = v.into_iter().map(|i| i.into()).collect();
12288 self
12289 }
12290
12291 pub fn set_source_file<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12293 self.source_file = v.into();
12294 self
12295 }
12296
12297 pub fn set_begin<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12299 self.begin = v.into();
12300 self
12301 }
12302
12303 pub fn set_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12305 self.end = v.into();
12306 self
12307 }
12308
12309 pub fn set_semantic<
12311 T: std::convert::Into<crate::generated_code_info::annotation::Semantic>,
12312 >(
12313 mut self,
12314 v: T,
12315 ) -> Self {
12316 self.semantic = v.into();
12317 self
12318 }
12319 }
12320
12321 impl wkt::message::Message for Annotation {
12322 fn typename() -> &'static str {
12323 "type.googleapis.com/google.protobuf.GeneratedCodeInfo.Annotation"
12324 }
12325 }
12326
12327 #[doc(hidden)]
12328 impl<'de> serde::de::Deserialize<'de> for Annotation {
12329 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12330 where
12331 D: serde::Deserializer<'de>,
12332 {
12333 #[allow(non_camel_case_types)]
12334 #[doc(hidden)]
12335 #[derive(PartialEq, Eq, Hash)]
12336 enum __FieldTag {
12337 __path,
12338 __source_file,
12339 __begin,
12340 __end,
12341 __semantic,
12342 Unknown(std::string::String),
12343 }
12344 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12345 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12346 where
12347 D: serde::Deserializer<'de>,
12348 {
12349 struct Visitor;
12350 impl<'de> serde::de::Visitor<'de> for Visitor {
12351 type Value = __FieldTag;
12352 fn expecting(
12353 &self,
12354 formatter: &mut std::fmt::Formatter,
12355 ) -> std::fmt::Result {
12356 formatter.write_str("a field name for Annotation")
12357 }
12358 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12359 where
12360 E: serde::de::Error,
12361 {
12362 use std::result::Result::Ok;
12363 use std::string::ToString;
12364 match value {
12365 "path" => Ok(__FieldTag::__path),
12366 "sourceFile" => Ok(__FieldTag::__source_file),
12367 "source_file" => Ok(__FieldTag::__source_file),
12368 "begin" => Ok(__FieldTag::__begin),
12369 "end" => Ok(__FieldTag::__end),
12370 "semantic" => Ok(__FieldTag::__semantic),
12371 _ => Ok(__FieldTag::Unknown(value.to_string())),
12372 }
12373 }
12374 }
12375 deserializer.deserialize_identifier(Visitor)
12376 }
12377 }
12378 struct Visitor;
12379 impl<'de> serde::de::Visitor<'de> for Visitor {
12380 type Value = Annotation;
12381 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12382 formatter.write_str("struct Annotation")
12383 }
12384 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12385 where
12386 A: serde::de::MapAccess<'de>,
12387 {
12388 #[allow(unused_imports)]
12389 use serde::de::Error;
12390 use std::option::Option::Some;
12391 let mut fields = std::collections::HashSet::new();
12392 let mut result = Self::Value::new();
12393 while let Some(tag) = map.next_key::<__FieldTag>()? {
12394 #[allow(clippy::match_single_binding)]
12395 match tag {
12396 __FieldTag::__path => {
12397 if !fields.insert(__FieldTag::__path) {
12398 return std::result::Result::Err(A::Error::duplicate_field(
12399 "multiple values for path",
12400 ));
12401 }
12402 struct __With(std::option::Option<std::vec::Vec<i32>>);
12403 impl<'de> serde::de::Deserialize<'de> for __With {
12404 fn deserialize<D>(
12405 deserializer: D,
12406 ) -> std::result::Result<Self, D::Error>
12407 where
12408 D: serde::de::Deserializer<'de>,
12409 {
12410 serde_with::As::<
12411 std::option::Option<std::vec::Vec<wkt::internal::I32>>,
12412 >::deserialize(
12413 deserializer
12414 )
12415 .map(__With)
12416 }
12417 }
12418 result.path = map.next_value::<__With>()?.0.unwrap_or_default();
12419 }
12420 __FieldTag::__source_file => {
12421 if !fields.insert(__FieldTag::__source_file) {
12422 return std::result::Result::Err(A::Error::duplicate_field(
12423 "multiple values for source_file",
12424 ));
12425 }
12426 result.source_file = map
12427 .next_value::<std::option::Option<std::string::String>>()?
12428 .unwrap_or_default();
12429 }
12430 __FieldTag::__begin => {
12431 if !fields.insert(__FieldTag::__begin) {
12432 return std::result::Result::Err(A::Error::duplicate_field(
12433 "multiple values for begin",
12434 ));
12435 }
12436 struct __With(std::option::Option<i32>);
12437 impl<'de> serde::de::Deserialize<'de> for __With {
12438 fn deserialize<D>(
12439 deserializer: D,
12440 ) -> std::result::Result<Self, D::Error>
12441 where
12442 D: serde::de::Deserializer<'de>,
12443 {
12444 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
12445 }
12446 }
12447 result.begin = map.next_value::<__With>()?.0.unwrap_or_default();
12448 }
12449 __FieldTag::__end => {
12450 if !fields.insert(__FieldTag::__end) {
12451 return std::result::Result::Err(A::Error::duplicate_field(
12452 "multiple values for end",
12453 ));
12454 }
12455 struct __With(std::option::Option<i32>);
12456 impl<'de> serde::de::Deserialize<'de> for __With {
12457 fn deserialize<D>(
12458 deserializer: D,
12459 ) -> std::result::Result<Self, D::Error>
12460 where
12461 D: serde::de::Deserializer<'de>,
12462 {
12463 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
12464 }
12465 }
12466 result.end = map.next_value::<__With>()?.0.unwrap_or_default();
12467 }
12468 __FieldTag::__semantic => {
12469 if !fields.insert(__FieldTag::__semantic) {
12470 return std::result::Result::Err(A::Error::duplicate_field(
12471 "multiple values for semantic",
12472 ));
12473 }
12474 result.semantic = map
12475 .next_value::<std::option::Option<
12476 crate::generated_code_info::annotation::Semantic,
12477 >>()?
12478 .unwrap_or_default();
12479 }
12480 __FieldTag::Unknown(key) => {
12481 let value = map.next_value::<serde_json::Value>()?;
12482 result._unknown_fields.insert(key, value);
12483 }
12484 }
12485 }
12486 std::result::Result::Ok(result)
12487 }
12488 }
12489 deserializer.deserialize_any(Visitor)
12490 }
12491 }
12492
12493 #[doc(hidden)]
12494 impl serde::ser::Serialize for Annotation {
12495 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12496 where
12497 S: serde::ser::Serializer,
12498 {
12499 use serde::ser::SerializeMap;
12500 #[allow(unused_imports)]
12501 use std::option::Option::Some;
12502 let mut state = serializer.serialize_map(std::option::Option::None)?;
12503 if !self.path.is_empty() {
12504 struct __With<'a>(&'a std::vec::Vec<i32>);
12505 impl<'a> serde::ser::Serialize for __With<'a> {
12506 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12507 where
12508 S: serde::ser::Serializer,
12509 {
12510 serde_with::As::<std::vec::Vec<wkt::internal::I32>>::serialize(
12511 self.0, serializer,
12512 )
12513 }
12514 }
12515 state.serialize_entry("path", &__With(&self.path))?;
12516 }
12517 if !self.source_file.is_empty() {
12518 state.serialize_entry("sourceFile", &self.source_file)?;
12519 }
12520 if !wkt::internal::is_default(&self.begin) {
12521 struct __With<'a>(&'a i32);
12522 impl<'a> serde::ser::Serialize for __With<'a> {
12523 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12524 where
12525 S: serde::ser::Serializer,
12526 {
12527 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
12528 }
12529 }
12530 state.serialize_entry("begin", &__With(&self.begin))?;
12531 }
12532 if !wkt::internal::is_default(&self.end) {
12533 struct __With<'a>(&'a i32);
12534 impl<'a> serde::ser::Serialize for __With<'a> {
12535 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12536 where
12537 S: serde::ser::Serializer,
12538 {
12539 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
12540 }
12541 }
12542 state.serialize_entry("end", &__With(&self.end))?;
12543 }
12544 if !wkt::internal::is_default(&self.semantic) {
12545 state.serialize_entry("semantic", &self.semantic)?;
12546 }
12547 if !self._unknown_fields.is_empty() {
12548 for (key, value) in self._unknown_fields.iter() {
12549 state.serialize_entry(key, &value)?;
12550 }
12551 }
12552 state.end()
12553 }
12554 }
12555
12556 impl std::fmt::Debug for Annotation {
12557 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12558 let mut debug_struct = f.debug_struct("Annotation");
12559 debug_struct.field("path", &self.path);
12560 debug_struct.field("source_file", &self.source_file);
12561 debug_struct.field("begin", &self.begin);
12562 debug_struct.field("end", &self.end);
12563 debug_struct.field("semantic", &self.semantic);
12564 if !self._unknown_fields.is_empty() {
12565 debug_struct.field("_unknown_fields", &self._unknown_fields);
12566 }
12567 debug_struct.finish()
12568 }
12569 }
12570
12571 pub mod annotation {
12573 #[allow(unused_imports)]
12574 use super::*;
12575
12576 #[derive(Clone, Debug, PartialEq)]
12593 #[non_exhaustive]
12594 pub enum Semantic {
12595 None,
12597 Set,
12599 Alias,
12601 UnknownValue(semantic::UnknownValue),
12606 }
12607
12608 #[doc(hidden)]
12609 pub mod semantic {
12610 #[allow(unused_imports)]
12611 use super::*;
12612 #[derive(Clone, Debug, PartialEq)]
12613 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12614 }
12615
12616 impl Semantic {
12617 pub fn value(&self) -> std::option::Option<i32> {
12622 match self {
12623 Self::None => std::option::Option::Some(0),
12624 Self::Set => std::option::Option::Some(1),
12625 Self::Alias => std::option::Option::Some(2),
12626 Self::UnknownValue(u) => u.0.value(),
12627 }
12628 }
12629
12630 pub fn name(&self) -> std::option::Option<&str> {
12635 match self {
12636 Self::None => std::option::Option::Some("NONE"),
12637 Self::Set => std::option::Option::Some("SET"),
12638 Self::Alias => std::option::Option::Some("ALIAS"),
12639 Self::UnknownValue(u) => u.0.name(),
12640 }
12641 }
12642 }
12643
12644 impl std::default::Default for Semantic {
12645 fn default() -> Self {
12646 use std::convert::From;
12647 Self::from(0)
12648 }
12649 }
12650
12651 impl std::fmt::Display for Semantic {
12652 fn fmt(
12653 &self,
12654 f: &mut std::fmt::Formatter<'_>,
12655 ) -> std::result::Result<(), std::fmt::Error> {
12656 wkt::internal::display_enum(f, self.name(), self.value())
12657 }
12658 }
12659
12660 impl std::convert::From<i32> for Semantic {
12661 fn from(value: i32) -> Self {
12662 match value {
12663 0 => Self::None,
12664 1 => Self::Set,
12665 2 => Self::Alias,
12666 _ => Self::UnknownValue(semantic::UnknownValue(
12667 wkt::internal::UnknownEnumValue::Integer(value),
12668 )),
12669 }
12670 }
12671 }
12672
12673 impl std::convert::From<&str> for Semantic {
12674 fn from(value: &str) -> Self {
12675 use std::string::ToString;
12676 match value {
12677 "NONE" => Self::None,
12678 "SET" => Self::Set,
12679 "ALIAS" => Self::Alias,
12680 _ => Self::UnknownValue(semantic::UnknownValue(
12681 wkt::internal::UnknownEnumValue::String(value.to_string()),
12682 )),
12683 }
12684 }
12685 }
12686
12687 impl serde::ser::Serialize for Semantic {
12688 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12689 where
12690 S: serde::Serializer,
12691 {
12692 match self {
12693 Self::None => serializer.serialize_i32(0),
12694 Self::Set => serializer.serialize_i32(1),
12695 Self::Alias => serializer.serialize_i32(2),
12696 Self::UnknownValue(u) => u.0.serialize(serializer),
12697 }
12698 }
12699 }
12700
12701 impl<'de> serde::de::Deserialize<'de> for Semantic {
12702 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12703 where
12704 D: serde::Deserializer<'de>,
12705 {
12706 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Semantic>::new(
12707 ".google.protobuf.GeneratedCodeInfo.Annotation.Semantic",
12708 ))
12709 }
12710 }
12711 }
12712}
12713
12714#[derive(Clone, Default, PartialEq)]
12717#[non_exhaustive]
12718pub struct SourceContext {
12719 pub file_name: std::string::String,
12722
12723 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12724}
12725
12726impl SourceContext {
12727 pub fn new() -> Self {
12728 std::default::Default::default()
12729 }
12730
12731 pub fn set_file_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12733 self.file_name = v.into();
12734 self
12735 }
12736}
12737
12738impl wkt::message::Message for SourceContext {
12739 fn typename() -> &'static str {
12740 "type.googleapis.com/google.protobuf.SourceContext"
12741 }
12742}
12743
12744#[doc(hidden)]
12745impl<'de> serde::de::Deserialize<'de> for SourceContext {
12746 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12747 where
12748 D: serde::Deserializer<'de>,
12749 {
12750 #[allow(non_camel_case_types)]
12751 #[doc(hidden)]
12752 #[derive(PartialEq, Eq, Hash)]
12753 enum __FieldTag {
12754 __file_name,
12755 Unknown(std::string::String),
12756 }
12757 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12758 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12759 where
12760 D: serde::Deserializer<'de>,
12761 {
12762 struct Visitor;
12763 impl<'de> serde::de::Visitor<'de> for Visitor {
12764 type Value = __FieldTag;
12765 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12766 formatter.write_str("a field name for SourceContext")
12767 }
12768 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12769 where
12770 E: serde::de::Error,
12771 {
12772 use std::result::Result::Ok;
12773 use std::string::ToString;
12774 match value {
12775 "fileName" => Ok(__FieldTag::__file_name),
12776 "file_name" => Ok(__FieldTag::__file_name),
12777 _ => Ok(__FieldTag::Unknown(value.to_string())),
12778 }
12779 }
12780 }
12781 deserializer.deserialize_identifier(Visitor)
12782 }
12783 }
12784 struct Visitor;
12785 impl<'de> serde::de::Visitor<'de> for Visitor {
12786 type Value = SourceContext;
12787 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12788 formatter.write_str("struct SourceContext")
12789 }
12790 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
12791 where
12792 A: serde::de::MapAccess<'de>,
12793 {
12794 #[allow(unused_imports)]
12795 use serde::de::Error;
12796 use std::option::Option::Some;
12797 let mut fields = std::collections::HashSet::new();
12798 let mut result = Self::Value::new();
12799 while let Some(tag) = map.next_key::<__FieldTag>()? {
12800 #[allow(clippy::match_single_binding)]
12801 match tag {
12802 __FieldTag::__file_name => {
12803 if !fields.insert(__FieldTag::__file_name) {
12804 return std::result::Result::Err(A::Error::duplicate_field(
12805 "multiple values for file_name",
12806 ));
12807 }
12808 result.file_name = map
12809 .next_value::<std::option::Option<std::string::String>>()?
12810 .unwrap_or_default();
12811 }
12812 __FieldTag::Unknown(key) => {
12813 let value = map.next_value::<serde_json::Value>()?;
12814 result._unknown_fields.insert(key, value);
12815 }
12816 }
12817 }
12818 std::result::Result::Ok(result)
12819 }
12820 }
12821 deserializer.deserialize_any(Visitor)
12822 }
12823}
12824
12825#[doc(hidden)]
12826impl serde::ser::Serialize for SourceContext {
12827 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12828 where
12829 S: serde::ser::Serializer,
12830 {
12831 use serde::ser::SerializeMap;
12832 #[allow(unused_imports)]
12833 use std::option::Option::Some;
12834 let mut state = serializer.serialize_map(std::option::Option::None)?;
12835 if !self.file_name.is_empty() {
12836 state.serialize_entry("fileName", &self.file_name)?;
12837 }
12838 if !self._unknown_fields.is_empty() {
12839 for (key, value) in self._unknown_fields.iter() {
12840 state.serialize_entry(key, &value)?;
12841 }
12842 }
12843 state.end()
12844 }
12845}
12846
12847impl std::fmt::Debug for SourceContext {
12848 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12849 let mut debug_struct = f.debug_struct("SourceContext");
12850 debug_struct.field("file_name", &self.file_name);
12851 if !self._unknown_fields.is_empty() {
12852 debug_struct.field("_unknown_fields", &self._unknown_fields);
12853 }
12854 debug_struct.finish()
12855 }
12856}
12857
12858#[derive(Clone, Default, PartialEq)]
12860#[non_exhaustive]
12861pub struct Type {
12862 pub name: std::string::String,
12864
12865 pub fields: std::vec::Vec<crate::Field>,
12867
12868 pub oneofs: std::vec::Vec<std::string::String>,
12870
12871 pub options: std::vec::Vec<crate::Option>,
12873
12874 pub source_context: std::option::Option<crate::SourceContext>,
12876
12877 pub syntax: crate::Syntax,
12879
12880 pub edition: std::string::String,
12882
12883 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12884}
12885
12886impl Type {
12887 pub fn new() -> Self {
12888 std::default::Default::default()
12889 }
12890
12891 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12893 self.name = v.into();
12894 self
12895 }
12896
12897 pub fn set_fields<T, V>(mut self, v: T) -> Self
12899 where
12900 T: std::iter::IntoIterator<Item = V>,
12901 V: std::convert::Into<crate::Field>,
12902 {
12903 use std::iter::Iterator;
12904 self.fields = v.into_iter().map(|i| i.into()).collect();
12905 self
12906 }
12907
12908 pub fn set_oneofs<T, V>(mut self, v: T) -> Self
12910 where
12911 T: std::iter::IntoIterator<Item = V>,
12912 V: std::convert::Into<std::string::String>,
12913 {
12914 use std::iter::Iterator;
12915 self.oneofs = v.into_iter().map(|i| i.into()).collect();
12916 self
12917 }
12918
12919 pub fn set_options<T, V>(mut self, v: T) -> Self
12921 where
12922 T: std::iter::IntoIterator<Item = V>,
12923 V: std::convert::Into<crate::Option>,
12924 {
12925 use std::iter::Iterator;
12926 self.options = v.into_iter().map(|i| i.into()).collect();
12927 self
12928 }
12929
12930 pub fn set_source_context<T>(mut self, v: T) -> Self
12932 where
12933 T: std::convert::Into<crate::SourceContext>,
12934 {
12935 self.source_context = std::option::Option::Some(v.into());
12936 self
12937 }
12938
12939 pub fn set_or_clear_source_context<T>(mut self, v: std::option::Option<T>) -> Self
12941 where
12942 T: std::convert::Into<crate::SourceContext>,
12943 {
12944 self.source_context = v.map(|x| x.into());
12945 self
12946 }
12947
12948 pub fn set_syntax<T: std::convert::Into<crate::Syntax>>(mut self, v: T) -> Self {
12950 self.syntax = v.into();
12951 self
12952 }
12953
12954 pub fn set_edition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12956 self.edition = v.into();
12957 self
12958 }
12959}
12960
12961impl wkt::message::Message for Type {
12962 fn typename() -> &'static str {
12963 "type.googleapis.com/google.protobuf.Type"
12964 }
12965}
12966
12967#[doc(hidden)]
12968impl<'de> serde::de::Deserialize<'de> for Type {
12969 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12970 where
12971 D: serde::Deserializer<'de>,
12972 {
12973 #[allow(non_camel_case_types)]
12974 #[doc(hidden)]
12975 #[derive(PartialEq, Eq, Hash)]
12976 enum __FieldTag {
12977 __name,
12978 __fields,
12979 __oneofs,
12980 __options,
12981 __source_context,
12982 __syntax,
12983 __edition,
12984 Unknown(std::string::String),
12985 }
12986 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
12987 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12988 where
12989 D: serde::Deserializer<'de>,
12990 {
12991 struct Visitor;
12992 impl<'de> serde::de::Visitor<'de> for Visitor {
12993 type Value = __FieldTag;
12994 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
12995 formatter.write_str("a field name for Type")
12996 }
12997 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
12998 where
12999 E: serde::de::Error,
13000 {
13001 use std::result::Result::Ok;
13002 use std::string::ToString;
13003 match value {
13004 "name" => Ok(__FieldTag::__name),
13005 "fields" => Ok(__FieldTag::__fields),
13006 "oneofs" => Ok(__FieldTag::__oneofs),
13007 "options" => Ok(__FieldTag::__options),
13008 "sourceContext" => Ok(__FieldTag::__source_context),
13009 "source_context" => Ok(__FieldTag::__source_context),
13010 "syntax" => Ok(__FieldTag::__syntax),
13011 "edition" => Ok(__FieldTag::__edition),
13012 _ => Ok(__FieldTag::Unknown(value.to_string())),
13013 }
13014 }
13015 }
13016 deserializer.deserialize_identifier(Visitor)
13017 }
13018 }
13019 struct Visitor;
13020 impl<'de> serde::de::Visitor<'de> for Visitor {
13021 type Value = Type;
13022 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13023 formatter.write_str("struct Type")
13024 }
13025 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13026 where
13027 A: serde::de::MapAccess<'de>,
13028 {
13029 #[allow(unused_imports)]
13030 use serde::de::Error;
13031 use std::option::Option::Some;
13032 let mut fields = std::collections::HashSet::new();
13033 let mut result = Self::Value::new();
13034 while let Some(tag) = map.next_key::<__FieldTag>()? {
13035 #[allow(clippy::match_single_binding)]
13036 match tag {
13037 __FieldTag::__name => {
13038 if !fields.insert(__FieldTag::__name) {
13039 return std::result::Result::Err(A::Error::duplicate_field(
13040 "multiple values for name",
13041 ));
13042 }
13043 result.name = map
13044 .next_value::<std::option::Option<std::string::String>>()?
13045 .unwrap_or_default();
13046 }
13047 __FieldTag::__fields => {
13048 if !fields.insert(__FieldTag::__fields) {
13049 return std::result::Result::Err(A::Error::duplicate_field(
13050 "multiple values for fields",
13051 ));
13052 }
13053 result.fields = map
13054 .next_value::<std::option::Option<std::vec::Vec<crate::Field>>>()?
13055 .unwrap_or_default();
13056 }
13057 __FieldTag::__oneofs => {
13058 if !fields.insert(__FieldTag::__oneofs) {
13059 return std::result::Result::Err(A::Error::duplicate_field(
13060 "multiple values for oneofs",
13061 ));
13062 }
13063 result.oneofs = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
13064 }
13065 __FieldTag::__options => {
13066 if !fields.insert(__FieldTag::__options) {
13067 return std::result::Result::Err(A::Error::duplicate_field(
13068 "multiple values for options",
13069 ));
13070 }
13071 result.options = map
13072 .next_value::<std::option::Option<std::vec::Vec<crate::Option>>>()?
13073 .unwrap_or_default();
13074 }
13075 __FieldTag::__source_context => {
13076 if !fields.insert(__FieldTag::__source_context) {
13077 return std::result::Result::Err(A::Error::duplicate_field(
13078 "multiple values for source_context",
13079 ));
13080 }
13081 result.source_context =
13082 map.next_value::<std::option::Option<crate::SourceContext>>()?;
13083 }
13084 __FieldTag::__syntax => {
13085 if !fields.insert(__FieldTag::__syntax) {
13086 return std::result::Result::Err(A::Error::duplicate_field(
13087 "multiple values for syntax",
13088 ));
13089 }
13090 result.syntax = map
13091 .next_value::<std::option::Option<crate::Syntax>>()?
13092 .unwrap_or_default();
13093 }
13094 __FieldTag::__edition => {
13095 if !fields.insert(__FieldTag::__edition) {
13096 return std::result::Result::Err(A::Error::duplicate_field(
13097 "multiple values for edition",
13098 ));
13099 }
13100 result.edition = map
13101 .next_value::<std::option::Option<std::string::String>>()?
13102 .unwrap_or_default();
13103 }
13104 __FieldTag::Unknown(key) => {
13105 let value = map.next_value::<serde_json::Value>()?;
13106 result._unknown_fields.insert(key, value);
13107 }
13108 }
13109 }
13110 std::result::Result::Ok(result)
13111 }
13112 }
13113 deserializer.deserialize_any(Visitor)
13114 }
13115}
13116
13117#[doc(hidden)]
13118impl serde::ser::Serialize for Type {
13119 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13120 where
13121 S: serde::ser::Serializer,
13122 {
13123 use serde::ser::SerializeMap;
13124 #[allow(unused_imports)]
13125 use std::option::Option::Some;
13126 let mut state = serializer.serialize_map(std::option::Option::None)?;
13127 if !self.name.is_empty() {
13128 state.serialize_entry("name", &self.name)?;
13129 }
13130 if !self.fields.is_empty() {
13131 state.serialize_entry("fields", &self.fields)?;
13132 }
13133 if !self.oneofs.is_empty() {
13134 state.serialize_entry("oneofs", &self.oneofs)?;
13135 }
13136 if !self.options.is_empty() {
13137 state.serialize_entry("options", &self.options)?;
13138 }
13139 if self.source_context.is_some() {
13140 state.serialize_entry("sourceContext", &self.source_context)?;
13141 }
13142 if !wkt::internal::is_default(&self.syntax) {
13143 state.serialize_entry("syntax", &self.syntax)?;
13144 }
13145 if !self.edition.is_empty() {
13146 state.serialize_entry("edition", &self.edition)?;
13147 }
13148 if !self._unknown_fields.is_empty() {
13149 for (key, value) in self._unknown_fields.iter() {
13150 state.serialize_entry(key, &value)?;
13151 }
13152 }
13153 state.end()
13154 }
13155}
13156
13157impl std::fmt::Debug for Type {
13158 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13159 let mut debug_struct = f.debug_struct("Type");
13160 debug_struct.field("name", &self.name);
13161 debug_struct.field("fields", &self.fields);
13162 debug_struct.field("oneofs", &self.oneofs);
13163 debug_struct.field("options", &self.options);
13164 debug_struct.field("source_context", &self.source_context);
13165 debug_struct.field("syntax", &self.syntax);
13166 debug_struct.field("edition", &self.edition);
13167 if !self._unknown_fields.is_empty() {
13168 debug_struct.field("_unknown_fields", &self._unknown_fields);
13169 }
13170 debug_struct.finish()
13171 }
13172}
13173
13174#[derive(Clone, Default, PartialEq)]
13176#[non_exhaustive]
13177pub struct Field {
13178 pub kind: crate::field::Kind,
13180
13181 pub cardinality: crate::field::Cardinality,
13183
13184 pub number: i32,
13186
13187 pub name: std::string::String,
13189
13190 pub type_url: std::string::String,
13193
13194 pub oneof_index: i32,
13197
13198 pub packed: bool,
13200
13201 pub options: std::vec::Vec<crate::Option>,
13203
13204 pub json_name: std::string::String,
13206
13207 pub default_value: std::string::String,
13209
13210 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13211}
13212
13213impl Field {
13214 pub fn new() -> Self {
13215 std::default::Default::default()
13216 }
13217
13218 pub fn set_kind<T: std::convert::Into<crate::field::Kind>>(mut self, v: T) -> Self {
13220 self.kind = v.into();
13221 self
13222 }
13223
13224 pub fn set_cardinality<T: std::convert::Into<crate::field::Cardinality>>(
13226 mut self,
13227 v: T,
13228 ) -> Self {
13229 self.cardinality = v.into();
13230 self
13231 }
13232
13233 pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13235 self.number = v.into();
13236 self
13237 }
13238
13239 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13241 self.name = v.into();
13242 self
13243 }
13244
13245 pub fn set_type_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13247 self.type_url = v.into();
13248 self
13249 }
13250
13251 pub fn set_oneof_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13253 self.oneof_index = v.into();
13254 self
13255 }
13256
13257 pub fn set_packed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13259 self.packed = v.into();
13260 self
13261 }
13262
13263 pub fn set_options<T, V>(mut self, v: T) -> Self
13265 where
13266 T: std::iter::IntoIterator<Item = V>,
13267 V: std::convert::Into<crate::Option>,
13268 {
13269 use std::iter::Iterator;
13270 self.options = v.into_iter().map(|i| i.into()).collect();
13271 self
13272 }
13273
13274 pub fn set_json_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13276 self.json_name = v.into();
13277 self
13278 }
13279
13280 pub fn set_default_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13282 self.default_value = v.into();
13283 self
13284 }
13285}
13286
13287impl wkt::message::Message for Field {
13288 fn typename() -> &'static str {
13289 "type.googleapis.com/google.protobuf.Field"
13290 }
13291}
13292
13293#[doc(hidden)]
13294impl<'de> serde::de::Deserialize<'de> for Field {
13295 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13296 where
13297 D: serde::Deserializer<'de>,
13298 {
13299 #[allow(non_camel_case_types)]
13300 #[doc(hidden)]
13301 #[derive(PartialEq, Eq, Hash)]
13302 enum __FieldTag {
13303 __kind,
13304 __cardinality,
13305 __number,
13306 __name,
13307 __type_url,
13308 __oneof_index,
13309 __packed,
13310 __options,
13311 __json_name,
13312 __default_value,
13313 Unknown(std::string::String),
13314 }
13315 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
13316 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13317 where
13318 D: serde::Deserializer<'de>,
13319 {
13320 struct Visitor;
13321 impl<'de> serde::de::Visitor<'de> for Visitor {
13322 type Value = __FieldTag;
13323 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13324 formatter.write_str("a field name for Field")
13325 }
13326 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
13327 where
13328 E: serde::de::Error,
13329 {
13330 use std::result::Result::Ok;
13331 use std::string::ToString;
13332 match value {
13333 "kind" => Ok(__FieldTag::__kind),
13334 "cardinality" => Ok(__FieldTag::__cardinality),
13335 "number" => Ok(__FieldTag::__number),
13336 "name" => Ok(__FieldTag::__name),
13337 "typeUrl" => Ok(__FieldTag::__type_url),
13338 "type_url" => Ok(__FieldTag::__type_url),
13339 "oneofIndex" => Ok(__FieldTag::__oneof_index),
13340 "oneof_index" => Ok(__FieldTag::__oneof_index),
13341 "packed" => Ok(__FieldTag::__packed),
13342 "options" => Ok(__FieldTag::__options),
13343 "jsonName" => Ok(__FieldTag::__json_name),
13344 "json_name" => Ok(__FieldTag::__json_name),
13345 "defaultValue" => Ok(__FieldTag::__default_value),
13346 "default_value" => Ok(__FieldTag::__default_value),
13347 _ => Ok(__FieldTag::Unknown(value.to_string())),
13348 }
13349 }
13350 }
13351 deserializer.deserialize_identifier(Visitor)
13352 }
13353 }
13354 struct Visitor;
13355 impl<'de> serde::de::Visitor<'de> for Visitor {
13356 type Value = Field;
13357 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
13358 formatter.write_str("struct Field")
13359 }
13360 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
13361 where
13362 A: serde::de::MapAccess<'de>,
13363 {
13364 #[allow(unused_imports)]
13365 use serde::de::Error;
13366 use std::option::Option::Some;
13367 let mut fields = std::collections::HashSet::new();
13368 let mut result = Self::Value::new();
13369 while let Some(tag) = map.next_key::<__FieldTag>()? {
13370 #[allow(clippy::match_single_binding)]
13371 match tag {
13372 __FieldTag::__kind => {
13373 if !fields.insert(__FieldTag::__kind) {
13374 return std::result::Result::Err(A::Error::duplicate_field(
13375 "multiple values for kind",
13376 ));
13377 }
13378 result.kind = map
13379 .next_value::<std::option::Option<crate::field::Kind>>()?
13380 .unwrap_or_default();
13381 }
13382 __FieldTag::__cardinality => {
13383 if !fields.insert(__FieldTag::__cardinality) {
13384 return std::result::Result::Err(A::Error::duplicate_field(
13385 "multiple values for cardinality",
13386 ));
13387 }
13388 result.cardinality = map
13389 .next_value::<std::option::Option<crate::field::Cardinality>>()?
13390 .unwrap_or_default();
13391 }
13392 __FieldTag::__number => {
13393 if !fields.insert(__FieldTag::__number) {
13394 return std::result::Result::Err(A::Error::duplicate_field(
13395 "multiple values for number",
13396 ));
13397 }
13398 struct __With(std::option::Option<i32>);
13399 impl<'de> serde::de::Deserialize<'de> for __With {
13400 fn deserialize<D>(
13401 deserializer: D,
13402 ) -> std::result::Result<Self, D::Error>
13403 where
13404 D: serde::de::Deserializer<'de>,
13405 {
13406 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
13407 }
13408 }
13409 result.number = map.next_value::<__With>()?.0.unwrap_or_default();
13410 }
13411 __FieldTag::__name => {
13412 if !fields.insert(__FieldTag::__name) {
13413 return std::result::Result::Err(A::Error::duplicate_field(
13414 "multiple values for name",
13415 ));
13416 }
13417 result.name = map
13418 .next_value::<std::option::Option<std::string::String>>()?
13419 .unwrap_or_default();
13420 }
13421 __FieldTag::__type_url => {
13422 if !fields.insert(__FieldTag::__type_url) {
13423 return std::result::Result::Err(A::Error::duplicate_field(
13424 "multiple values for type_url",
13425 ));
13426 }
13427 result.type_url = map
13428 .next_value::<std::option::Option<std::string::String>>()?
13429 .unwrap_or_default();
13430 }
13431 __FieldTag::__oneof_index => {
13432 if !fields.insert(__FieldTag::__oneof_index) {
13433 return std::result::Result::Err(A::Error::duplicate_field(
13434 "multiple values for oneof_index",
13435 ));
13436 }
13437 struct __With(std::option::Option<i32>);
13438 impl<'de> serde::de::Deserialize<'de> for __With {
13439 fn deserialize<D>(
13440 deserializer: D,
13441 ) -> std::result::Result<Self, D::Error>
13442 where
13443 D: serde::de::Deserializer<'de>,
13444 {
13445 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
13446 }
13447 }
13448 result.oneof_index = map.next_value::<__With>()?.0.unwrap_or_default();
13449 }
13450 __FieldTag::__packed => {
13451 if !fields.insert(__FieldTag::__packed) {
13452 return std::result::Result::Err(A::Error::duplicate_field(
13453 "multiple values for packed",
13454 ));
13455 }
13456 result.packed = map
13457 .next_value::<std::option::Option<bool>>()?
13458 .unwrap_or_default();
13459 }
13460 __FieldTag::__options => {
13461 if !fields.insert(__FieldTag::__options) {
13462 return std::result::Result::Err(A::Error::duplicate_field(
13463 "multiple values for options",
13464 ));
13465 }
13466 result.options = map
13467 .next_value::<std::option::Option<std::vec::Vec<crate::Option>>>()?
13468 .unwrap_or_default();
13469 }
13470 __FieldTag::__json_name => {
13471 if !fields.insert(__FieldTag::__json_name) {
13472 return std::result::Result::Err(A::Error::duplicate_field(
13473 "multiple values for json_name",
13474 ));
13475 }
13476 result.json_name = map
13477 .next_value::<std::option::Option<std::string::String>>()?
13478 .unwrap_or_default();
13479 }
13480 __FieldTag::__default_value => {
13481 if !fields.insert(__FieldTag::__default_value) {
13482 return std::result::Result::Err(A::Error::duplicate_field(
13483 "multiple values for default_value",
13484 ));
13485 }
13486 result.default_value = map
13487 .next_value::<std::option::Option<std::string::String>>()?
13488 .unwrap_or_default();
13489 }
13490 __FieldTag::Unknown(key) => {
13491 let value = map.next_value::<serde_json::Value>()?;
13492 result._unknown_fields.insert(key, value);
13493 }
13494 }
13495 }
13496 std::result::Result::Ok(result)
13497 }
13498 }
13499 deserializer.deserialize_any(Visitor)
13500 }
13501}
13502
13503#[doc(hidden)]
13504impl serde::ser::Serialize for Field {
13505 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13506 where
13507 S: serde::ser::Serializer,
13508 {
13509 use serde::ser::SerializeMap;
13510 #[allow(unused_imports)]
13511 use std::option::Option::Some;
13512 let mut state = serializer.serialize_map(std::option::Option::None)?;
13513 if !wkt::internal::is_default(&self.kind) {
13514 state.serialize_entry("kind", &self.kind)?;
13515 }
13516 if !wkt::internal::is_default(&self.cardinality) {
13517 state.serialize_entry("cardinality", &self.cardinality)?;
13518 }
13519 if !wkt::internal::is_default(&self.number) {
13520 struct __With<'a>(&'a i32);
13521 impl<'a> serde::ser::Serialize for __With<'a> {
13522 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13523 where
13524 S: serde::ser::Serializer,
13525 {
13526 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
13527 }
13528 }
13529 state.serialize_entry("number", &__With(&self.number))?;
13530 }
13531 if !self.name.is_empty() {
13532 state.serialize_entry("name", &self.name)?;
13533 }
13534 if !self.type_url.is_empty() {
13535 state.serialize_entry("typeUrl", &self.type_url)?;
13536 }
13537 if !wkt::internal::is_default(&self.oneof_index) {
13538 struct __With<'a>(&'a i32);
13539 impl<'a> serde::ser::Serialize for __With<'a> {
13540 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13541 where
13542 S: serde::ser::Serializer,
13543 {
13544 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
13545 }
13546 }
13547 state.serialize_entry("oneofIndex", &__With(&self.oneof_index))?;
13548 }
13549 if !wkt::internal::is_default(&self.packed) {
13550 state.serialize_entry("packed", &self.packed)?;
13551 }
13552 if !self.options.is_empty() {
13553 state.serialize_entry("options", &self.options)?;
13554 }
13555 if !self.json_name.is_empty() {
13556 state.serialize_entry("jsonName", &self.json_name)?;
13557 }
13558 if !self.default_value.is_empty() {
13559 state.serialize_entry("defaultValue", &self.default_value)?;
13560 }
13561 if !self._unknown_fields.is_empty() {
13562 for (key, value) in self._unknown_fields.iter() {
13563 state.serialize_entry(key, &value)?;
13564 }
13565 }
13566 state.end()
13567 }
13568}
13569
13570impl std::fmt::Debug for Field {
13571 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13572 let mut debug_struct = f.debug_struct("Field");
13573 debug_struct.field("kind", &self.kind);
13574 debug_struct.field("cardinality", &self.cardinality);
13575 debug_struct.field("number", &self.number);
13576 debug_struct.field("name", &self.name);
13577 debug_struct.field("type_url", &self.type_url);
13578 debug_struct.field("oneof_index", &self.oneof_index);
13579 debug_struct.field("packed", &self.packed);
13580 debug_struct.field("options", &self.options);
13581 debug_struct.field("json_name", &self.json_name);
13582 debug_struct.field("default_value", &self.default_value);
13583 if !self._unknown_fields.is_empty() {
13584 debug_struct.field("_unknown_fields", &self._unknown_fields);
13585 }
13586 debug_struct.finish()
13587 }
13588}
13589
13590pub mod field {
13592 #[allow(unused_imports)]
13593 use super::*;
13594
13595 #[derive(Clone, Debug, PartialEq)]
13611 #[non_exhaustive]
13612 pub enum Kind {
13613 TypeUnknown,
13615 TypeDouble,
13617 TypeFloat,
13619 TypeInt64,
13621 TypeUint64,
13623 TypeInt32,
13625 TypeFixed64,
13627 TypeFixed32,
13629 TypeBool,
13631 TypeString,
13633 TypeGroup,
13635 TypeMessage,
13637 TypeBytes,
13639 TypeUint32,
13641 TypeEnum,
13643 TypeSfixed32,
13645 TypeSfixed64,
13647 TypeSint32,
13649 TypeSint64,
13651 UnknownValue(kind::UnknownValue),
13656 }
13657
13658 #[doc(hidden)]
13659 pub mod kind {
13660 #[allow(unused_imports)]
13661 use super::*;
13662 #[derive(Clone, Debug, PartialEq)]
13663 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13664 }
13665
13666 impl Kind {
13667 pub fn value(&self) -> std::option::Option<i32> {
13672 match self {
13673 Self::TypeUnknown => std::option::Option::Some(0),
13674 Self::TypeDouble => std::option::Option::Some(1),
13675 Self::TypeFloat => std::option::Option::Some(2),
13676 Self::TypeInt64 => std::option::Option::Some(3),
13677 Self::TypeUint64 => std::option::Option::Some(4),
13678 Self::TypeInt32 => std::option::Option::Some(5),
13679 Self::TypeFixed64 => std::option::Option::Some(6),
13680 Self::TypeFixed32 => std::option::Option::Some(7),
13681 Self::TypeBool => std::option::Option::Some(8),
13682 Self::TypeString => std::option::Option::Some(9),
13683 Self::TypeGroup => std::option::Option::Some(10),
13684 Self::TypeMessage => std::option::Option::Some(11),
13685 Self::TypeBytes => std::option::Option::Some(12),
13686 Self::TypeUint32 => std::option::Option::Some(13),
13687 Self::TypeEnum => std::option::Option::Some(14),
13688 Self::TypeSfixed32 => std::option::Option::Some(15),
13689 Self::TypeSfixed64 => std::option::Option::Some(16),
13690 Self::TypeSint32 => std::option::Option::Some(17),
13691 Self::TypeSint64 => std::option::Option::Some(18),
13692 Self::UnknownValue(u) => u.0.value(),
13693 }
13694 }
13695
13696 pub fn name(&self) -> std::option::Option<&str> {
13701 match self {
13702 Self::TypeUnknown => std::option::Option::Some("TYPE_UNKNOWN"),
13703 Self::TypeDouble => std::option::Option::Some("TYPE_DOUBLE"),
13704 Self::TypeFloat => std::option::Option::Some("TYPE_FLOAT"),
13705 Self::TypeInt64 => std::option::Option::Some("TYPE_INT64"),
13706 Self::TypeUint64 => std::option::Option::Some("TYPE_UINT64"),
13707 Self::TypeInt32 => std::option::Option::Some("TYPE_INT32"),
13708 Self::TypeFixed64 => std::option::Option::Some("TYPE_FIXED64"),
13709 Self::TypeFixed32 => std::option::Option::Some("TYPE_FIXED32"),
13710 Self::TypeBool => std::option::Option::Some("TYPE_BOOL"),
13711 Self::TypeString => std::option::Option::Some("TYPE_STRING"),
13712 Self::TypeGroup => std::option::Option::Some("TYPE_GROUP"),
13713 Self::TypeMessage => std::option::Option::Some("TYPE_MESSAGE"),
13714 Self::TypeBytes => std::option::Option::Some("TYPE_BYTES"),
13715 Self::TypeUint32 => std::option::Option::Some("TYPE_UINT32"),
13716 Self::TypeEnum => std::option::Option::Some("TYPE_ENUM"),
13717 Self::TypeSfixed32 => std::option::Option::Some("TYPE_SFIXED32"),
13718 Self::TypeSfixed64 => std::option::Option::Some("TYPE_SFIXED64"),
13719 Self::TypeSint32 => std::option::Option::Some("TYPE_SINT32"),
13720 Self::TypeSint64 => std::option::Option::Some("TYPE_SINT64"),
13721 Self::UnknownValue(u) => u.0.name(),
13722 }
13723 }
13724 }
13725
13726 impl std::default::Default for Kind {
13727 fn default() -> Self {
13728 use std::convert::From;
13729 Self::from(0)
13730 }
13731 }
13732
13733 impl std::fmt::Display for Kind {
13734 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13735 wkt::internal::display_enum(f, self.name(), self.value())
13736 }
13737 }
13738
13739 impl std::convert::From<i32> for Kind {
13740 fn from(value: i32) -> Self {
13741 match value {
13742 0 => Self::TypeUnknown,
13743 1 => Self::TypeDouble,
13744 2 => Self::TypeFloat,
13745 3 => Self::TypeInt64,
13746 4 => Self::TypeUint64,
13747 5 => Self::TypeInt32,
13748 6 => Self::TypeFixed64,
13749 7 => Self::TypeFixed32,
13750 8 => Self::TypeBool,
13751 9 => Self::TypeString,
13752 10 => Self::TypeGroup,
13753 11 => Self::TypeMessage,
13754 12 => Self::TypeBytes,
13755 13 => Self::TypeUint32,
13756 14 => Self::TypeEnum,
13757 15 => Self::TypeSfixed32,
13758 16 => Self::TypeSfixed64,
13759 17 => Self::TypeSint32,
13760 18 => Self::TypeSint64,
13761 _ => Self::UnknownValue(kind::UnknownValue(
13762 wkt::internal::UnknownEnumValue::Integer(value),
13763 )),
13764 }
13765 }
13766 }
13767
13768 impl std::convert::From<&str> for Kind {
13769 fn from(value: &str) -> Self {
13770 use std::string::ToString;
13771 match value {
13772 "TYPE_UNKNOWN" => Self::TypeUnknown,
13773 "TYPE_DOUBLE" => Self::TypeDouble,
13774 "TYPE_FLOAT" => Self::TypeFloat,
13775 "TYPE_INT64" => Self::TypeInt64,
13776 "TYPE_UINT64" => Self::TypeUint64,
13777 "TYPE_INT32" => Self::TypeInt32,
13778 "TYPE_FIXED64" => Self::TypeFixed64,
13779 "TYPE_FIXED32" => Self::TypeFixed32,
13780 "TYPE_BOOL" => Self::TypeBool,
13781 "TYPE_STRING" => Self::TypeString,
13782 "TYPE_GROUP" => Self::TypeGroup,
13783 "TYPE_MESSAGE" => Self::TypeMessage,
13784 "TYPE_BYTES" => Self::TypeBytes,
13785 "TYPE_UINT32" => Self::TypeUint32,
13786 "TYPE_ENUM" => Self::TypeEnum,
13787 "TYPE_SFIXED32" => Self::TypeSfixed32,
13788 "TYPE_SFIXED64" => Self::TypeSfixed64,
13789 "TYPE_SINT32" => Self::TypeSint32,
13790 "TYPE_SINT64" => Self::TypeSint64,
13791 _ => Self::UnknownValue(kind::UnknownValue(
13792 wkt::internal::UnknownEnumValue::String(value.to_string()),
13793 )),
13794 }
13795 }
13796 }
13797
13798 impl serde::ser::Serialize for Kind {
13799 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13800 where
13801 S: serde::Serializer,
13802 {
13803 match self {
13804 Self::TypeUnknown => serializer.serialize_i32(0),
13805 Self::TypeDouble => serializer.serialize_i32(1),
13806 Self::TypeFloat => serializer.serialize_i32(2),
13807 Self::TypeInt64 => serializer.serialize_i32(3),
13808 Self::TypeUint64 => serializer.serialize_i32(4),
13809 Self::TypeInt32 => serializer.serialize_i32(5),
13810 Self::TypeFixed64 => serializer.serialize_i32(6),
13811 Self::TypeFixed32 => serializer.serialize_i32(7),
13812 Self::TypeBool => serializer.serialize_i32(8),
13813 Self::TypeString => serializer.serialize_i32(9),
13814 Self::TypeGroup => serializer.serialize_i32(10),
13815 Self::TypeMessage => serializer.serialize_i32(11),
13816 Self::TypeBytes => serializer.serialize_i32(12),
13817 Self::TypeUint32 => serializer.serialize_i32(13),
13818 Self::TypeEnum => serializer.serialize_i32(14),
13819 Self::TypeSfixed32 => serializer.serialize_i32(15),
13820 Self::TypeSfixed64 => serializer.serialize_i32(16),
13821 Self::TypeSint32 => serializer.serialize_i32(17),
13822 Self::TypeSint64 => serializer.serialize_i32(18),
13823 Self::UnknownValue(u) => u.0.serialize(serializer),
13824 }
13825 }
13826 }
13827
13828 impl<'de> serde::de::Deserialize<'de> for Kind {
13829 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13830 where
13831 D: serde::Deserializer<'de>,
13832 {
13833 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Kind>::new(
13834 ".google.protobuf.Field.Kind",
13835 ))
13836 }
13837 }
13838
13839 #[derive(Clone, Debug, PartialEq)]
13855 #[non_exhaustive]
13856 pub enum Cardinality {
13857 Unknown,
13859 Optional,
13861 Required,
13863 Repeated,
13865 UnknownValue(cardinality::UnknownValue),
13870 }
13871
13872 #[doc(hidden)]
13873 pub mod cardinality {
13874 #[allow(unused_imports)]
13875 use super::*;
13876 #[derive(Clone, Debug, PartialEq)]
13877 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13878 }
13879
13880 impl Cardinality {
13881 pub fn value(&self) -> std::option::Option<i32> {
13886 match self {
13887 Self::Unknown => std::option::Option::Some(0),
13888 Self::Optional => std::option::Option::Some(1),
13889 Self::Required => std::option::Option::Some(2),
13890 Self::Repeated => std::option::Option::Some(3),
13891 Self::UnknownValue(u) => u.0.value(),
13892 }
13893 }
13894
13895 pub fn name(&self) -> std::option::Option<&str> {
13900 match self {
13901 Self::Unknown => std::option::Option::Some("CARDINALITY_UNKNOWN"),
13902 Self::Optional => std::option::Option::Some("CARDINALITY_OPTIONAL"),
13903 Self::Required => std::option::Option::Some("CARDINALITY_REQUIRED"),
13904 Self::Repeated => std::option::Option::Some("CARDINALITY_REPEATED"),
13905 Self::UnknownValue(u) => u.0.name(),
13906 }
13907 }
13908 }
13909
13910 impl std::default::Default for Cardinality {
13911 fn default() -> Self {
13912 use std::convert::From;
13913 Self::from(0)
13914 }
13915 }
13916
13917 impl std::fmt::Display for Cardinality {
13918 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13919 wkt::internal::display_enum(f, self.name(), self.value())
13920 }
13921 }
13922
13923 impl std::convert::From<i32> for Cardinality {
13924 fn from(value: i32) -> Self {
13925 match value {
13926 0 => Self::Unknown,
13927 1 => Self::Optional,
13928 2 => Self::Required,
13929 3 => Self::Repeated,
13930 _ => Self::UnknownValue(cardinality::UnknownValue(
13931 wkt::internal::UnknownEnumValue::Integer(value),
13932 )),
13933 }
13934 }
13935 }
13936
13937 impl std::convert::From<&str> for Cardinality {
13938 fn from(value: &str) -> Self {
13939 use std::string::ToString;
13940 match value {
13941 "CARDINALITY_UNKNOWN" => Self::Unknown,
13942 "CARDINALITY_OPTIONAL" => Self::Optional,
13943 "CARDINALITY_REQUIRED" => Self::Required,
13944 "CARDINALITY_REPEATED" => Self::Repeated,
13945 _ => Self::UnknownValue(cardinality::UnknownValue(
13946 wkt::internal::UnknownEnumValue::String(value.to_string()),
13947 )),
13948 }
13949 }
13950 }
13951
13952 impl serde::ser::Serialize for Cardinality {
13953 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13954 where
13955 S: serde::Serializer,
13956 {
13957 match self {
13958 Self::Unknown => serializer.serialize_i32(0),
13959 Self::Optional => serializer.serialize_i32(1),
13960 Self::Required => serializer.serialize_i32(2),
13961 Self::Repeated => serializer.serialize_i32(3),
13962 Self::UnknownValue(u) => u.0.serialize(serializer),
13963 }
13964 }
13965 }
13966
13967 impl<'de> serde::de::Deserialize<'de> for Cardinality {
13968 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13969 where
13970 D: serde::Deserializer<'de>,
13971 {
13972 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Cardinality>::new(
13973 ".google.protobuf.Field.Cardinality",
13974 ))
13975 }
13976 }
13977}
13978
13979#[derive(Clone, Default, PartialEq)]
13981#[non_exhaustive]
13982pub struct Enum {
13983 pub name: std::string::String,
13985
13986 pub enumvalue: std::vec::Vec<crate::EnumValue>,
13988
13989 pub options: std::vec::Vec<crate::Option>,
13991
13992 pub source_context: std::option::Option<crate::SourceContext>,
13994
13995 pub syntax: crate::Syntax,
13997
13998 pub edition: std::string::String,
14000
14001 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14002}
14003
14004impl Enum {
14005 pub fn new() -> Self {
14006 std::default::Default::default()
14007 }
14008
14009 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14011 self.name = v.into();
14012 self
14013 }
14014
14015 pub fn set_enumvalue<T, V>(mut self, v: T) -> Self
14017 where
14018 T: std::iter::IntoIterator<Item = V>,
14019 V: std::convert::Into<crate::EnumValue>,
14020 {
14021 use std::iter::Iterator;
14022 self.enumvalue = v.into_iter().map(|i| i.into()).collect();
14023 self
14024 }
14025
14026 pub fn set_options<T, V>(mut self, v: T) -> Self
14028 where
14029 T: std::iter::IntoIterator<Item = V>,
14030 V: std::convert::Into<crate::Option>,
14031 {
14032 use std::iter::Iterator;
14033 self.options = v.into_iter().map(|i| i.into()).collect();
14034 self
14035 }
14036
14037 pub fn set_source_context<T>(mut self, v: T) -> Self
14039 where
14040 T: std::convert::Into<crate::SourceContext>,
14041 {
14042 self.source_context = std::option::Option::Some(v.into());
14043 self
14044 }
14045
14046 pub fn set_or_clear_source_context<T>(mut self, v: std::option::Option<T>) -> Self
14048 where
14049 T: std::convert::Into<crate::SourceContext>,
14050 {
14051 self.source_context = v.map(|x| x.into());
14052 self
14053 }
14054
14055 pub fn set_syntax<T: std::convert::Into<crate::Syntax>>(mut self, v: T) -> Self {
14057 self.syntax = v.into();
14058 self
14059 }
14060
14061 pub fn set_edition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14063 self.edition = v.into();
14064 self
14065 }
14066}
14067
14068impl wkt::message::Message for Enum {
14069 fn typename() -> &'static str {
14070 "type.googleapis.com/google.protobuf.Enum"
14071 }
14072}
14073
14074#[doc(hidden)]
14075impl<'de> serde::de::Deserialize<'de> for Enum {
14076 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14077 where
14078 D: serde::Deserializer<'de>,
14079 {
14080 #[allow(non_camel_case_types)]
14081 #[doc(hidden)]
14082 #[derive(PartialEq, Eq, Hash)]
14083 enum __FieldTag {
14084 __name,
14085 __enumvalue,
14086 __options,
14087 __source_context,
14088 __syntax,
14089 __edition,
14090 Unknown(std::string::String),
14091 }
14092 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14093 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14094 where
14095 D: serde::Deserializer<'de>,
14096 {
14097 struct Visitor;
14098 impl<'de> serde::de::Visitor<'de> for Visitor {
14099 type Value = __FieldTag;
14100 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14101 formatter.write_str("a field name for Enum")
14102 }
14103 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14104 where
14105 E: serde::de::Error,
14106 {
14107 use std::result::Result::Ok;
14108 use std::string::ToString;
14109 match value {
14110 "name" => Ok(__FieldTag::__name),
14111 "enumvalue" => Ok(__FieldTag::__enumvalue),
14112 "options" => Ok(__FieldTag::__options),
14113 "sourceContext" => Ok(__FieldTag::__source_context),
14114 "source_context" => Ok(__FieldTag::__source_context),
14115 "syntax" => Ok(__FieldTag::__syntax),
14116 "edition" => Ok(__FieldTag::__edition),
14117 _ => Ok(__FieldTag::Unknown(value.to_string())),
14118 }
14119 }
14120 }
14121 deserializer.deserialize_identifier(Visitor)
14122 }
14123 }
14124 struct Visitor;
14125 impl<'de> serde::de::Visitor<'de> for Visitor {
14126 type Value = Enum;
14127 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14128 formatter.write_str("struct Enum")
14129 }
14130 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14131 where
14132 A: serde::de::MapAccess<'de>,
14133 {
14134 #[allow(unused_imports)]
14135 use serde::de::Error;
14136 use std::option::Option::Some;
14137 let mut fields = std::collections::HashSet::new();
14138 let mut result = Self::Value::new();
14139 while let Some(tag) = map.next_key::<__FieldTag>()? {
14140 #[allow(clippy::match_single_binding)]
14141 match tag {
14142 __FieldTag::__name => {
14143 if !fields.insert(__FieldTag::__name) {
14144 return std::result::Result::Err(A::Error::duplicate_field(
14145 "multiple values for name",
14146 ));
14147 }
14148 result.name = map
14149 .next_value::<std::option::Option<std::string::String>>()?
14150 .unwrap_or_default();
14151 }
14152 __FieldTag::__enumvalue => {
14153 if !fields.insert(__FieldTag::__enumvalue) {
14154 return std::result::Result::Err(A::Error::duplicate_field(
14155 "multiple values for enumvalue",
14156 ));
14157 }
14158 result.enumvalue = map
14159 .next_value::<std::option::Option<std::vec::Vec<crate::EnumValue>>>(
14160 )?
14161 .unwrap_or_default();
14162 }
14163 __FieldTag::__options => {
14164 if !fields.insert(__FieldTag::__options) {
14165 return std::result::Result::Err(A::Error::duplicate_field(
14166 "multiple values for options",
14167 ));
14168 }
14169 result.options = map
14170 .next_value::<std::option::Option<std::vec::Vec<crate::Option>>>()?
14171 .unwrap_or_default();
14172 }
14173 __FieldTag::__source_context => {
14174 if !fields.insert(__FieldTag::__source_context) {
14175 return std::result::Result::Err(A::Error::duplicate_field(
14176 "multiple values for source_context",
14177 ));
14178 }
14179 result.source_context =
14180 map.next_value::<std::option::Option<crate::SourceContext>>()?;
14181 }
14182 __FieldTag::__syntax => {
14183 if !fields.insert(__FieldTag::__syntax) {
14184 return std::result::Result::Err(A::Error::duplicate_field(
14185 "multiple values for syntax",
14186 ));
14187 }
14188 result.syntax = map
14189 .next_value::<std::option::Option<crate::Syntax>>()?
14190 .unwrap_or_default();
14191 }
14192 __FieldTag::__edition => {
14193 if !fields.insert(__FieldTag::__edition) {
14194 return std::result::Result::Err(A::Error::duplicate_field(
14195 "multiple values for edition",
14196 ));
14197 }
14198 result.edition = map
14199 .next_value::<std::option::Option<std::string::String>>()?
14200 .unwrap_or_default();
14201 }
14202 __FieldTag::Unknown(key) => {
14203 let value = map.next_value::<serde_json::Value>()?;
14204 result._unknown_fields.insert(key, value);
14205 }
14206 }
14207 }
14208 std::result::Result::Ok(result)
14209 }
14210 }
14211 deserializer.deserialize_any(Visitor)
14212 }
14213}
14214
14215#[doc(hidden)]
14216impl serde::ser::Serialize for Enum {
14217 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14218 where
14219 S: serde::ser::Serializer,
14220 {
14221 use serde::ser::SerializeMap;
14222 #[allow(unused_imports)]
14223 use std::option::Option::Some;
14224 let mut state = serializer.serialize_map(std::option::Option::None)?;
14225 if !self.name.is_empty() {
14226 state.serialize_entry("name", &self.name)?;
14227 }
14228 if !self.enumvalue.is_empty() {
14229 state.serialize_entry("enumvalue", &self.enumvalue)?;
14230 }
14231 if !self.options.is_empty() {
14232 state.serialize_entry("options", &self.options)?;
14233 }
14234 if self.source_context.is_some() {
14235 state.serialize_entry("sourceContext", &self.source_context)?;
14236 }
14237 if !wkt::internal::is_default(&self.syntax) {
14238 state.serialize_entry("syntax", &self.syntax)?;
14239 }
14240 if !self.edition.is_empty() {
14241 state.serialize_entry("edition", &self.edition)?;
14242 }
14243 if !self._unknown_fields.is_empty() {
14244 for (key, value) in self._unknown_fields.iter() {
14245 state.serialize_entry(key, &value)?;
14246 }
14247 }
14248 state.end()
14249 }
14250}
14251
14252impl std::fmt::Debug for Enum {
14253 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14254 let mut debug_struct = f.debug_struct("Enum");
14255 debug_struct.field("name", &self.name);
14256 debug_struct.field("enumvalue", &self.enumvalue);
14257 debug_struct.field("options", &self.options);
14258 debug_struct.field("source_context", &self.source_context);
14259 debug_struct.field("syntax", &self.syntax);
14260 debug_struct.field("edition", &self.edition);
14261 if !self._unknown_fields.is_empty() {
14262 debug_struct.field("_unknown_fields", &self._unknown_fields);
14263 }
14264 debug_struct.finish()
14265 }
14266}
14267
14268#[derive(Clone, Default, PartialEq)]
14270#[non_exhaustive]
14271pub struct EnumValue {
14272 pub name: std::string::String,
14274
14275 pub number: i32,
14277
14278 pub options: std::vec::Vec<crate::Option>,
14280
14281 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14282}
14283
14284impl EnumValue {
14285 pub fn new() -> Self {
14286 std::default::Default::default()
14287 }
14288
14289 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14291 self.name = v.into();
14292 self
14293 }
14294
14295 pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14297 self.number = v.into();
14298 self
14299 }
14300
14301 pub fn set_options<T, V>(mut self, v: T) -> Self
14303 where
14304 T: std::iter::IntoIterator<Item = V>,
14305 V: std::convert::Into<crate::Option>,
14306 {
14307 use std::iter::Iterator;
14308 self.options = v.into_iter().map(|i| i.into()).collect();
14309 self
14310 }
14311}
14312
14313impl wkt::message::Message for EnumValue {
14314 fn typename() -> &'static str {
14315 "type.googleapis.com/google.protobuf.EnumValue"
14316 }
14317}
14318
14319#[doc(hidden)]
14320impl<'de> serde::de::Deserialize<'de> for EnumValue {
14321 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14322 where
14323 D: serde::Deserializer<'de>,
14324 {
14325 #[allow(non_camel_case_types)]
14326 #[doc(hidden)]
14327 #[derive(PartialEq, Eq, Hash)]
14328 enum __FieldTag {
14329 __name,
14330 __number,
14331 __options,
14332 Unknown(std::string::String),
14333 }
14334 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14335 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14336 where
14337 D: serde::Deserializer<'de>,
14338 {
14339 struct Visitor;
14340 impl<'de> serde::de::Visitor<'de> for Visitor {
14341 type Value = __FieldTag;
14342 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14343 formatter.write_str("a field name for EnumValue")
14344 }
14345 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14346 where
14347 E: serde::de::Error,
14348 {
14349 use std::result::Result::Ok;
14350 use std::string::ToString;
14351 match value {
14352 "name" => Ok(__FieldTag::__name),
14353 "number" => Ok(__FieldTag::__number),
14354 "options" => Ok(__FieldTag::__options),
14355 _ => Ok(__FieldTag::Unknown(value.to_string())),
14356 }
14357 }
14358 }
14359 deserializer.deserialize_identifier(Visitor)
14360 }
14361 }
14362 struct Visitor;
14363 impl<'de> serde::de::Visitor<'de> for Visitor {
14364 type Value = EnumValue;
14365 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14366 formatter.write_str("struct EnumValue")
14367 }
14368 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14369 where
14370 A: serde::de::MapAccess<'de>,
14371 {
14372 #[allow(unused_imports)]
14373 use serde::de::Error;
14374 use std::option::Option::Some;
14375 let mut fields = std::collections::HashSet::new();
14376 let mut result = Self::Value::new();
14377 while let Some(tag) = map.next_key::<__FieldTag>()? {
14378 #[allow(clippy::match_single_binding)]
14379 match tag {
14380 __FieldTag::__name => {
14381 if !fields.insert(__FieldTag::__name) {
14382 return std::result::Result::Err(A::Error::duplicate_field(
14383 "multiple values for name",
14384 ));
14385 }
14386 result.name = map
14387 .next_value::<std::option::Option<std::string::String>>()?
14388 .unwrap_or_default();
14389 }
14390 __FieldTag::__number => {
14391 if !fields.insert(__FieldTag::__number) {
14392 return std::result::Result::Err(A::Error::duplicate_field(
14393 "multiple values for number",
14394 ));
14395 }
14396 struct __With(std::option::Option<i32>);
14397 impl<'de> serde::de::Deserialize<'de> for __With {
14398 fn deserialize<D>(
14399 deserializer: D,
14400 ) -> std::result::Result<Self, D::Error>
14401 where
14402 D: serde::de::Deserializer<'de>,
14403 {
14404 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
14405 }
14406 }
14407 result.number = map.next_value::<__With>()?.0.unwrap_or_default();
14408 }
14409 __FieldTag::__options => {
14410 if !fields.insert(__FieldTag::__options) {
14411 return std::result::Result::Err(A::Error::duplicate_field(
14412 "multiple values for options",
14413 ));
14414 }
14415 result.options = map
14416 .next_value::<std::option::Option<std::vec::Vec<crate::Option>>>()?
14417 .unwrap_or_default();
14418 }
14419 __FieldTag::Unknown(key) => {
14420 let value = map.next_value::<serde_json::Value>()?;
14421 result._unknown_fields.insert(key, value);
14422 }
14423 }
14424 }
14425 std::result::Result::Ok(result)
14426 }
14427 }
14428 deserializer.deserialize_any(Visitor)
14429 }
14430}
14431
14432#[doc(hidden)]
14433impl serde::ser::Serialize for EnumValue {
14434 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14435 where
14436 S: serde::ser::Serializer,
14437 {
14438 use serde::ser::SerializeMap;
14439 #[allow(unused_imports)]
14440 use std::option::Option::Some;
14441 let mut state = serializer.serialize_map(std::option::Option::None)?;
14442 if !self.name.is_empty() {
14443 state.serialize_entry("name", &self.name)?;
14444 }
14445 if !wkt::internal::is_default(&self.number) {
14446 struct __With<'a>(&'a i32);
14447 impl<'a> serde::ser::Serialize for __With<'a> {
14448 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14449 where
14450 S: serde::ser::Serializer,
14451 {
14452 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
14453 }
14454 }
14455 state.serialize_entry("number", &__With(&self.number))?;
14456 }
14457 if !self.options.is_empty() {
14458 state.serialize_entry("options", &self.options)?;
14459 }
14460 if !self._unknown_fields.is_empty() {
14461 for (key, value) in self._unknown_fields.iter() {
14462 state.serialize_entry(key, &value)?;
14463 }
14464 }
14465 state.end()
14466 }
14467}
14468
14469impl std::fmt::Debug for EnumValue {
14470 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14471 let mut debug_struct = f.debug_struct("EnumValue");
14472 debug_struct.field("name", &self.name);
14473 debug_struct.field("number", &self.number);
14474 debug_struct.field("options", &self.options);
14475 if !self._unknown_fields.is_empty() {
14476 debug_struct.field("_unknown_fields", &self._unknown_fields);
14477 }
14478 debug_struct.finish()
14479 }
14480}
14481
14482#[derive(Clone, Default, PartialEq)]
14485#[non_exhaustive]
14486pub struct Option {
14487 pub name: std::string::String,
14492
14493 pub value: std::option::Option<crate::Any>,
14498
14499 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14500}
14501
14502impl Option {
14503 pub fn new() -> Self {
14504 std::default::Default::default()
14505 }
14506
14507 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14509 self.name = v.into();
14510 self
14511 }
14512
14513 pub fn set_value<T>(mut self, v: T) -> Self
14515 where
14516 T: std::convert::Into<crate::Any>,
14517 {
14518 self.value = std::option::Option::Some(v.into());
14519 self
14520 }
14521
14522 pub fn set_or_clear_value<T>(mut self, v: std::option::Option<T>) -> Self
14524 where
14525 T: std::convert::Into<crate::Any>,
14526 {
14527 self.value = v.map(|x| x.into());
14528 self
14529 }
14530}
14531
14532impl wkt::message::Message for Option {
14533 fn typename() -> &'static str {
14534 "type.googleapis.com/google.protobuf.Option"
14535 }
14536}
14537
14538#[doc(hidden)]
14539impl<'de> serde::de::Deserialize<'de> for Option {
14540 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14541 where
14542 D: serde::Deserializer<'de>,
14543 {
14544 #[allow(non_camel_case_types)]
14545 #[doc(hidden)]
14546 #[derive(PartialEq, Eq, Hash)]
14547 enum __FieldTag {
14548 __name,
14549 __value,
14550 Unknown(std::string::String),
14551 }
14552 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
14553 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14554 where
14555 D: serde::Deserializer<'de>,
14556 {
14557 struct Visitor;
14558 impl<'de> serde::de::Visitor<'de> for Visitor {
14559 type Value = __FieldTag;
14560 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14561 formatter.write_str("a field name for Option")
14562 }
14563 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
14564 where
14565 E: serde::de::Error,
14566 {
14567 use std::result::Result::Ok;
14568 use std::string::ToString;
14569 match value {
14570 "name" => Ok(__FieldTag::__name),
14571 "value" => Ok(__FieldTag::__value),
14572 _ => Ok(__FieldTag::Unknown(value.to_string())),
14573 }
14574 }
14575 }
14576 deserializer.deserialize_identifier(Visitor)
14577 }
14578 }
14579 struct Visitor;
14580 impl<'de> serde::de::Visitor<'de> for Visitor {
14581 type Value = Option;
14582 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
14583 formatter.write_str("struct Option")
14584 }
14585 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
14586 where
14587 A: serde::de::MapAccess<'de>,
14588 {
14589 #[allow(unused_imports)]
14590 use serde::de::Error;
14591 use std::option::Option::Some;
14592 let mut fields = std::collections::HashSet::new();
14593 let mut result = Self::Value::new();
14594 while let Some(tag) = map.next_key::<__FieldTag>()? {
14595 #[allow(clippy::match_single_binding)]
14596 match tag {
14597 __FieldTag::__name => {
14598 if !fields.insert(__FieldTag::__name) {
14599 return std::result::Result::Err(A::Error::duplicate_field(
14600 "multiple values for name",
14601 ));
14602 }
14603 result.name = map
14604 .next_value::<std::option::Option<std::string::String>>()?
14605 .unwrap_or_default();
14606 }
14607 __FieldTag::__value => {
14608 if !fields.insert(__FieldTag::__value) {
14609 return std::result::Result::Err(A::Error::duplicate_field(
14610 "multiple values for value",
14611 ));
14612 }
14613 result.value = map.next_value::<std::option::Option<crate::Any>>()?;
14614 }
14615 __FieldTag::Unknown(key) => {
14616 let value = map.next_value::<serde_json::Value>()?;
14617 result._unknown_fields.insert(key, value);
14618 }
14619 }
14620 }
14621 std::result::Result::Ok(result)
14622 }
14623 }
14624 deserializer.deserialize_any(Visitor)
14625 }
14626}
14627
14628#[doc(hidden)]
14629impl serde::ser::Serialize for Option {
14630 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14631 where
14632 S: serde::ser::Serializer,
14633 {
14634 use serde::ser::SerializeMap;
14635 #[allow(unused_imports)]
14636 use std::option::Option::Some;
14637 let mut state = serializer.serialize_map(std::option::Option::None)?;
14638 if !self.name.is_empty() {
14639 state.serialize_entry("name", &self.name)?;
14640 }
14641 if self.value.is_some() {
14642 state.serialize_entry("value", &self.value)?;
14643 }
14644 if !self._unknown_fields.is_empty() {
14645 for (key, value) in self._unknown_fields.iter() {
14646 state.serialize_entry(key, &value)?;
14647 }
14648 }
14649 state.end()
14650 }
14651}
14652
14653impl std::fmt::Debug for Option {
14654 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14655 let mut debug_struct = f.debug_struct("Option");
14656 debug_struct.field("name", &self.name);
14657 debug_struct.field("value", &self.value);
14658 if !self._unknown_fields.is_empty() {
14659 debug_struct.field("_unknown_fields", &self._unknown_fields);
14660 }
14661 debug_struct.finish()
14662 }
14663}
14664
14665#[derive(Clone, Debug, PartialEq)]
14681#[non_exhaustive]
14682pub enum Edition {
14683 Unknown,
14685 Legacy,
14688 Proto2,
14693 Proto3,
14694 Edition2023,
14698 Edition2024,
14699 Edition1TestOnly,
14702 Edition2TestOnly,
14703 Edition99997TestOnly,
14704 Edition99998TestOnly,
14705 Edition99999TestOnly,
14706 Max,
14710 UnknownValue(edition::UnknownValue),
14715}
14716
14717#[doc(hidden)]
14718pub mod edition {
14719 #[allow(unused_imports)]
14720 use super::*;
14721 #[derive(Clone, Debug, PartialEq)]
14722 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14723}
14724
14725impl Edition {
14726 pub fn value(&self) -> std::option::Option<i32> {
14731 match self {
14732 Self::Unknown => std::option::Option::Some(0),
14733 Self::Legacy => std::option::Option::Some(900),
14734 Self::Proto2 => std::option::Option::Some(998),
14735 Self::Proto3 => std::option::Option::Some(999),
14736 Self::Edition2023 => std::option::Option::Some(1000),
14737 Self::Edition2024 => std::option::Option::Some(1001),
14738 Self::Edition1TestOnly => std::option::Option::Some(1),
14739 Self::Edition2TestOnly => std::option::Option::Some(2),
14740 Self::Edition99997TestOnly => std::option::Option::Some(99997),
14741 Self::Edition99998TestOnly => std::option::Option::Some(99998),
14742 Self::Edition99999TestOnly => std::option::Option::Some(99999),
14743 Self::Max => std::option::Option::Some(2147483647),
14744 Self::UnknownValue(u) => u.0.value(),
14745 }
14746 }
14747
14748 pub fn name(&self) -> std::option::Option<&str> {
14753 match self {
14754 Self::Unknown => std::option::Option::Some("EDITION_UNKNOWN"),
14755 Self::Legacy => std::option::Option::Some("EDITION_LEGACY"),
14756 Self::Proto2 => std::option::Option::Some("EDITION_PROTO2"),
14757 Self::Proto3 => std::option::Option::Some("EDITION_PROTO3"),
14758 Self::Edition2023 => std::option::Option::Some("EDITION_2023"),
14759 Self::Edition2024 => std::option::Option::Some("EDITION_2024"),
14760 Self::Edition1TestOnly => std::option::Option::Some("EDITION_1_TEST_ONLY"),
14761 Self::Edition2TestOnly => std::option::Option::Some("EDITION_2_TEST_ONLY"),
14762 Self::Edition99997TestOnly => std::option::Option::Some("EDITION_99997_TEST_ONLY"),
14763 Self::Edition99998TestOnly => std::option::Option::Some("EDITION_99998_TEST_ONLY"),
14764 Self::Edition99999TestOnly => std::option::Option::Some("EDITION_99999_TEST_ONLY"),
14765 Self::Max => std::option::Option::Some("EDITION_MAX"),
14766 Self::UnknownValue(u) => u.0.name(),
14767 }
14768 }
14769}
14770
14771impl std::default::Default for Edition {
14772 fn default() -> Self {
14773 use std::convert::From;
14774 Self::from(0)
14775 }
14776}
14777
14778impl std::fmt::Display for Edition {
14779 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14780 wkt::internal::display_enum(f, self.name(), self.value())
14781 }
14782}
14783
14784impl std::convert::From<i32> for Edition {
14785 fn from(value: i32) -> Self {
14786 match value {
14787 0 => Self::Unknown,
14788 1 => Self::Edition1TestOnly,
14789 2 => Self::Edition2TestOnly,
14790 900 => Self::Legacy,
14791 998 => Self::Proto2,
14792 999 => Self::Proto3,
14793 1000 => Self::Edition2023,
14794 1001 => Self::Edition2024,
14795 99997 => Self::Edition99997TestOnly,
14796 99998 => Self::Edition99998TestOnly,
14797 99999 => Self::Edition99999TestOnly,
14798 2147483647 => Self::Max,
14799 _ => Self::UnknownValue(edition::UnknownValue(
14800 wkt::internal::UnknownEnumValue::Integer(value),
14801 )),
14802 }
14803 }
14804}
14805
14806impl std::convert::From<&str> for Edition {
14807 fn from(value: &str) -> Self {
14808 use std::string::ToString;
14809 match value {
14810 "EDITION_UNKNOWN" => Self::Unknown,
14811 "EDITION_LEGACY" => Self::Legacy,
14812 "EDITION_PROTO2" => Self::Proto2,
14813 "EDITION_PROTO3" => Self::Proto3,
14814 "EDITION_2023" => Self::Edition2023,
14815 "EDITION_2024" => Self::Edition2024,
14816 "EDITION_1_TEST_ONLY" => Self::Edition1TestOnly,
14817 "EDITION_2_TEST_ONLY" => Self::Edition2TestOnly,
14818 "EDITION_99997_TEST_ONLY" => Self::Edition99997TestOnly,
14819 "EDITION_99998_TEST_ONLY" => Self::Edition99998TestOnly,
14820 "EDITION_99999_TEST_ONLY" => Self::Edition99999TestOnly,
14821 "EDITION_MAX" => Self::Max,
14822 _ => Self::UnknownValue(edition::UnknownValue(
14823 wkt::internal::UnknownEnumValue::String(value.to_string()),
14824 )),
14825 }
14826 }
14827}
14828
14829impl serde::ser::Serialize for Edition {
14830 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14831 where
14832 S: serde::Serializer,
14833 {
14834 match self {
14835 Self::Unknown => serializer.serialize_i32(0),
14836 Self::Legacy => serializer.serialize_i32(900),
14837 Self::Proto2 => serializer.serialize_i32(998),
14838 Self::Proto3 => serializer.serialize_i32(999),
14839 Self::Edition2023 => serializer.serialize_i32(1000),
14840 Self::Edition2024 => serializer.serialize_i32(1001),
14841 Self::Edition1TestOnly => serializer.serialize_i32(1),
14842 Self::Edition2TestOnly => serializer.serialize_i32(2),
14843 Self::Edition99997TestOnly => serializer.serialize_i32(99997),
14844 Self::Edition99998TestOnly => serializer.serialize_i32(99998),
14845 Self::Edition99999TestOnly => serializer.serialize_i32(99999),
14846 Self::Max => serializer.serialize_i32(2147483647),
14847 Self::UnknownValue(u) => u.0.serialize(serializer),
14848 }
14849 }
14850}
14851
14852impl<'de> serde::de::Deserialize<'de> for Edition {
14853 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14854 where
14855 D: serde::Deserializer<'de>,
14856 {
14857 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Edition>::new(
14858 ".google.protobuf.Edition",
14859 ))
14860 }
14861}
14862
14863#[derive(Clone, Debug, PartialEq)]
14879#[non_exhaustive]
14880pub enum Syntax {
14881 Proto2,
14883 Proto3,
14885 Editions,
14887 UnknownValue(syntax::UnknownValue),
14892}
14893
14894#[doc(hidden)]
14895pub mod syntax {
14896 #[allow(unused_imports)]
14897 use super::*;
14898 #[derive(Clone, Debug, PartialEq)]
14899 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14900}
14901
14902impl Syntax {
14903 pub fn value(&self) -> std::option::Option<i32> {
14908 match self {
14909 Self::Proto2 => std::option::Option::Some(0),
14910 Self::Proto3 => std::option::Option::Some(1),
14911 Self::Editions => std::option::Option::Some(2),
14912 Self::UnknownValue(u) => u.0.value(),
14913 }
14914 }
14915
14916 pub fn name(&self) -> std::option::Option<&str> {
14921 match self {
14922 Self::Proto2 => std::option::Option::Some("SYNTAX_PROTO2"),
14923 Self::Proto3 => std::option::Option::Some("SYNTAX_PROTO3"),
14924 Self::Editions => std::option::Option::Some("SYNTAX_EDITIONS"),
14925 Self::UnknownValue(u) => u.0.name(),
14926 }
14927 }
14928}
14929
14930impl std::default::Default for Syntax {
14931 fn default() -> Self {
14932 use std::convert::From;
14933 Self::from(0)
14934 }
14935}
14936
14937impl std::fmt::Display for Syntax {
14938 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14939 wkt::internal::display_enum(f, self.name(), self.value())
14940 }
14941}
14942
14943impl std::convert::From<i32> for Syntax {
14944 fn from(value: i32) -> Self {
14945 match value {
14946 0 => Self::Proto2,
14947 1 => Self::Proto3,
14948 2 => Self::Editions,
14949 _ => Self::UnknownValue(syntax::UnknownValue(
14950 wkt::internal::UnknownEnumValue::Integer(value),
14951 )),
14952 }
14953 }
14954}
14955
14956impl std::convert::From<&str> for Syntax {
14957 fn from(value: &str) -> Self {
14958 use std::string::ToString;
14959 match value {
14960 "SYNTAX_PROTO2" => Self::Proto2,
14961 "SYNTAX_PROTO3" => Self::Proto3,
14962 "SYNTAX_EDITIONS" => Self::Editions,
14963 _ => Self::UnknownValue(syntax::UnknownValue(
14964 wkt::internal::UnknownEnumValue::String(value.to_string()),
14965 )),
14966 }
14967 }
14968}
14969
14970impl serde::ser::Serialize for Syntax {
14971 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14972 where
14973 S: serde::Serializer,
14974 {
14975 match self {
14976 Self::Proto2 => serializer.serialize_i32(0),
14977 Self::Proto3 => serializer.serialize_i32(1),
14978 Self::Editions => serializer.serialize_i32(2),
14979 Self::UnknownValue(u) => u.0.serialize(serializer),
14980 }
14981 }
14982}
14983
14984impl<'de> serde::de::Deserialize<'de> for Syntax {
14985 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14986 where
14987 D: serde::Deserializer<'de>,
14988 {
14989 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Syntax>::new(
14990 ".google.protobuf.Syntax",
14991 ))
14992 }
14993}