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