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