google_cloud_trace_v2/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
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/// A span represents a single operation within a trace. Spans can be
39/// nested to form a trace tree. Often, a trace contains a root span
40/// that describes the end-to-end latency, and one or more subspans for
41/// its sub-operations.
42///
43/// A trace can also contain multiple root spans, or none at all.
44/// Spans do not need to be contiguous. There might be
45/// gaps or overlaps between spans in a trace.
46#[derive(Clone, Default, PartialEq)]
47#[non_exhaustive]
48pub struct Span {
49    /// Required. The resource name of the span in the following format:
50    ///
51    /// * `projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]`
52    ///
53    /// `[TRACE_ID]` is a unique identifier for a trace within a project;
54    /// it is a 32-character hexadecimal encoding of a 16-byte array. It should
55    /// not be zero.
56    ///
57    /// `[SPAN_ID]` is a unique identifier for a span within a trace; it
58    /// is a 16-character hexadecimal encoding of an 8-byte array. It should not
59    /// be zero.
60    /// .
61    pub name: std::string::String,
62
63    /// Required. The `[SPAN_ID]` portion of the span's resource name.
64    pub span_id: std::string::String,
65
66    /// The `[SPAN_ID]` of this span's parent span. If this is a root span,
67    /// then this field must be empty.
68    pub parent_span_id: std::string::String,
69
70    /// Required. A description of the span's operation (up to 128 bytes).
71    /// Cloud Trace displays the description in the
72    /// Cloud console.
73    /// For example, the display name can be a qualified method name or a file name
74    /// and a line number where the operation is called. A best practice is to use
75    /// the same display name within an application and at the same call point.
76    /// This makes it easier to correlate spans in different traces.
77    pub display_name: std::option::Option<crate::model::TruncatableString>,
78
79    /// Required. The start time of the span. On the client side, this is the time
80    /// kept by the local machine where the span execution starts. On the server
81    /// side, this is the time when the server's application handler starts
82    /// running.
83    pub start_time: std::option::Option<wkt::Timestamp>,
84
85    /// Required. The end time of the span. On the client side, this is the time
86    /// kept by the local machine where the span execution ends. On the server
87    /// side, this is the time when the server application handler stops running.
88    pub end_time: std::option::Option<wkt::Timestamp>,
89
90    /// A set of attributes on the span. You can have up to 32 attributes per
91    /// span.
92    pub attributes: std::option::Option<crate::model::span::Attributes>,
93
94    /// Stack trace captured at the start of the span.
95    pub stack_trace: std::option::Option<crate::model::StackTrace>,
96
97    /// A set of time events. You can have up to 32 annotations and 128 message
98    /// events per span.
99    pub time_events: std::option::Option<crate::model::span::TimeEvents>,
100
101    /// Links associated with the span. You can have up to 128 links per Span.
102    pub links: std::option::Option<crate::model::span::Links>,
103
104    /// Optional. The final status for this span.
105    pub status: std::option::Option<rpc::model::Status>,
106
107    /// Optional. Set this parameter to indicate whether this span is in
108    /// the same process as its parent. If you do not set this parameter,
109    /// Trace is unable to take advantage of this helpful information.
110    pub same_process_as_parent_span: std::option::Option<wkt::BoolValue>,
111
112    /// Optional. The number of child spans that were generated while this span
113    /// was active. If set, allows implementation to detect missing child spans.
114    pub child_span_count: std::option::Option<wkt::Int32Value>,
115
116    /// Optional. Distinguishes between spans generated in a particular context.
117    /// For example, two spans with the same name may be distinguished using
118    /// `CLIENT` (caller) and `SERVER` (callee) to identify an RPC call.
119    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    /// Sets the value of [name][crate::model::Span::name].
130    ///
131    /// # Example
132    /// ```ignore,no_run
133    /// # use google_cloud_trace_v2::model::Span;
134    /// let x = Span::new().set_name("example");
135    /// ```
136    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
137        self.name = v.into();
138        self
139    }
140
141    /// Sets the value of [span_id][crate::model::Span::span_id].
142    ///
143    /// # Example
144    /// ```ignore,no_run
145    /// # use google_cloud_trace_v2::model::Span;
146    /// let x = Span::new().set_span_id("example");
147    /// ```
148    pub fn set_span_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
149        self.span_id = v.into();
150        self
151    }
152
153    /// Sets the value of [parent_span_id][crate::model::Span::parent_span_id].
154    ///
155    /// # Example
156    /// ```ignore,no_run
157    /// # use google_cloud_trace_v2::model::Span;
158    /// let x = Span::new().set_parent_span_id("example");
159    /// ```
160    pub fn set_parent_span_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
161        self.parent_span_id = v.into();
162        self
163    }
164
165    /// Sets the value of [display_name][crate::model::Span::display_name].
166    ///
167    /// # Example
168    /// ```ignore,no_run
169    /// # use google_cloud_trace_v2::model::Span;
170    /// use google_cloud_trace_v2::model::TruncatableString;
171    /// let x = Span::new().set_display_name(TruncatableString::default()/* use setters */);
172    /// ```
173    pub fn set_display_name<T>(mut self, v: T) -> Self
174    where
175        T: std::convert::Into<crate::model::TruncatableString>,
176    {
177        self.display_name = std::option::Option::Some(v.into());
178        self
179    }
180
181    /// Sets or clears the value of [display_name][crate::model::Span::display_name].
182    ///
183    /// # Example
184    /// ```ignore,no_run
185    /// # use google_cloud_trace_v2::model::Span;
186    /// use google_cloud_trace_v2::model::TruncatableString;
187    /// let x = Span::new().set_or_clear_display_name(Some(TruncatableString::default()/* use setters */));
188    /// let x = Span::new().set_or_clear_display_name(None::<TruncatableString>);
189    /// ```
190    pub fn set_or_clear_display_name<T>(mut self, v: std::option::Option<T>) -> Self
191    where
192        T: std::convert::Into<crate::model::TruncatableString>,
193    {
194        self.display_name = v.map(|x| x.into());
195        self
196    }
197
198    /// Sets the value of [start_time][crate::model::Span::start_time].
199    ///
200    /// # Example
201    /// ```ignore,no_run
202    /// # use google_cloud_trace_v2::model::Span;
203    /// use wkt::Timestamp;
204    /// let x = Span::new().set_start_time(Timestamp::default()/* use setters */);
205    /// ```
206    pub fn set_start_time<T>(mut self, v: T) -> Self
207    where
208        T: std::convert::Into<wkt::Timestamp>,
209    {
210        self.start_time = std::option::Option::Some(v.into());
211        self
212    }
213
214    /// Sets or clears the value of [start_time][crate::model::Span::start_time].
215    ///
216    /// # Example
217    /// ```ignore,no_run
218    /// # use google_cloud_trace_v2::model::Span;
219    /// use wkt::Timestamp;
220    /// let x = Span::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
221    /// let x = Span::new().set_or_clear_start_time(None::<Timestamp>);
222    /// ```
223    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
224    where
225        T: std::convert::Into<wkt::Timestamp>,
226    {
227        self.start_time = v.map(|x| x.into());
228        self
229    }
230
231    /// Sets the value of [end_time][crate::model::Span::end_time].
232    ///
233    /// # Example
234    /// ```ignore,no_run
235    /// # use google_cloud_trace_v2::model::Span;
236    /// use wkt::Timestamp;
237    /// let x = Span::new().set_end_time(Timestamp::default()/* use setters */);
238    /// ```
239    pub fn set_end_time<T>(mut self, v: T) -> Self
240    where
241        T: std::convert::Into<wkt::Timestamp>,
242    {
243        self.end_time = std::option::Option::Some(v.into());
244        self
245    }
246
247    /// Sets or clears the value of [end_time][crate::model::Span::end_time].
248    ///
249    /// # Example
250    /// ```ignore,no_run
251    /// # use google_cloud_trace_v2::model::Span;
252    /// use wkt::Timestamp;
253    /// let x = Span::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
254    /// let x = Span::new().set_or_clear_end_time(None::<Timestamp>);
255    /// ```
256    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
257    where
258        T: std::convert::Into<wkt::Timestamp>,
259    {
260        self.end_time = v.map(|x| x.into());
261        self
262    }
263
264    /// Sets the value of [attributes][crate::model::Span::attributes].
265    ///
266    /// # Example
267    /// ```ignore,no_run
268    /// # use google_cloud_trace_v2::model::Span;
269    /// use google_cloud_trace_v2::model::span::Attributes;
270    /// let x = Span::new().set_attributes(Attributes::default()/* use setters */);
271    /// ```
272    pub fn set_attributes<T>(mut self, v: T) -> Self
273    where
274        T: std::convert::Into<crate::model::span::Attributes>,
275    {
276        self.attributes = std::option::Option::Some(v.into());
277        self
278    }
279
280    /// Sets or clears the value of [attributes][crate::model::Span::attributes].
281    ///
282    /// # Example
283    /// ```ignore,no_run
284    /// # use google_cloud_trace_v2::model::Span;
285    /// use google_cloud_trace_v2::model::span::Attributes;
286    /// let x = Span::new().set_or_clear_attributes(Some(Attributes::default()/* use setters */));
287    /// let x = Span::new().set_or_clear_attributes(None::<Attributes>);
288    /// ```
289    pub fn set_or_clear_attributes<T>(mut self, v: std::option::Option<T>) -> Self
290    where
291        T: std::convert::Into<crate::model::span::Attributes>,
292    {
293        self.attributes = v.map(|x| x.into());
294        self
295    }
296
297    /// Sets the value of [stack_trace][crate::model::Span::stack_trace].
298    ///
299    /// # Example
300    /// ```ignore,no_run
301    /// # use google_cloud_trace_v2::model::Span;
302    /// use google_cloud_trace_v2::model::StackTrace;
303    /// let x = Span::new().set_stack_trace(StackTrace::default()/* use setters */);
304    /// ```
305    pub fn set_stack_trace<T>(mut self, v: T) -> Self
306    where
307        T: std::convert::Into<crate::model::StackTrace>,
308    {
309        self.stack_trace = std::option::Option::Some(v.into());
310        self
311    }
312
313    /// Sets or clears the value of [stack_trace][crate::model::Span::stack_trace].
314    ///
315    /// # Example
316    /// ```ignore,no_run
317    /// # use google_cloud_trace_v2::model::Span;
318    /// use google_cloud_trace_v2::model::StackTrace;
319    /// let x = Span::new().set_or_clear_stack_trace(Some(StackTrace::default()/* use setters */));
320    /// let x = Span::new().set_or_clear_stack_trace(None::<StackTrace>);
321    /// ```
322    pub fn set_or_clear_stack_trace<T>(mut self, v: std::option::Option<T>) -> Self
323    where
324        T: std::convert::Into<crate::model::StackTrace>,
325    {
326        self.stack_trace = v.map(|x| x.into());
327        self
328    }
329
330    /// Sets the value of [time_events][crate::model::Span::time_events].
331    ///
332    /// # Example
333    /// ```ignore,no_run
334    /// # use google_cloud_trace_v2::model::Span;
335    /// use google_cloud_trace_v2::model::span::TimeEvents;
336    /// let x = Span::new().set_time_events(TimeEvents::default()/* use setters */);
337    /// ```
338    pub fn set_time_events<T>(mut self, v: T) -> Self
339    where
340        T: std::convert::Into<crate::model::span::TimeEvents>,
341    {
342        self.time_events = std::option::Option::Some(v.into());
343        self
344    }
345
346    /// Sets or clears the value of [time_events][crate::model::Span::time_events].
347    ///
348    /// # Example
349    /// ```ignore,no_run
350    /// # use google_cloud_trace_v2::model::Span;
351    /// use google_cloud_trace_v2::model::span::TimeEvents;
352    /// let x = Span::new().set_or_clear_time_events(Some(TimeEvents::default()/* use setters */));
353    /// let x = Span::new().set_or_clear_time_events(None::<TimeEvents>);
354    /// ```
355    pub fn set_or_clear_time_events<T>(mut self, v: std::option::Option<T>) -> Self
356    where
357        T: std::convert::Into<crate::model::span::TimeEvents>,
358    {
359        self.time_events = v.map(|x| x.into());
360        self
361    }
362
363    /// Sets the value of [links][crate::model::Span::links].
364    ///
365    /// # Example
366    /// ```ignore,no_run
367    /// # use google_cloud_trace_v2::model::Span;
368    /// use google_cloud_trace_v2::model::span::Links;
369    /// let x = Span::new().set_links(Links::default()/* use setters */);
370    /// ```
371    pub fn set_links<T>(mut self, v: T) -> Self
372    where
373        T: std::convert::Into<crate::model::span::Links>,
374    {
375        self.links = std::option::Option::Some(v.into());
376        self
377    }
378
379    /// Sets or clears the value of [links][crate::model::Span::links].
380    ///
381    /// # Example
382    /// ```ignore,no_run
383    /// # use google_cloud_trace_v2::model::Span;
384    /// use google_cloud_trace_v2::model::span::Links;
385    /// let x = Span::new().set_or_clear_links(Some(Links::default()/* use setters */));
386    /// let x = Span::new().set_or_clear_links(None::<Links>);
387    /// ```
388    pub fn set_or_clear_links<T>(mut self, v: std::option::Option<T>) -> Self
389    where
390        T: std::convert::Into<crate::model::span::Links>,
391    {
392        self.links = v.map(|x| x.into());
393        self
394    }
395
396    /// Sets the value of [status][crate::model::Span::status].
397    ///
398    /// # Example
399    /// ```ignore,no_run
400    /// # use google_cloud_trace_v2::model::Span;
401    /// use rpc::model::Status;
402    /// let x = Span::new().set_status(Status::default()/* use setters */);
403    /// ```
404    pub fn set_status<T>(mut self, v: T) -> Self
405    where
406        T: std::convert::Into<rpc::model::Status>,
407    {
408        self.status = std::option::Option::Some(v.into());
409        self
410    }
411
412    /// Sets or clears the value of [status][crate::model::Span::status].
413    ///
414    /// # Example
415    /// ```ignore,no_run
416    /// # use google_cloud_trace_v2::model::Span;
417    /// use rpc::model::Status;
418    /// let x = Span::new().set_or_clear_status(Some(Status::default()/* use setters */));
419    /// let x = Span::new().set_or_clear_status(None::<Status>);
420    /// ```
421    pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
422    where
423        T: std::convert::Into<rpc::model::Status>,
424    {
425        self.status = v.map(|x| x.into());
426        self
427    }
428
429    /// Sets the value of [same_process_as_parent_span][crate::model::Span::same_process_as_parent_span].
430    ///
431    /// # Example
432    /// ```ignore,no_run
433    /// # use google_cloud_trace_v2::model::Span;
434    /// use wkt::BoolValue;
435    /// let x = Span::new().set_same_process_as_parent_span(BoolValue::default()/* use setters */);
436    /// ```
437    pub fn set_same_process_as_parent_span<T>(mut self, v: T) -> Self
438    where
439        T: std::convert::Into<wkt::BoolValue>,
440    {
441        self.same_process_as_parent_span = std::option::Option::Some(v.into());
442        self
443    }
444
445    /// Sets or clears the value of [same_process_as_parent_span][crate::model::Span::same_process_as_parent_span].
446    ///
447    /// # Example
448    /// ```ignore,no_run
449    /// # use google_cloud_trace_v2::model::Span;
450    /// use wkt::BoolValue;
451    /// let x = Span::new().set_or_clear_same_process_as_parent_span(Some(BoolValue::default()/* use setters */));
452    /// let x = Span::new().set_or_clear_same_process_as_parent_span(None::<BoolValue>);
453    /// ```
454    pub fn set_or_clear_same_process_as_parent_span<T>(mut self, v: std::option::Option<T>) -> Self
455    where
456        T: std::convert::Into<wkt::BoolValue>,
457    {
458        self.same_process_as_parent_span = v.map(|x| x.into());
459        self
460    }
461
462    /// Sets the value of [child_span_count][crate::model::Span::child_span_count].
463    ///
464    /// # Example
465    /// ```ignore,no_run
466    /// # use google_cloud_trace_v2::model::Span;
467    /// use wkt::Int32Value;
468    /// let x = Span::new().set_child_span_count(Int32Value::default()/* use setters */);
469    /// ```
470    pub fn set_child_span_count<T>(mut self, v: T) -> Self
471    where
472        T: std::convert::Into<wkt::Int32Value>,
473    {
474        self.child_span_count = std::option::Option::Some(v.into());
475        self
476    }
477
478    /// Sets or clears the value of [child_span_count][crate::model::Span::child_span_count].
479    ///
480    /// # Example
481    /// ```ignore,no_run
482    /// # use google_cloud_trace_v2::model::Span;
483    /// use wkt::Int32Value;
484    /// let x = Span::new().set_or_clear_child_span_count(Some(Int32Value::default()/* use setters */));
485    /// let x = Span::new().set_or_clear_child_span_count(None::<Int32Value>);
486    /// ```
487    pub fn set_or_clear_child_span_count<T>(mut self, v: std::option::Option<T>) -> Self
488    where
489        T: std::convert::Into<wkt::Int32Value>,
490    {
491        self.child_span_count = v.map(|x| x.into());
492        self
493    }
494
495    /// Sets the value of [span_kind][crate::model::Span::span_kind].
496    ///
497    /// # Example
498    /// ```ignore,no_run
499    /// # use google_cloud_trace_v2::model::Span;
500    /// use google_cloud_trace_v2::model::span::SpanKind;
501    /// let x0 = Span::new().set_span_kind(SpanKind::Internal);
502    /// let x1 = Span::new().set_span_kind(SpanKind::Server);
503    /// let x2 = Span::new().set_span_kind(SpanKind::Client);
504    /// ```
505    pub fn set_span_kind<T: std::convert::Into<crate::model::span::SpanKind>>(
506        mut self,
507        v: T,
508    ) -> Self {
509        self.span_kind = v.into();
510        self
511    }
512}
513
514impl wkt::message::Message for Span {
515    fn typename() -> &'static str {
516        "type.googleapis.com/google.devtools.cloudtrace.v2.Span"
517    }
518}
519
520/// Defines additional types related to [Span].
521pub mod span {
522    #[allow(unused_imports)]
523    use super::*;
524
525    /// A set of attributes as key-value pairs.
526    #[derive(Clone, Default, PartialEq)]
527    #[non_exhaustive]
528    pub struct Attributes {
529        /// A set of attributes. Each attribute's key can be up to 128 bytes
530        /// long. The value can be a string up to 256 bytes, a signed 64-bit integer,
531        /// or the boolean values `true` or `false`. For example:
532        ///
533        /// ```norust
534        /// "/instance_id": { "string_value": { "value": "my-instance" } }
535        /// "/http/request_bytes": { "int_value": 300 }
536        /// "abc.com/myattribute": { "bool_value": false }
537        /// ```
538        pub attribute_map:
539            std::collections::HashMap<std::string::String, crate::model::AttributeValue>,
540
541        /// The number of attributes that were discarded. Attributes can be discarded
542        /// because their keys are too long or because there are too many attributes.
543        /// If this value is 0 then all attributes are valid.
544        pub dropped_attributes_count: i32,
545
546        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
547    }
548
549    impl Attributes {
550        pub fn new() -> Self {
551            std::default::Default::default()
552        }
553
554        /// Sets the value of [attribute_map][crate::model::span::Attributes::attribute_map].
555        ///
556        /// # Example
557        /// ```ignore,no_run
558        /// # use google_cloud_trace_v2::model::span::Attributes;
559        /// use google_cloud_trace_v2::model::AttributeValue;
560        /// let x = Attributes::new().set_attribute_map([
561        ///     ("key0", AttributeValue::default()/* use setters */),
562        ///     ("key1", AttributeValue::default()/* use (different) setters */),
563        /// ]);
564        /// ```
565        pub fn set_attribute_map<T, K, V>(mut self, v: T) -> Self
566        where
567            T: std::iter::IntoIterator<Item = (K, V)>,
568            K: std::convert::Into<std::string::String>,
569            V: std::convert::Into<crate::model::AttributeValue>,
570        {
571            use std::iter::Iterator;
572            self.attribute_map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
573            self
574        }
575
576        /// Sets the value of [dropped_attributes_count][crate::model::span::Attributes::dropped_attributes_count].
577        ///
578        /// # Example
579        /// ```ignore,no_run
580        /// # use google_cloud_trace_v2::model::span::Attributes;
581        /// let x = Attributes::new().set_dropped_attributes_count(42);
582        /// ```
583        pub fn set_dropped_attributes_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
584            self.dropped_attributes_count = v.into();
585            self
586        }
587    }
588
589    impl wkt::message::Message for Attributes {
590        fn typename() -> &'static str {
591            "type.googleapis.com/google.devtools.cloudtrace.v2.Span.Attributes"
592        }
593    }
594
595    /// A time-stamped annotation or message event in the Span.
596    #[derive(Clone, Default, PartialEq)]
597    #[non_exhaustive]
598    pub struct TimeEvent {
599        /// The timestamp indicating the time the event occurred.
600        pub time: std::option::Option<wkt::Timestamp>,
601
602        /// A `TimeEvent` can contain either an `Annotation` object or a
603        /// `MessageEvent` object, but not both.
604        pub value: std::option::Option<crate::model::span::time_event::Value>,
605
606        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
607    }
608
609    impl TimeEvent {
610        pub fn new() -> Self {
611            std::default::Default::default()
612        }
613
614        /// Sets the value of [time][crate::model::span::TimeEvent::time].
615        ///
616        /// # Example
617        /// ```ignore,no_run
618        /// # use google_cloud_trace_v2::model::span::TimeEvent;
619        /// use wkt::Timestamp;
620        /// let x = TimeEvent::new().set_time(Timestamp::default()/* use setters */);
621        /// ```
622        pub fn set_time<T>(mut self, v: T) -> Self
623        where
624            T: std::convert::Into<wkt::Timestamp>,
625        {
626            self.time = std::option::Option::Some(v.into());
627            self
628        }
629
630        /// Sets or clears the value of [time][crate::model::span::TimeEvent::time].
631        ///
632        /// # Example
633        /// ```ignore,no_run
634        /// # use google_cloud_trace_v2::model::span::TimeEvent;
635        /// use wkt::Timestamp;
636        /// let x = TimeEvent::new().set_or_clear_time(Some(Timestamp::default()/* use setters */));
637        /// let x = TimeEvent::new().set_or_clear_time(None::<Timestamp>);
638        /// ```
639        pub fn set_or_clear_time<T>(mut self, v: std::option::Option<T>) -> Self
640        where
641            T: std::convert::Into<wkt::Timestamp>,
642        {
643            self.time = v.map(|x| x.into());
644            self
645        }
646
647        /// Sets the value of [value][crate::model::span::TimeEvent::value].
648        ///
649        /// Note that all the setters affecting `value` are mutually
650        /// exclusive.
651        ///
652        /// # Example
653        /// ```ignore,no_run
654        /// # use google_cloud_trace_v2::model::span::TimeEvent;
655        /// use google_cloud_trace_v2::model::span::time_event::Annotation;
656        /// let x = TimeEvent::new().set_value(Some(
657        ///     google_cloud_trace_v2::model::span::time_event::Value::Annotation(Annotation::default().into())));
658        /// ```
659        pub fn set_value<
660            T: std::convert::Into<std::option::Option<crate::model::span::time_event::Value>>,
661        >(
662            mut self,
663            v: T,
664        ) -> Self {
665            self.value = v.into();
666            self
667        }
668
669        /// The value of [value][crate::model::span::TimeEvent::value]
670        /// if it holds a `Annotation`, `None` if the field is not set or
671        /// holds a different branch.
672        pub fn annotation(
673            &self,
674        ) -> std::option::Option<&std::boxed::Box<crate::model::span::time_event::Annotation>>
675        {
676            #[allow(unreachable_patterns)]
677            self.value.as_ref().and_then(|v| match v {
678                crate::model::span::time_event::Value::Annotation(v) => {
679                    std::option::Option::Some(v)
680                }
681                _ => std::option::Option::None,
682            })
683        }
684
685        /// Sets the value of [value][crate::model::span::TimeEvent::value]
686        /// to hold a `Annotation`.
687        ///
688        /// Note that all the setters affecting `value` are
689        /// mutually exclusive.
690        ///
691        /// # Example
692        /// ```ignore,no_run
693        /// # use google_cloud_trace_v2::model::span::TimeEvent;
694        /// use google_cloud_trace_v2::model::span::time_event::Annotation;
695        /// let x = TimeEvent::new().set_annotation(Annotation::default()/* use setters */);
696        /// assert!(x.annotation().is_some());
697        /// assert!(x.message_event().is_none());
698        /// ```
699        pub fn set_annotation<
700            T: std::convert::Into<std::boxed::Box<crate::model::span::time_event::Annotation>>,
701        >(
702            mut self,
703            v: T,
704        ) -> Self {
705            self.value = std::option::Option::Some(
706                crate::model::span::time_event::Value::Annotation(v.into()),
707            );
708            self
709        }
710
711        /// The value of [value][crate::model::span::TimeEvent::value]
712        /// if it holds a `MessageEvent`, `None` if the field is not set or
713        /// holds a different branch.
714        pub fn message_event(
715            &self,
716        ) -> std::option::Option<&std::boxed::Box<crate::model::span::time_event::MessageEvent>>
717        {
718            #[allow(unreachable_patterns)]
719            self.value.as_ref().and_then(|v| match v {
720                crate::model::span::time_event::Value::MessageEvent(v) => {
721                    std::option::Option::Some(v)
722                }
723                _ => std::option::Option::None,
724            })
725        }
726
727        /// Sets the value of [value][crate::model::span::TimeEvent::value]
728        /// to hold a `MessageEvent`.
729        ///
730        /// Note that all the setters affecting `value` are
731        /// mutually exclusive.
732        ///
733        /// # Example
734        /// ```ignore,no_run
735        /// # use google_cloud_trace_v2::model::span::TimeEvent;
736        /// use google_cloud_trace_v2::model::span::time_event::MessageEvent;
737        /// let x = TimeEvent::new().set_message_event(MessageEvent::default()/* use setters */);
738        /// assert!(x.message_event().is_some());
739        /// assert!(x.annotation().is_none());
740        /// ```
741        pub fn set_message_event<
742            T: std::convert::Into<std::boxed::Box<crate::model::span::time_event::MessageEvent>>,
743        >(
744            mut self,
745            v: T,
746        ) -> Self {
747            self.value = std::option::Option::Some(
748                crate::model::span::time_event::Value::MessageEvent(v.into()),
749            );
750            self
751        }
752    }
753
754    impl wkt::message::Message for TimeEvent {
755        fn typename() -> &'static str {
756            "type.googleapis.com/google.devtools.cloudtrace.v2.Span.TimeEvent"
757        }
758    }
759
760    /// Defines additional types related to [TimeEvent].
761    pub mod time_event {
762        #[allow(unused_imports)]
763        use super::*;
764
765        /// Text annotation with a set of attributes.
766        #[derive(Clone, Default, PartialEq)]
767        #[non_exhaustive]
768        pub struct Annotation {
769            /// A user-supplied message describing the event. The maximum length for
770            /// the description is 256 bytes.
771            pub description: std::option::Option<crate::model::TruncatableString>,
772
773            /// A set of attributes on the annotation. You can have up to 4 attributes
774            /// per Annotation.
775            pub attributes: std::option::Option<crate::model::span::Attributes>,
776
777            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
778        }
779
780        impl Annotation {
781            pub fn new() -> Self {
782                std::default::Default::default()
783            }
784
785            /// Sets the value of [description][crate::model::span::time_event::Annotation::description].
786            ///
787            /// # Example
788            /// ```ignore,no_run
789            /// # use google_cloud_trace_v2::model::span::time_event::Annotation;
790            /// use google_cloud_trace_v2::model::TruncatableString;
791            /// let x = Annotation::new().set_description(TruncatableString::default()/* use setters */);
792            /// ```
793            pub fn set_description<T>(mut self, v: T) -> Self
794            where
795                T: std::convert::Into<crate::model::TruncatableString>,
796            {
797                self.description = std::option::Option::Some(v.into());
798                self
799            }
800
801            /// Sets or clears the value of [description][crate::model::span::time_event::Annotation::description].
802            ///
803            /// # Example
804            /// ```ignore,no_run
805            /// # use google_cloud_trace_v2::model::span::time_event::Annotation;
806            /// use google_cloud_trace_v2::model::TruncatableString;
807            /// let x = Annotation::new().set_or_clear_description(Some(TruncatableString::default()/* use setters */));
808            /// let x = Annotation::new().set_or_clear_description(None::<TruncatableString>);
809            /// ```
810            pub fn set_or_clear_description<T>(mut self, v: std::option::Option<T>) -> Self
811            where
812                T: std::convert::Into<crate::model::TruncatableString>,
813            {
814                self.description = v.map(|x| x.into());
815                self
816            }
817
818            /// Sets the value of [attributes][crate::model::span::time_event::Annotation::attributes].
819            ///
820            /// # Example
821            /// ```ignore,no_run
822            /// # use google_cloud_trace_v2::model::span::time_event::Annotation;
823            /// use google_cloud_trace_v2::model::span::Attributes;
824            /// let x = Annotation::new().set_attributes(Attributes::default()/* use setters */);
825            /// ```
826            pub fn set_attributes<T>(mut self, v: T) -> Self
827            where
828                T: std::convert::Into<crate::model::span::Attributes>,
829            {
830                self.attributes = std::option::Option::Some(v.into());
831                self
832            }
833
834            /// Sets or clears the value of [attributes][crate::model::span::time_event::Annotation::attributes].
835            ///
836            /// # Example
837            /// ```ignore,no_run
838            /// # use google_cloud_trace_v2::model::span::time_event::Annotation;
839            /// use google_cloud_trace_v2::model::span::Attributes;
840            /// let x = Annotation::new().set_or_clear_attributes(Some(Attributes::default()/* use setters */));
841            /// let x = Annotation::new().set_or_clear_attributes(None::<Attributes>);
842            /// ```
843            pub fn set_or_clear_attributes<T>(mut self, v: std::option::Option<T>) -> Self
844            where
845                T: std::convert::Into<crate::model::span::Attributes>,
846            {
847                self.attributes = v.map(|x| x.into());
848                self
849            }
850        }
851
852        impl wkt::message::Message for Annotation {
853            fn typename() -> &'static str {
854                "type.googleapis.com/google.devtools.cloudtrace.v2.Span.TimeEvent.Annotation"
855            }
856        }
857
858        /// An event describing a message sent/received between Spans.
859        #[derive(Clone, Default, PartialEq)]
860        #[non_exhaustive]
861        pub struct MessageEvent {
862            /// Type of MessageEvent. Indicates whether the message was sent or
863            /// received.
864            pub r#type: crate::model::span::time_event::message_event::Type,
865
866            /// An identifier for the MessageEvent's message that can be used to match
867            /// `SENT` and `RECEIVED` MessageEvents.
868            pub id: i64,
869
870            /// The number of uncompressed bytes sent or received.
871            pub uncompressed_size_bytes: i64,
872
873            /// The number of compressed bytes sent or received. If missing, the
874            /// compressed size is assumed to be the same size as the uncompressed
875            /// size.
876            pub compressed_size_bytes: i64,
877
878            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
879        }
880
881        impl MessageEvent {
882            pub fn new() -> Self {
883                std::default::Default::default()
884            }
885
886            /// Sets the value of [r#type][crate::model::span::time_event::MessageEvent::type].
887            ///
888            /// # Example
889            /// ```ignore,no_run
890            /// # use google_cloud_trace_v2::model::span::time_event::MessageEvent;
891            /// use google_cloud_trace_v2::model::span::time_event::message_event::Type;
892            /// let x0 = MessageEvent::new().set_type(Type::Sent);
893            /// let x1 = MessageEvent::new().set_type(Type::Received);
894            /// ```
895            pub fn set_type<
896                T: std::convert::Into<crate::model::span::time_event::message_event::Type>,
897            >(
898                mut self,
899                v: T,
900            ) -> Self {
901                self.r#type = v.into();
902                self
903            }
904
905            /// Sets the value of [id][crate::model::span::time_event::MessageEvent::id].
906            ///
907            /// # Example
908            /// ```ignore,no_run
909            /// # use google_cloud_trace_v2::model::span::time_event::MessageEvent;
910            /// let x = MessageEvent::new().set_id(42);
911            /// ```
912            pub fn set_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
913                self.id = v.into();
914                self
915            }
916
917            /// Sets the value of [uncompressed_size_bytes][crate::model::span::time_event::MessageEvent::uncompressed_size_bytes].
918            ///
919            /// # Example
920            /// ```ignore,no_run
921            /// # use google_cloud_trace_v2::model::span::time_event::MessageEvent;
922            /// let x = MessageEvent::new().set_uncompressed_size_bytes(42);
923            /// ```
924            pub fn set_uncompressed_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
925                self.uncompressed_size_bytes = v.into();
926                self
927            }
928
929            /// Sets the value of [compressed_size_bytes][crate::model::span::time_event::MessageEvent::compressed_size_bytes].
930            ///
931            /// # Example
932            /// ```ignore,no_run
933            /// # use google_cloud_trace_v2::model::span::time_event::MessageEvent;
934            /// let x = MessageEvent::new().set_compressed_size_bytes(42);
935            /// ```
936            pub fn set_compressed_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
937                self.compressed_size_bytes = v.into();
938                self
939            }
940        }
941
942        impl wkt::message::Message for MessageEvent {
943            fn typename() -> &'static str {
944                "type.googleapis.com/google.devtools.cloudtrace.v2.Span.TimeEvent.MessageEvent"
945            }
946        }
947
948        /// Defines additional types related to [MessageEvent].
949        pub mod message_event {
950            #[allow(unused_imports)]
951            use super::*;
952
953            /// Indicates whether the message was sent or received.
954            ///
955            /// # Working with unknown values
956            ///
957            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
958            /// additional enum variants at any time. Adding new variants is not considered
959            /// a breaking change. Applications should write their code in anticipation of:
960            ///
961            /// - New values appearing in future releases of the client library, **and**
962            /// - New values received dynamically, without application changes.
963            ///
964            /// Please consult the [Working with enums] section in the user guide for some
965            /// guidelines.
966            ///
967            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
968            #[derive(Clone, Debug, PartialEq)]
969            #[non_exhaustive]
970            pub enum Type {
971                /// Unknown event type.
972                Unspecified,
973                /// Indicates a sent message.
974                Sent,
975                /// Indicates a received message.
976                Received,
977                /// If set, the enum was initialized with an unknown value.
978                ///
979                /// Applications can examine the value using [Type::value] or
980                /// [Type::name].
981                UnknownValue(r#type::UnknownValue),
982            }
983
984            #[doc(hidden)]
985            pub mod r#type {
986                #[allow(unused_imports)]
987                use super::*;
988                #[derive(Clone, Debug, PartialEq)]
989                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
990            }
991
992            impl Type {
993                /// Gets the enum value.
994                ///
995                /// Returns `None` if the enum contains an unknown value deserialized from
996                /// the string representation of enums.
997                pub fn value(&self) -> std::option::Option<i32> {
998                    match self {
999                        Self::Unspecified => std::option::Option::Some(0),
1000                        Self::Sent => std::option::Option::Some(1),
1001                        Self::Received => std::option::Option::Some(2),
1002                        Self::UnknownValue(u) => u.0.value(),
1003                    }
1004                }
1005
1006                /// Gets the enum value as a string.
1007                ///
1008                /// Returns `None` if the enum contains an unknown value deserialized from
1009                /// the integer representation of enums.
1010                pub fn name(&self) -> std::option::Option<&str> {
1011                    match self {
1012                        Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
1013                        Self::Sent => std::option::Option::Some("SENT"),
1014                        Self::Received => std::option::Option::Some("RECEIVED"),
1015                        Self::UnknownValue(u) => u.0.name(),
1016                    }
1017                }
1018            }
1019
1020            impl std::default::Default for Type {
1021                fn default() -> Self {
1022                    use std::convert::From;
1023                    Self::from(0)
1024                }
1025            }
1026
1027            impl std::fmt::Display for Type {
1028                fn fmt(
1029                    &self,
1030                    f: &mut std::fmt::Formatter<'_>,
1031                ) -> std::result::Result<(), std::fmt::Error> {
1032                    wkt::internal::display_enum(f, self.name(), self.value())
1033                }
1034            }
1035
1036            impl std::convert::From<i32> for Type {
1037                fn from(value: i32) -> Self {
1038                    match value {
1039                        0 => Self::Unspecified,
1040                        1 => Self::Sent,
1041                        2 => Self::Received,
1042                        _ => Self::UnknownValue(r#type::UnknownValue(
1043                            wkt::internal::UnknownEnumValue::Integer(value),
1044                        )),
1045                    }
1046                }
1047            }
1048
1049            impl std::convert::From<&str> for Type {
1050                fn from(value: &str) -> Self {
1051                    use std::string::ToString;
1052                    match value {
1053                        "TYPE_UNSPECIFIED" => Self::Unspecified,
1054                        "SENT" => Self::Sent,
1055                        "RECEIVED" => Self::Received,
1056                        _ => Self::UnknownValue(r#type::UnknownValue(
1057                            wkt::internal::UnknownEnumValue::String(value.to_string()),
1058                        )),
1059                    }
1060                }
1061            }
1062
1063            impl serde::ser::Serialize for Type {
1064                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1065                where
1066                    S: serde::Serializer,
1067                {
1068                    match self {
1069                        Self::Unspecified => serializer.serialize_i32(0),
1070                        Self::Sent => serializer.serialize_i32(1),
1071                        Self::Received => serializer.serialize_i32(2),
1072                        Self::UnknownValue(u) => u.0.serialize(serializer),
1073                    }
1074                }
1075            }
1076
1077            impl<'de> serde::de::Deserialize<'de> for Type {
1078                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1079                where
1080                    D: serde::Deserializer<'de>,
1081                {
1082                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
1083                        ".google.devtools.cloudtrace.v2.Span.TimeEvent.MessageEvent.Type",
1084                    ))
1085                }
1086            }
1087        }
1088
1089        /// A `TimeEvent` can contain either an `Annotation` object or a
1090        /// `MessageEvent` object, but not both.
1091        #[derive(Clone, Debug, PartialEq)]
1092        #[non_exhaustive]
1093        pub enum Value {
1094            /// Text annotation with a set of attributes.
1095            Annotation(std::boxed::Box<crate::model::span::time_event::Annotation>),
1096            /// An event describing a message sent/received between Spans.
1097            MessageEvent(std::boxed::Box<crate::model::span::time_event::MessageEvent>),
1098        }
1099    }
1100
1101    /// A collection of `TimeEvent`s. A `TimeEvent` is a time-stamped annotation
1102    /// on the span, consisting of either user-supplied key:value pairs, or
1103    /// details of a message sent/received between Spans.
1104    #[derive(Clone, Default, PartialEq)]
1105    #[non_exhaustive]
1106    pub struct TimeEvents {
1107        /// A collection of `TimeEvent`s.
1108        pub time_event: std::vec::Vec<crate::model::span::TimeEvent>,
1109
1110        /// The number of dropped annotations in all the included time events.
1111        /// If the value is 0, then no annotations were dropped.
1112        pub dropped_annotations_count: i32,
1113
1114        /// The number of dropped message events in all the included time events.
1115        /// If the value is 0, then no message events were dropped.
1116        pub dropped_message_events_count: i32,
1117
1118        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1119    }
1120
1121    impl TimeEvents {
1122        pub fn new() -> Self {
1123            std::default::Default::default()
1124        }
1125
1126        /// Sets the value of [time_event][crate::model::span::TimeEvents::time_event].
1127        ///
1128        /// # Example
1129        /// ```ignore,no_run
1130        /// # use google_cloud_trace_v2::model::span::TimeEvents;
1131        /// use google_cloud_trace_v2::model::span::TimeEvent;
1132        /// let x = TimeEvents::new()
1133        ///     .set_time_event([
1134        ///         TimeEvent::default()/* use setters */,
1135        ///         TimeEvent::default()/* use (different) setters */,
1136        ///     ]);
1137        /// ```
1138        pub fn set_time_event<T, V>(mut self, v: T) -> Self
1139        where
1140            T: std::iter::IntoIterator<Item = V>,
1141            V: std::convert::Into<crate::model::span::TimeEvent>,
1142        {
1143            use std::iter::Iterator;
1144            self.time_event = v.into_iter().map(|i| i.into()).collect();
1145            self
1146        }
1147
1148        /// Sets the value of [dropped_annotations_count][crate::model::span::TimeEvents::dropped_annotations_count].
1149        ///
1150        /// # Example
1151        /// ```ignore,no_run
1152        /// # use google_cloud_trace_v2::model::span::TimeEvents;
1153        /// let x = TimeEvents::new().set_dropped_annotations_count(42);
1154        /// ```
1155        pub fn set_dropped_annotations_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1156            self.dropped_annotations_count = v.into();
1157            self
1158        }
1159
1160        /// Sets the value of [dropped_message_events_count][crate::model::span::TimeEvents::dropped_message_events_count].
1161        ///
1162        /// # Example
1163        /// ```ignore,no_run
1164        /// # use google_cloud_trace_v2::model::span::TimeEvents;
1165        /// let x = TimeEvents::new().set_dropped_message_events_count(42);
1166        /// ```
1167        pub fn set_dropped_message_events_count<T: std::convert::Into<i32>>(
1168            mut self,
1169            v: T,
1170        ) -> Self {
1171            self.dropped_message_events_count = v.into();
1172            self
1173        }
1174    }
1175
1176    impl wkt::message::Message for TimeEvents {
1177        fn typename() -> &'static str {
1178            "type.googleapis.com/google.devtools.cloudtrace.v2.Span.TimeEvents"
1179        }
1180    }
1181
1182    /// A pointer from the current span to another span in the same trace or in a
1183    /// different trace. For example, this can be used in batching operations,
1184    /// where a single batch handler processes multiple requests from different
1185    /// traces or when the handler receives a request from a different project.
1186    #[derive(Clone, Default, PartialEq)]
1187    #[non_exhaustive]
1188    pub struct Link {
1189        /// The `[TRACE_ID]` for a trace within a project.
1190        pub trace_id: std::string::String,
1191
1192        /// The `[SPAN_ID]` for a span within a trace.
1193        pub span_id: std::string::String,
1194
1195        /// The relationship of the current span relative to the linked span.
1196        pub r#type: crate::model::span::link::Type,
1197
1198        /// A set of attributes on the link. Up to 32 attributes can be
1199        /// specified per link.
1200        pub attributes: std::option::Option<crate::model::span::Attributes>,
1201
1202        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1203    }
1204
1205    impl Link {
1206        pub fn new() -> Self {
1207            std::default::Default::default()
1208        }
1209
1210        /// Sets the value of [trace_id][crate::model::span::Link::trace_id].
1211        ///
1212        /// # Example
1213        /// ```ignore,no_run
1214        /// # use google_cloud_trace_v2::model::span::Link;
1215        /// let x = Link::new().set_trace_id("example");
1216        /// ```
1217        pub fn set_trace_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1218            self.trace_id = v.into();
1219            self
1220        }
1221
1222        /// Sets the value of [span_id][crate::model::span::Link::span_id].
1223        ///
1224        /// # Example
1225        /// ```ignore,no_run
1226        /// # use google_cloud_trace_v2::model::span::Link;
1227        /// let x = Link::new().set_span_id("example");
1228        /// ```
1229        pub fn set_span_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1230            self.span_id = v.into();
1231            self
1232        }
1233
1234        /// Sets the value of [r#type][crate::model::span::Link::type].
1235        ///
1236        /// # Example
1237        /// ```ignore,no_run
1238        /// # use google_cloud_trace_v2::model::span::Link;
1239        /// use google_cloud_trace_v2::model::span::link::Type;
1240        /// let x0 = Link::new().set_type(Type::ChildLinkedSpan);
1241        /// let x1 = Link::new().set_type(Type::ParentLinkedSpan);
1242        /// ```
1243        pub fn set_type<T: std::convert::Into<crate::model::span::link::Type>>(
1244            mut self,
1245            v: T,
1246        ) -> Self {
1247            self.r#type = v.into();
1248            self
1249        }
1250
1251        /// Sets the value of [attributes][crate::model::span::Link::attributes].
1252        ///
1253        /// # Example
1254        /// ```ignore,no_run
1255        /// # use google_cloud_trace_v2::model::span::Link;
1256        /// use google_cloud_trace_v2::model::span::Attributes;
1257        /// let x = Link::new().set_attributes(Attributes::default()/* use setters */);
1258        /// ```
1259        pub fn set_attributes<T>(mut self, v: T) -> Self
1260        where
1261            T: std::convert::Into<crate::model::span::Attributes>,
1262        {
1263            self.attributes = std::option::Option::Some(v.into());
1264            self
1265        }
1266
1267        /// Sets or clears the value of [attributes][crate::model::span::Link::attributes].
1268        ///
1269        /// # Example
1270        /// ```ignore,no_run
1271        /// # use google_cloud_trace_v2::model::span::Link;
1272        /// use google_cloud_trace_v2::model::span::Attributes;
1273        /// let x = Link::new().set_or_clear_attributes(Some(Attributes::default()/* use setters */));
1274        /// let x = Link::new().set_or_clear_attributes(None::<Attributes>);
1275        /// ```
1276        pub fn set_or_clear_attributes<T>(mut self, v: std::option::Option<T>) -> Self
1277        where
1278            T: std::convert::Into<crate::model::span::Attributes>,
1279        {
1280            self.attributes = v.map(|x| x.into());
1281            self
1282        }
1283    }
1284
1285    impl wkt::message::Message for Link {
1286        fn typename() -> &'static str {
1287            "type.googleapis.com/google.devtools.cloudtrace.v2.Span.Link"
1288        }
1289    }
1290
1291    /// Defines additional types related to [Link].
1292    pub mod link {
1293        #[allow(unused_imports)]
1294        use super::*;
1295
1296        /// The relationship of the current span relative to the linked span: child,
1297        /// parent, or unspecified.
1298        ///
1299        /// # Working with unknown values
1300        ///
1301        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1302        /// additional enum variants at any time. Adding new variants is not considered
1303        /// a breaking change. Applications should write their code in anticipation of:
1304        ///
1305        /// - New values appearing in future releases of the client library, **and**
1306        /// - New values received dynamically, without application changes.
1307        ///
1308        /// Please consult the [Working with enums] section in the user guide for some
1309        /// guidelines.
1310        ///
1311        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1312        #[derive(Clone, Debug, PartialEq)]
1313        #[non_exhaustive]
1314        pub enum Type {
1315            /// The relationship of the two spans is unknown.
1316            Unspecified,
1317            /// The linked span is a child of the current span.
1318            ChildLinkedSpan,
1319            /// The linked span is a parent of the current span.
1320            ParentLinkedSpan,
1321            /// If set, the enum was initialized with an unknown value.
1322            ///
1323            /// Applications can examine the value using [Type::value] or
1324            /// [Type::name].
1325            UnknownValue(r#type::UnknownValue),
1326        }
1327
1328        #[doc(hidden)]
1329        pub mod r#type {
1330            #[allow(unused_imports)]
1331            use super::*;
1332            #[derive(Clone, Debug, PartialEq)]
1333            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1334        }
1335
1336        impl Type {
1337            /// Gets the enum value.
1338            ///
1339            /// Returns `None` if the enum contains an unknown value deserialized from
1340            /// the string representation of enums.
1341            pub fn value(&self) -> std::option::Option<i32> {
1342                match self {
1343                    Self::Unspecified => std::option::Option::Some(0),
1344                    Self::ChildLinkedSpan => std::option::Option::Some(1),
1345                    Self::ParentLinkedSpan => std::option::Option::Some(2),
1346                    Self::UnknownValue(u) => u.0.value(),
1347                }
1348            }
1349
1350            /// Gets the enum value as a string.
1351            ///
1352            /// Returns `None` if the enum contains an unknown value deserialized from
1353            /// the integer representation of enums.
1354            pub fn name(&self) -> std::option::Option<&str> {
1355                match self {
1356                    Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
1357                    Self::ChildLinkedSpan => std::option::Option::Some("CHILD_LINKED_SPAN"),
1358                    Self::ParentLinkedSpan => std::option::Option::Some("PARENT_LINKED_SPAN"),
1359                    Self::UnknownValue(u) => u.0.name(),
1360                }
1361            }
1362        }
1363
1364        impl std::default::Default for Type {
1365            fn default() -> Self {
1366                use std::convert::From;
1367                Self::from(0)
1368            }
1369        }
1370
1371        impl std::fmt::Display for Type {
1372            fn fmt(
1373                &self,
1374                f: &mut std::fmt::Formatter<'_>,
1375            ) -> std::result::Result<(), std::fmt::Error> {
1376                wkt::internal::display_enum(f, self.name(), self.value())
1377            }
1378        }
1379
1380        impl std::convert::From<i32> for Type {
1381            fn from(value: i32) -> Self {
1382                match value {
1383                    0 => Self::Unspecified,
1384                    1 => Self::ChildLinkedSpan,
1385                    2 => Self::ParentLinkedSpan,
1386                    _ => Self::UnknownValue(r#type::UnknownValue(
1387                        wkt::internal::UnknownEnumValue::Integer(value),
1388                    )),
1389                }
1390            }
1391        }
1392
1393        impl std::convert::From<&str> for Type {
1394            fn from(value: &str) -> Self {
1395                use std::string::ToString;
1396                match value {
1397                    "TYPE_UNSPECIFIED" => Self::Unspecified,
1398                    "CHILD_LINKED_SPAN" => Self::ChildLinkedSpan,
1399                    "PARENT_LINKED_SPAN" => Self::ParentLinkedSpan,
1400                    _ => Self::UnknownValue(r#type::UnknownValue(
1401                        wkt::internal::UnknownEnumValue::String(value.to_string()),
1402                    )),
1403                }
1404            }
1405        }
1406
1407        impl serde::ser::Serialize for Type {
1408            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1409            where
1410                S: serde::Serializer,
1411            {
1412                match self {
1413                    Self::Unspecified => serializer.serialize_i32(0),
1414                    Self::ChildLinkedSpan => serializer.serialize_i32(1),
1415                    Self::ParentLinkedSpan => serializer.serialize_i32(2),
1416                    Self::UnknownValue(u) => u.0.serialize(serializer),
1417                }
1418            }
1419        }
1420
1421        impl<'de> serde::de::Deserialize<'de> for Type {
1422            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1423            where
1424                D: serde::Deserializer<'de>,
1425            {
1426                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
1427                    ".google.devtools.cloudtrace.v2.Span.Link.Type",
1428                ))
1429            }
1430        }
1431    }
1432
1433    /// A collection of links, which are references from this span to a span
1434    /// in the same or different trace.
1435    #[derive(Clone, Default, PartialEq)]
1436    #[non_exhaustive]
1437    pub struct Links {
1438        /// A collection of links.
1439        pub link: std::vec::Vec<crate::model::span::Link>,
1440
1441        /// The number of dropped links after the maximum size was enforced. If
1442        /// this value is 0, then no links were dropped.
1443        pub dropped_links_count: i32,
1444
1445        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1446    }
1447
1448    impl Links {
1449        pub fn new() -> Self {
1450            std::default::Default::default()
1451        }
1452
1453        /// Sets the value of [link][crate::model::span::Links::link].
1454        ///
1455        /// # Example
1456        /// ```ignore,no_run
1457        /// # use google_cloud_trace_v2::model::span::Links;
1458        /// use google_cloud_trace_v2::model::span::Link;
1459        /// let x = Links::new()
1460        ///     .set_link([
1461        ///         Link::default()/* use setters */,
1462        ///         Link::default()/* use (different) setters */,
1463        ///     ]);
1464        /// ```
1465        pub fn set_link<T, V>(mut self, v: T) -> Self
1466        where
1467            T: std::iter::IntoIterator<Item = V>,
1468            V: std::convert::Into<crate::model::span::Link>,
1469        {
1470            use std::iter::Iterator;
1471            self.link = v.into_iter().map(|i| i.into()).collect();
1472            self
1473        }
1474
1475        /// Sets the value of [dropped_links_count][crate::model::span::Links::dropped_links_count].
1476        ///
1477        /// # Example
1478        /// ```ignore,no_run
1479        /// # use google_cloud_trace_v2::model::span::Links;
1480        /// let x = Links::new().set_dropped_links_count(42);
1481        /// ```
1482        pub fn set_dropped_links_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1483            self.dropped_links_count = v.into();
1484            self
1485        }
1486    }
1487
1488    impl wkt::message::Message for Links {
1489        fn typename() -> &'static str {
1490            "type.googleapis.com/google.devtools.cloudtrace.v2.Span.Links"
1491        }
1492    }
1493
1494    /// Type of span. Can be used to specify additional relationships between spans
1495    /// in addition to a parent/child relationship.
1496    ///
1497    /// # Working with unknown values
1498    ///
1499    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1500    /// additional enum variants at any time. Adding new variants is not considered
1501    /// a breaking change. Applications should write their code in anticipation of:
1502    ///
1503    /// - New values appearing in future releases of the client library, **and**
1504    /// - New values received dynamically, without application changes.
1505    ///
1506    /// Please consult the [Working with enums] section in the user guide for some
1507    /// guidelines.
1508    ///
1509    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1510    #[derive(Clone, Debug, PartialEq)]
1511    #[non_exhaustive]
1512    pub enum SpanKind {
1513        /// Unspecified. Do NOT use as default.
1514        /// Implementations MAY assume SpanKind.INTERNAL to be default.
1515        Unspecified,
1516        /// Indicates that the span is used internally. Default value.
1517        Internal,
1518        /// Indicates that the span covers server-side handling of an RPC or other
1519        /// remote network request.
1520        Server,
1521        /// Indicates that the span covers the client-side wrapper around an RPC or
1522        /// other remote request.
1523        Client,
1524        /// Indicates that the span describes producer sending a message to a broker.
1525        /// Unlike client and  server, there is no direct critical path latency
1526        /// relationship between producer and consumer spans (e.g. publishing a
1527        /// message to a pubsub service).
1528        Producer,
1529        /// Indicates that the span describes consumer receiving a message from a
1530        /// broker. Unlike client and  server, there is no direct critical path
1531        /// latency relationship between producer and consumer spans (e.g. receiving
1532        /// a message from a pubsub service subscription).
1533        Consumer,
1534        /// If set, the enum was initialized with an unknown value.
1535        ///
1536        /// Applications can examine the value using [SpanKind::value] or
1537        /// [SpanKind::name].
1538        UnknownValue(span_kind::UnknownValue),
1539    }
1540
1541    #[doc(hidden)]
1542    pub mod span_kind {
1543        #[allow(unused_imports)]
1544        use super::*;
1545        #[derive(Clone, Debug, PartialEq)]
1546        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1547    }
1548
1549    impl SpanKind {
1550        /// Gets the enum value.
1551        ///
1552        /// Returns `None` if the enum contains an unknown value deserialized from
1553        /// the string representation of enums.
1554        pub fn value(&self) -> std::option::Option<i32> {
1555            match self {
1556                Self::Unspecified => std::option::Option::Some(0),
1557                Self::Internal => std::option::Option::Some(1),
1558                Self::Server => std::option::Option::Some(2),
1559                Self::Client => std::option::Option::Some(3),
1560                Self::Producer => std::option::Option::Some(4),
1561                Self::Consumer => std::option::Option::Some(5),
1562                Self::UnknownValue(u) => u.0.value(),
1563            }
1564        }
1565
1566        /// Gets the enum value as a string.
1567        ///
1568        /// Returns `None` if the enum contains an unknown value deserialized from
1569        /// the integer representation of enums.
1570        pub fn name(&self) -> std::option::Option<&str> {
1571            match self {
1572                Self::Unspecified => std::option::Option::Some("SPAN_KIND_UNSPECIFIED"),
1573                Self::Internal => std::option::Option::Some("INTERNAL"),
1574                Self::Server => std::option::Option::Some("SERVER"),
1575                Self::Client => std::option::Option::Some("CLIENT"),
1576                Self::Producer => std::option::Option::Some("PRODUCER"),
1577                Self::Consumer => std::option::Option::Some("CONSUMER"),
1578                Self::UnknownValue(u) => u.0.name(),
1579            }
1580        }
1581    }
1582
1583    impl std::default::Default for SpanKind {
1584        fn default() -> Self {
1585            use std::convert::From;
1586            Self::from(0)
1587        }
1588    }
1589
1590    impl std::fmt::Display for SpanKind {
1591        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1592            wkt::internal::display_enum(f, self.name(), self.value())
1593        }
1594    }
1595
1596    impl std::convert::From<i32> for SpanKind {
1597        fn from(value: i32) -> Self {
1598            match value {
1599                0 => Self::Unspecified,
1600                1 => Self::Internal,
1601                2 => Self::Server,
1602                3 => Self::Client,
1603                4 => Self::Producer,
1604                5 => Self::Consumer,
1605                _ => Self::UnknownValue(span_kind::UnknownValue(
1606                    wkt::internal::UnknownEnumValue::Integer(value),
1607                )),
1608            }
1609        }
1610    }
1611
1612    impl std::convert::From<&str> for SpanKind {
1613        fn from(value: &str) -> Self {
1614            use std::string::ToString;
1615            match value {
1616                "SPAN_KIND_UNSPECIFIED" => Self::Unspecified,
1617                "INTERNAL" => Self::Internal,
1618                "SERVER" => Self::Server,
1619                "CLIENT" => Self::Client,
1620                "PRODUCER" => Self::Producer,
1621                "CONSUMER" => Self::Consumer,
1622                _ => Self::UnknownValue(span_kind::UnknownValue(
1623                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1624                )),
1625            }
1626        }
1627    }
1628
1629    impl serde::ser::Serialize for SpanKind {
1630        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1631        where
1632            S: serde::Serializer,
1633        {
1634            match self {
1635                Self::Unspecified => serializer.serialize_i32(0),
1636                Self::Internal => serializer.serialize_i32(1),
1637                Self::Server => serializer.serialize_i32(2),
1638                Self::Client => serializer.serialize_i32(3),
1639                Self::Producer => serializer.serialize_i32(4),
1640                Self::Consumer => serializer.serialize_i32(5),
1641                Self::UnknownValue(u) => u.0.serialize(serializer),
1642            }
1643        }
1644    }
1645
1646    impl<'de> serde::de::Deserialize<'de> for SpanKind {
1647        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1648        where
1649            D: serde::Deserializer<'de>,
1650        {
1651            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SpanKind>::new(
1652                ".google.devtools.cloudtrace.v2.Span.SpanKind",
1653            ))
1654        }
1655    }
1656}
1657
1658/// The allowed types for `[VALUE]` in a `[KEY]:[VALUE]` attribute.
1659#[derive(Clone, Default, PartialEq)]
1660#[non_exhaustive]
1661pub struct AttributeValue {
1662    /// The type of the value.
1663    pub value: std::option::Option<crate::model::attribute_value::Value>,
1664
1665    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1666}
1667
1668impl AttributeValue {
1669    pub fn new() -> Self {
1670        std::default::Default::default()
1671    }
1672
1673    /// Sets the value of [value][crate::model::AttributeValue::value].
1674    ///
1675    /// Note that all the setters affecting `value` are mutually
1676    /// exclusive.
1677    ///
1678    /// # Example
1679    /// ```ignore,no_run
1680    /// # use google_cloud_trace_v2::model::AttributeValue;
1681    /// use google_cloud_trace_v2::model::attribute_value::Value;
1682    /// let x = AttributeValue::new().set_value(Some(Value::IntValue(42)));
1683    /// ```
1684    pub fn set_value<
1685        T: std::convert::Into<std::option::Option<crate::model::attribute_value::Value>>,
1686    >(
1687        mut self,
1688        v: T,
1689    ) -> Self {
1690        self.value = v.into();
1691        self
1692    }
1693
1694    /// The value of [value][crate::model::AttributeValue::value]
1695    /// if it holds a `StringValue`, `None` if the field is not set or
1696    /// holds a different branch.
1697    pub fn string_value(
1698        &self,
1699    ) -> std::option::Option<&std::boxed::Box<crate::model::TruncatableString>> {
1700        #[allow(unreachable_patterns)]
1701        self.value.as_ref().and_then(|v| match v {
1702            crate::model::attribute_value::Value::StringValue(v) => std::option::Option::Some(v),
1703            _ => std::option::Option::None,
1704        })
1705    }
1706
1707    /// Sets the value of [value][crate::model::AttributeValue::value]
1708    /// to hold a `StringValue`.
1709    ///
1710    /// Note that all the setters affecting `value` are
1711    /// mutually exclusive.
1712    ///
1713    /// # Example
1714    /// ```ignore,no_run
1715    /// # use google_cloud_trace_v2::model::AttributeValue;
1716    /// use google_cloud_trace_v2::model::TruncatableString;
1717    /// let x = AttributeValue::new().set_string_value(TruncatableString::default()/* use setters */);
1718    /// assert!(x.string_value().is_some());
1719    /// assert!(x.int_value().is_none());
1720    /// assert!(x.bool_value().is_none());
1721    /// ```
1722    pub fn set_string_value<
1723        T: std::convert::Into<std::boxed::Box<crate::model::TruncatableString>>,
1724    >(
1725        mut self,
1726        v: T,
1727    ) -> Self {
1728        self.value =
1729            std::option::Option::Some(crate::model::attribute_value::Value::StringValue(v.into()));
1730        self
1731    }
1732
1733    /// The value of [value][crate::model::AttributeValue::value]
1734    /// if it holds a `IntValue`, `None` if the field is not set or
1735    /// holds a different branch.
1736    pub fn int_value(&self) -> std::option::Option<&i64> {
1737        #[allow(unreachable_patterns)]
1738        self.value.as_ref().and_then(|v| match v {
1739            crate::model::attribute_value::Value::IntValue(v) => std::option::Option::Some(v),
1740            _ => std::option::Option::None,
1741        })
1742    }
1743
1744    /// Sets the value of [value][crate::model::AttributeValue::value]
1745    /// to hold a `IntValue`.
1746    ///
1747    /// Note that all the setters affecting `value` are
1748    /// mutually exclusive.
1749    ///
1750    /// # Example
1751    /// ```ignore,no_run
1752    /// # use google_cloud_trace_v2::model::AttributeValue;
1753    /// let x = AttributeValue::new().set_int_value(42);
1754    /// assert!(x.int_value().is_some());
1755    /// assert!(x.string_value().is_none());
1756    /// assert!(x.bool_value().is_none());
1757    /// ```
1758    pub fn set_int_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1759        self.value =
1760            std::option::Option::Some(crate::model::attribute_value::Value::IntValue(v.into()));
1761        self
1762    }
1763
1764    /// The value of [value][crate::model::AttributeValue::value]
1765    /// if it holds a `BoolValue`, `None` if the field is not set or
1766    /// holds a different branch.
1767    pub fn bool_value(&self) -> std::option::Option<&bool> {
1768        #[allow(unreachable_patterns)]
1769        self.value.as_ref().and_then(|v| match v {
1770            crate::model::attribute_value::Value::BoolValue(v) => std::option::Option::Some(v),
1771            _ => std::option::Option::None,
1772        })
1773    }
1774
1775    /// Sets the value of [value][crate::model::AttributeValue::value]
1776    /// to hold a `BoolValue`.
1777    ///
1778    /// Note that all the setters affecting `value` are
1779    /// mutually exclusive.
1780    ///
1781    /// # Example
1782    /// ```ignore,no_run
1783    /// # use google_cloud_trace_v2::model::AttributeValue;
1784    /// let x = AttributeValue::new().set_bool_value(true);
1785    /// assert!(x.bool_value().is_some());
1786    /// assert!(x.string_value().is_none());
1787    /// assert!(x.int_value().is_none());
1788    /// ```
1789    pub fn set_bool_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1790        self.value =
1791            std::option::Option::Some(crate::model::attribute_value::Value::BoolValue(v.into()));
1792        self
1793    }
1794}
1795
1796impl wkt::message::Message for AttributeValue {
1797    fn typename() -> &'static str {
1798        "type.googleapis.com/google.devtools.cloudtrace.v2.AttributeValue"
1799    }
1800}
1801
1802/// Defines additional types related to [AttributeValue].
1803pub mod attribute_value {
1804    #[allow(unused_imports)]
1805    use super::*;
1806
1807    /// The type of the value.
1808    #[derive(Clone, Debug, PartialEq)]
1809    #[non_exhaustive]
1810    pub enum Value {
1811        /// A string up to 256 bytes long.
1812        StringValue(std::boxed::Box<crate::model::TruncatableString>),
1813        /// A 64-bit signed integer.
1814        IntValue(i64),
1815        /// A Boolean value represented by `true` or `false`.
1816        BoolValue(bool),
1817    }
1818}
1819
1820/// A call stack appearing in a trace.
1821#[derive(Clone, Default, PartialEq)]
1822#[non_exhaustive]
1823pub struct StackTrace {
1824    /// Stack frames in this stack trace. A maximum of 128 frames are allowed.
1825    pub stack_frames: std::option::Option<crate::model::stack_trace::StackFrames>,
1826
1827    /// The hash ID is used to conserve network bandwidth for duplicate
1828    /// stack traces within a single trace.
1829    ///
1830    /// Often multiple spans will have identical stack traces.
1831    /// The first occurrence of a stack trace should contain both the
1832    /// `stackFrame` content and a value in `stackTraceHashId`.
1833    ///
1834    /// Subsequent spans within the same request can refer
1835    /// to that stack trace by only setting `stackTraceHashId`.
1836    pub stack_trace_hash_id: i64,
1837
1838    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1839}
1840
1841impl StackTrace {
1842    pub fn new() -> Self {
1843        std::default::Default::default()
1844    }
1845
1846    /// Sets the value of [stack_frames][crate::model::StackTrace::stack_frames].
1847    ///
1848    /// # Example
1849    /// ```ignore,no_run
1850    /// # use google_cloud_trace_v2::model::StackTrace;
1851    /// use google_cloud_trace_v2::model::stack_trace::StackFrames;
1852    /// let x = StackTrace::new().set_stack_frames(StackFrames::default()/* use setters */);
1853    /// ```
1854    pub fn set_stack_frames<T>(mut self, v: T) -> Self
1855    where
1856        T: std::convert::Into<crate::model::stack_trace::StackFrames>,
1857    {
1858        self.stack_frames = std::option::Option::Some(v.into());
1859        self
1860    }
1861
1862    /// Sets or clears the value of [stack_frames][crate::model::StackTrace::stack_frames].
1863    ///
1864    /// # Example
1865    /// ```ignore,no_run
1866    /// # use google_cloud_trace_v2::model::StackTrace;
1867    /// use google_cloud_trace_v2::model::stack_trace::StackFrames;
1868    /// let x = StackTrace::new().set_or_clear_stack_frames(Some(StackFrames::default()/* use setters */));
1869    /// let x = StackTrace::new().set_or_clear_stack_frames(None::<StackFrames>);
1870    /// ```
1871    pub fn set_or_clear_stack_frames<T>(mut self, v: std::option::Option<T>) -> Self
1872    where
1873        T: std::convert::Into<crate::model::stack_trace::StackFrames>,
1874    {
1875        self.stack_frames = v.map(|x| x.into());
1876        self
1877    }
1878
1879    /// Sets the value of [stack_trace_hash_id][crate::model::StackTrace::stack_trace_hash_id].
1880    ///
1881    /// # Example
1882    /// ```ignore,no_run
1883    /// # use google_cloud_trace_v2::model::StackTrace;
1884    /// let x = StackTrace::new().set_stack_trace_hash_id(42);
1885    /// ```
1886    pub fn set_stack_trace_hash_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1887        self.stack_trace_hash_id = v.into();
1888        self
1889    }
1890}
1891
1892impl wkt::message::Message for StackTrace {
1893    fn typename() -> &'static str {
1894        "type.googleapis.com/google.devtools.cloudtrace.v2.StackTrace"
1895    }
1896}
1897
1898/// Defines additional types related to [StackTrace].
1899pub mod stack_trace {
1900    #[allow(unused_imports)]
1901    use super::*;
1902
1903    /// Represents a single stack frame in a stack trace.
1904    #[derive(Clone, Default, PartialEq)]
1905    #[non_exhaustive]
1906    pub struct StackFrame {
1907        /// The fully-qualified name that uniquely identifies the function or
1908        /// method that is active in this frame (up to 1024 bytes).
1909        pub function_name: std::option::Option<crate::model::TruncatableString>,
1910
1911        /// An un-mangled function name, if `function_name` is mangled.
1912        /// To get information about name mangling, run
1913        /// [this search](https://www.google.com/search?q=cxx+name+mangling).
1914        /// The name can be fully-qualified (up to 1024 bytes).
1915        pub original_function_name: std::option::Option<crate::model::TruncatableString>,
1916
1917        /// The name of the source file where the function call appears (up to 256
1918        /// bytes).
1919        pub file_name: std::option::Option<crate::model::TruncatableString>,
1920
1921        /// The line number in `file_name` where the function call appears.
1922        pub line_number: i64,
1923
1924        /// The column number where the function call appears, if available.
1925        /// This is important in JavaScript because of its anonymous functions.
1926        pub column_number: i64,
1927
1928        /// The binary module from where the code was loaded.
1929        pub load_module: std::option::Option<crate::model::Module>,
1930
1931        /// The version of the deployed source code (up to 128 bytes).
1932        pub source_version: std::option::Option<crate::model::TruncatableString>,
1933
1934        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1935    }
1936
1937    impl StackFrame {
1938        pub fn new() -> Self {
1939            std::default::Default::default()
1940        }
1941
1942        /// Sets the value of [function_name][crate::model::stack_trace::StackFrame::function_name].
1943        ///
1944        /// # Example
1945        /// ```ignore,no_run
1946        /// # use google_cloud_trace_v2::model::stack_trace::StackFrame;
1947        /// use google_cloud_trace_v2::model::TruncatableString;
1948        /// let x = StackFrame::new().set_function_name(TruncatableString::default()/* use setters */);
1949        /// ```
1950        pub fn set_function_name<T>(mut self, v: T) -> Self
1951        where
1952            T: std::convert::Into<crate::model::TruncatableString>,
1953        {
1954            self.function_name = std::option::Option::Some(v.into());
1955            self
1956        }
1957
1958        /// Sets or clears the value of [function_name][crate::model::stack_trace::StackFrame::function_name].
1959        ///
1960        /// # Example
1961        /// ```ignore,no_run
1962        /// # use google_cloud_trace_v2::model::stack_trace::StackFrame;
1963        /// use google_cloud_trace_v2::model::TruncatableString;
1964        /// let x = StackFrame::new().set_or_clear_function_name(Some(TruncatableString::default()/* use setters */));
1965        /// let x = StackFrame::new().set_or_clear_function_name(None::<TruncatableString>);
1966        /// ```
1967        pub fn set_or_clear_function_name<T>(mut self, v: std::option::Option<T>) -> Self
1968        where
1969            T: std::convert::Into<crate::model::TruncatableString>,
1970        {
1971            self.function_name = v.map(|x| x.into());
1972            self
1973        }
1974
1975        /// Sets the value of [original_function_name][crate::model::stack_trace::StackFrame::original_function_name].
1976        ///
1977        /// # Example
1978        /// ```ignore,no_run
1979        /// # use google_cloud_trace_v2::model::stack_trace::StackFrame;
1980        /// use google_cloud_trace_v2::model::TruncatableString;
1981        /// let x = StackFrame::new().set_original_function_name(TruncatableString::default()/* use setters */);
1982        /// ```
1983        pub fn set_original_function_name<T>(mut self, v: T) -> Self
1984        where
1985            T: std::convert::Into<crate::model::TruncatableString>,
1986        {
1987            self.original_function_name = std::option::Option::Some(v.into());
1988            self
1989        }
1990
1991        /// Sets or clears the value of [original_function_name][crate::model::stack_trace::StackFrame::original_function_name].
1992        ///
1993        /// # Example
1994        /// ```ignore,no_run
1995        /// # use google_cloud_trace_v2::model::stack_trace::StackFrame;
1996        /// use google_cloud_trace_v2::model::TruncatableString;
1997        /// let x = StackFrame::new().set_or_clear_original_function_name(Some(TruncatableString::default()/* use setters */));
1998        /// let x = StackFrame::new().set_or_clear_original_function_name(None::<TruncatableString>);
1999        /// ```
2000        pub fn set_or_clear_original_function_name<T>(mut self, v: std::option::Option<T>) -> Self
2001        where
2002            T: std::convert::Into<crate::model::TruncatableString>,
2003        {
2004            self.original_function_name = v.map(|x| x.into());
2005            self
2006        }
2007
2008        /// Sets the value of [file_name][crate::model::stack_trace::StackFrame::file_name].
2009        ///
2010        /// # Example
2011        /// ```ignore,no_run
2012        /// # use google_cloud_trace_v2::model::stack_trace::StackFrame;
2013        /// use google_cloud_trace_v2::model::TruncatableString;
2014        /// let x = StackFrame::new().set_file_name(TruncatableString::default()/* use setters */);
2015        /// ```
2016        pub fn set_file_name<T>(mut self, v: T) -> Self
2017        where
2018            T: std::convert::Into<crate::model::TruncatableString>,
2019        {
2020            self.file_name = std::option::Option::Some(v.into());
2021            self
2022        }
2023
2024        /// Sets or clears the value of [file_name][crate::model::stack_trace::StackFrame::file_name].
2025        ///
2026        /// # Example
2027        /// ```ignore,no_run
2028        /// # use google_cloud_trace_v2::model::stack_trace::StackFrame;
2029        /// use google_cloud_trace_v2::model::TruncatableString;
2030        /// let x = StackFrame::new().set_or_clear_file_name(Some(TruncatableString::default()/* use setters */));
2031        /// let x = StackFrame::new().set_or_clear_file_name(None::<TruncatableString>);
2032        /// ```
2033        pub fn set_or_clear_file_name<T>(mut self, v: std::option::Option<T>) -> Self
2034        where
2035            T: std::convert::Into<crate::model::TruncatableString>,
2036        {
2037            self.file_name = v.map(|x| x.into());
2038            self
2039        }
2040
2041        /// Sets the value of [line_number][crate::model::stack_trace::StackFrame::line_number].
2042        ///
2043        /// # Example
2044        /// ```ignore,no_run
2045        /// # use google_cloud_trace_v2::model::stack_trace::StackFrame;
2046        /// let x = StackFrame::new().set_line_number(42);
2047        /// ```
2048        pub fn set_line_number<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2049            self.line_number = v.into();
2050            self
2051        }
2052
2053        /// Sets the value of [column_number][crate::model::stack_trace::StackFrame::column_number].
2054        ///
2055        /// # Example
2056        /// ```ignore,no_run
2057        /// # use google_cloud_trace_v2::model::stack_trace::StackFrame;
2058        /// let x = StackFrame::new().set_column_number(42);
2059        /// ```
2060        pub fn set_column_number<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2061            self.column_number = v.into();
2062            self
2063        }
2064
2065        /// Sets the value of [load_module][crate::model::stack_trace::StackFrame::load_module].
2066        ///
2067        /// # Example
2068        /// ```ignore,no_run
2069        /// # use google_cloud_trace_v2::model::stack_trace::StackFrame;
2070        /// use google_cloud_trace_v2::model::Module;
2071        /// let x = StackFrame::new().set_load_module(Module::default()/* use setters */);
2072        /// ```
2073        pub fn set_load_module<T>(mut self, v: T) -> Self
2074        where
2075            T: std::convert::Into<crate::model::Module>,
2076        {
2077            self.load_module = std::option::Option::Some(v.into());
2078            self
2079        }
2080
2081        /// Sets or clears the value of [load_module][crate::model::stack_trace::StackFrame::load_module].
2082        ///
2083        /// # Example
2084        /// ```ignore,no_run
2085        /// # use google_cloud_trace_v2::model::stack_trace::StackFrame;
2086        /// use google_cloud_trace_v2::model::Module;
2087        /// let x = StackFrame::new().set_or_clear_load_module(Some(Module::default()/* use setters */));
2088        /// let x = StackFrame::new().set_or_clear_load_module(None::<Module>);
2089        /// ```
2090        pub fn set_or_clear_load_module<T>(mut self, v: std::option::Option<T>) -> Self
2091        where
2092            T: std::convert::Into<crate::model::Module>,
2093        {
2094            self.load_module = v.map(|x| x.into());
2095            self
2096        }
2097
2098        /// Sets the value of [source_version][crate::model::stack_trace::StackFrame::source_version].
2099        ///
2100        /// # Example
2101        /// ```ignore,no_run
2102        /// # use google_cloud_trace_v2::model::stack_trace::StackFrame;
2103        /// use google_cloud_trace_v2::model::TruncatableString;
2104        /// let x = StackFrame::new().set_source_version(TruncatableString::default()/* use setters */);
2105        /// ```
2106        pub fn set_source_version<T>(mut self, v: T) -> Self
2107        where
2108            T: std::convert::Into<crate::model::TruncatableString>,
2109        {
2110            self.source_version = std::option::Option::Some(v.into());
2111            self
2112        }
2113
2114        /// Sets or clears the value of [source_version][crate::model::stack_trace::StackFrame::source_version].
2115        ///
2116        /// # Example
2117        /// ```ignore,no_run
2118        /// # use google_cloud_trace_v2::model::stack_trace::StackFrame;
2119        /// use google_cloud_trace_v2::model::TruncatableString;
2120        /// let x = StackFrame::new().set_or_clear_source_version(Some(TruncatableString::default()/* use setters */));
2121        /// let x = StackFrame::new().set_or_clear_source_version(None::<TruncatableString>);
2122        /// ```
2123        pub fn set_or_clear_source_version<T>(mut self, v: std::option::Option<T>) -> Self
2124        where
2125            T: std::convert::Into<crate::model::TruncatableString>,
2126        {
2127            self.source_version = v.map(|x| x.into());
2128            self
2129        }
2130    }
2131
2132    impl wkt::message::Message for StackFrame {
2133        fn typename() -> &'static str {
2134            "type.googleapis.com/google.devtools.cloudtrace.v2.StackTrace.StackFrame"
2135        }
2136    }
2137
2138    /// A collection of stack frames, which can be truncated.
2139    #[derive(Clone, Default, PartialEq)]
2140    #[non_exhaustive]
2141    pub struct StackFrames {
2142        /// Stack frames in this call stack.
2143        pub frame: std::vec::Vec<crate::model::stack_trace::StackFrame>,
2144
2145        /// The number of stack frames that were dropped because there
2146        /// were too many stack frames.
2147        /// If this value is 0, then no stack frames were dropped.
2148        pub dropped_frames_count: i32,
2149
2150        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2151    }
2152
2153    impl StackFrames {
2154        pub fn new() -> Self {
2155            std::default::Default::default()
2156        }
2157
2158        /// Sets the value of [frame][crate::model::stack_trace::StackFrames::frame].
2159        ///
2160        /// # Example
2161        /// ```ignore,no_run
2162        /// # use google_cloud_trace_v2::model::stack_trace::StackFrames;
2163        /// use google_cloud_trace_v2::model::stack_trace::StackFrame;
2164        /// let x = StackFrames::new()
2165        ///     .set_frame([
2166        ///         StackFrame::default()/* use setters */,
2167        ///         StackFrame::default()/* use (different) setters */,
2168        ///     ]);
2169        /// ```
2170        pub fn set_frame<T, V>(mut self, v: T) -> Self
2171        where
2172            T: std::iter::IntoIterator<Item = V>,
2173            V: std::convert::Into<crate::model::stack_trace::StackFrame>,
2174        {
2175            use std::iter::Iterator;
2176            self.frame = v.into_iter().map(|i| i.into()).collect();
2177            self
2178        }
2179
2180        /// Sets the value of [dropped_frames_count][crate::model::stack_trace::StackFrames::dropped_frames_count].
2181        ///
2182        /// # Example
2183        /// ```ignore,no_run
2184        /// # use google_cloud_trace_v2::model::stack_trace::StackFrames;
2185        /// let x = StackFrames::new().set_dropped_frames_count(42);
2186        /// ```
2187        pub fn set_dropped_frames_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2188            self.dropped_frames_count = v.into();
2189            self
2190        }
2191    }
2192
2193    impl wkt::message::Message for StackFrames {
2194        fn typename() -> &'static str {
2195            "type.googleapis.com/google.devtools.cloudtrace.v2.StackTrace.StackFrames"
2196        }
2197    }
2198}
2199
2200/// Binary module.
2201#[derive(Clone, Default, PartialEq)]
2202#[non_exhaustive]
2203pub struct Module {
2204    /// For example: main binary, kernel modules, and dynamic libraries
2205    /// such as libc.so, sharedlib.so (up to 256 bytes).
2206    pub module: std::option::Option<crate::model::TruncatableString>,
2207
2208    /// A unique identifier for the module, usually a hash of its
2209    /// contents (up to 128 bytes).
2210    pub build_id: std::option::Option<crate::model::TruncatableString>,
2211
2212    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2213}
2214
2215impl Module {
2216    pub fn new() -> Self {
2217        std::default::Default::default()
2218    }
2219
2220    /// Sets the value of [module][crate::model::Module::module].
2221    ///
2222    /// # Example
2223    /// ```ignore,no_run
2224    /// # use google_cloud_trace_v2::model::Module;
2225    /// use google_cloud_trace_v2::model::TruncatableString;
2226    /// let x = Module::new().set_module(TruncatableString::default()/* use setters */);
2227    /// ```
2228    pub fn set_module<T>(mut self, v: T) -> Self
2229    where
2230        T: std::convert::Into<crate::model::TruncatableString>,
2231    {
2232        self.module = std::option::Option::Some(v.into());
2233        self
2234    }
2235
2236    /// Sets or clears the value of [module][crate::model::Module::module].
2237    ///
2238    /// # Example
2239    /// ```ignore,no_run
2240    /// # use google_cloud_trace_v2::model::Module;
2241    /// use google_cloud_trace_v2::model::TruncatableString;
2242    /// let x = Module::new().set_or_clear_module(Some(TruncatableString::default()/* use setters */));
2243    /// let x = Module::new().set_or_clear_module(None::<TruncatableString>);
2244    /// ```
2245    pub fn set_or_clear_module<T>(mut self, v: std::option::Option<T>) -> Self
2246    where
2247        T: std::convert::Into<crate::model::TruncatableString>,
2248    {
2249        self.module = v.map(|x| x.into());
2250        self
2251    }
2252
2253    /// Sets the value of [build_id][crate::model::Module::build_id].
2254    ///
2255    /// # Example
2256    /// ```ignore,no_run
2257    /// # use google_cloud_trace_v2::model::Module;
2258    /// use google_cloud_trace_v2::model::TruncatableString;
2259    /// let x = Module::new().set_build_id(TruncatableString::default()/* use setters */);
2260    /// ```
2261    pub fn set_build_id<T>(mut self, v: T) -> Self
2262    where
2263        T: std::convert::Into<crate::model::TruncatableString>,
2264    {
2265        self.build_id = std::option::Option::Some(v.into());
2266        self
2267    }
2268
2269    /// Sets or clears the value of [build_id][crate::model::Module::build_id].
2270    ///
2271    /// # Example
2272    /// ```ignore,no_run
2273    /// # use google_cloud_trace_v2::model::Module;
2274    /// use google_cloud_trace_v2::model::TruncatableString;
2275    /// let x = Module::new().set_or_clear_build_id(Some(TruncatableString::default()/* use setters */));
2276    /// let x = Module::new().set_or_clear_build_id(None::<TruncatableString>);
2277    /// ```
2278    pub fn set_or_clear_build_id<T>(mut self, v: std::option::Option<T>) -> Self
2279    where
2280        T: std::convert::Into<crate::model::TruncatableString>,
2281    {
2282        self.build_id = v.map(|x| x.into());
2283        self
2284    }
2285}
2286
2287impl wkt::message::Message for Module {
2288    fn typename() -> &'static str {
2289        "type.googleapis.com/google.devtools.cloudtrace.v2.Module"
2290    }
2291}
2292
2293/// Represents a string that might be shortened to a specified length.
2294#[derive(Clone, Default, PartialEq)]
2295#[non_exhaustive]
2296pub struct TruncatableString {
2297    /// The shortened string. For example, if the original string is 500
2298    /// bytes long and the limit of the string is 128 bytes, then
2299    /// `value` contains the first 128 bytes of the 500-byte string.
2300    ///
2301    /// Truncation always happens on a UTF8 character boundary. If there
2302    /// are multi-byte characters in the string, then the length of the
2303    /// shortened string might be less than the size limit.
2304    pub value: std::string::String,
2305
2306    /// The number of bytes removed from the original string. If this
2307    /// value is 0, then the string was not shortened.
2308    pub truncated_byte_count: i32,
2309
2310    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2311}
2312
2313impl TruncatableString {
2314    pub fn new() -> Self {
2315        std::default::Default::default()
2316    }
2317
2318    /// Sets the value of [value][crate::model::TruncatableString::value].
2319    ///
2320    /// # Example
2321    /// ```ignore,no_run
2322    /// # use google_cloud_trace_v2::model::TruncatableString;
2323    /// let x = TruncatableString::new().set_value("example");
2324    /// ```
2325    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2326        self.value = v.into();
2327        self
2328    }
2329
2330    /// Sets the value of [truncated_byte_count][crate::model::TruncatableString::truncated_byte_count].
2331    ///
2332    /// # Example
2333    /// ```ignore,no_run
2334    /// # use google_cloud_trace_v2::model::TruncatableString;
2335    /// let x = TruncatableString::new().set_truncated_byte_count(42);
2336    /// ```
2337    pub fn set_truncated_byte_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2338        self.truncated_byte_count = v.into();
2339        self
2340    }
2341}
2342
2343impl wkt::message::Message for TruncatableString {
2344    fn typename() -> &'static str {
2345        "type.googleapis.com/google.devtools.cloudtrace.v2.TruncatableString"
2346    }
2347}
2348
2349/// The request message for the `BatchWriteSpans` method.
2350#[derive(Clone, Default, PartialEq)]
2351#[non_exhaustive]
2352pub struct BatchWriteSpansRequest {
2353    /// Required. The name of the project where the spans belong. The format is
2354    /// `projects/[PROJECT_ID]`.
2355    pub name: std::string::String,
2356
2357    /// Required. A list of new spans. The span names must not match existing
2358    /// spans, otherwise the results are undefined.
2359    pub spans: std::vec::Vec<crate::model::Span>,
2360
2361    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2362}
2363
2364impl BatchWriteSpansRequest {
2365    pub fn new() -> Self {
2366        std::default::Default::default()
2367    }
2368
2369    /// Sets the value of [name][crate::model::BatchWriteSpansRequest::name].
2370    ///
2371    /// # Example
2372    /// ```ignore,no_run
2373    /// # use google_cloud_trace_v2::model::BatchWriteSpansRequest;
2374    /// let x = BatchWriteSpansRequest::new().set_name("example");
2375    /// ```
2376    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2377        self.name = v.into();
2378        self
2379    }
2380
2381    /// Sets the value of [spans][crate::model::BatchWriteSpansRequest::spans].
2382    ///
2383    /// # Example
2384    /// ```ignore,no_run
2385    /// # use google_cloud_trace_v2::model::BatchWriteSpansRequest;
2386    /// use google_cloud_trace_v2::model::Span;
2387    /// let x = BatchWriteSpansRequest::new()
2388    ///     .set_spans([
2389    ///         Span::default()/* use setters */,
2390    ///         Span::default()/* use (different) setters */,
2391    ///     ]);
2392    /// ```
2393    pub fn set_spans<T, V>(mut self, v: T) -> Self
2394    where
2395        T: std::iter::IntoIterator<Item = V>,
2396        V: std::convert::Into<crate::model::Span>,
2397    {
2398        use std::iter::Iterator;
2399        self.spans = v.into_iter().map(|i| i.into()).collect();
2400        self
2401    }
2402}
2403
2404impl wkt::message::Message for BatchWriteSpansRequest {
2405    fn typename() -> &'static str {
2406        "type.googleapis.com/google.devtools.cloudtrace.v2.BatchWriteSpansRequest"
2407    }
2408}