fidl_fuchsia_inspect_deprecated_common/
fidl_fuchsia_inspect_deprecated_common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12pub struct InspectListChildrenResponse {
13    pub children_names: Vec<String>,
14}
15
16impl fidl::Persistable for InspectListChildrenResponse {}
17
18#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
19pub struct InspectOpenChildResponse {
20    pub success: bool,
21}
22
23impl fidl::Persistable for InspectOpenChildResponse {}
24
25#[derive(Clone, Debug, PartialEq, PartialOrd)]
26pub struct InspectReadDataResponse {
27    pub object: Object,
28}
29
30impl fidl::Persistable for InspectReadDataResponse {}
31
32#[derive(Clone, Debug, PartialEq, PartialOrd)]
33pub struct Metric {
34    pub key: String,
35    pub value: MetricValue,
36}
37
38impl fidl::Persistable for Metric {}
39
40#[derive(Clone, Debug, PartialEq, PartialOrd)]
41pub struct Object {
42    pub name: String,
43    pub properties: Vec<Property>,
44    pub metrics: Vec<Metric>,
45}
46
47impl fidl::Persistable for Object {}
48
49#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
50pub struct Property {
51    pub key: String,
52    pub value: PropertyValue,
53}
54
55impl fidl::Persistable for Property {}
56
57#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
58pub enum MetricValue {
59    IntValue(i64),
60    UintValue(u64),
61    DoubleValue(f64),
62}
63
64impl MetricValue {
65    #[inline]
66    pub fn ordinal(&self) -> u64 {
67        match *self {
68            Self::IntValue(_) => 1,
69            Self::UintValue(_) => 2,
70            Self::DoubleValue(_) => 3,
71        }
72    }
73
74    #[deprecated = "Strict unions should not use `is_unknown`"]
75    #[inline]
76    pub fn is_unknown(&self) -> bool {
77        false
78    }
79}
80
81impl fidl::Persistable for MetricValue {}
82
83#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
84pub enum PropertyValue {
85    Str(String),
86    Bytes(Vec<u8>),
87}
88
89impl PropertyValue {
90    #[inline]
91    pub fn ordinal(&self) -> u64 {
92        match *self {
93            Self::Str(_) => 1,
94            Self::Bytes(_) => 2,
95        }
96    }
97
98    #[deprecated = "Strict unions should not use `is_unknown`"]
99    #[inline]
100    pub fn is_unknown(&self) -> bool {
101        false
102    }
103}
104
105impl fidl::Persistable for PropertyValue {}
106
107mod internal {
108    use super::*;
109
110    impl fidl::encoding::ValueTypeMarker for InspectListChildrenResponse {
111        type Borrowed<'a> = &'a Self;
112        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
113            value
114        }
115    }
116
117    unsafe impl fidl::encoding::TypeMarker for InspectListChildrenResponse {
118        type Owned = Self;
119
120        #[inline(always)]
121        fn inline_align(_context: fidl::encoding::Context) -> usize {
122            8
123        }
124
125        #[inline(always)]
126        fn inline_size(_context: fidl::encoding::Context) -> usize {
127            16
128        }
129    }
130
131    unsafe impl<D: fidl::encoding::ResourceDialect>
132        fidl::encoding::Encode<InspectListChildrenResponse, D> for &InspectListChildrenResponse
133    {
134        #[inline]
135        unsafe fn encode(
136            self,
137            encoder: &mut fidl::encoding::Encoder<'_, D>,
138            offset: usize,
139            _depth: fidl::encoding::Depth,
140        ) -> fidl::Result<()> {
141            encoder.debug_check_bounds::<InspectListChildrenResponse>(offset);
142            // Delegate to tuple encoding.
143            fidl::encoding::Encode::<InspectListChildrenResponse, D>::encode(
144                (
145                    <fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.children_names),
146                ),
147                encoder, offset, _depth
148            )
149        }
150    }
151    unsafe impl<
152            D: fidl::encoding::ResourceDialect,
153            T0: fidl::encoding::Encode<
154                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
155                D,
156            >,
157        > fidl::encoding::Encode<InspectListChildrenResponse, D> for (T0,)
158    {
159        #[inline]
160        unsafe fn encode(
161            self,
162            encoder: &mut fidl::encoding::Encoder<'_, D>,
163            offset: usize,
164            depth: fidl::encoding::Depth,
165        ) -> fidl::Result<()> {
166            encoder.debug_check_bounds::<InspectListChildrenResponse>(offset);
167            // Zero out padding regions. There's no need to apply masks
168            // because the unmasked parts will be overwritten by fields.
169            // Write the fields.
170            self.0.encode(encoder, offset + 0, depth)?;
171            Ok(())
172        }
173    }
174
175    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
176        for InspectListChildrenResponse
177    {
178        #[inline(always)]
179        fn new_empty() -> Self {
180            Self {
181                children_names: fidl::new_empty!(
182                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
183                    D
184                ),
185            }
186        }
187
188        #[inline]
189        unsafe fn decode(
190            &mut self,
191            decoder: &mut fidl::encoding::Decoder<'_, D>,
192            offset: usize,
193            _depth: fidl::encoding::Depth,
194        ) -> fidl::Result<()> {
195            decoder.debug_check_bounds::<Self>(offset);
196            // Verify that padding bytes are zero.
197            fidl::decode!(
198                fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
199                D,
200                &mut self.children_names,
201                decoder,
202                offset + 0,
203                _depth
204            )?;
205            Ok(())
206        }
207    }
208
209    impl fidl::encoding::ValueTypeMarker for InspectOpenChildResponse {
210        type Borrowed<'a> = &'a Self;
211        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
212            value
213        }
214    }
215
216    unsafe impl fidl::encoding::TypeMarker for InspectOpenChildResponse {
217        type Owned = Self;
218
219        #[inline(always)]
220        fn inline_align(_context: fidl::encoding::Context) -> usize {
221            1
222        }
223
224        #[inline(always)]
225        fn inline_size(_context: fidl::encoding::Context) -> usize {
226            1
227        }
228    }
229
230    unsafe impl<D: fidl::encoding::ResourceDialect>
231        fidl::encoding::Encode<InspectOpenChildResponse, D> for &InspectOpenChildResponse
232    {
233        #[inline]
234        unsafe fn encode(
235            self,
236            encoder: &mut fidl::encoding::Encoder<'_, D>,
237            offset: usize,
238            _depth: fidl::encoding::Depth,
239        ) -> fidl::Result<()> {
240            encoder.debug_check_bounds::<InspectOpenChildResponse>(offset);
241            // Delegate to tuple encoding.
242            fidl::encoding::Encode::<InspectOpenChildResponse, D>::encode(
243                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.success),),
244                encoder,
245                offset,
246                _depth,
247            )
248        }
249    }
250    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
251        fidl::encoding::Encode<InspectOpenChildResponse, D> for (T0,)
252    {
253        #[inline]
254        unsafe fn encode(
255            self,
256            encoder: &mut fidl::encoding::Encoder<'_, D>,
257            offset: usize,
258            depth: fidl::encoding::Depth,
259        ) -> fidl::Result<()> {
260            encoder.debug_check_bounds::<InspectOpenChildResponse>(offset);
261            // Zero out padding regions. There's no need to apply masks
262            // because the unmasked parts will be overwritten by fields.
263            // Write the fields.
264            self.0.encode(encoder, offset + 0, depth)?;
265            Ok(())
266        }
267    }
268
269    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
270        for InspectOpenChildResponse
271    {
272        #[inline(always)]
273        fn new_empty() -> Self {
274            Self { success: fidl::new_empty!(bool, D) }
275        }
276
277        #[inline]
278        unsafe fn decode(
279            &mut self,
280            decoder: &mut fidl::encoding::Decoder<'_, D>,
281            offset: usize,
282            _depth: fidl::encoding::Depth,
283        ) -> fidl::Result<()> {
284            decoder.debug_check_bounds::<Self>(offset);
285            // Verify that padding bytes are zero.
286            fidl::decode!(bool, D, &mut self.success, decoder, offset + 0, _depth)?;
287            Ok(())
288        }
289    }
290
291    impl fidl::encoding::ValueTypeMarker for InspectReadDataResponse {
292        type Borrowed<'a> = &'a Self;
293        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
294            value
295        }
296    }
297
298    unsafe impl fidl::encoding::TypeMarker for InspectReadDataResponse {
299        type Owned = Self;
300
301        #[inline(always)]
302        fn inline_align(_context: fidl::encoding::Context) -> usize {
303            8
304        }
305
306        #[inline(always)]
307        fn inline_size(_context: fidl::encoding::Context) -> usize {
308            48
309        }
310    }
311
312    unsafe impl<D: fidl::encoding::ResourceDialect>
313        fidl::encoding::Encode<InspectReadDataResponse, D> for &InspectReadDataResponse
314    {
315        #[inline]
316        unsafe fn encode(
317            self,
318            encoder: &mut fidl::encoding::Encoder<'_, D>,
319            offset: usize,
320            _depth: fidl::encoding::Depth,
321        ) -> fidl::Result<()> {
322            encoder.debug_check_bounds::<InspectReadDataResponse>(offset);
323            // Delegate to tuple encoding.
324            fidl::encoding::Encode::<InspectReadDataResponse, D>::encode(
325                (<Object as fidl::encoding::ValueTypeMarker>::borrow(&self.object),),
326                encoder,
327                offset,
328                _depth,
329            )
330        }
331    }
332    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Object, D>>
333        fidl::encoding::Encode<InspectReadDataResponse, D> for (T0,)
334    {
335        #[inline]
336        unsafe fn encode(
337            self,
338            encoder: &mut fidl::encoding::Encoder<'_, D>,
339            offset: usize,
340            depth: fidl::encoding::Depth,
341        ) -> fidl::Result<()> {
342            encoder.debug_check_bounds::<InspectReadDataResponse>(offset);
343            // Zero out padding regions. There's no need to apply masks
344            // because the unmasked parts will be overwritten by fields.
345            // Write the fields.
346            self.0.encode(encoder, offset + 0, depth)?;
347            Ok(())
348        }
349    }
350
351    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
352        for InspectReadDataResponse
353    {
354        #[inline(always)]
355        fn new_empty() -> Self {
356            Self { object: fidl::new_empty!(Object, D) }
357        }
358
359        #[inline]
360        unsafe fn decode(
361            &mut self,
362            decoder: &mut fidl::encoding::Decoder<'_, D>,
363            offset: usize,
364            _depth: fidl::encoding::Depth,
365        ) -> fidl::Result<()> {
366            decoder.debug_check_bounds::<Self>(offset);
367            // Verify that padding bytes are zero.
368            fidl::decode!(Object, D, &mut self.object, decoder, offset + 0, _depth)?;
369            Ok(())
370        }
371    }
372
373    impl fidl::encoding::ValueTypeMarker for Metric {
374        type Borrowed<'a> = &'a Self;
375        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
376            value
377        }
378    }
379
380    unsafe impl fidl::encoding::TypeMarker for Metric {
381        type Owned = Self;
382
383        #[inline(always)]
384        fn inline_align(_context: fidl::encoding::Context) -> usize {
385            8
386        }
387
388        #[inline(always)]
389        fn inline_size(_context: fidl::encoding::Context) -> usize {
390            32
391        }
392    }
393
394    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Metric, D> for &Metric {
395        #[inline]
396        unsafe fn encode(
397            self,
398            encoder: &mut fidl::encoding::Encoder<'_, D>,
399            offset: usize,
400            _depth: fidl::encoding::Depth,
401        ) -> fidl::Result<()> {
402            encoder.debug_check_bounds::<Metric>(offset);
403            // Delegate to tuple encoding.
404            fidl::encoding::Encode::<Metric, D>::encode(
405                (
406                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
407                        &self.key,
408                    ),
409                    <MetricValue as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
410                ),
411                encoder,
412                offset,
413                _depth,
414            )
415        }
416    }
417    unsafe impl<
418            D: fidl::encoding::ResourceDialect,
419            T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
420            T1: fidl::encoding::Encode<MetricValue, D>,
421        > fidl::encoding::Encode<Metric, D> for (T0, T1)
422    {
423        #[inline]
424        unsafe fn encode(
425            self,
426            encoder: &mut fidl::encoding::Encoder<'_, D>,
427            offset: usize,
428            depth: fidl::encoding::Depth,
429        ) -> fidl::Result<()> {
430            encoder.debug_check_bounds::<Metric>(offset);
431            // Zero out padding regions. There's no need to apply masks
432            // because the unmasked parts will be overwritten by fields.
433            // Write the fields.
434            self.0.encode(encoder, offset + 0, depth)?;
435            self.1.encode(encoder, offset + 16, depth)?;
436            Ok(())
437        }
438    }
439
440    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Metric {
441        #[inline(always)]
442        fn new_empty() -> Self {
443            Self {
444                key: fidl::new_empty!(fidl::encoding::UnboundedString, D),
445                value: fidl::new_empty!(MetricValue, D),
446            }
447        }
448
449        #[inline]
450        unsafe fn decode(
451            &mut self,
452            decoder: &mut fidl::encoding::Decoder<'_, D>,
453            offset: usize,
454            _depth: fidl::encoding::Depth,
455        ) -> fidl::Result<()> {
456            decoder.debug_check_bounds::<Self>(offset);
457            // Verify that padding bytes are zero.
458            fidl::decode!(
459                fidl::encoding::UnboundedString,
460                D,
461                &mut self.key,
462                decoder,
463                offset + 0,
464                _depth
465            )?;
466            fidl::decode!(MetricValue, D, &mut self.value, decoder, offset + 16, _depth)?;
467            Ok(())
468        }
469    }
470
471    impl fidl::encoding::ValueTypeMarker for Object {
472        type Borrowed<'a> = &'a Self;
473        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
474            value
475        }
476    }
477
478    unsafe impl fidl::encoding::TypeMarker for Object {
479        type Owned = Self;
480
481        #[inline(always)]
482        fn inline_align(_context: fidl::encoding::Context) -> usize {
483            8
484        }
485
486        #[inline(always)]
487        fn inline_size(_context: fidl::encoding::Context) -> usize {
488            48
489        }
490    }
491
492    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Object, D> for &Object {
493        #[inline]
494        unsafe fn encode(
495            self,
496            encoder: &mut fidl::encoding::Encoder<'_, D>,
497            offset: usize,
498            _depth: fidl::encoding::Depth,
499        ) -> fidl::Result<()> {
500            encoder.debug_check_bounds::<Object>(offset);
501            // Delegate to tuple encoding.
502            fidl::encoding::Encode::<Object, D>::encode(
503                (
504                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
505                    <fidl::encoding::UnboundedVector<Property> as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),
506                    <fidl::encoding::UnboundedVector<Metric> as fidl::encoding::ValueTypeMarker>::borrow(&self.metrics),
507                ),
508                encoder, offset, _depth
509            )
510        }
511    }
512    unsafe impl<
513            D: fidl::encoding::ResourceDialect,
514            T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
515            T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Property>, D>,
516            T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Metric>, D>,
517        > fidl::encoding::Encode<Object, D> for (T0, T1, T2)
518    {
519        #[inline]
520        unsafe fn encode(
521            self,
522            encoder: &mut fidl::encoding::Encoder<'_, D>,
523            offset: usize,
524            depth: fidl::encoding::Depth,
525        ) -> fidl::Result<()> {
526            encoder.debug_check_bounds::<Object>(offset);
527            // Zero out padding regions. There's no need to apply masks
528            // because the unmasked parts will be overwritten by fields.
529            // Write the fields.
530            self.0.encode(encoder, offset + 0, depth)?;
531            self.1.encode(encoder, offset + 16, depth)?;
532            self.2.encode(encoder, offset + 32, depth)?;
533            Ok(())
534        }
535    }
536
537    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Object {
538        #[inline(always)]
539        fn new_empty() -> Self {
540            Self {
541                name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
542                properties: fidl::new_empty!(fidl::encoding::UnboundedVector<Property>, D),
543                metrics: fidl::new_empty!(fidl::encoding::UnboundedVector<Metric>, D),
544            }
545        }
546
547        #[inline]
548        unsafe fn decode(
549            &mut self,
550            decoder: &mut fidl::encoding::Decoder<'_, D>,
551            offset: usize,
552            _depth: fidl::encoding::Depth,
553        ) -> fidl::Result<()> {
554            decoder.debug_check_bounds::<Self>(offset);
555            // Verify that padding bytes are zero.
556            fidl::decode!(
557                fidl::encoding::UnboundedString,
558                D,
559                &mut self.name,
560                decoder,
561                offset + 0,
562                _depth
563            )?;
564            fidl::decode!(
565                fidl::encoding::UnboundedVector<Property>,
566                D,
567                &mut self.properties,
568                decoder,
569                offset + 16,
570                _depth
571            )?;
572            fidl::decode!(
573                fidl::encoding::UnboundedVector<Metric>,
574                D,
575                &mut self.metrics,
576                decoder,
577                offset + 32,
578                _depth
579            )?;
580            Ok(())
581        }
582    }
583
584    impl fidl::encoding::ValueTypeMarker for Property {
585        type Borrowed<'a> = &'a Self;
586        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
587            value
588        }
589    }
590
591    unsafe impl fidl::encoding::TypeMarker for Property {
592        type Owned = Self;
593
594        #[inline(always)]
595        fn inline_align(_context: fidl::encoding::Context) -> usize {
596            8
597        }
598
599        #[inline(always)]
600        fn inline_size(_context: fidl::encoding::Context) -> usize {
601            32
602        }
603    }
604
605    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Property, D> for &Property {
606        #[inline]
607        unsafe fn encode(
608            self,
609            encoder: &mut fidl::encoding::Encoder<'_, D>,
610            offset: usize,
611            _depth: fidl::encoding::Depth,
612        ) -> fidl::Result<()> {
613            encoder.debug_check_bounds::<Property>(offset);
614            // Delegate to tuple encoding.
615            fidl::encoding::Encode::<Property, D>::encode(
616                (
617                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
618                        &self.key,
619                    ),
620                    <PropertyValue as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
621                ),
622                encoder,
623                offset,
624                _depth,
625            )
626        }
627    }
628    unsafe impl<
629            D: fidl::encoding::ResourceDialect,
630            T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
631            T1: fidl::encoding::Encode<PropertyValue, D>,
632        > fidl::encoding::Encode<Property, D> for (T0, T1)
633    {
634        #[inline]
635        unsafe fn encode(
636            self,
637            encoder: &mut fidl::encoding::Encoder<'_, D>,
638            offset: usize,
639            depth: fidl::encoding::Depth,
640        ) -> fidl::Result<()> {
641            encoder.debug_check_bounds::<Property>(offset);
642            // Zero out padding regions. There's no need to apply masks
643            // because the unmasked parts will be overwritten by fields.
644            // Write the fields.
645            self.0.encode(encoder, offset + 0, depth)?;
646            self.1.encode(encoder, offset + 16, depth)?;
647            Ok(())
648        }
649    }
650
651    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Property {
652        #[inline(always)]
653        fn new_empty() -> Self {
654            Self {
655                key: fidl::new_empty!(fidl::encoding::UnboundedString, D),
656                value: fidl::new_empty!(PropertyValue, D),
657            }
658        }
659
660        #[inline]
661        unsafe fn decode(
662            &mut self,
663            decoder: &mut fidl::encoding::Decoder<'_, D>,
664            offset: usize,
665            _depth: fidl::encoding::Depth,
666        ) -> fidl::Result<()> {
667            decoder.debug_check_bounds::<Self>(offset);
668            // Verify that padding bytes are zero.
669            fidl::decode!(
670                fidl::encoding::UnboundedString,
671                D,
672                &mut self.key,
673                decoder,
674                offset + 0,
675                _depth
676            )?;
677            fidl::decode!(PropertyValue, D, &mut self.value, decoder, offset + 16, _depth)?;
678            Ok(())
679        }
680    }
681
682    impl fidl::encoding::ValueTypeMarker for MetricValue {
683        type Borrowed<'a> = &'a Self;
684        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
685            value
686        }
687    }
688
689    unsafe impl fidl::encoding::TypeMarker for MetricValue {
690        type Owned = Self;
691
692        #[inline(always)]
693        fn inline_align(_context: fidl::encoding::Context) -> usize {
694            8
695        }
696
697        #[inline(always)]
698        fn inline_size(_context: fidl::encoding::Context) -> usize {
699            16
700        }
701    }
702
703    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MetricValue, D>
704        for &MetricValue
705    {
706        #[inline]
707        unsafe fn encode(
708            self,
709            encoder: &mut fidl::encoding::Encoder<'_, D>,
710            offset: usize,
711            _depth: fidl::encoding::Depth,
712        ) -> fidl::Result<()> {
713            encoder.debug_check_bounds::<MetricValue>(offset);
714            encoder.write_num::<u64>(self.ordinal(), offset);
715            match self {
716                MetricValue::IntValue(ref val) => fidl::encoding::encode_in_envelope::<i64, D>(
717                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
718                    encoder,
719                    offset + 8,
720                    _depth,
721                ),
722                MetricValue::UintValue(ref val) => fidl::encoding::encode_in_envelope::<u64, D>(
723                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
724                    encoder,
725                    offset + 8,
726                    _depth,
727                ),
728                MetricValue::DoubleValue(ref val) => fidl::encoding::encode_in_envelope::<f64, D>(
729                    <f64 as fidl::encoding::ValueTypeMarker>::borrow(val),
730                    encoder,
731                    offset + 8,
732                    _depth,
733                ),
734            }
735        }
736    }
737
738    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MetricValue {
739        #[inline(always)]
740        fn new_empty() -> Self {
741            Self::IntValue(fidl::new_empty!(i64, D))
742        }
743
744        #[inline]
745        unsafe fn decode(
746            &mut self,
747            decoder: &mut fidl::encoding::Decoder<'_, D>,
748            offset: usize,
749            mut depth: fidl::encoding::Depth,
750        ) -> fidl::Result<()> {
751            decoder.debug_check_bounds::<Self>(offset);
752            #[allow(unused_variables)]
753            let next_out_of_line = decoder.next_out_of_line();
754            let handles_before = decoder.remaining_handles();
755            let (ordinal, inlined, num_bytes, num_handles) =
756                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
757
758            let member_inline_size = match ordinal {
759                1 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
760                2 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
761                3 => <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
762                _ => return Err(fidl::Error::UnknownUnionTag),
763            };
764
765            if inlined != (member_inline_size <= 4) {
766                return Err(fidl::Error::InvalidInlineBitInEnvelope);
767            }
768            let _inner_offset;
769            if inlined {
770                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
771                _inner_offset = offset + 8;
772            } else {
773                depth.increment()?;
774                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
775            }
776            match ordinal {
777                1 => {
778                    #[allow(irrefutable_let_patterns)]
779                    if let MetricValue::IntValue(_) = self {
780                        // Do nothing, read the value into the object
781                    } else {
782                        // Initialize `self` to the right variant
783                        *self = MetricValue::IntValue(fidl::new_empty!(i64, D));
784                    }
785                    #[allow(irrefutable_let_patterns)]
786                    if let MetricValue::IntValue(ref mut val) = self {
787                        fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
788                    } else {
789                        unreachable!()
790                    }
791                }
792                2 => {
793                    #[allow(irrefutable_let_patterns)]
794                    if let MetricValue::UintValue(_) = self {
795                        // Do nothing, read the value into the object
796                    } else {
797                        // Initialize `self` to the right variant
798                        *self = MetricValue::UintValue(fidl::new_empty!(u64, D));
799                    }
800                    #[allow(irrefutable_let_patterns)]
801                    if let MetricValue::UintValue(ref mut val) = self {
802                        fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
803                    } else {
804                        unreachable!()
805                    }
806                }
807                3 => {
808                    #[allow(irrefutable_let_patterns)]
809                    if let MetricValue::DoubleValue(_) = self {
810                        // Do nothing, read the value into the object
811                    } else {
812                        // Initialize `self` to the right variant
813                        *self = MetricValue::DoubleValue(fidl::new_empty!(f64, D));
814                    }
815                    #[allow(irrefutable_let_patterns)]
816                    if let MetricValue::DoubleValue(ref mut val) = self {
817                        fidl::decode!(f64, D, val, decoder, _inner_offset, depth)?;
818                    } else {
819                        unreachable!()
820                    }
821                }
822                ordinal => panic!("unexpected ordinal {:?}", ordinal),
823            }
824            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
825                return Err(fidl::Error::InvalidNumBytesInEnvelope);
826            }
827            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
828                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
829            }
830            Ok(())
831        }
832    }
833
834    impl fidl::encoding::ValueTypeMarker for PropertyValue {
835        type Borrowed<'a> = &'a Self;
836        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
837            value
838        }
839    }
840
841    unsafe impl fidl::encoding::TypeMarker for PropertyValue {
842        type Owned = Self;
843
844        #[inline(always)]
845        fn inline_align(_context: fidl::encoding::Context) -> usize {
846            8
847        }
848
849        #[inline(always)]
850        fn inline_size(_context: fidl::encoding::Context) -> usize {
851            16
852        }
853    }
854
855    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PropertyValue, D>
856        for &PropertyValue
857    {
858        #[inline]
859        unsafe fn encode(
860            self,
861            encoder: &mut fidl::encoding::Encoder<'_, D>,
862            offset: usize,
863            _depth: fidl::encoding::Depth,
864        ) -> fidl::Result<()> {
865            encoder.debug_check_bounds::<PropertyValue>(offset);
866            encoder.write_num::<u64>(self.ordinal(), offset);
867            match self {
868            PropertyValue::Str(ref val) => {
869                fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedString, D>(
870                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(val),
871                    encoder, offset + 8, _depth
872                )
873            }
874            PropertyValue::Bytes(ref val) => {
875                fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedVector<u8>, D>(
876                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(val),
877                    encoder, offset + 8, _depth
878                )
879            }
880        }
881        }
882    }
883
884    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PropertyValue {
885        #[inline(always)]
886        fn new_empty() -> Self {
887            Self::Str(fidl::new_empty!(fidl::encoding::UnboundedString, D))
888        }
889
890        #[inline]
891        unsafe fn decode(
892            &mut self,
893            decoder: &mut fidl::encoding::Decoder<'_, D>,
894            offset: usize,
895            mut depth: fidl::encoding::Depth,
896        ) -> fidl::Result<()> {
897            decoder.debug_check_bounds::<Self>(offset);
898            #[allow(unused_variables)]
899            let next_out_of_line = decoder.next_out_of_line();
900            let handles_before = decoder.remaining_handles();
901            let (ordinal, inlined, num_bytes, num_handles) =
902                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
903
904            let member_inline_size = match ordinal {
905                1 => <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
906                    decoder.context,
907                ),
908                2 => {
909                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(
910                        decoder.context,
911                    )
912                }
913                _ => return Err(fidl::Error::UnknownUnionTag),
914            };
915
916            if inlined != (member_inline_size <= 4) {
917                return Err(fidl::Error::InvalidInlineBitInEnvelope);
918            }
919            let _inner_offset;
920            if inlined {
921                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
922                _inner_offset = offset + 8;
923            } else {
924                depth.increment()?;
925                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
926            }
927            match ordinal {
928                1 => {
929                    #[allow(irrefutable_let_patterns)]
930                    if let PropertyValue::Str(_) = self {
931                        // Do nothing, read the value into the object
932                    } else {
933                        // Initialize `self` to the right variant
934                        *self = PropertyValue::Str(fidl::new_empty!(
935                            fidl::encoding::UnboundedString,
936                            D
937                        ));
938                    }
939                    #[allow(irrefutable_let_patterns)]
940                    if let PropertyValue::Str(ref mut val) = self {
941                        fidl::decode!(
942                            fidl::encoding::UnboundedString,
943                            D,
944                            val,
945                            decoder,
946                            _inner_offset,
947                            depth
948                        )?;
949                    } else {
950                        unreachable!()
951                    }
952                }
953                2 => {
954                    #[allow(irrefutable_let_patterns)]
955                    if let PropertyValue::Bytes(_) = self {
956                        // Do nothing, read the value into the object
957                    } else {
958                        // Initialize `self` to the right variant
959                        *self = PropertyValue::Bytes(fidl::new_empty!(
960                            fidl::encoding::UnboundedVector<u8>,
961                            D
962                        ));
963                    }
964                    #[allow(irrefutable_let_patterns)]
965                    if let PropertyValue::Bytes(ref mut val) = self {
966                        fidl::decode!(
967                            fidl::encoding::UnboundedVector<u8>,
968                            D,
969                            val,
970                            decoder,
971                            _inner_offset,
972                            depth
973                        )?;
974                    } else {
975                        unreachable!()
976                    }
977                }
978                ordinal => panic!("unexpected ordinal {:?}", ordinal),
979            }
980            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
981                return Err(fidl::Error::InvalidNumBytesInEnvelope);
982            }
983            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
984                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
985            }
986            Ok(())
987        }
988    }
989}