fidl_fuchsia_validate_logs__common/
fidl_fuchsia_validate_logs__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/// Maximum number of arguments that can be encoded per record, as specified by the tracing format:
12///
13/// https://fuchsia.dev/fuchsia-src/development/tracing/trace-format#arguments
14pub const MAX_ARGS: u32 = 15;
15
16/// A small(ish) limit on the length of argument names is used because argument names are expected
17/// to be used repeatedly, many times.
18pub const MAX_ARG_NAME_LENGTH: u32 = 256;
19
20/// The maximum string length which we can encode into the tracing format.
21pub const MAX_TEXT_ARG_LENGTH: u32 = 32768;
22
23#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
24#[repr(u32)]
25pub enum PuppetError {
26    UnsupportedRecord = 1,
27}
28
29impl PuppetError {
30    #[inline]
31    pub fn from_primitive(prim: u32) -> Option<Self> {
32        match prim {
33            1 => Some(Self::UnsupportedRecord),
34            _ => None,
35        }
36    }
37
38    #[inline]
39    pub const fn into_primitive(self) -> u32 {
40        self as u32
41    }
42}
43
44/// A named key-value pair in the diagnostic record.
45#[derive(Clone, Debug, PartialEq)]
46pub struct Argument {
47    /// The name of the argument.
48    pub name: String,
49    /// The value of the argument.
50    pub value: Value,
51}
52
53impl fidl::Persistable for Argument {}
54
55#[derive(Clone, Debug, PartialEq)]
56pub struct EncodingPuppetEncodeRequest {
57    pub record: Record,
58}
59
60impl fidl::Persistable for EncodingPuppetEncodeRequest {}
61
62#[derive(Clone, Debug, PartialEq)]
63pub struct LogSinkPuppetEmitLogRequest {
64    pub spec: RecordSpec,
65}
66
67impl fidl::Persistable for LogSinkPuppetEmitLogRequest {}
68
69#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
70pub struct LogSinkPuppetGetInfoResponse {
71    pub info: PuppetInfo,
72}
73
74impl fidl::Persistable for LogSinkPuppetGetInfoResponse {}
75
76#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
77pub struct PuppetInfo {
78    pub tag: Option<String>,
79    pub pid: u64,
80    pub tid: u64,
81}
82
83impl fidl::Persistable for PuppetInfo {}
84
85/// A record in the diagnostic stream.
86#[derive(Clone, Debug, PartialEq)]
87pub struct Record {
88    /// The time at which the record was generated measured in nanoseconds since
89    /// boot.
90    pub timestamp: fidl::BootInstant,
91    /// Severity of the record.
92    pub severity: fidl_fuchsia_diagnostics_types__common::Severity,
93    /// The key-value pairs which make up this record.
94    pub arguments: Vec<Argument>,
95}
96
97impl fidl::Persistable for Record {}
98
99#[derive(Clone, Debug, PartialEq)]
100pub struct RecordSpec {
101    pub file: String,
102    pub line: u32,
103    pub record: Record,
104}
105
106impl fidl::Persistable for RecordSpec {}
107
108#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
109pub struct TestFailure {
110    /// The name of the test case.
111    pub test_name: String,
112    /// The reason the test case failed.
113    pub reason: String,
114}
115
116impl fidl::Persistable for TestFailure {}
117
118#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
119pub struct TestSuccess {
120    /// The name of the test case.
121    pub test_name: String,
122}
123
124impl fidl::Persistable for TestSuccess {}
125
126#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
127pub enum ValidateResult {
128    /// Set when the test case passed.
129    Success(TestSuccess),
130    /// Set when the test case failed.
131    Failure(TestFailure),
132}
133
134impl ValidateResult {
135    #[inline]
136    pub fn ordinal(&self) -> u64 {
137        match *self {
138            Self::Success(_) => 1,
139            Self::Failure(_) => 2,
140        }
141    }
142}
143
144impl fidl::Persistable for ValidateResult {}
145
146/// An argument value which can be one of several types.
147#[derive(Clone, Debug)]
148pub enum Value {
149    /// A signed integral argument.
150    SignedInt(i64),
151    /// An unsigned integral argument.
152    UnsignedInt(u64),
153    /// A double-precision floating-point argument.
154    Floating(f64),
155    /// A UTF8 text argument.
156    Text(String),
157    /// A boolean argument.
158    Boolean(bool),
159    #[doc(hidden)]
160    __SourceBreaking { unknown_ordinal: u64 },
161}
162
163/// Pattern that matches an unknown `Value` member.
164#[macro_export]
165macro_rules! ValueUnknown {
166    () => {
167        _
168    };
169}
170
171// Custom PartialEq so that unknown variants are not equal to themselves.
172impl PartialEq for Value {
173    fn eq(&self, other: &Self) -> bool {
174        match (self, other) {
175            (Self::SignedInt(x), Self::SignedInt(y)) => *x == *y,
176            (Self::UnsignedInt(x), Self::UnsignedInt(y)) => *x == *y,
177            (Self::Floating(x), Self::Floating(y)) => *x == *y,
178            (Self::Text(x), Self::Text(y)) => *x == *y,
179            (Self::Boolean(x), Self::Boolean(y)) => *x == *y,
180            _ => false,
181        }
182    }
183}
184
185impl Value {
186    #[inline]
187    pub fn ordinal(&self) -> u64 {
188        match *self {
189            Self::SignedInt(_) => 1,
190            Self::UnsignedInt(_) => 2,
191            Self::Floating(_) => 3,
192            Self::Text(_) => 4,
193            Self::Boolean(_) => 5,
194            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
195        }
196    }
197
198    #[inline]
199    pub fn unknown_variant_for_testing() -> Self {
200        Self::__SourceBreaking { unknown_ordinal: 0 }
201    }
202
203    #[inline]
204    pub fn is_unknown(&self) -> bool {
205        match self {
206            Self::__SourceBreaking { .. } => true,
207            _ => false,
208        }
209    }
210}
211
212impl fidl::Persistable for Value {}
213
214pub mod encoding_puppet_ordinals {
215    pub const ENCODE: u64 = 0x4486ab9d1bb462f8;
216}
217
218pub mod encoding_validator_ordinals {
219    pub const VALIDATE: u64 = 0x1ac204a62465f23c;
220}
221
222pub mod log_sink_puppet_ordinals {
223    pub const GET_INFO: u64 = 0x5b1c3dac76c26425;
224    pub const EMIT_LOG: u64 = 0x58b64b6672ed66de;
225    pub const STOP_INTEREST_LISTENER: u64 = 0x4c69520a50828cbd;
226}
227
228pub mod validate_results_iterator_ordinals {
229    pub const GET_NEXT: u64 = 0x1b1573e93311e8b7;
230}
231
232mod internal {
233    use super::*;
234    unsafe impl fidl::encoding::TypeMarker for PuppetError {
235        type Owned = Self;
236
237        #[inline(always)]
238        fn inline_align(_context: fidl::encoding::Context) -> usize {
239            std::mem::align_of::<u32>()
240        }
241
242        #[inline(always)]
243        fn inline_size(_context: fidl::encoding::Context) -> usize {
244            std::mem::size_of::<u32>()
245        }
246
247        #[inline(always)]
248        fn encode_is_copy() -> bool {
249            true
250        }
251
252        #[inline(always)]
253        fn decode_is_copy() -> bool {
254            false
255        }
256    }
257
258    impl fidl::encoding::ValueTypeMarker for PuppetError {
259        type Borrowed<'a> = Self;
260        #[inline(always)]
261        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
262            *value
263        }
264    }
265
266    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PuppetError {
267        #[inline]
268        unsafe fn encode(
269            self,
270            encoder: &mut fidl::encoding::Encoder<'_, D>,
271            offset: usize,
272            _depth: fidl::encoding::Depth,
273        ) -> fidl::Result<()> {
274            encoder.debug_check_bounds::<Self>(offset);
275            encoder.write_num(self.into_primitive(), offset);
276            Ok(())
277        }
278    }
279
280    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PuppetError {
281        #[inline(always)]
282        fn new_empty() -> Self {
283            Self::UnsupportedRecord
284        }
285
286        #[inline]
287        unsafe fn decode(
288            &mut self,
289            decoder: &mut fidl::encoding::Decoder<'_, D>,
290            offset: usize,
291            _depth: fidl::encoding::Depth,
292        ) -> fidl::Result<()> {
293            decoder.debug_check_bounds::<Self>(offset);
294            let prim = decoder.read_num::<u32>(offset);
295
296            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
297            Ok(())
298        }
299    }
300
301    impl fidl::encoding::ValueTypeMarker for Argument {
302        type Borrowed<'a> = &'a Self;
303        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
304            value
305        }
306    }
307
308    unsafe impl fidl::encoding::TypeMarker for Argument {
309        type Owned = Self;
310
311        #[inline(always)]
312        fn inline_align(_context: fidl::encoding::Context) -> usize {
313            8
314        }
315
316        #[inline(always)]
317        fn inline_size(_context: fidl::encoding::Context) -> usize {
318            32
319        }
320    }
321
322    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Argument, D> for &Argument {
323        #[inline]
324        unsafe fn encode(
325            self,
326            encoder: &mut fidl::encoding::Encoder<'_, D>,
327            offset: usize,
328            _depth: fidl::encoding::Depth,
329        ) -> fidl::Result<()> {
330            encoder.debug_check_bounds::<Argument>(offset);
331            // Delegate to tuple encoding.
332            fidl::encoding::Encode::<Argument, D>::encode(
333                (
334                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
335                        &self.name,
336                    ),
337                    <Value as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
338                ),
339                encoder,
340                offset,
341                _depth,
342            )
343        }
344    }
345    unsafe impl<
346            D: fidl::encoding::ResourceDialect,
347            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
348            T1: fidl::encoding::Encode<Value, D>,
349        > fidl::encoding::Encode<Argument, D> for (T0, T1)
350    {
351        #[inline]
352        unsafe fn encode(
353            self,
354            encoder: &mut fidl::encoding::Encoder<'_, D>,
355            offset: usize,
356            depth: fidl::encoding::Depth,
357        ) -> fidl::Result<()> {
358            encoder.debug_check_bounds::<Argument>(offset);
359            // Zero out padding regions. There's no need to apply masks
360            // because the unmasked parts will be overwritten by fields.
361            // Write the fields.
362            self.0.encode(encoder, offset + 0, depth)?;
363            self.1.encode(encoder, offset + 16, depth)?;
364            Ok(())
365        }
366    }
367
368    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Argument {
369        #[inline(always)]
370        fn new_empty() -> Self {
371            Self {
372                name: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
373                value: fidl::new_empty!(Value, D),
374            }
375        }
376
377        #[inline]
378        unsafe fn decode(
379            &mut self,
380            decoder: &mut fidl::encoding::Decoder<'_, D>,
381            offset: usize,
382            _depth: fidl::encoding::Depth,
383        ) -> fidl::Result<()> {
384            decoder.debug_check_bounds::<Self>(offset);
385            // Verify that padding bytes are zero.
386            fidl::decode!(
387                fidl::encoding::BoundedString<256>,
388                D,
389                &mut self.name,
390                decoder,
391                offset + 0,
392                _depth
393            )?;
394            fidl::decode!(Value, D, &mut self.value, decoder, offset + 16, _depth)?;
395            Ok(())
396        }
397    }
398
399    impl fidl::encoding::ValueTypeMarker for EncodingPuppetEncodeRequest {
400        type Borrowed<'a> = &'a Self;
401        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
402            value
403        }
404    }
405
406    unsafe impl fidl::encoding::TypeMarker for EncodingPuppetEncodeRequest {
407        type Owned = Self;
408
409        #[inline(always)]
410        fn inline_align(_context: fidl::encoding::Context) -> usize {
411            8
412        }
413
414        #[inline(always)]
415        fn inline_size(_context: fidl::encoding::Context) -> usize {
416            32
417        }
418    }
419
420    unsafe impl<D: fidl::encoding::ResourceDialect>
421        fidl::encoding::Encode<EncodingPuppetEncodeRequest, D> for &EncodingPuppetEncodeRequest
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::<EncodingPuppetEncodeRequest>(offset);
431            // Delegate to tuple encoding.
432            fidl::encoding::Encode::<EncodingPuppetEncodeRequest, D>::encode(
433                (<Record as fidl::encoding::ValueTypeMarker>::borrow(&self.record),),
434                encoder,
435                offset,
436                _depth,
437            )
438        }
439    }
440    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Record, D>>
441        fidl::encoding::Encode<EncodingPuppetEncodeRequest, D> for (T0,)
442    {
443        #[inline]
444        unsafe fn encode(
445            self,
446            encoder: &mut fidl::encoding::Encoder<'_, D>,
447            offset: usize,
448            depth: fidl::encoding::Depth,
449        ) -> fidl::Result<()> {
450            encoder.debug_check_bounds::<EncodingPuppetEncodeRequest>(offset);
451            // Zero out padding regions. There's no need to apply masks
452            // because the unmasked parts will be overwritten by fields.
453            // Write the fields.
454            self.0.encode(encoder, offset + 0, depth)?;
455            Ok(())
456        }
457    }
458
459    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
460        for EncodingPuppetEncodeRequest
461    {
462        #[inline(always)]
463        fn new_empty() -> Self {
464            Self { record: fidl::new_empty!(Record, D) }
465        }
466
467        #[inline]
468        unsafe fn decode(
469            &mut self,
470            decoder: &mut fidl::encoding::Decoder<'_, D>,
471            offset: usize,
472            _depth: fidl::encoding::Depth,
473        ) -> fidl::Result<()> {
474            decoder.debug_check_bounds::<Self>(offset);
475            // Verify that padding bytes are zero.
476            fidl::decode!(Record, D, &mut self.record, decoder, offset + 0, _depth)?;
477            Ok(())
478        }
479    }
480
481    impl fidl::encoding::ValueTypeMarker for LogSinkPuppetEmitLogRequest {
482        type Borrowed<'a> = &'a Self;
483        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
484            value
485        }
486    }
487
488    unsafe impl fidl::encoding::TypeMarker for LogSinkPuppetEmitLogRequest {
489        type Owned = Self;
490
491        #[inline(always)]
492        fn inline_align(_context: fidl::encoding::Context) -> usize {
493            8
494        }
495
496        #[inline(always)]
497        fn inline_size(_context: fidl::encoding::Context) -> usize {
498            56
499        }
500    }
501
502    unsafe impl<D: fidl::encoding::ResourceDialect>
503        fidl::encoding::Encode<LogSinkPuppetEmitLogRequest, D> for &LogSinkPuppetEmitLogRequest
504    {
505        #[inline]
506        unsafe fn encode(
507            self,
508            encoder: &mut fidl::encoding::Encoder<'_, D>,
509            offset: usize,
510            _depth: fidl::encoding::Depth,
511        ) -> fidl::Result<()> {
512            encoder.debug_check_bounds::<LogSinkPuppetEmitLogRequest>(offset);
513            // Delegate to tuple encoding.
514            fidl::encoding::Encode::<LogSinkPuppetEmitLogRequest, D>::encode(
515                (<RecordSpec as fidl::encoding::ValueTypeMarker>::borrow(&self.spec),),
516                encoder,
517                offset,
518                _depth,
519            )
520        }
521    }
522    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RecordSpec, D>>
523        fidl::encoding::Encode<LogSinkPuppetEmitLogRequest, D> for (T0,)
524    {
525        #[inline]
526        unsafe fn encode(
527            self,
528            encoder: &mut fidl::encoding::Encoder<'_, D>,
529            offset: usize,
530            depth: fidl::encoding::Depth,
531        ) -> fidl::Result<()> {
532            encoder.debug_check_bounds::<LogSinkPuppetEmitLogRequest>(offset);
533            // Zero out padding regions. There's no need to apply masks
534            // because the unmasked parts will be overwritten by fields.
535            // Write the fields.
536            self.0.encode(encoder, offset + 0, depth)?;
537            Ok(())
538        }
539    }
540
541    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
542        for LogSinkPuppetEmitLogRequest
543    {
544        #[inline(always)]
545        fn new_empty() -> Self {
546            Self { spec: fidl::new_empty!(RecordSpec, D) }
547        }
548
549        #[inline]
550        unsafe fn decode(
551            &mut self,
552            decoder: &mut fidl::encoding::Decoder<'_, D>,
553            offset: usize,
554            _depth: fidl::encoding::Depth,
555        ) -> fidl::Result<()> {
556            decoder.debug_check_bounds::<Self>(offset);
557            // Verify that padding bytes are zero.
558            fidl::decode!(RecordSpec, D, &mut self.spec, decoder, offset + 0, _depth)?;
559            Ok(())
560        }
561    }
562
563    impl fidl::encoding::ValueTypeMarker for LogSinkPuppetGetInfoResponse {
564        type Borrowed<'a> = &'a Self;
565        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
566            value
567        }
568    }
569
570    unsafe impl fidl::encoding::TypeMarker for LogSinkPuppetGetInfoResponse {
571        type Owned = Self;
572
573        #[inline(always)]
574        fn inline_align(_context: fidl::encoding::Context) -> usize {
575            8
576        }
577
578        #[inline(always)]
579        fn inline_size(_context: fidl::encoding::Context) -> usize {
580            32
581        }
582    }
583
584    unsafe impl<D: fidl::encoding::ResourceDialect>
585        fidl::encoding::Encode<LogSinkPuppetGetInfoResponse, D> for &LogSinkPuppetGetInfoResponse
586    {
587        #[inline]
588        unsafe fn encode(
589            self,
590            encoder: &mut fidl::encoding::Encoder<'_, D>,
591            offset: usize,
592            _depth: fidl::encoding::Depth,
593        ) -> fidl::Result<()> {
594            encoder.debug_check_bounds::<LogSinkPuppetGetInfoResponse>(offset);
595            // Delegate to tuple encoding.
596            fidl::encoding::Encode::<LogSinkPuppetGetInfoResponse, D>::encode(
597                (<PuppetInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
598                encoder,
599                offset,
600                _depth,
601            )
602        }
603    }
604    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PuppetInfo, D>>
605        fidl::encoding::Encode<LogSinkPuppetGetInfoResponse, D> for (T0,)
606    {
607        #[inline]
608        unsafe fn encode(
609            self,
610            encoder: &mut fidl::encoding::Encoder<'_, D>,
611            offset: usize,
612            depth: fidl::encoding::Depth,
613        ) -> fidl::Result<()> {
614            encoder.debug_check_bounds::<LogSinkPuppetGetInfoResponse>(offset);
615            // Zero out padding regions. There's no need to apply masks
616            // because the unmasked parts will be overwritten by fields.
617            // Write the fields.
618            self.0.encode(encoder, offset + 0, depth)?;
619            Ok(())
620        }
621    }
622
623    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
624        for LogSinkPuppetGetInfoResponse
625    {
626        #[inline(always)]
627        fn new_empty() -> Self {
628            Self { info: fidl::new_empty!(PuppetInfo, D) }
629        }
630
631        #[inline]
632        unsafe fn decode(
633            &mut self,
634            decoder: &mut fidl::encoding::Decoder<'_, D>,
635            offset: usize,
636            _depth: fidl::encoding::Depth,
637        ) -> fidl::Result<()> {
638            decoder.debug_check_bounds::<Self>(offset);
639            // Verify that padding bytes are zero.
640            fidl::decode!(PuppetInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
641            Ok(())
642        }
643    }
644
645    impl fidl::encoding::ValueTypeMarker for PuppetInfo {
646        type Borrowed<'a> = &'a Self;
647        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
648            value
649        }
650    }
651
652    unsafe impl fidl::encoding::TypeMarker for PuppetInfo {
653        type Owned = Self;
654
655        #[inline(always)]
656        fn inline_align(_context: fidl::encoding::Context) -> usize {
657            8
658        }
659
660        #[inline(always)]
661        fn inline_size(_context: fidl::encoding::Context) -> usize {
662            32
663        }
664    }
665
666    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PuppetInfo, D>
667        for &PuppetInfo
668    {
669        #[inline]
670        unsafe fn encode(
671            self,
672            encoder: &mut fidl::encoding::Encoder<'_, D>,
673            offset: usize,
674            _depth: fidl::encoding::Depth,
675        ) -> fidl::Result<()> {
676            encoder.debug_check_bounds::<PuppetInfo>(offset);
677            // Delegate to tuple encoding.
678            fidl::encoding::Encode::<PuppetInfo, D>::encode(
679                (
680                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.tag),
681                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.pid),
682                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.tid),
683                ),
684                encoder, offset, _depth
685            )
686        }
687    }
688    unsafe impl<
689            D: fidl::encoding::ResourceDialect,
690            T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::UnboundedString>, D>,
691            T1: fidl::encoding::Encode<u64, D>,
692            T2: fidl::encoding::Encode<u64, D>,
693        > fidl::encoding::Encode<PuppetInfo, D> for (T0, T1, T2)
694    {
695        #[inline]
696        unsafe fn encode(
697            self,
698            encoder: &mut fidl::encoding::Encoder<'_, D>,
699            offset: usize,
700            depth: fidl::encoding::Depth,
701        ) -> fidl::Result<()> {
702            encoder.debug_check_bounds::<PuppetInfo>(offset);
703            // Zero out padding regions. There's no need to apply masks
704            // because the unmasked parts will be overwritten by fields.
705            // Write the fields.
706            self.0.encode(encoder, offset + 0, depth)?;
707            self.1.encode(encoder, offset + 16, depth)?;
708            self.2.encode(encoder, offset + 24, depth)?;
709            Ok(())
710        }
711    }
712
713    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PuppetInfo {
714        #[inline(always)]
715        fn new_empty() -> Self {
716            Self {
717                tag: fidl::new_empty!(fidl::encoding::Optional<fidl::encoding::UnboundedString>, D),
718                pid: fidl::new_empty!(u64, D),
719                tid: fidl::new_empty!(u64, D),
720            }
721        }
722
723        #[inline]
724        unsafe fn decode(
725            &mut self,
726            decoder: &mut fidl::encoding::Decoder<'_, D>,
727            offset: usize,
728            _depth: fidl::encoding::Depth,
729        ) -> fidl::Result<()> {
730            decoder.debug_check_bounds::<Self>(offset);
731            // Verify that padding bytes are zero.
732            fidl::decode!(
733                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
734                D,
735                &mut self.tag,
736                decoder,
737                offset + 0,
738                _depth
739            )?;
740            fidl::decode!(u64, D, &mut self.pid, decoder, offset + 16, _depth)?;
741            fidl::decode!(u64, D, &mut self.tid, decoder, offset + 24, _depth)?;
742            Ok(())
743        }
744    }
745
746    impl fidl::encoding::ValueTypeMarker for Record {
747        type Borrowed<'a> = &'a Self;
748        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
749            value
750        }
751    }
752
753    unsafe impl fidl::encoding::TypeMarker for Record {
754        type Owned = Self;
755
756        #[inline(always)]
757        fn inline_align(_context: fidl::encoding::Context) -> usize {
758            8
759        }
760
761        #[inline(always)]
762        fn inline_size(_context: fidl::encoding::Context) -> usize {
763            32
764        }
765    }
766
767    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Record, D> for &Record {
768        #[inline]
769        unsafe fn encode(
770            self,
771            encoder: &mut fidl::encoding::Encoder<'_, D>,
772            offset: usize,
773            _depth: fidl::encoding::Depth,
774        ) -> fidl::Result<()> {
775            encoder.debug_check_bounds::<Record>(offset);
776            // Delegate to tuple encoding.
777            fidl::encoding::Encode::<Record, D>::encode(
778                (
779                    <fidl::BootInstant as fidl::encoding::ValueTypeMarker>::borrow(&self.timestamp),
780                    <fidl_fuchsia_diagnostics_types__common::Severity as fidl::encoding::ValueTypeMarker>::borrow(&self.severity),
781                    <fidl::encoding::Vector<Argument, 15> as fidl::encoding::ValueTypeMarker>::borrow(&self.arguments),
782                ),
783                encoder, offset, _depth
784            )
785        }
786    }
787    unsafe impl<
788            D: fidl::encoding::ResourceDialect,
789            T0: fidl::encoding::Encode<fidl::BootInstant, D>,
790            T1: fidl::encoding::Encode<fidl_fuchsia_diagnostics_types__common::Severity, D>,
791            T2: fidl::encoding::Encode<fidl::encoding::Vector<Argument, 15>, D>,
792        > fidl::encoding::Encode<Record, D> for (T0, T1, T2)
793    {
794        #[inline]
795        unsafe fn encode(
796            self,
797            encoder: &mut fidl::encoding::Encoder<'_, D>,
798            offset: usize,
799            depth: fidl::encoding::Depth,
800        ) -> fidl::Result<()> {
801            encoder.debug_check_bounds::<Record>(offset);
802            // Zero out padding regions. There's no need to apply masks
803            // because the unmasked parts will be overwritten by fields.
804            unsafe {
805                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
806                (ptr as *mut u64).write_unaligned(0);
807            }
808            // Write the fields.
809            self.0.encode(encoder, offset + 0, depth)?;
810            self.1.encode(encoder, offset + 8, depth)?;
811            self.2.encode(encoder, offset + 16, depth)?;
812            Ok(())
813        }
814    }
815
816    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Record {
817        #[inline(always)]
818        fn new_empty() -> Self {
819            Self {
820                timestamp: fidl::new_empty!(fidl::BootInstant, D),
821                severity: fidl::new_empty!(fidl_fuchsia_diagnostics_types__common::Severity, D),
822                arguments: fidl::new_empty!(fidl::encoding::Vector<Argument, 15>, D),
823            }
824        }
825
826        #[inline]
827        unsafe fn decode(
828            &mut self,
829            decoder: &mut fidl::encoding::Decoder<'_, D>,
830            offset: usize,
831            _depth: fidl::encoding::Depth,
832        ) -> fidl::Result<()> {
833            decoder.debug_check_bounds::<Self>(offset);
834            // Verify that padding bytes are zero.
835            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
836            let padval = unsafe { (ptr as *const u64).read_unaligned() };
837            let mask = 0xffffffffffffff00u64;
838            let maskedval = padval & mask;
839            if maskedval != 0 {
840                return Err(fidl::Error::NonZeroPadding {
841                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
842                });
843            }
844            fidl::decode!(fidl::BootInstant, D, &mut self.timestamp, decoder, offset + 0, _depth)?;
845            fidl::decode!(
846                fidl_fuchsia_diagnostics_types__common::Severity,
847                D,
848                &mut self.severity,
849                decoder,
850                offset + 8,
851                _depth
852            )?;
853            fidl::decode!(fidl::encoding::Vector<Argument, 15>, D, &mut self.arguments, decoder, offset + 16, _depth)?;
854            Ok(())
855        }
856    }
857
858    impl fidl::encoding::ValueTypeMarker for RecordSpec {
859        type Borrowed<'a> = &'a Self;
860        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
861            value
862        }
863    }
864
865    unsafe impl fidl::encoding::TypeMarker for RecordSpec {
866        type Owned = Self;
867
868        #[inline(always)]
869        fn inline_align(_context: fidl::encoding::Context) -> usize {
870            8
871        }
872
873        #[inline(always)]
874        fn inline_size(_context: fidl::encoding::Context) -> usize {
875            56
876        }
877    }
878
879    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RecordSpec, D>
880        for &RecordSpec
881    {
882        #[inline]
883        unsafe fn encode(
884            self,
885            encoder: &mut fidl::encoding::Encoder<'_, D>,
886            offset: usize,
887            _depth: fidl::encoding::Depth,
888        ) -> fidl::Result<()> {
889            encoder.debug_check_bounds::<RecordSpec>(offset);
890            // Delegate to tuple encoding.
891            fidl::encoding::Encode::<RecordSpec, D>::encode(
892                (
893                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
894                        &self.file,
895                    ),
896                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.line),
897                    <Record as fidl::encoding::ValueTypeMarker>::borrow(&self.record),
898                ),
899                encoder,
900                offset,
901                _depth,
902            )
903        }
904    }
905    unsafe impl<
906            D: fidl::encoding::ResourceDialect,
907            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
908            T1: fidl::encoding::Encode<u32, D>,
909            T2: fidl::encoding::Encode<Record, D>,
910        > fidl::encoding::Encode<RecordSpec, D> for (T0, T1, T2)
911    {
912        #[inline]
913        unsafe fn encode(
914            self,
915            encoder: &mut fidl::encoding::Encoder<'_, D>,
916            offset: usize,
917            depth: fidl::encoding::Depth,
918        ) -> fidl::Result<()> {
919            encoder.debug_check_bounds::<RecordSpec>(offset);
920            // Zero out padding regions. There's no need to apply masks
921            // because the unmasked parts will be overwritten by fields.
922            unsafe {
923                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
924                (ptr as *mut u64).write_unaligned(0);
925            }
926            // Write the fields.
927            self.0.encode(encoder, offset + 0, depth)?;
928            self.1.encode(encoder, offset + 16, depth)?;
929            self.2.encode(encoder, offset + 24, depth)?;
930            Ok(())
931        }
932    }
933
934    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RecordSpec {
935        #[inline(always)]
936        fn new_empty() -> Self {
937            Self {
938                file: fidl::new_empty!(fidl::encoding::BoundedString<256>, D),
939                line: fidl::new_empty!(u32, D),
940                record: fidl::new_empty!(Record, D),
941            }
942        }
943
944        #[inline]
945        unsafe fn decode(
946            &mut self,
947            decoder: &mut fidl::encoding::Decoder<'_, D>,
948            offset: usize,
949            _depth: fidl::encoding::Depth,
950        ) -> fidl::Result<()> {
951            decoder.debug_check_bounds::<Self>(offset);
952            // Verify that padding bytes are zero.
953            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
954            let padval = unsafe { (ptr as *const u64).read_unaligned() };
955            let mask = 0xffffffff00000000u64;
956            let maskedval = padval & mask;
957            if maskedval != 0 {
958                return Err(fidl::Error::NonZeroPadding {
959                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
960                });
961            }
962            fidl::decode!(
963                fidl::encoding::BoundedString<256>,
964                D,
965                &mut self.file,
966                decoder,
967                offset + 0,
968                _depth
969            )?;
970            fidl::decode!(u32, D, &mut self.line, decoder, offset + 16, _depth)?;
971            fidl::decode!(Record, D, &mut self.record, decoder, offset + 24, _depth)?;
972            Ok(())
973        }
974    }
975
976    impl fidl::encoding::ValueTypeMarker for TestFailure {
977        type Borrowed<'a> = &'a Self;
978        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
979            value
980        }
981    }
982
983    unsafe impl fidl::encoding::TypeMarker for TestFailure {
984        type Owned = Self;
985
986        #[inline(always)]
987        fn inline_align(_context: fidl::encoding::Context) -> usize {
988            8
989        }
990
991        #[inline(always)]
992        fn inline_size(_context: fidl::encoding::Context) -> usize {
993            32
994        }
995    }
996
997    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TestFailure, D>
998        for &TestFailure
999    {
1000        #[inline]
1001        unsafe fn encode(
1002            self,
1003            encoder: &mut fidl::encoding::Encoder<'_, D>,
1004            offset: usize,
1005            _depth: fidl::encoding::Depth,
1006        ) -> fidl::Result<()> {
1007            encoder.debug_check_bounds::<TestFailure>(offset);
1008            // Delegate to tuple encoding.
1009            fidl::encoding::Encode::<TestFailure, D>::encode(
1010                (
1011                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
1012                        &self.test_name,
1013                    ),
1014                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
1015                        &self.reason,
1016                    ),
1017                ),
1018                encoder,
1019                offset,
1020                _depth,
1021            )
1022        }
1023    }
1024    unsafe impl<
1025            D: fidl::encoding::ResourceDialect,
1026            T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
1027            T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
1028        > fidl::encoding::Encode<TestFailure, D> for (T0, T1)
1029    {
1030        #[inline]
1031        unsafe fn encode(
1032            self,
1033            encoder: &mut fidl::encoding::Encoder<'_, D>,
1034            offset: usize,
1035            depth: fidl::encoding::Depth,
1036        ) -> fidl::Result<()> {
1037            encoder.debug_check_bounds::<TestFailure>(offset);
1038            // Zero out padding regions. There's no need to apply masks
1039            // because the unmasked parts will be overwritten by fields.
1040            // Write the fields.
1041            self.0.encode(encoder, offset + 0, depth)?;
1042            self.1.encode(encoder, offset + 16, depth)?;
1043            Ok(())
1044        }
1045    }
1046
1047    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TestFailure {
1048        #[inline(always)]
1049        fn new_empty() -> Self {
1050            Self {
1051                test_name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
1052                reason: fidl::new_empty!(fidl::encoding::UnboundedString, D),
1053            }
1054        }
1055
1056        #[inline]
1057        unsafe fn decode(
1058            &mut self,
1059            decoder: &mut fidl::encoding::Decoder<'_, D>,
1060            offset: usize,
1061            _depth: fidl::encoding::Depth,
1062        ) -> fidl::Result<()> {
1063            decoder.debug_check_bounds::<Self>(offset);
1064            // Verify that padding bytes are zero.
1065            fidl::decode!(
1066                fidl::encoding::UnboundedString,
1067                D,
1068                &mut self.test_name,
1069                decoder,
1070                offset + 0,
1071                _depth
1072            )?;
1073            fidl::decode!(
1074                fidl::encoding::UnboundedString,
1075                D,
1076                &mut self.reason,
1077                decoder,
1078                offset + 16,
1079                _depth
1080            )?;
1081            Ok(())
1082        }
1083    }
1084
1085    impl fidl::encoding::ValueTypeMarker for TestSuccess {
1086        type Borrowed<'a> = &'a Self;
1087        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1088            value
1089        }
1090    }
1091
1092    unsafe impl fidl::encoding::TypeMarker for TestSuccess {
1093        type Owned = Self;
1094
1095        #[inline(always)]
1096        fn inline_align(_context: fidl::encoding::Context) -> usize {
1097            8
1098        }
1099
1100        #[inline(always)]
1101        fn inline_size(_context: fidl::encoding::Context) -> usize {
1102            16
1103        }
1104    }
1105
1106    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TestSuccess, D>
1107        for &TestSuccess
1108    {
1109        #[inline]
1110        unsafe fn encode(
1111            self,
1112            encoder: &mut fidl::encoding::Encoder<'_, D>,
1113            offset: usize,
1114            _depth: fidl::encoding::Depth,
1115        ) -> fidl::Result<()> {
1116            encoder.debug_check_bounds::<TestSuccess>(offset);
1117            // Delegate to tuple encoding.
1118            fidl::encoding::Encode::<TestSuccess, D>::encode(
1119                (<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
1120                    &self.test_name,
1121                ),),
1122                encoder,
1123                offset,
1124                _depth,
1125            )
1126        }
1127    }
1128    unsafe impl<
1129            D: fidl::encoding::ResourceDialect,
1130            T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
1131        > fidl::encoding::Encode<TestSuccess, D> for (T0,)
1132    {
1133        #[inline]
1134        unsafe fn encode(
1135            self,
1136            encoder: &mut fidl::encoding::Encoder<'_, D>,
1137            offset: usize,
1138            depth: fidl::encoding::Depth,
1139        ) -> fidl::Result<()> {
1140            encoder.debug_check_bounds::<TestSuccess>(offset);
1141            // Zero out padding regions. There's no need to apply masks
1142            // because the unmasked parts will be overwritten by fields.
1143            // Write the fields.
1144            self.0.encode(encoder, offset + 0, depth)?;
1145            Ok(())
1146        }
1147    }
1148
1149    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TestSuccess {
1150        #[inline(always)]
1151        fn new_empty() -> Self {
1152            Self { test_name: fidl::new_empty!(fidl::encoding::UnboundedString, D) }
1153        }
1154
1155        #[inline]
1156        unsafe fn decode(
1157            &mut self,
1158            decoder: &mut fidl::encoding::Decoder<'_, D>,
1159            offset: usize,
1160            _depth: fidl::encoding::Depth,
1161        ) -> fidl::Result<()> {
1162            decoder.debug_check_bounds::<Self>(offset);
1163            // Verify that padding bytes are zero.
1164            fidl::decode!(
1165                fidl::encoding::UnboundedString,
1166                D,
1167                &mut self.test_name,
1168                decoder,
1169                offset + 0,
1170                _depth
1171            )?;
1172            Ok(())
1173        }
1174    }
1175
1176    impl fidl::encoding::ValueTypeMarker for ValidateResult {
1177        type Borrowed<'a> = &'a Self;
1178        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1179            value
1180        }
1181    }
1182
1183    unsafe impl fidl::encoding::TypeMarker for ValidateResult {
1184        type Owned = Self;
1185
1186        #[inline(always)]
1187        fn inline_align(_context: fidl::encoding::Context) -> usize {
1188            8
1189        }
1190
1191        #[inline(always)]
1192        fn inline_size(_context: fidl::encoding::Context) -> usize {
1193            16
1194        }
1195    }
1196
1197    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ValidateResult, D>
1198        for &ValidateResult
1199    {
1200        #[inline]
1201        unsafe fn encode(
1202            self,
1203            encoder: &mut fidl::encoding::Encoder<'_, D>,
1204            offset: usize,
1205            _depth: fidl::encoding::Depth,
1206        ) -> fidl::Result<()> {
1207            encoder.debug_check_bounds::<ValidateResult>(offset);
1208            encoder.write_num::<u64>(self.ordinal(), offset);
1209            match self {
1210                ValidateResult::Success(ref val) => {
1211                    fidl::encoding::encode_in_envelope::<TestSuccess, D>(
1212                        <TestSuccess as fidl::encoding::ValueTypeMarker>::borrow(val),
1213                        encoder,
1214                        offset + 8,
1215                        _depth,
1216                    )
1217                }
1218                ValidateResult::Failure(ref val) => {
1219                    fidl::encoding::encode_in_envelope::<TestFailure, D>(
1220                        <TestFailure as fidl::encoding::ValueTypeMarker>::borrow(val),
1221                        encoder,
1222                        offset + 8,
1223                        _depth,
1224                    )
1225                }
1226            }
1227        }
1228    }
1229
1230    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ValidateResult {
1231        #[inline(always)]
1232        fn new_empty() -> Self {
1233            Self::Success(fidl::new_empty!(TestSuccess, D))
1234        }
1235
1236        #[inline]
1237        unsafe fn decode(
1238            &mut self,
1239            decoder: &mut fidl::encoding::Decoder<'_, D>,
1240            offset: usize,
1241            mut depth: fidl::encoding::Depth,
1242        ) -> fidl::Result<()> {
1243            decoder.debug_check_bounds::<Self>(offset);
1244            #[allow(unused_variables)]
1245            let next_out_of_line = decoder.next_out_of_line();
1246            let handles_before = decoder.remaining_handles();
1247            let (ordinal, inlined, num_bytes, num_handles) =
1248                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1249
1250            let member_inline_size = match ordinal {
1251                1 => <TestSuccess as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1252                2 => <TestFailure as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1253                _ => return Err(fidl::Error::UnknownUnionTag),
1254            };
1255
1256            if inlined != (member_inline_size <= 4) {
1257                return Err(fidl::Error::InvalidInlineBitInEnvelope);
1258            }
1259            let _inner_offset;
1260            if inlined {
1261                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1262                _inner_offset = offset + 8;
1263            } else {
1264                depth.increment()?;
1265                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1266            }
1267            match ordinal {
1268                1 => {
1269                    #[allow(irrefutable_let_patterns)]
1270                    if let ValidateResult::Success(_) = self {
1271                        // Do nothing, read the value into the object
1272                    } else {
1273                        // Initialize `self` to the right variant
1274                        *self = ValidateResult::Success(fidl::new_empty!(TestSuccess, D));
1275                    }
1276                    #[allow(irrefutable_let_patterns)]
1277                    if let ValidateResult::Success(ref mut val) = self {
1278                        fidl::decode!(TestSuccess, D, val, decoder, _inner_offset, depth)?;
1279                    } else {
1280                        unreachable!()
1281                    }
1282                }
1283                2 => {
1284                    #[allow(irrefutable_let_patterns)]
1285                    if let ValidateResult::Failure(_) = self {
1286                        // Do nothing, read the value into the object
1287                    } else {
1288                        // Initialize `self` to the right variant
1289                        *self = ValidateResult::Failure(fidl::new_empty!(TestFailure, D));
1290                    }
1291                    #[allow(irrefutable_let_patterns)]
1292                    if let ValidateResult::Failure(ref mut val) = self {
1293                        fidl::decode!(TestFailure, D, val, decoder, _inner_offset, depth)?;
1294                    } else {
1295                        unreachable!()
1296                    }
1297                }
1298                ordinal => panic!("unexpected ordinal {:?}", ordinal),
1299            }
1300            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1301                return Err(fidl::Error::InvalidNumBytesInEnvelope);
1302            }
1303            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1304                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1305            }
1306            Ok(())
1307        }
1308    }
1309
1310    impl fidl::encoding::ValueTypeMarker for Value {
1311        type Borrowed<'a> = &'a Self;
1312        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1313            value
1314        }
1315    }
1316
1317    unsafe impl fidl::encoding::TypeMarker for Value {
1318        type Owned = Self;
1319
1320        #[inline(always)]
1321        fn inline_align(_context: fidl::encoding::Context) -> usize {
1322            8
1323        }
1324
1325        #[inline(always)]
1326        fn inline_size(_context: fidl::encoding::Context) -> usize {
1327            16
1328        }
1329    }
1330
1331    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Value, D> for &Value {
1332        #[inline]
1333        unsafe fn encode(
1334            self,
1335            encoder: &mut fidl::encoding::Encoder<'_, D>,
1336            offset: usize,
1337            _depth: fidl::encoding::Depth,
1338        ) -> fidl::Result<()> {
1339            encoder.debug_check_bounds::<Value>(offset);
1340            encoder.write_num::<u64>(self.ordinal(), offset);
1341            match self {
1342            Value::SignedInt(ref val) => {
1343                fidl::encoding::encode_in_envelope::<i64, D>(
1344                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
1345                    encoder, offset + 8, _depth
1346                )
1347            }
1348            Value::UnsignedInt(ref val) => {
1349                fidl::encoding::encode_in_envelope::<u64, D>(
1350                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
1351                    encoder, offset + 8, _depth
1352                )
1353            }
1354            Value::Floating(ref val) => {
1355                fidl::encoding::encode_in_envelope::<f64, D>(
1356                    <f64 as fidl::encoding::ValueTypeMarker>::borrow(val),
1357                    encoder, offset + 8, _depth
1358                )
1359            }
1360            Value::Text(ref val) => {
1361                fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<32768>, D>(
1362                    <fidl::encoding::BoundedString<32768> as fidl::encoding::ValueTypeMarker>::borrow(val),
1363                    encoder, offset + 8, _depth
1364                )
1365            }
1366            Value::Boolean(ref val) => {
1367                fidl::encoding::encode_in_envelope::<bool, D>(
1368                    <bool as fidl::encoding::ValueTypeMarker>::borrow(val),
1369                    encoder, offset + 8, _depth
1370                )
1371            }
1372            Value::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1373        }
1374        }
1375    }
1376
1377    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Value {
1378        #[inline(always)]
1379        fn new_empty() -> Self {
1380            Self::__SourceBreaking { unknown_ordinal: 0 }
1381        }
1382
1383        #[inline]
1384        unsafe fn decode(
1385            &mut self,
1386            decoder: &mut fidl::encoding::Decoder<'_, D>,
1387            offset: usize,
1388            mut depth: fidl::encoding::Depth,
1389        ) -> fidl::Result<()> {
1390            decoder.debug_check_bounds::<Self>(offset);
1391            #[allow(unused_variables)]
1392            let next_out_of_line = decoder.next_out_of_line();
1393            let handles_before = decoder.remaining_handles();
1394            let (ordinal, inlined, num_bytes, num_handles) =
1395                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1396
1397            let member_inline_size = match ordinal {
1398            1 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1399            2 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1400            3 => <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1401            4 => <fidl::encoding::BoundedString<32768> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1402            5 => <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1403            0 => return Err(fidl::Error::UnknownUnionTag),
1404            _ => num_bytes as usize,
1405        };
1406
1407            if inlined != (member_inline_size <= 4) {
1408                return Err(fidl::Error::InvalidInlineBitInEnvelope);
1409            }
1410            let _inner_offset;
1411            if inlined {
1412                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1413                _inner_offset = offset + 8;
1414            } else {
1415                depth.increment()?;
1416                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1417            }
1418            match ordinal {
1419                1 => {
1420                    #[allow(irrefutable_let_patterns)]
1421                    if let Value::SignedInt(_) = self {
1422                        // Do nothing, read the value into the object
1423                    } else {
1424                        // Initialize `self` to the right variant
1425                        *self = Value::SignedInt(fidl::new_empty!(i64, D));
1426                    }
1427                    #[allow(irrefutable_let_patterns)]
1428                    if let Value::SignedInt(ref mut val) = self {
1429                        fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
1430                    } else {
1431                        unreachable!()
1432                    }
1433                }
1434                2 => {
1435                    #[allow(irrefutable_let_patterns)]
1436                    if let Value::UnsignedInt(_) = self {
1437                        // Do nothing, read the value into the object
1438                    } else {
1439                        // Initialize `self` to the right variant
1440                        *self = Value::UnsignedInt(fidl::new_empty!(u64, D));
1441                    }
1442                    #[allow(irrefutable_let_patterns)]
1443                    if let Value::UnsignedInt(ref mut val) = self {
1444                        fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
1445                    } else {
1446                        unreachable!()
1447                    }
1448                }
1449                3 => {
1450                    #[allow(irrefutable_let_patterns)]
1451                    if let Value::Floating(_) = self {
1452                        // Do nothing, read the value into the object
1453                    } else {
1454                        // Initialize `self` to the right variant
1455                        *self = Value::Floating(fidl::new_empty!(f64, D));
1456                    }
1457                    #[allow(irrefutable_let_patterns)]
1458                    if let Value::Floating(ref mut val) = self {
1459                        fidl::decode!(f64, D, val, decoder, _inner_offset, depth)?;
1460                    } else {
1461                        unreachable!()
1462                    }
1463                }
1464                4 => {
1465                    #[allow(irrefutable_let_patterns)]
1466                    if let Value::Text(_) = self {
1467                        // Do nothing, read the value into the object
1468                    } else {
1469                        // Initialize `self` to the right variant
1470                        *self =
1471                            Value::Text(fidl::new_empty!(fidl::encoding::BoundedString<32768>, D));
1472                    }
1473                    #[allow(irrefutable_let_patterns)]
1474                    if let Value::Text(ref mut val) = self {
1475                        fidl::decode!(
1476                            fidl::encoding::BoundedString<32768>,
1477                            D,
1478                            val,
1479                            decoder,
1480                            _inner_offset,
1481                            depth
1482                        )?;
1483                    } else {
1484                        unreachable!()
1485                    }
1486                }
1487                5 => {
1488                    #[allow(irrefutable_let_patterns)]
1489                    if let Value::Boolean(_) = self {
1490                        // Do nothing, read the value into the object
1491                    } else {
1492                        // Initialize `self` to the right variant
1493                        *self = Value::Boolean(fidl::new_empty!(bool, D));
1494                    }
1495                    #[allow(irrefutable_let_patterns)]
1496                    if let Value::Boolean(ref mut val) = self {
1497                        fidl::decode!(bool, D, val, decoder, _inner_offset, depth)?;
1498                    } else {
1499                        unreachable!()
1500                    }
1501                }
1502                #[allow(deprecated)]
1503                ordinal => {
1504                    for _ in 0..num_handles {
1505                        decoder.drop_next_handle()?;
1506                    }
1507                    *self = Value::__SourceBreaking { unknown_ordinal: ordinal };
1508                }
1509            }
1510            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1511                return Err(fidl::Error::InvalidNumBytesInEnvelope);
1512            }
1513            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1514                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1515            }
1516            Ok(())
1517        }
1518    }
1519}