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