1#![allow(rustdoc::invalid_html_tags)]
18#![allow(rustdoc::redundant_explicit_links)]
19use crate as wkt;
20
21#[serde_with::serde_as]
31#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
32#[serde(default, rename_all = "camelCase")]
33#[non_exhaustive]
34pub struct Api {
35 #[serde(skip_serializing_if = "std::string::String::is_empty")]
38 pub name: std::string::String,
39
40 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
42 pub methods: std::vec::Vec<crate::Method>,
43
44 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
46 pub options: std::vec::Vec<crate::Option>,
47
48 #[serde(skip_serializing_if = "std::string::String::is_empty")]
68 pub version: std::string::String,
69
70 #[serde(skip_serializing_if = "std::option::Option::is_none")]
73 pub source_context: std::option::Option<crate::SourceContext>,
74
75 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
79 pub mixins: std::vec::Vec<crate::Mixin>,
80
81 pub syntax: crate::Syntax,
83}
84
85impl Api {
86 pub fn new() -> Self {
87 std::default::Default::default()
88 }
89
90 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
92 self.name = v.into();
93 self
94 }
95
96 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
98 self.version = v.into();
99 self
100 }
101
102 pub fn set_source_context<T: std::convert::Into<std::option::Option<crate::SourceContext>>>(
104 mut self,
105 v: T,
106 ) -> Self {
107 self.source_context = v.into();
108 self
109 }
110
111 pub fn set_syntax<T: std::convert::Into<crate::Syntax>>(mut self, v: T) -> Self {
113 self.syntax = v.into();
114 self
115 }
116
117 pub fn set_methods<T, V>(mut self, v: T) -> Self
119 where
120 T: std::iter::IntoIterator<Item = V>,
121 V: std::convert::Into<crate::Method>,
122 {
123 use std::iter::Iterator;
124 self.methods = v.into_iter().map(|i| i.into()).collect();
125 self
126 }
127
128 pub fn set_options<T, V>(mut self, v: T) -> Self
130 where
131 T: std::iter::IntoIterator<Item = V>,
132 V: std::convert::Into<crate::Option>,
133 {
134 use std::iter::Iterator;
135 self.options = v.into_iter().map(|i| i.into()).collect();
136 self
137 }
138
139 pub fn set_mixins<T, V>(mut self, v: T) -> Self
141 where
142 T: std::iter::IntoIterator<Item = V>,
143 V: std::convert::Into<crate::Mixin>,
144 {
145 use std::iter::Iterator;
146 self.mixins = v.into_iter().map(|i| i.into()).collect();
147 self
148 }
149}
150
151impl wkt::message::Message for Api {
152 fn typename() -> &'static str {
153 "type.googleapis.com/google.protobuf.Api"
154 }
155}
156
157#[serde_with::serde_as]
159#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
160#[serde(default, rename_all = "camelCase")]
161#[non_exhaustive]
162pub struct Method {
163 #[serde(skip_serializing_if = "std::string::String::is_empty")]
165 pub name: std::string::String,
166
167 #[serde(skip_serializing_if = "std::string::String::is_empty")]
169 pub request_type_url: std::string::String,
170
171 pub request_streaming: bool,
173
174 #[serde(skip_serializing_if = "std::string::String::is_empty")]
176 pub response_type_url: std::string::String,
177
178 pub response_streaming: bool,
180
181 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
183 pub options: std::vec::Vec<crate::Option>,
184
185 pub syntax: crate::Syntax,
187}
188
189impl Method {
190 pub fn new() -> Self {
191 std::default::Default::default()
192 }
193
194 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
196 self.name = v.into();
197 self
198 }
199
200 pub fn set_request_type_url<T: std::convert::Into<std::string::String>>(
202 mut self,
203 v: T,
204 ) -> Self {
205 self.request_type_url = v.into();
206 self
207 }
208
209 pub fn set_request_streaming<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
211 self.request_streaming = v.into();
212 self
213 }
214
215 pub fn set_response_type_url<T: std::convert::Into<std::string::String>>(
217 mut self,
218 v: T,
219 ) -> Self {
220 self.response_type_url = v.into();
221 self
222 }
223
224 pub fn set_response_streaming<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
226 self.response_streaming = v.into();
227 self
228 }
229
230 pub fn set_syntax<T: std::convert::Into<crate::Syntax>>(mut self, v: T) -> Self {
232 self.syntax = v.into();
233 self
234 }
235
236 pub fn set_options<T, V>(mut self, v: T) -> Self
238 where
239 T: std::iter::IntoIterator<Item = V>,
240 V: std::convert::Into<crate::Option>,
241 {
242 use std::iter::Iterator;
243 self.options = v.into_iter().map(|i| i.into()).collect();
244 self
245 }
246}
247
248impl wkt::message::Message for Method {
249 fn typename() -> &'static str {
250 "type.googleapis.com/google.protobuf.Method"
251 }
252}
253
254#[serde_with::serde_as]
346#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
347#[serde(default, rename_all = "camelCase")]
348#[non_exhaustive]
349pub struct Mixin {
350 #[serde(skip_serializing_if = "std::string::String::is_empty")]
352 pub name: std::string::String,
353
354 #[serde(skip_serializing_if = "std::string::String::is_empty")]
357 pub root: std::string::String,
358}
359
360impl Mixin {
361 pub fn new() -> Self {
362 std::default::Default::default()
363 }
364
365 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
367 self.name = v.into();
368 self
369 }
370
371 pub fn set_root<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
373 self.root = v.into();
374 self
375 }
376}
377
378impl wkt::message::Message for Mixin {
379 fn typename() -> &'static str {
380 "type.googleapis.com/google.protobuf.Mixin"
381 }
382}
383
384#[serde_with::serde_as]
387#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
388#[serde(default, rename_all = "camelCase")]
389#[non_exhaustive]
390pub struct SourceContext {
391 #[serde(skip_serializing_if = "std::string::String::is_empty")]
394 pub file_name: std::string::String,
395}
396
397impl SourceContext {
398 pub fn new() -> Self {
399 std::default::Default::default()
400 }
401
402 pub fn set_file_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
404 self.file_name = v.into();
405 self
406 }
407}
408
409impl wkt::message::Message for SourceContext {
410 fn typename() -> &'static str {
411 "type.googleapis.com/google.protobuf.SourceContext"
412 }
413}
414
415#[serde_with::serde_as]
417#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
418#[serde(default, rename_all = "camelCase")]
419#[non_exhaustive]
420pub struct Type {
421 #[serde(skip_serializing_if = "std::string::String::is_empty")]
423 pub name: std::string::String,
424
425 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
427 pub fields: std::vec::Vec<crate::Field>,
428
429 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
431 pub oneofs: std::vec::Vec<std::string::String>,
432
433 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
435 pub options: std::vec::Vec<crate::Option>,
436
437 #[serde(skip_serializing_if = "std::option::Option::is_none")]
439 pub source_context: std::option::Option<crate::SourceContext>,
440
441 pub syntax: crate::Syntax,
443
444 #[serde(skip_serializing_if = "std::string::String::is_empty")]
446 pub edition: std::string::String,
447}
448
449impl Type {
450 pub fn new() -> Self {
451 std::default::Default::default()
452 }
453
454 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
456 self.name = v.into();
457 self
458 }
459
460 pub fn set_source_context<T: std::convert::Into<std::option::Option<crate::SourceContext>>>(
462 mut self,
463 v: T,
464 ) -> Self {
465 self.source_context = v.into();
466 self
467 }
468
469 pub fn set_syntax<T: std::convert::Into<crate::Syntax>>(mut self, v: T) -> Self {
471 self.syntax = v.into();
472 self
473 }
474
475 pub fn set_edition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
477 self.edition = v.into();
478 self
479 }
480
481 pub fn set_fields<T, V>(mut self, v: T) -> Self
483 where
484 T: std::iter::IntoIterator<Item = V>,
485 V: std::convert::Into<crate::Field>,
486 {
487 use std::iter::Iterator;
488 self.fields = v.into_iter().map(|i| i.into()).collect();
489 self
490 }
491
492 pub fn set_oneofs<T, V>(mut self, v: T) -> Self
494 where
495 T: std::iter::IntoIterator<Item = V>,
496 V: std::convert::Into<std::string::String>,
497 {
498 use std::iter::Iterator;
499 self.oneofs = v.into_iter().map(|i| i.into()).collect();
500 self
501 }
502
503 pub fn set_options<T, V>(mut self, v: T) -> Self
505 where
506 T: std::iter::IntoIterator<Item = V>,
507 V: std::convert::Into<crate::Option>,
508 {
509 use std::iter::Iterator;
510 self.options = v.into_iter().map(|i| i.into()).collect();
511 self
512 }
513}
514
515impl wkt::message::Message for Type {
516 fn typename() -> &'static str {
517 "type.googleapis.com/google.protobuf.Type"
518 }
519}
520
521#[serde_with::serde_as]
523#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
524#[serde(default, rename_all = "camelCase")]
525#[non_exhaustive]
526pub struct Field {
527 pub kind: crate::field::Kind,
529
530 pub cardinality: crate::field::Cardinality,
532
533 pub number: i32,
535
536 #[serde(skip_serializing_if = "std::string::String::is_empty")]
538 pub name: std::string::String,
539
540 #[serde(skip_serializing_if = "std::string::String::is_empty")]
543 pub type_url: std::string::String,
544
545 pub oneof_index: i32,
548
549 pub packed: bool,
551
552 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
554 pub options: std::vec::Vec<crate::Option>,
555
556 #[serde(skip_serializing_if = "std::string::String::is_empty")]
558 pub json_name: std::string::String,
559
560 #[serde(skip_serializing_if = "std::string::String::is_empty")]
562 pub default_value: std::string::String,
563}
564
565impl Field {
566 pub fn new() -> Self {
567 std::default::Default::default()
568 }
569
570 pub fn set_kind<T: std::convert::Into<crate::field::Kind>>(mut self, v: T) -> Self {
572 self.kind = v.into();
573 self
574 }
575
576 pub fn set_cardinality<T: std::convert::Into<crate::field::Cardinality>>(
578 mut self,
579 v: T,
580 ) -> Self {
581 self.cardinality = v.into();
582 self
583 }
584
585 pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
587 self.number = v.into();
588 self
589 }
590
591 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
593 self.name = v.into();
594 self
595 }
596
597 pub fn set_type_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
599 self.type_url = v.into();
600 self
601 }
602
603 pub fn set_oneof_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
605 self.oneof_index = v.into();
606 self
607 }
608
609 pub fn set_packed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
611 self.packed = v.into();
612 self
613 }
614
615 pub fn set_json_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
617 self.json_name = v.into();
618 self
619 }
620
621 pub fn set_default_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
623 self.default_value = v.into();
624 self
625 }
626
627 pub fn set_options<T, V>(mut self, v: T) -> Self
629 where
630 T: std::iter::IntoIterator<Item = V>,
631 V: std::convert::Into<crate::Option>,
632 {
633 use std::iter::Iterator;
634 self.options = v.into_iter().map(|i| i.into()).collect();
635 self
636 }
637}
638
639impl wkt::message::Message for Field {
640 fn typename() -> &'static str {
641 "type.googleapis.com/google.protobuf.Field"
642 }
643}
644
645pub mod field {
647 #[allow(unused_imports)]
648 use super::*;
649
650 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
652 pub struct Kind(std::borrow::Cow<'static, str>);
653
654 impl Kind {
655 pub const fn new(v: &'static str) -> Self {
657 Self(std::borrow::Cow::Borrowed(v))
658 }
659
660 pub fn value(&self) -> &str {
662 &self.0
663 }
664 }
665
666 pub mod kind {
668 use super::Kind;
669
670 pub const TYPE_UNKNOWN: Kind = Kind::new("TYPE_UNKNOWN");
672
673 pub const TYPE_DOUBLE: Kind = Kind::new("TYPE_DOUBLE");
675
676 pub const TYPE_FLOAT: Kind = Kind::new("TYPE_FLOAT");
678
679 pub const TYPE_INT64: Kind = Kind::new("TYPE_INT64");
681
682 pub const TYPE_UINT64: Kind = Kind::new("TYPE_UINT64");
684
685 pub const TYPE_INT32: Kind = Kind::new("TYPE_INT32");
687
688 pub const TYPE_FIXED64: Kind = Kind::new("TYPE_FIXED64");
690
691 pub const TYPE_FIXED32: Kind = Kind::new("TYPE_FIXED32");
693
694 pub const TYPE_BOOL: Kind = Kind::new("TYPE_BOOL");
696
697 pub const TYPE_STRING: Kind = Kind::new("TYPE_STRING");
699
700 pub const TYPE_GROUP: Kind = Kind::new("TYPE_GROUP");
702
703 pub const TYPE_MESSAGE: Kind = Kind::new("TYPE_MESSAGE");
705
706 pub const TYPE_BYTES: Kind = Kind::new("TYPE_BYTES");
708
709 pub const TYPE_UINT32: Kind = Kind::new("TYPE_UINT32");
711
712 pub const TYPE_ENUM: Kind = Kind::new("TYPE_ENUM");
714
715 pub const TYPE_SFIXED32: Kind = Kind::new("TYPE_SFIXED32");
717
718 pub const TYPE_SFIXED64: Kind = Kind::new("TYPE_SFIXED64");
720
721 pub const TYPE_SINT32: Kind = Kind::new("TYPE_SINT32");
723
724 pub const TYPE_SINT64: Kind = Kind::new("TYPE_SINT64");
726 }
727
728 impl std::convert::From<std::string::String> for Kind {
729 fn from(value: std::string::String) -> Self {
730 Self(std::borrow::Cow::Owned(value))
731 }
732 }
733
734 #[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
736 pub struct Cardinality(std::borrow::Cow<'static, str>);
737
738 impl Cardinality {
739 pub const fn new(v: &'static str) -> Self {
741 Self(std::borrow::Cow::Borrowed(v))
742 }
743
744 pub fn value(&self) -> &str {
746 &self.0
747 }
748 }
749
750 pub mod cardinality {
752 use super::Cardinality;
753
754 pub const CARDINALITY_UNKNOWN: Cardinality = Cardinality::new("CARDINALITY_UNKNOWN");
756
757 pub const CARDINALITY_OPTIONAL: Cardinality = Cardinality::new("CARDINALITY_OPTIONAL");
759
760 pub const CARDINALITY_REQUIRED: Cardinality = Cardinality::new("CARDINALITY_REQUIRED");
762
763 pub const CARDINALITY_REPEATED: Cardinality = Cardinality::new("CARDINALITY_REPEATED");
765 }
766
767 impl std::convert::From<std::string::String> for Cardinality {
768 fn from(value: std::string::String) -> Self {
769 Self(std::borrow::Cow::Owned(value))
770 }
771 }
772}
773
774#[serde_with::serde_as]
776#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
777#[serde(default, rename_all = "camelCase")]
778#[non_exhaustive]
779pub struct Enum {
780 #[serde(skip_serializing_if = "std::string::String::is_empty")]
782 pub name: std::string::String,
783
784 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
786 pub enumvalue: std::vec::Vec<crate::EnumValue>,
787
788 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
790 pub options: std::vec::Vec<crate::Option>,
791
792 #[serde(skip_serializing_if = "std::option::Option::is_none")]
794 pub source_context: std::option::Option<crate::SourceContext>,
795
796 pub syntax: crate::Syntax,
798
799 #[serde(skip_serializing_if = "std::string::String::is_empty")]
801 pub edition: std::string::String,
802}
803
804impl Enum {
805 pub fn new() -> Self {
806 std::default::Default::default()
807 }
808
809 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
811 self.name = v.into();
812 self
813 }
814
815 pub fn set_source_context<T: std::convert::Into<std::option::Option<crate::SourceContext>>>(
817 mut self,
818 v: T,
819 ) -> Self {
820 self.source_context = v.into();
821 self
822 }
823
824 pub fn set_syntax<T: std::convert::Into<crate::Syntax>>(mut self, v: T) -> Self {
826 self.syntax = v.into();
827 self
828 }
829
830 pub fn set_edition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
832 self.edition = v.into();
833 self
834 }
835
836 pub fn set_enumvalue<T, V>(mut self, v: T) -> Self
838 where
839 T: std::iter::IntoIterator<Item = V>,
840 V: std::convert::Into<crate::EnumValue>,
841 {
842 use std::iter::Iterator;
843 self.enumvalue = v.into_iter().map(|i| i.into()).collect();
844 self
845 }
846
847 pub fn set_options<T, V>(mut self, v: T) -> Self
849 where
850 T: std::iter::IntoIterator<Item = V>,
851 V: std::convert::Into<crate::Option>,
852 {
853 use std::iter::Iterator;
854 self.options = v.into_iter().map(|i| i.into()).collect();
855 self
856 }
857}
858
859impl wkt::message::Message for Enum {
860 fn typename() -> &'static str {
861 "type.googleapis.com/google.protobuf.Enum"
862 }
863}
864
865#[serde_with::serde_as]
867#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
868#[serde(default, rename_all = "camelCase")]
869#[non_exhaustive]
870pub struct EnumValue {
871 #[serde(skip_serializing_if = "std::string::String::is_empty")]
873 pub name: std::string::String,
874
875 pub number: i32,
877
878 #[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
880 pub options: std::vec::Vec<crate::Option>,
881}
882
883impl EnumValue {
884 pub fn new() -> Self {
885 std::default::Default::default()
886 }
887
888 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
890 self.name = v.into();
891 self
892 }
893
894 pub fn set_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
896 self.number = v.into();
897 self
898 }
899
900 pub fn set_options<T, V>(mut self, v: T) -> Self
902 where
903 T: std::iter::IntoIterator<Item = V>,
904 V: std::convert::Into<crate::Option>,
905 {
906 use std::iter::Iterator;
907 self.options = v.into_iter().map(|i| i.into()).collect();
908 self
909 }
910}
911
912impl wkt::message::Message for EnumValue {
913 fn typename() -> &'static str {
914 "type.googleapis.com/google.protobuf.EnumValue"
915 }
916}
917
918#[serde_with::serde_as]
921#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
922#[serde(default, rename_all = "camelCase")]
923#[non_exhaustive]
924pub struct Option {
925 #[serde(skip_serializing_if = "std::string::String::is_empty")]
930 pub name: std::string::String,
931
932 #[serde(skip_serializing_if = "std::option::Option::is_none")]
937 pub value: std::option::Option<crate::Any>,
938}
939
940impl Option {
941 pub fn new() -> Self {
942 std::default::Default::default()
943 }
944
945 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
947 self.name = v.into();
948 self
949 }
950
951 pub fn set_value<T: std::convert::Into<std::option::Option<crate::Any>>>(
953 mut self,
954 v: T,
955 ) -> Self {
956 self.value = v.into();
957 self
958 }
959}
960
961impl wkt::message::Message for Option {
962 fn typename() -> &'static str {
963 "type.googleapis.com/google.protobuf.Option"
964 }
965}
966
967#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
969pub struct Syntax(std::borrow::Cow<'static, str>);
970
971impl Syntax {
972 pub const fn new(v: &'static str) -> Self {
974 Self(std::borrow::Cow::Borrowed(v))
975 }
976
977 pub fn value(&self) -> &str {
979 &self.0
980 }
981}
982
983pub mod syntax {
985 use super::Syntax;
986
987 pub const SYNTAX_PROTO2: Syntax = Syntax::new("SYNTAX_PROTO2");
989
990 pub const SYNTAX_PROTO3: Syntax = Syntax::new("SYNTAX_PROTO3");
992
993 pub const SYNTAX_EDITIONS: Syntax = Syntax::new("SYNTAX_EDITIONS");
995}
996
997impl std::convert::From<std::string::String> for Syntax {
998 fn from(value: std::string::String) -> Self {
999 Self(std::borrow::Cow::Owned(value))
1000 }
1001}