1#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate lazy_static;
25extern crate reqwest;
26extern crate rpc;
27extern crate serde;
28extern crate serde_json;
29extern crate serde_with;
30extern crate std;
31extern crate tracing;
32extern crate wkt;
33
34mod debug;
35mod deserialize;
36mod serialize;
37
38#[derive(Clone, Default, PartialEq)]
47#[non_exhaustive]
48pub struct Span {
49 pub name: std::string::String,
62
63 pub span_id: std::string::String,
65
66 pub parent_span_id: std::string::String,
69
70 pub display_name: std::option::Option<crate::model::TruncatableString>,
78
79 pub start_time: std::option::Option<wkt::Timestamp>,
84
85 pub end_time: std::option::Option<wkt::Timestamp>,
89
90 pub attributes: std::option::Option<crate::model::span::Attributes>,
93
94 pub stack_trace: std::option::Option<crate::model::StackTrace>,
96
97 pub time_events: std::option::Option<crate::model::span::TimeEvents>,
100
101 pub links: std::option::Option<crate::model::span::Links>,
103
104 pub status: std::option::Option<rpc::model::Status>,
106
107 pub same_process_as_parent_span: std::option::Option<wkt::BoolValue>,
111
112 pub child_span_count: std::option::Option<wkt::Int32Value>,
115
116 pub span_kind: crate::model::span::SpanKind,
120
121 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
122}
123
124impl Span {
125 pub fn new() -> Self {
126 std::default::Default::default()
127 }
128
129 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
131 self.name = v.into();
132 self
133 }
134
135 pub fn set_span_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
137 self.span_id = v.into();
138 self
139 }
140
141 pub fn set_parent_span_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
143 self.parent_span_id = v.into();
144 self
145 }
146
147 pub fn set_display_name<T>(mut self, v: T) -> Self
149 where
150 T: std::convert::Into<crate::model::TruncatableString>,
151 {
152 self.display_name = std::option::Option::Some(v.into());
153 self
154 }
155
156 pub fn set_or_clear_display_name<T>(mut self, v: std::option::Option<T>) -> Self
158 where
159 T: std::convert::Into<crate::model::TruncatableString>,
160 {
161 self.display_name = v.map(|x| x.into());
162 self
163 }
164
165 pub fn set_start_time<T>(mut self, v: T) -> Self
167 where
168 T: std::convert::Into<wkt::Timestamp>,
169 {
170 self.start_time = std::option::Option::Some(v.into());
171 self
172 }
173
174 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
176 where
177 T: std::convert::Into<wkt::Timestamp>,
178 {
179 self.start_time = v.map(|x| x.into());
180 self
181 }
182
183 pub fn set_end_time<T>(mut self, v: T) -> Self
185 where
186 T: std::convert::Into<wkt::Timestamp>,
187 {
188 self.end_time = std::option::Option::Some(v.into());
189 self
190 }
191
192 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
194 where
195 T: std::convert::Into<wkt::Timestamp>,
196 {
197 self.end_time = v.map(|x| x.into());
198 self
199 }
200
201 pub fn set_attributes<T>(mut self, v: T) -> Self
203 where
204 T: std::convert::Into<crate::model::span::Attributes>,
205 {
206 self.attributes = std::option::Option::Some(v.into());
207 self
208 }
209
210 pub fn set_or_clear_attributes<T>(mut self, v: std::option::Option<T>) -> Self
212 where
213 T: std::convert::Into<crate::model::span::Attributes>,
214 {
215 self.attributes = v.map(|x| x.into());
216 self
217 }
218
219 pub fn set_stack_trace<T>(mut self, v: T) -> Self
221 where
222 T: std::convert::Into<crate::model::StackTrace>,
223 {
224 self.stack_trace = std::option::Option::Some(v.into());
225 self
226 }
227
228 pub fn set_or_clear_stack_trace<T>(mut self, v: std::option::Option<T>) -> Self
230 where
231 T: std::convert::Into<crate::model::StackTrace>,
232 {
233 self.stack_trace = v.map(|x| x.into());
234 self
235 }
236
237 pub fn set_time_events<T>(mut self, v: T) -> Self
239 where
240 T: std::convert::Into<crate::model::span::TimeEvents>,
241 {
242 self.time_events = std::option::Option::Some(v.into());
243 self
244 }
245
246 pub fn set_or_clear_time_events<T>(mut self, v: std::option::Option<T>) -> Self
248 where
249 T: std::convert::Into<crate::model::span::TimeEvents>,
250 {
251 self.time_events = v.map(|x| x.into());
252 self
253 }
254
255 pub fn set_links<T>(mut self, v: T) -> Self
257 where
258 T: std::convert::Into<crate::model::span::Links>,
259 {
260 self.links = std::option::Option::Some(v.into());
261 self
262 }
263
264 pub fn set_or_clear_links<T>(mut self, v: std::option::Option<T>) -> Self
266 where
267 T: std::convert::Into<crate::model::span::Links>,
268 {
269 self.links = v.map(|x| x.into());
270 self
271 }
272
273 pub fn set_status<T>(mut self, v: T) -> Self
275 where
276 T: std::convert::Into<rpc::model::Status>,
277 {
278 self.status = std::option::Option::Some(v.into());
279 self
280 }
281
282 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
284 where
285 T: std::convert::Into<rpc::model::Status>,
286 {
287 self.status = v.map(|x| x.into());
288 self
289 }
290
291 pub fn set_same_process_as_parent_span<T>(mut self, v: T) -> Self
293 where
294 T: std::convert::Into<wkt::BoolValue>,
295 {
296 self.same_process_as_parent_span = std::option::Option::Some(v.into());
297 self
298 }
299
300 pub fn set_or_clear_same_process_as_parent_span<T>(mut self, v: std::option::Option<T>) -> Self
302 where
303 T: std::convert::Into<wkt::BoolValue>,
304 {
305 self.same_process_as_parent_span = v.map(|x| x.into());
306 self
307 }
308
309 pub fn set_child_span_count<T>(mut self, v: T) -> Self
311 where
312 T: std::convert::Into<wkt::Int32Value>,
313 {
314 self.child_span_count = std::option::Option::Some(v.into());
315 self
316 }
317
318 pub fn set_or_clear_child_span_count<T>(mut self, v: std::option::Option<T>) -> Self
320 where
321 T: std::convert::Into<wkt::Int32Value>,
322 {
323 self.child_span_count = v.map(|x| x.into());
324 self
325 }
326
327 pub fn set_span_kind<T: std::convert::Into<crate::model::span::SpanKind>>(
329 mut self,
330 v: T,
331 ) -> Self {
332 self.span_kind = v.into();
333 self
334 }
335}
336
337impl wkt::message::Message for Span {
338 fn typename() -> &'static str {
339 "type.googleapis.com/google.devtools.cloudtrace.v2.Span"
340 }
341}
342
343pub mod span {
345 #[allow(unused_imports)]
346 use super::*;
347
348 #[derive(Clone, Default, PartialEq)]
350 #[non_exhaustive]
351 pub struct Attributes {
352 pub attribute_map:
362 std::collections::HashMap<std::string::String, crate::model::AttributeValue>,
363
364 pub dropped_attributes_count: i32,
368
369 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
370 }
371
372 impl Attributes {
373 pub fn new() -> Self {
374 std::default::Default::default()
375 }
376
377 pub fn set_attribute_map<T, K, V>(mut self, v: T) -> Self
379 where
380 T: std::iter::IntoIterator<Item = (K, V)>,
381 K: std::convert::Into<std::string::String>,
382 V: std::convert::Into<crate::model::AttributeValue>,
383 {
384 use std::iter::Iterator;
385 self.attribute_map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
386 self
387 }
388
389 pub fn set_dropped_attributes_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
391 self.dropped_attributes_count = v.into();
392 self
393 }
394 }
395
396 impl wkt::message::Message for Attributes {
397 fn typename() -> &'static str {
398 "type.googleapis.com/google.devtools.cloudtrace.v2.Span.Attributes"
399 }
400 }
401
402 #[derive(Clone, Default, PartialEq)]
404 #[non_exhaustive]
405 pub struct TimeEvent {
406 pub time: std::option::Option<wkt::Timestamp>,
408
409 pub value: std::option::Option<crate::model::span::time_event::Value>,
412
413 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
414 }
415
416 impl TimeEvent {
417 pub fn new() -> Self {
418 std::default::Default::default()
419 }
420
421 pub fn set_time<T>(mut self, v: T) -> Self
423 where
424 T: std::convert::Into<wkt::Timestamp>,
425 {
426 self.time = std::option::Option::Some(v.into());
427 self
428 }
429
430 pub fn set_or_clear_time<T>(mut self, v: std::option::Option<T>) -> Self
432 where
433 T: std::convert::Into<wkt::Timestamp>,
434 {
435 self.time = v.map(|x| x.into());
436 self
437 }
438
439 pub fn set_value<
444 T: std::convert::Into<std::option::Option<crate::model::span::time_event::Value>>,
445 >(
446 mut self,
447 v: T,
448 ) -> Self {
449 self.value = v.into();
450 self
451 }
452
453 pub fn annotation(
457 &self,
458 ) -> std::option::Option<&std::boxed::Box<crate::model::span::time_event::Annotation>>
459 {
460 #[allow(unreachable_patterns)]
461 self.value.as_ref().and_then(|v| match v {
462 crate::model::span::time_event::Value::Annotation(v) => {
463 std::option::Option::Some(v)
464 }
465 _ => std::option::Option::None,
466 })
467 }
468
469 pub fn set_annotation<
475 T: std::convert::Into<std::boxed::Box<crate::model::span::time_event::Annotation>>,
476 >(
477 mut self,
478 v: T,
479 ) -> Self {
480 self.value = std::option::Option::Some(
481 crate::model::span::time_event::Value::Annotation(v.into()),
482 );
483 self
484 }
485
486 pub fn message_event(
490 &self,
491 ) -> std::option::Option<&std::boxed::Box<crate::model::span::time_event::MessageEvent>>
492 {
493 #[allow(unreachable_patterns)]
494 self.value.as_ref().and_then(|v| match v {
495 crate::model::span::time_event::Value::MessageEvent(v) => {
496 std::option::Option::Some(v)
497 }
498 _ => std::option::Option::None,
499 })
500 }
501
502 pub fn set_message_event<
508 T: std::convert::Into<std::boxed::Box<crate::model::span::time_event::MessageEvent>>,
509 >(
510 mut self,
511 v: T,
512 ) -> Self {
513 self.value = std::option::Option::Some(
514 crate::model::span::time_event::Value::MessageEvent(v.into()),
515 );
516 self
517 }
518 }
519
520 impl wkt::message::Message for TimeEvent {
521 fn typename() -> &'static str {
522 "type.googleapis.com/google.devtools.cloudtrace.v2.Span.TimeEvent"
523 }
524 }
525
526 pub mod time_event {
528 #[allow(unused_imports)]
529 use super::*;
530
531 #[derive(Clone, Default, PartialEq)]
533 #[non_exhaustive]
534 pub struct Annotation {
535 pub description: std::option::Option<crate::model::TruncatableString>,
538
539 pub attributes: std::option::Option<crate::model::span::Attributes>,
542
543 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
544 }
545
546 impl Annotation {
547 pub fn new() -> Self {
548 std::default::Default::default()
549 }
550
551 pub fn set_description<T>(mut self, v: T) -> Self
553 where
554 T: std::convert::Into<crate::model::TruncatableString>,
555 {
556 self.description = std::option::Option::Some(v.into());
557 self
558 }
559
560 pub fn set_or_clear_description<T>(mut self, v: std::option::Option<T>) -> Self
562 where
563 T: std::convert::Into<crate::model::TruncatableString>,
564 {
565 self.description = v.map(|x| x.into());
566 self
567 }
568
569 pub fn set_attributes<T>(mut self, v: T) -> Self
571 where
572 T: std::convert::Into<crate::model::span::Attributes>,
573 {
574 self.attributes = std::option::Option::Some(v.into());
575 self
576 }
577
578 pub fn set_or_clear_attributes<T>(mut self, v: std::option::Option<T>) -> Self
580 where
581 T: std::convert::Into<crate::model::span::Attributes>,
582 {
583 self.attributes = v.map(|x| x.into());
584 self
585 }
586 }
587
588 impl wkt::message::Message for Annotation {
589 fn typename() -> &'static str {
590 "type.googleapis.com/google.devtools.cloudtrace.v2.Span.TimeEvent.Annotation"
591 }
592 }
593
594 #[derive(Clone, Default, PartialEq)]
596 #[non_exhaustive]
597 pub struct MessageEvent {
598 pub r#type: crate::model::span::time_event::message_event::Type,
601
602 pub id: i64,
605
606 pub uncompressed_size_bytes: i64,
608
609 pub compressed_size_bytes: i64,
613
614 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
615 }
616
617 impl MessageEvent {
618 pub fn new() -> Self {
619 std::default::Default::default()
620 }
621
622 pub fn set_type<
624 T: std::convert::Into<crate::model::span::time_event::message_event::Type>,
625 >(
626 mut self,
627 v: T,
628 ) -> Self {
629 self.r#type = v.into();
630 self
631 }
632
633 pub fn set_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
635 self.id = v.into();
636 self
637 }
638
639 pub fn set_uncompressed_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
641 self.uncompressed_size_bytes = v.into();
642 self
643 }
644
645 pub fn set_compressed_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
647 self.compressed_size_bytes = v.into();
648 self
649 }
650 }
651
652 impl wkt::message::Message for MessageEvent {
653 fn typename() -> &'static str {
654 "type.googleapis.com/google.devtools.cloudtrace.v2.Span.TimeEvent.MessageEvent"
655 }
656 }
657
658 pub mod message_event {
660 #[allow(unused_imports)]
661 use super::*;
662
663 #[derive(Clone, Debug, PartialEq)]
679 #[non_exhaustive]
680 pub enum Type {
681 Unspecified,
683 Sent,
685 Received,
687 UnknownValue(r#type::UnknownValue),
692 }
693
694 #[doc(hidden)]
695 pub mod r#type {
696 #[allow(unused_imports)]
697 use super::*;
698 #[derive(Clone, Debug, PartialEq)]
699 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
700 }
701
702 impl Type {
703 pub fn value(&self) -> std::option::Option<i32> {
708 match self {
709 Self::Unspecified => std::option::Option::Some(0),
710 Self::Sent => std::option::Option::Some(1),
711 Self::Received => std::option::Option::Some(2),
712 Self::UnknownValue(u) => u.0.value(),
713 }
714 }
715
716 pub fn name(&self) -> std::option::Option<&str> {
721 match self {
722 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
723 Self::Sent => std::option::Option::Some("SENT"),
724 Self::Received => std::option::Option::Some("RECEIVED"),
725 Self::UnknownValue(u) => u.0.name(),
726 }
727 }
728 }
729
730 impl std::default::Default for Type {
731 fn default() -> Self {
732 use std::convert::From;
733 Self::from(0)
734 }
735 }
736
737 impl std::fmt::Display for Type {
738 fn fmt(
739 &self,
740 f: &mut std::fmt::Formatter<'_>,
741 ) -> std::result::Result<(), std::fmt::Error> {
742 wkt::internal::display_enum(f, self.name(), self.value())
743 }
744 }
745
746 impl std::convert::From<i32> for Type {
747 fn from(value: i32) -> Self {
748 match value {
749 0 => Self::Unspecified,
750 1 => Self::Sent,
751 2 => Self::Received,
752 _ => Self::UnknownValue(r#type::UnknownValue(
753 wkt::internal::UnknownEnumValue::Integer(value),
754 )),
755 }
756 }
757 }
758
759 impl std::convert::From<&str> for Type {
760 fn from(value: &str) -> Self {
761 use std::string::ToString;
762 match value {
763 "TYPE_UNSPECIFIED" => Self::Unspecified,
764 "SENT" => Self::Sent,
765 "RECEIVED" => Self::Received,
766 _ => Self::UnknownValue(r#type::UnknownValue(
767 wkt::internal::UnknownEnumValue::String(value.to_string()),
768 )),
769 }
770 }
771 }
772
773 impl serde::ser::Serialize for Type {
774 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
775 where
776 S: serde::Serializer,
777 {
778 match self {
779 Self::Unspecified => serializer.serialize_i32(0),
780 Self::Sent => serializer.serialize_i32(1),
781 Self::Received => serializer.serialize_i32(2),
782 Self::UnknownValue(u) => u.0.serialize(serializer),
783 }
784 }
785 }
786
787 impl<'de> serde::de::Deserialize<'de> for Type {
788 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
789 where
790 D: serde::Deserializer<'de>,
791 {
792 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
793 ".google.devtools.cloudtrace.v2.Span.TimeEvent.MessageEvent.Type",
794 ))
795 }
796 }
797 }
798
799 #[derive(Clone, Debug, PartialEq)]
802 #[non_exhaustive]
803 pub enum Value {
804 Annotation(std::boxed::Box<crate::model::span::time_event::Annotation>),
806 MessageEvent(std::boxed::Box<crate::model::span::time_event::MessageEvent>),
808 }
809 }
810
811 #[derive(Clone, Default, PartialEq)]
815 #[non_exhaustive]
816 pub struct TimeEvents {
817 pub time_event: std::vec::Vec<crate::model::span::TimeEvent>,
819
820 pub dropped_annotations_count: i32,
823
824 pub dropped_message_events_count: i32,
827
828 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
829 }
830
831 impl TimeEvents {
832 pub fn new() -> Self {
833 std::default::Default::default()
834 }
835
836 pub fn set_time_event<T, V>(mut self, v: T) -> Self
838 where
839 T: std::iter::IntoIterator<Item = V>,
840 V: std::convert::Into<crate::model::span::TimeEvent>,
841 {
842 use std::iter::Iterator;
843 self.time_event = v.into_iter().map(|i| i.into()).collect();
844 self
845 }
846
847 pub fn set_dropped_annotations_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
849 self.dropped_annotations_count = v.into();
850 self
851 }
852
853 pub fn set_dropped_message_events_count<T: std::convert::Into<i32>>(
855 mut self,
856 v: T,
857 ) -> Self {
858 self.dropped_message_events_count = v.into();
859 self
860 }
861 }
862
863 impl wkt::message::Message for TimeEvents {
864 fn typename() -> &'static str {
865 "type.googleapis.com/google.devtools.cloudtrace.v2.Span.TimeEvents"
866 }
867 }
868
869 #[derive(Clone, Default, PartialEq)]
874 #[non_exhaustive]
875 pub struct Link {
876 pub trace_id: std::string::String,
878
879 pub span_id: std::string::String,
881
882 pub r#type: crate::model::span::link::Type,
884
885 pub attributes: std::option::Option<crate::model::span::Attributes>,
888
889 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
890 }
891
892 impl Link {
893 pub fn new() -> Self {
894 std::default::Default::default()
895 }
896
897 pub fn set_trace_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
899 self.trace_id = v.into();
900 self
901 }
902
903 pub fn set_span_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
905 self.span_id = v.into();
906 self
907 }
908
909 pub fn set_type<T: std::convert::Into<crate::model::span::link::Type>>(
911 mut self,
912 v: T,
913 ) -> Self {
914 self.r#type = v.into();
915 self
916 }
917
918 pub fn set_attributes<T>(mut self, v: T) -> Self
920 where
921 T: std::convert::Into<crate::model::span::Attributes>,
922 {
923 self.attributes = std::option::Option::Some(v.into());
924 self
925 }
926
927 pub fn set_or_clear_attributes<T>(mut self, v: std::option::Option<T>) -> Self
929 where
930 T: std::convert::Into<crate::model::span::Attributes>,
931 {
932 self.attributes = v.map(|x| x.into());
933 self
934 }
935 }
936
937 impl wkt::message::Message for Link {
938 fn typename() -> &'static str {
939 "type.googleapis.com/google.devtools.cloudtrace.v2.Span.Link"
940 }
941 }
942
943 pub mod link {
945 #[allow(unused_imports)]
946 use super::*;
947
948 #[derive(Clone, Debug, PartialEq)]
965 #[non_exhaustive]
966 pub enum Type {
967 Unspecified,
969 ChildLinkedSpan,
971 ParentLinkedSpan,
973 UnknownValue(r#type::UnknownValue),
978 }
979
980 #[doc(hidden)]
981 pub mod r#type {
982 #[allow(unused_imports)]
983 use super::*;
984 #[derive(Clone, Debug, PartialEq)]
985 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
986 }
987
988 impl Type {
989 pub fn value(&self) -> std::option::Option<i32> {
994 match self {
995 Self::Unspecified => std::option::Option::Some(0),
996 Self::ChildLinkedSpan => std::option::Option::Some(1),
997 Self::ParentLinkedSpan => std::option::Option::Some(2),
998 Self::UnknownValue(u) => u.0.value(),
999 }
1000 }
1001
1002 pub fn name(&self) -> std::option::Option<&str> {
1007 match self {
1008 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
1009 Self::ChildLinkedSpan => std::option::Option::Some("CHILD_LINKED_SPAN"),
1010 Self::ParentLinkedSpan => std::option::Option::Some("PARENT_LINKED_SPAN"),
1011 Self::UnknownValue(u) => u.0.name(),
1012 }
1013 }
1014 }
1015
1016 impl std::default::Default for Type {
1017 fn default() -> Self {
1018 use std::convert::From;
1019 Self::from(0)
1020 }
1021 }
1022
1023 impl std::fmt::Display for Type {
1024 fn fmt(
1025 &self,
1026 f: &mut std::fmt::Formatter<'_>,
1027 ) -> std::result::Result<(), std::fmt::Error> {
1028 wkt::internal::display_enum(f, self.name(), self.value())
1029 }
1030 }
1031
1032 impl std::convert::From<i32> for Type {
1033 fn from(value: i32) -> Self {
1034 match value {
1035 0 => Self::Unspecified,
1036 1 => Self::ChildLinkedSpan,
1037 2 => Self::ParentLinkedSpan,
1038 _ => Self::UnknownValue(r#type::UnknownValue(
1039 wkt::internal::UnknownEnumValue::Integer(value),
1040 )),
1041 }
1042 }
1043 }
1044
1045 impl std::convert::From<&str> for Type {
1046 fn from(value: &str) -> Self {
1047 use std::string::ToString;
1048 match value {
1049 "TYPE_UNSPECIFIED" => Self::Unspecified,
1050 "CHILD_LINKED_SPAN" => Self::ChildLinkedSpan,
1051 "PARENT_LINKED_SPAN" => Self::ParentLinkedSpan,
1052 _ => Self::UnknownValue(r#type::UnknownValue(
1053 wkt::internal::UnknownEnumValue::String(value.to_string()),
1054 )),
1055 }
1056 }
1057 }
1058
1059 impl serde::ser::Serialize for Type {
1060 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1061 where
1062 S: serde::Serializer,
1063 {
1064 match self {
1065 Self::Unspecified => serializer.serialize_i32(0),
1066 Self::ChildLinkedSpan => serializer.serialize_i32(1),
1067 Self::ParentLinkedSpan => serializer.serialize_i32(2),
1068 Self::UnknownValue(u) => u.0.serialize(serializer),
1069 }
1070 }
1071 }
1072
1073 impl<'de> serde::de::Deserialize<'de> for Type {
1074 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1075 where
1076 D: serde::Deserializer<'de>,
1077 {
1078 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
1079 ".google.devtools.cloudtrace.v2.Span.Link.Type",
1080 ))
1081 }
1082 }
1083 }
1084
1085 #[derive(Clone, Default, PartialEq)]
1088 #[non_exhaustive]
1089 pub struct Links {
1090 pub link: std::vec::Vec<crate::model::span::Link>,
1092
1093 pub dropped_links_count: i32,
1096
1097 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1098 }
1099
1100 impl Links {
1101 pub fn new() -> Self {
1102 std::default::Default::default()
1103 }
1104
1105 pub fn set_link<T, V>(mut self, v: T) -> Self
1107 where
1108 T: std::iter::IntoIterator<Item = V>,
1109 V: std::convert::Into<crate::model::span::Link>,
1110 {
1111 use std::iter::Iterator;
1112 self.link = v.into_iter().map(|i| i.into()).collect();
1113 self
1114 }
1115
1116 pub fn set_dropped_links_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1118 self.dropped_links_count = v.into();
1119 self
1120 }
1121 }
1122
1123 impl wkt::message::Message for Links {
1124 fn typename() -> &'static str {
1125 "type.googleapis.com/google.devtools.cloudtrace.v2.Span.Links"
1126 }
1127 }
1128
1129 #[derive(Clone, Debug, PartialEq)]
1146 #[non_exhaustive]
1147 pub enum SpanKind {
1148 Unspecified,
1151 Internal,
1153 Server,
1156 Client,
1159 Producer,
1164 Consumer,
1169 UnknownValue(span_kind::UnknownValue),
1174 }
1175
1176 #[doc(hidden)]
1177 pub mod span_kind {
1178 #[allow(unused_imports)]
1179 use super::*;
1180 #[derive(Clone, Debug, PartialEq)]
1181 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1182 }
1183
1184 impl SpanKind {
1185 pub fn value(&self) -> std::option::Option<i32> {
1190 match self {
1191 Self::Unspecified => std::option::Option::Some(0),
1192 Self::Internal => std::option::Option::Some(1),
1193 Self::Server => std::option::Option::Some(2),
1194 Self::Client => std::option::Option::Some(3),
1195 Self::Producer => std::option::Option::Some(4),
1196 Self::Consumer => std::option::Option::Some(5),
1197 Self::UnknownValue(u) => u.0.value(),
1198 }
1199 }
1200
1201 pub fn name(&self) -> std::option::Option<&str> {
1206 match self {
1207 Self::Unspecified => std::option::Option::Some("SPAN_KIND_UNSPECIFIED"),
1208 Self::Internal => std::option::Option::Some("INTERNAL"),
1209 Self::Server => std::option::Option::Some("SERVER"),
1210 Self::Client => std::option::Option::Some("CLIENT"),
1211 Self::Producer => std::option::Option::Some("PRODUCER"),
1212 Self::Consumer => std::option::Option::Some("CONSUMER"),
1213 Self::UnknownValue(u) => u.0.name(),
1214 }
1215 }
1216 }
1217
1218 impl std::default::Default for SpanKind {
1219 fn default() -> Self {
1220 use std::convert::From;
1221 Self::from(0)
1222 }
1223 }
1224
1225 impl std::fmt::Display for SpanKind {
1226 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1227 wkt::internal::display_enum(f, self.name(), self.value())
1228 }
1229 }
1230
1231 impl std::convert::From<i32> for SpanKind {
1232 fn from(value: i32) -> Self {
1233 match value {
1234 0 => Self::Unspecified,
1235 1 => Self::Internal,
1236 2 => Self::Server,
1237 3 => Self::Client,
1238 4 => Self::Producer,
1239 5 => Self::Consumer,
1240 _ => Self::UnknownValue(span_kind::UnknownValue(
1241 wkt::internal::UnknownEnumValue::Integer(value),
1242 )),
1243 }
1244 }
1245 }
1246
1247 impl std::convert::From<&str> for SpanKind {
1248 fn from(value: &str) -> Self {
1249 use std::string::ToString;
1250 match value {
1251 "SPAN_KIND_UNSPECIFIED" => Self::Unspecified,
1252 "INTERNAL" => Self::Internal,
1253 "SERVER" => Self::Server,
1254 "CLIENT" => Self::Client,
1255 "PRODUCER" => Self::Producer,
1256 "CONSUMER" => Self::Consumer,
1257 _ => Self::UnknownValue(span_kind::UnknownValue(
1258 wkt::internal::UnknownEnumValue::String(value.to_string()),
1259 )),
1260 }
1261 }
1262 }
1263
1264 impl serde::ser::Serialize for SpanKind {
1265 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1266 where
1267 S: serde::Serializer,
1268 {
1269 match self {
1270 Self::Unspecified => serializer.serialize_i32(0),
1271 Self::Internal => serializer.serialize_i32(1),
1272 Self::Server => serializer.serialize_i32(2),
1273 Self::Client => serializer.serialize_i32(3),
1274 Self::Producer => serializer.serialize_i32(4),
1275 Self::Consumer => serializer.serialize_i32(5),
1276 Self::UnknownValue(u) => u.0.serialize(serializer),
1277 }
1278 }
1279 }
1280
1281 impl<'de> serde::de::Deserialize<'de> for SpanKind {
1282 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1283 where
1284 D: serde::Deserializer<'de>,
1285 {
1286 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SpanKind>::new(
1287 ".google.devtools.cloudtrace.v2.Span.SpanKind",
1288 ))
1289 }
1290 }
1291}
1292
1293#[derive(Clone, Default, PartialEq)]
1295#[non_exhaustive]
1296pub struct AttributeValue {
1297 pub value: std::option::Option<crate::model::attribute_value::Value>,
1299
1300 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1301}
1302
1303impl AttributeValue {
1304 pub fn new() -> Self {
1305 std::default::Default::default()
1306 }
1307
1308 pub fn set_value<
1313 T: std::convert::Into<std::option::Option<crate::model::attribute_value::Value>>,
1314 >(
1315 mut self,
1316 v: T,
1317 ) -> Self {
1318 self.value = v.into();
1319 self
1320 }
1321
1322 pub fn string_value(
1326 &self,
1327 ) -> std::option::Option<&std::boxed::Box<crate::model::TruncatableString>> {
1328 #[allow(unreachable_patterns)]
1329 self.value.as_ref().and_then(|v| match v {
1330 crate::model::attribute_value::Value::StringValue(v) => std::option::Option::Some(v),
1331 _ => std::option::Option::None,
1332 })
1333 }
1334
1335 pub fn set_string_value<
1341 T: std::convert::Into<std::boxed::Box<crate::model::TruncatableString>>,
1342 >(
1343 mut self,
1344 v: T,
1345 ) -> Self {
1346 self.value =
1347 std::option::Option::Some(crate::model::attribute_value::Value::StringValue(v.into()));
1348 self
1349 }
1350
1351 pub fn int_value(&self) -> std::option::Option<&i64> {
1355 #[allow(unreachable_patterns)]
1356 self.value.as_ref().and_then(|v| match v {
1357 crate::model::attribute_value::Value::IntValue(v) => std::option::Option::Some(v),
1358 _ => std::option::Option::None,
1359 })
1360 }
1361
1362 pub fn set_int_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1368 self.value =
1369 std::option::Option::Some(crate::model::attribute_value::Value::IntValue(v.into()));
1370 self
1371 }
1372
1373 pub fn bool_value(&self) -> std::option::Option<&bool> {
1377 #[allow(unreachable_patterns)]
1378 self.value.as_ref().and_then(|v| match v {
1379 crate::model::attribute_value::Value::BoolValue(v) => std::option::Option::Some(v),
1380 _ => std::option::Option::None,
1381 })
1382 }
1383
1384 pub fn set_bool_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1390 self.value =
1391 std::option::Option::Some(crate::model::attribute_value::Value::BoolValue(v.into()));
1392 self
1393 }
1394}
1395
1396impl wkt::message::Message for AttributeValue {
1397 fn typename() -> &'static str {
1398 "type.googleapis.com/google.devtools.cloudtrace.v2.AttributeValue"
1399 }
1400}
1401
1402pub mod attribute_value {
1404 #[allow(unused_imports)]
1405 use super::*;
1406
1407 #[derive(Clone, Debug, PartialEq)]
1409 #[non_exhaustive]
1410 pub enum Value {
1411 StringValue(std::boxed::Box<crate::model::TruncatableString>),
1413 IntValue(i64),
1415 BoolValue(bool),
1417 }
1418}
1419
1420#[derive(Clone, Default, PartialEq)]
1422#[non_exhaustive]
1423pub struct StackTrace {
1424 pub stack_frames: std::option::Option<crate::model::stack_trace::StackFrames>,
1426
1427 pub stack_trace_hash_id: i64,
1437
1438 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1439}
1440
1441impl StackTrace {
1442 pub fn new() -> Self {
1443 std::default::Default::default()
1444 }
1445
1446 pub fn set_stack_frames<T>(mut self, v: T) -> Self
1448 where
1449 T: std::convert::Into<crate::model::stack_trace::StackFrames>,
1450 {
1451 self.stack_frames = std::option::Option::Some(v.into());
1452 self
1453 }
1454
1455 pub fn set_or_clear_stack_frames<T>(mut self, v: std::option::Option<T>) -> Self
1457 where
1458 T: std::convert::Into<crate::model::stack_trace::StackFrames>,
1459 {
1460 self.stack_frames = v.map(|x| x.into());
1461 self
1462 }
1463
1464 pub fn set_stack_trace_hash_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1466 self.stack_trace_hash_id = v.into();
1467 self
1468 }
1469}
1470
1471impl wkt::message::Message for StackTrace {
1472 fn typename() -> &'static str {
1473 "type.googleapis.com/google.devtools.cloudtrace.v2.StackTrace"
1474 }
1475}
1476
1477pub mod stack_trace {
1479 #[allow(unused_imports)]
1480 use super::*;
1481
1482 #[derive(Clone, Default, PartialEq)]
1484 #[non_exhaustive]
1485 pub struct StackFrame {
1486 pub function_name: std::option::Option<crate::model::TruncatableString>,
1489
1490 pub original_function_name: std::option::Option<crate::model::TruncatableString>,
1495
1496 pub file_name: std::option::Option<crate::model::TruncatableString>,
1499
1500 pub line_number: i64,
1502
1503 pub column_number: i64,
1506
1507 pub load_module: std::option::Option<crate::model::Module>,
1509
1510 pub source_version: std::option::Option<crate::model::TruncatableString>,
1512
1513 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1514 }
1515
1516 impl StackFrame {
1517 pub fn new() -> Self {
1518 std::default::Default::default()
1519 }
1520
1521 pub fn set_function_name<T>(mut self, v: T) -> Self
1523 where
1524 T: std::convert::Into<crate::model::TruncatableString>,
1525 {
1526 self.function_name = std::option::Option::Some(v.into());
1527 self
1528 }
1529
1530 pub fn set_or_clear_function_name<T>(mut self, v: std::option::Option<T>) -> Self
1532 where
1533 T: std::convert::Into<crate::model::TruncatableString>,
1534 {
1535 self.function_name = v.map(|x| x.into());
1536 self
1537 }
1538
1539 pub fn set_original_function_name<T>(mut self, v: T) -> Self
1541 where
1542 T: std::convert::Into<crate::model::TruncatableString>,
1543 {
1544 self.original_function_name = std::option::Option::Some(v.into());
1545 self
1546 }
1547
1548 pub fn set_or_clear_original_function_name<T>(mut self, v: std::option::Option<T>) -> Self
1550 where
1551 T: std::convert::Into<crate::model::TruncatableString>,
1552 {
1553 self.original_function_name = v.map(|x| x.into());
1554 self
1555 }
1556
1557 pub fn set_file_name<T>(mut self, v: T) -> Self
1559 where
1560 T: std::convert::Into<crate::model::TruncatableString>,
1561 {
1562 self.file_name = std::option::Option::Some(v.into());
1563 self
1564 }
1565
1566 pub fn set_or_clear_file_name<T>(mut self, v: std::option::Option<T>) -> Self
1568 where
1569 T: std::convert::Into<crate::model::TruncatableString>,
1570 {
1571 self.file_name = v.map(|x| x.into());
1572 self
1573 }
1574
1575 pub fn set_line_number<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1577 self.line_number = v.into();
1578 self
1579 }
1580
1581 pub fn set_column_number<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1583 self.column_number = v.into();
1584 self
1585 }
1586
1587 pub fn set_load_module<T>(mut self, v: T) -> Self
1589 where
1590 T: std::convert::Into<crate::model::Module>,
1591 {
1592 self.load_module = std::option::Option::Some(v.into());
1593 self
1594 }
1595
1596 pub fn set_or_clear_load_module<T>(mut self, v: std::option::Option<T>) -> Self
1598 where
1599 T: std::convert::Into<crate::model::Module>,
1600 {
1601 self.load_module = v.map(|x| x.into());
1602 self
1603 }
1604
1605 pub fn set_source_version<T>(mut self, v: T) -> Self
1607 where
1608 T: std::convert::Into<crate::model::TruncatableString>,
1609 {
1610 self.source_version = std::option::Option::Some(v.into());
1611 self
1612 }
1613
1614 pub fn set_or_clear_source_version<T>(mut self, v: std::option::Option<T>) -> Self
1616 where
1617 T: std::convert::Into<crate::model::TruncatableString>,
1618 {
1619 self.source_version = v.map(|x| x.into());
1620 self
1621 }
1622 }
1623
1624 impl wkt::message::Message for StackFrame {
1625 fn typename() -> &'static str {
1626 "type.googleapis.com/google.devtools.cloudtrace.v2.StackTrace.StackFrame"
1627 }
1628 }
1629
1630 #[derive(Clone, Default, PartialEq)]
1632 #[non_exhaustive]
1633 pub struct StackFrames {
1634 pub frame: std::vec::Vec<crate::model::stack_trace::StackFrame>,
1636
1637 pub dropped_frames_count: i32,
1641
1642 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1643 }
1644
1645 impl StackFrames {
1646 pub fn new() -> Self {
1647 std::default::Default::default()
1648 }
1649
1650 pub fn set_frame<T, V>(mut self, v: T) -> Self
1652 where
1653 T: std::iter::IntoIterator<Item = V>,
1654 V: std::convert::Into<crate::model::stack_trace::StackFrame>,
1655 {
1656 use std::iter::Iterator;
1657 self.frame = v.into_iter().map(|i| i.into()).collect();
1658 self
1659 }
1660
1661 pub fn set_dropped_frames_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1663 self.dropped_frames_count = v.into();
1664 self
1665 }
1666 }
1667
1668 impl wkt::message::Message for StackFrames {
1669 fn typename() -> &'static str {
1670 "type.googleapis.com/google.devtools.cloudtrace.v2.StackTrace.StackFrames"
1671 }
1672 }
1673}
1674
1675#[derive(Clone, Default, PartialEq)]
1677#[non_exhaustive]
1678pub struct Module {
1679 pub module: std::option::Option<crate::model::TruncatableString>,
1682
1683 pub build_id: std::option::Option<crate::model::TruncatableString>,
1686
1687 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1688}
1689
1690impl Module {
1691 pub fn new() -> Self {
1692 std::default::Default::default()
1693 }
1694
1695 pub fn set_module<T>(mut self, v: T) -> Self
1697 where
1698 T: std::convert::Into<crate::model::TruncatableString>,
1699 {
1700 self.module = std::option::Option::Some(v.into());
1701 self
1702 }
1703
1704 pub fn set_or_clear_module<T>(mut self, v: std::option::Option<T>) -> Self
1706 where
1707 T: std::convert::Into<crate::model::TruncatableString>,
1708 {
1709 self.module = v.map(|x| x.into());
1710 self
1711 }
1712
1713 pub fn set_build_id<T>(mut self, v: T) -> Self
1715 where
1716 T: std::convert::Into<crate::model::TruncatableString>,
1717 {
1718 self.build_id = std::option::Option::Some(v.into());
1719 self
1720 }
1721
1722 pub fn set_or_clear_build_id<T>(mut self, v: std::option::Option<T>) -> Self
1724 where
1725 T: std::convert::Into<crate::model::TruncatableString>,
1726 {
1727 self.build_id = v.map(|x| x.into());
1728 self
1729 }
1730}
1731
1732impl wkt::message::Message for Module {
1733 fn typename() -> &'static str {
1734 "type.googleapis.com/google.devtools.cloudtrace.v2.Module"
1735 }
1736}
1737
1738#[derive(Clone, Default, PartialEq)]
1740#[non_exhaustive]
1741pub struct TruncatableString {
1742 pub value: std::string::String,
1750
1751 pub truncated_byte_count: i32,
1754
1755 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1756}
1757
1758impl TruncatableString {
1759 pub fn new() -> Self {
1760 std::default::Default::default()
1761 }
1762
1763 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1765 self.value = v.into();
1766 self
1767 }
1768
1769 pub fn set_truncated_byte_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1771 self.truncated_byte_count = v.into();
1772 self
1773 }
1774}
1775
1776impl wkt::message::Message for TruncatableString {
1777 fn typename() -> &'static str {
1778 "type.googleapis.com/google.devtools.cloudtrace.v2.TruncatableString"
1779 }
1780}
1781
1782#[derive(Clone, Default, PartialEq)]
1784#[non_exhaustive]
1785pub struct BatchWriteSpansRequest {
1786 pub name: std::string::String,
1789
1790 pub spans: std::vec::Vec<crate::model::Span>,
1793
1794 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1795}
1796
1797impl BatchWriteSpansRequest {
1798 pub fn new() -> Self {
1799 std::default::Default::default()
1800 }
1801
1802 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1804 self.name = v.into();
1805 self
1806 }
1807
1808 pub fn set_spans<T, V>(mut self, v: T) -> Self
1810 where
1811 T: std::iter::IntoIterator<Item = V>,
1812 V: std::convert::Into<crate::model::Span>,
1813 {
1814 use std::iter::Iterator;
1815 self.spans = v.into_iter().map(|i| i.into()).collect();
1816 self
1817 }
1818}
1819
1820impl wkt::message::Message for BatchWriteSpansRequest {
1821 fn typename() -> &'static str {
1822 "type.googleapis.com/google.devtools.cloudtrace.v2.BatchWriteSpansRequest"
1823 }
1824}