fidl_diagnostics_validate_deprecated_common/
fidl_diagnostics_validate_deprecated_common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11/// Indicate the preferred DiffType on failed tests.
12#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
13#[repr(u32)]
14pub enum DiffType {
15    /// Get the full rendering of both trees.
16    Full = 0,
17    /// Get the diff between the trees.
18    Diff = 1,
19    /// Get both the full rendering of both trees, and their diff.
20    Both = 2,
21}
22
23impl DiffType {
24    #[inline]
25    pub fn from_primitive(prim: u32) -> Option<Self> {
26        match prim {
27            0 => Some(Self::Full),
28            1 => Some(Self::Diff),
29            2 => Some(Self::Both),
30            _ => None,
31        }
32    }
33
34    #[inline]
35    pub const fn into_primitive(self) -> u32 {
36        self as u32
37    }
38}
39
40/// TestResult tells the result of executing an Initialize or Act command.
41#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
42#[repr(u32)]
43pub enum TestResult {
44    /// The function call completed without error.
45    Ok = 0,
46    /// The Inspect library doesn't implement a requested feature.
47    Unimplemented = 1,
48    /// The Inspect library reported a failure executing the function.
49    Failed = 2,
50    /// The driver and/or puppet-wrapper was in an illegal state.
51    Illegal = 3,
52}
53
54impl TestResult {
55    #[inline]
56    pub fn from_primitive(prim: u32) -> Option<Self> {
57        match prim {
58            0 => Some(Self::Ok),
59            1 => Some(Self::Unimplemented),
60            2 => Some(Self::Failed),
61            3 => Some(Self::Illegal),
62            _ => None,
63        }
64    }
65
66    #[inline]
67    pub const fn into_primitive(self) -> u32 {
68        self as u32
69    }
70}
71
72/// Tells the puppet to create a property with the given byte array value.
73#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
74pub struct CreateBytesProperty {
75    pub parent: u32,
76    pub id: u32,
77    pub name: String,
78    pub value: Vec<u8>,
79}
80
81impl fidl::Persistable for CreateBytesProperty {}
82
83/// Tells the puppet to create a Node with the given name, parentage, and ID
84/// (the id is specified so other nodes can later be created under it).
85#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
86pub struct CreateNode {
87    pub parent: u32,
88    pub id: u32,
89    pub name: String,
90}
91
92impl fidl::Persistable for CreateNode {}
93
94/// Tells the puppet to create a property with the given numeric value.
95#[derive(Clone, Debug, PartialEq)]
96pub struct CreateNumericProperty {
97    pub parent: u32,
98    pub id: u32,
99    pub name: String,
100    pub value: Value,
101}
102
103impl fidl::Persistable for CreateNumericProperty {}
104
105/// Tells the puppet to delete the given node.
106#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
107#[repr(C)]
108pub struct DeleteNode {
109    pub id: u32,
110}
111
112impl fidl::Persistable for DeleteNode {}
113
114#[derive(Clone, Debug, PartialEq)]
115pub struct InspectPuppetActRequest {
116    pub action: Action,
117}
118
119impl fidl::Persistable for InspectPuppetActRequest {}
120
121#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
122pub struct InspectPuppetActResponse {
123    pub result: TestResult,
124}
125
126impl fidl::Persistable for InspectPuppetActResponse {}
127
128#[derive(Clone, Debug, PartialEq)]
129pub struct InspectPuppetInitializeRequest {
130    pub params: InitializationParams,
131}
132
133impl fidl::Persistable for InspectPuppetInitializeRequest {}
134
135#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
136pub struct InspectPuppetPublishResponse {
137    pub result: TestResult,
138}
139
140impl fidl::Persistable for InspectPuppetPublishResponse {}
141
142/// InitializationParams tells how to initialize the Inspect library.
143#[derive(Clone, Debug, Default, PartialEq)]
144pub struct InitializationParams {
145    pub vmo_size: Option<u64>,
146    #[doc(hidden)]
147    pub __source_breaking: fidl::marker::SourceBreaking,
148}
149
150impl fidl::Persistable for InitializationParams {}
151
152/// Tells the puppet to do something to modify the VMO.
153#[derive(Clone, Debug)]
154pub enum Action {
155    CreateNode(CreateNode),
156    DeleteNode(DeleteNode),
157    CreateNumericProperty(CreateNumericProperty),
158    CreateBytesProperty(CreateBytesProperty),
159    #[doc(hidden)]
160    __SourceBreaking {
161        unknown_ordinal: u64,
162    },
163}
164
165/// Pattern that matches an unknown `Action` member.
166#[macro_export]
167macro_rules! ActionUnknown {
168    () => {
169        _
170    };
171}
172
173// Custom PartialEq so that unknown variants are not equal to themselves.
174impl PartialEq for Action {
175    fn eq(&self, other: &Self) -> bool {
176        match (self, other) {
177            (Self::CreateNode(x), Self::CreateNode(y)) => *x == *y,
178            (Self::DeleteNode(x), Self::DeleteNode(y)) => *x == *y,
179            (Self::CreateNumericProperty(x), Self::CreateNumericProperty(y)) => *x == *y,
180            (Self::CreateBytesProperty(x), Self::CreateBytesProperty(y)) => *x == *y,
181            _ => false,
182        }
183    }
184}
185
186impl Action {
187    #[inline]
188    pub fn ordinal(&self) -> u64 {
189        match *self {
190            Self::CreateNode(_) => 1,
191            Self::DeleteNode(_) => 2,
192            Self::CreateNumericProperty(_) => 3,
193            Self::CreateBytesProperty(_) => 4,
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 Action {}
213
214#[derive(Clone, Debug)]
215pub enum Value {
216    IntT(i64),
217    UintT(u64),
218    DoubleT(f64),
219    StringT(String),
220    #[doc(hidden)]
221    __SourceBreaking {
222        unknown_ordinal: u64,
223    },
224}
225
226/// Pattern that matches an unknown `Value` member.
227#[macro_export]
228macro_rules! ValueUnknown {
229    () => {
230        _
231    };
232}
233
234// Custom PartialEq so that unknown variants are not equal to themselves.
235impl PartialEq for Value {
236    fn eq(&self, other: &Self) -> bool {
237        match (self, other) {
238            (Self::IntT(x), Self::IntT(y)) => *x == *y,
239            (Self::UintT(x), Self::UintT(y)) => *x == *y,
240            (Self::DoubleT(x), Self::DoubleT(y)) => *x == *y,
241            (Self::StringT(x), Self::StringT(y)) => *x == *y,
242            _ => false,
243        }
244    }
245}
246
247impl Value {
248    #[inline]
249    pub fn ordinal(&self) -> u64 {
250        match *self {
251            Self::IntT(_) => 1,
252            Self::UintT(_) => 2,
253            Self::DoubleT(_) => 3,
254            Self::StringT(_) => 4,
255            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
256        }
257    }
258
259    #[inline]
260    pub fn unknown_variant_for_testing() -> Self {
261        Self::__SourceBreaking { unknown_ordinal: 0 }
262    }
263
264    #[inline]
265    pub fn is_unknown(&self) -> bool {
266        match self {
267            Self::__SourceBreaking { .. } => true,
268            _ => false,
269        }
270    }
271}
272
273impl fidl::Persistable for Value {}
274
275mod internal {
276    use super::*;
277    unsafe impl fidl::encoding::TypeMarker for DiffType {
278        type Owned = Self;
279
280        #[inline(always)]
281        fn inline_align(_context: fidl::encoding::Context) -> usize {
282            std::mem::align_of::<u32>()
283        }
284
285        #[inline(always)]
286        fn inline_size(_context: fidl::encoding::Context) -> usize {
287            std::mem::size_of::<u32>()
288        }
289
290        #[inline(always)]
291        fn encode_is_copy() -> bool {
292            true
293        }
294
295        #[inline(always)]
296        fn decode_is_copy() -> bool {
297            false
298        }
299    }
300
301    impl fidl::encoding::ValueTypeMarker for DiffType {
302        type Borrowed<'a> = Self;
303        #[inline(always)]
304        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
305            *value
306        }
307    }
308
309    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DiffType {
310        #[inline]
311        unsafe fn encode(
312            self,
313            encoder: &mut fidl::encoding::Encoder<'_, D>,
314            offset: usize,
315            _depth: fidl::encoding::Depth,
316        ) -> fidl::Result<()> {
317            encoder.debug_check_bounds::<Self>(offset);
318            encoder.write_num(self.into_primitive(), offset);
319            Ok(())
320        }
321    }
322
323    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DiffType {
324        #[inline(always)]
325        fn new_empty() -> Self {
326            Self::Full
327        }
328
329        #[inline]
330        unsafe fn decode(
331            &mut self,
332            decoder: &mut fidl::encoding::Decoder<'_, D>,
333            offset: usize,
334            _depth: fidl::encoding::Depth,
335        ) -> fidl::Result<()> {
336            decoder.debug_check_bounds::<Self>(offset);
337            let prim = decoder.read_num::<u32>(offset);
338
339            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
340            Ok(())
341        }
342    }
343    unsafe impl fidl::encoding::TypeMarker for TestResult {
344        type Owned = Self;
345
346        #[inline(always)]
347        fn inline_align(_context: fidl::encoding::Context) -> usize {
348            std::mem::align_of::<u32>()
349        }
350
351        #[inline(always)]
352        fn inline_size(_context: fidl::encoding::Context) -> usize {
353            std::mem::size_of::<u32>()
354        }
355
356        #[inline(always)]
357        fn encode_is_copy() -> bool {
358            true
359        }
360
361        #[inline(always)]
362        fn decode_is_copy() -> bool {
363            false
364        }
365    }
366
367    impl fidl::encoding::ValueTypeMarker for TestResult {
368        type Borrowed<'a> = Self;
369        #[inline(always)]
370        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
371            *value
372        }
373    }
374
375    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TestResult {
376        #[inline]
377        unsafe fn encode(
378            self,
379            encoder: &mut fidl::encoding::Encoder<'_, D>,
380            offset: usize,
381            _depth: fidl::encoding::Depth,
382        ) -> fidl::Result<()> {
383            encoder.debug_check_bounds::<Self>(offset);
384            encoder.write_num(self.into_primitive(), offset);
385            Ok(())
386        }
387    }
388
389    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TestResult {
390        #[inline(always)]
391        fn new_empty() -> Self {
392            Self::Ok
393        }
394
395        #[inline]
396        unsafe fn decode(
397            &mut self,
398            decoder: &mut fidl::encoding::Decoder<'_, D>,
399            offset: usize,
400            _depth: fidl::encoding::Depth,
401        ) -> fidl::Result<()> {
402            decoder.debug_check_bounds::<Self>(offset);
403            let prim = decoder.read_num::<u32>(offset);
404
405            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
406            Ok(())
407        }
408    }
409
410    impl fidl::encoding::ValueTypeMarker for CreateBytesProperty {
411        type Borrowed<'a> = &'a Self;
412        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
413            value
414        }
415    }
416
417    unsafe impl fidl::encoding::TypeMarker for CreateBytesProperty {
418        type Owned = Self;
419
420        #[inline(always)]
421        fn inline_align(_context: fidl::encoding::Context) -> usize {
422            8
423        }
424
425        #[inline(always)]
426        fn inline_size(_context: fidl::encoding::Context) -> usize {
427            40
428        }
429    }
430
431    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CreateBytesProperty, D>
432        for &CreateBytesProperty
433    {
434        #[inline]
435        unsafe fn encode(
436            self,
437            encoder: &mut fidl::encoding::Encoder<'_, D>,
438            offset: usize,
439            _depth: fidl::encoding::Depth,
440        ) -> fidl::Result<()> {
441            encoder.debug_check_bounds::<CreateBytesProperty>(offset);
442            // Delegate to tuple encoding.
443            fidl::encoding::Encode::<CreateBytesProperty, D>::encode(
444                (
445                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.parent),
446                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
447                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
448                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
449                ),
450                encoder, offset, _depth
451            )
452        }
453    }
454    unsafe impl<
455            D: fidl::encoding::ResourceDialect,
456            T0: fidl::encoding::Encode<u32, D>,
457            T1: fidl::encoding::Encode<u32, D>,
458            T2: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
459            T3: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
460        > fidl::encoding::Encode<CreateBytesProperty, D> for (T0, T1, T2, T3)
461    {
462        #[inline]
463        unsafe fn encode(
464            self,
465            encoder: &mut fidl::encoding::Encoder<'_, D>,
466            offset: usize,
467            depth: fidl::encoding::Depth,
468        ) -> fidl::Result<()> {
469            encoder.debug_check_bounds::<CreateBytesProperty>(offset);
470            // Zero out padding regions. There's no need to apply masks
471            // because the unmasked parts will be overwritten by fields.
472            // Write the fields.
473            self.0.encode(encoder, offset + 0, depth)?;
474            self.1.encode(encoder, offset + 4, depth)?;
475            self.2.encode(encoder, offset + 8, depth)?;
476            self.3.encode(encoder, offset + 24, depth)?;
477            Ok(())
478        }
479    }
480
481    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CreateBytesProperty {
482        #[inline(always)]
483        fn new_empty() -> Self {
484            Self {
485                parent: fidl::new_empty!(u32, D),
486                id: fidl::new_empty!(u32, D),
487                name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
488                value: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
489            }
490        }
491
492        #[inline]
493        unsafe fn decode(
494            &mut self,
495            decoder: &mut fidl::encoding::Decoder<'_, D>,
496            offset: usize,
497            _depth: fidl::encoding::Depth,
498        ) -> fidl::Result<()> {
499            decoder.debug_check_bounds::<Self>(offset);
500            // Verify that padding bytes are zero.
501            fidl::decode!(u32, D, &mut self.parent, decoder, offset + 0, _depth)?;
502            fidl::decode!(u32, D, &mut self.id, decoder, offset + 4, _depth)?;
503            fidl::decode!(
504                fidl::encoding::UnboundedString,
505                D,
506                &mut self.name,
507                decoder,
508                offset + 8,
509                _depth
510            )?;
511            fidl::decode!(
512                fidl::encoding::UnboundedVector<u8>,
513                D,
514                &mut self.value,
515                decoder,
516                offset + 24,
517                _depth
518            )?;
519            Ok(())
520        }
521    }
522
523    impl fidl::encoding::ValueTypeMarker for CreateNode {
524        type Borrowed<'a> = &'a Self;
525        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
526            value
527        }
528    }
529
530    unsafe impl fidl::encoding::TypeMarker for CreateNode {
531        type Owned = Self;
532
533        #[inline(always)]
534        fn inline_align(_context: fidl::encoding::Context) -> usize {
535            8
536        }
537
538        #[inline(always)]
539        fn inline_size(_context: fidl::encoding::Context) -> usize {
540            24
541        }
542    }
543
544    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CreateNode, D>
545        for &CreateNode
546    {
547        #[inline]
548        unsafe fn encode(
549            self,
550            encoder: &mut fidl::encoding::Encoder<'_, D>,
551            offset: usize,
552            _depth: fidl::encoding::Depth,
553        ) -> fidl::Result<()> {
554            encoder.debug_check_bounds::<CreateNode>(offset);
555            // Delegate to tuple encoding.
556            fidl::encoding::Encode::<CreateNode, D>::encode(
557                (
558                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.parent),
559                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
560                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
561                        &self.name,
562                    ),
563                ),
564                encoder,
565                offset,
566                _depth,
567            )
568        }
569    }
570    unsafe impl<
571            D: fidl::encoding::ResourceDialect,
572            T0: fidl::encoding::Encode<u32, D>,
573            T1: fidl::encoding::Encode<u32, D>,
574            T2: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
575        > fidl::encoding::Encode<CreateNode, D> for (T0, T1, T2)
576    {
577        #[inline]
578        unsafe fn encode(
579            self,
580            encoder: &mut fidl::encoding::Encoder<'_, D>,
581            offset: usize,
582            depth: fidl::encoding::Depth,
583        ) -> fidl::Result<()> {
584            encoder.debug_check_bounds::<CreateNode>(offset);
585            // Zero out padding regions. There's no need to apply masks
586            // because the unmasked parts will be overwritten by fields.
587            // Write the fields.
588            self.0.encode(encoder, offset + 0, depth)?;
589            self.1.encode(encoder, offset + 4, depth)?;
590            self.2.encode(encoder, offset + 8, depth)?;
591            Ok(())
592        }
593    }
594
595    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CreateNode {
596        #[inline(always)]
597        fn new_empty() -> Self {
598            Self {
599                parent: fidl::new_empty!(u32, D),
600                id: fidl::new_empty!(u32, D),
601                name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
602            }
603        }
604
605        #[inline]
606        unsafe fn decode(
607            &mut self,
608            decoder: &mut fidl::encoding::Decoder<'_, D>,
609            offset: usize,
610            _depth: fidl::encoding::Depth,
611        ) -> fidl::Result<()> {
612            decoder.debug_check_bounds::<Self>(offset);
613            // Verify that padding bytes are zero.
614            fidl::decode!(u32, D, &mut self.parent, decoder, offset + 0, _depth)?;
615            fidl::decode!(u32, D, &mut self.id, decoder, offset + 4, _depth)?;
616            fidl::decode!(
617                fidl::encoding::UnboundedString,
618                D,
619                &mut self.name,
620                decoder,
621                offset + 8,
622                _depth
623            )?;
624            Ok(())
625        }
626    }
627
628    impl fidl::encoding::ValueTypeMarker for CreateNumericProperty {
629        type Borrowed<'a> = &'a Self;
630        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
631            value
632        }
633    }
634
635    unsafe impl fidl::encoding::TypeMarker for CreateNumericProperty {
636        type Owned = Self;
637
638        #[inline(always)]
639        fn inline_align(_context: fidl::encoding::Context) -> usize {
640            8
641        }
642
643        #[inline(always)]
644        fn inline_size(_context: fidl::encoding::Context) -> usize {
645            40
646        }
647    }
648
649    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CreateNumericProperty, D>
650        for &CreateNumericProperty
651    {
652        #[inline]
653        unsafe fn encode(
654            self,
655            encoder: &mut fidl::encoding::Encoder<'_, D>,
656            offset: usize,
657            _depth: fidl::encoding::Depth,
658        ) -> fidl::Result<()> {
659            encoder.debug_check_bounds::<CreateNumericProperty>(offset);
660            // Delegate to tuple encoding.
661            fidl::encoding::Encode::<CreateNumericProperty, D>::encode(
662                (
663                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.parent),
664                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
665                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
666                        &self.name,
667                    ),
668                    <Value as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
669                ),
670                encoder,
671                offset,
672                _depth,
673            )
674        }
675    }
676    unsafe impl<
677            D: fidl::encoding::ResourceDialect,
678            T0: fidl::encoding::Encode<u32, D>,
679            T1: fidl::encoding::Encode<u32, D>,
680            T2: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
681            T3: fidl::encoding::Encode<Value, D>,
682        > fidl::encoding::Encode<CreateNumericProperty, D> for (T0, T1, T2, T3)
683    {
684        #[inline]
685        unsafe fn encode(
686            self,
687            encoder: &mut fidl::encoding::Encoder<'_, D>,
688            offset: usize,
689            depth: fidl::encoding::Depth,
690        ) -> fidl::Result<()> {
691            encoder.debug_check_bounds::<CreateNumericProperty>(offset);
692            // Zero out padding regions. There's no need to apply masks
693            // because the unmasked parts will be overwritten by fields.
694            // Write the fields.
695            self.0.encode(encoder, offset + 0, depth)?;
696            self.1.encode(encoder, offset + 4, depth)?;
697            self.2.encode(encoder, offset + 8, depth)?;
698            self.3.encode(encoder, offset + 24, depth)?;
699            Ok(())
700        }
701    }
702
703    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CreateNumericProperty {
704        #[inline(always)]
705        fn new_empty() -> Self {
706            Self {
707                parent: fidl::new_empty!(u32, D),
708                id: fidl::new_empty!(u32, D),
709                name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
710                value: fidl::new_empty!(Value, D),
711            }
712        }
713
714        #[inline]
715        unsafe fn decode(
716            &mut self,
717            decoder: &mut fidl::encoding::Decoder<'_, D>,
718            offset: usize,
719            _depth: fidl::encoding::Depth,
720        ) -> fidl::Result<()> {
721            decoder.debug_check_bounds::<Self>(offset);
722            // Verify that padding bytes are zero.
723            fidl::decode!(u32, D, &mut self.parent, decoder, offset + 0, _depth)?;
724            fidl::decode!(u32, D, &mut self.id, decoder, offset + 4, _depth)?;
725            fidl::decode!(
726                fidl::encoding::UnboundedString,
727                D,
728                &mut self.name,
729                decoder,
730                offset + 8,
731                _depth
732            )?;
733            fidl::decode!(Value, D, &mut self.value, decoder, offset + 24, _depth)?;
734            Ok(())
735        }
736    }
737
738    impl fidl::encoding::ValueTypeMarker for DeleteNode {
739        type Borrowed<'a> = &'a Self;
740        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
741            value
742        }
743    }
744
745    unsafe impl fidl::encoding::TypeMarker for DeleteNode {
746        type Owned = Self;
747
748        #[inline(always)]
749        fn inline_align(_context: fidl::encoding::Context) -> usize {
750            4
751        }
752
753        #[inline(always)]
754        fn inline_size(_context: fidl::encoding::Context) -> usize {
755            4
756        }
757        #[inline(always)]
758        fn encode_is_copy() -> bool {
759            true
760        }
761
762        #[inline(always)]
763        fn decode_is_copy() -> bool {
764            true
765        }
766    }
767
768    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeleteNode, D>
769        for &DeleteNode
770    {
771        #[inline]
772        unsafe fn encode(
773            self,
774            encoder: &mut fidl::encoding::Encoder<'_, D>,
775            offset: usize,
776            _depth: fidl::encoding::Depth,
777        ) -> fidl::Result<()> {
778            encoder.debug_check_bounds::<DeleteNode>(offset);
779            unsafe {
780                // Copy the object into the buffer.
781                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
782                (buf_ptr as *mut DeleteNode).write_unaligned((self as *const DeleteNode).read());
783                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
784                // done second because the memcpy will write garbage to these bytes.
785            }
786            Ok(())
787        }
788    }
789    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
790        fidl::encoding::Encode<DeleteNode, D> for (T0,)
791    {
792        #[inline]
793        unsafe fn encode(
794            self,
795            encoder: &mut fidl::encoding::Encoder<'_, D>,
796            offset: usize,
797            depth: fidl::encoding::Depth,
798        ) -> fidl::Result<()> {
799            encoder.debug_check_bounds::<DeleteNode>(offset);
800            // Zero out padding regions. There's no need to apply masks
801            // because the unmasked parts will be overwritten by fields.
802            // Write the fields.
803            self.0.encode(encoder, offset + 0, depth)?;
804            Ok(())
805        }
806    }
807
808    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeleteNode {
809        #[inline(always)]
810        fn new_empty() -> Self {
811            Self { id: fidl::new_empty!(u32, D) }
812        }
813
814        #[inline]
815        unsafe fn decode(
816            &mut self,
817            decoder: &mut fidl::encoding::Decoder<'_, D>,
818            offset: usize,
819            _depth: fidl::encoding::Depth,
820        ) -> fidl::Result<()> {
821            decoder.debug_check_bounds::<Self>(offset);
822            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
823            // Verify that padding bytes are zero.
824            // Copy from the buffer into the object.
825            unsafe {
826                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
827            }
828            Ok(())
829        }
830    }
831
832    impl fidl::encoding::ValueTypeMarker for InspectPuppetActRequest {
833        type Borrowed<'a> = &'a Self;
834        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
835            value
836        }
837    }
838
839    unsafe impl fidl::encoding::TypeMarker for InspectPuppetActRequest {
840        type Owned = Self;
841
842        #[inline(always)]
843        fn inline_align(_context: fidl::encoding::Context) -> usize {
844            8
845        }
846
847        #[inline(always)]
848        fn inline_size(_context: fidl::encoding::Context) -> usize {
849            16
850        }
851    }
852
853    unsafe impl<D: fidl::encoding::ResourceDialect>
854        fidl::encoding::Encode<InspectPuppetActRequest, D> for &InspectPuppetActRequest
855    {
856        #[inline]
857        unsafe fn encode(
858            self,
859            encoder: &mut fidl::encoding::Encoder<'_, D>,
860            offset: usize,
861            _depth: fidl::encoding::Depth,
862        ) -> fidl::Result<()> {
863            encoder.debug_check_bounds::<InspectPuppetActRequest>(offset);
864            // Delegate to tuple encoding.
865            fidl::encoding::Encode::<InspectPuppetActRequest, D>::encode(
866                (<Action as fidl::encoding::ValueTypeMarker>::borrow(&self.action),),
867                encoder,
868                offset,
869                _depth,
870            )
871        }
872    }
873    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Action, D>>
874        fidl::encoding::Encode<InspectPuppetActRequest, D> for (T0,)
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::<InspectPuppetActRequest>(offset);
884            // Zero out padding regions. There's no need to apply masks
885            // because the unmasked parts will be overwritten by fields.
886            // Write the fields.
887            self.0.encode(encoder, offset + 0, depth)?;
888            Ok(())
889        }
890    }
891
892    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
893        for InspectPuppetActRequest
894    {
895        #[inline(always)]
896        fn new_empty() -> Self {
897            Self { action: fidl::new_empty!(Action, D) }
898        }
899
900        #[inline]
901        unsafe fn decode(
902            &mut self,
903            decoder: &mut fidl::encoding::Decoder<'_, D>,
904            offset: usize,
905            _depth: fidl::encoding::Depth,
906        ) -> fidl::Result<()> {
907            decoder.debug_check_bounds::<Self>(offset);
908            // Verify that padding bytes are zero.
909            fidl::decode!(Action, D, &mut self.action, decoder, offset + 0, _depth)?;
910            Ok(())
911        }
912    }
913
914    impl fidl::encoding::ValueTypeMarker for InspectPuppetActResponse {
915        type Borrowed<'a> = &'a Self;
916        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
917            value
918        }
919    }
920
921    unsafe impl fidl::encoding::TypeMarker for InspectPuppetActResponse {
922        type Owned = Self;
923
924        #[inline(always)]
925        fn inline_align(_context: fidl::encoding::Context) -> usize {
926            4
927        }
928
929        #[inline(always)]
930        fn inline_size(_context: fidl::encoding::Context) -> usize {
931            4
932        }
933    }
934
935    unsafe impl<D: fidl::encoding::ResourceDialect>
936        fidl::encoding::Encode<InspectPuppetActResponse, D> for &InspectPuppetActResponse
937    {
938        #[inline]
939        unsafe fn encode(
940            self,
941            encoder: &mut fidl::encoding::Encoder<'_, D>,
942            offset: usize,
943            _depth: fidl::encoding::Depth,
944        ) -> fidl::Result<()> {
945            encoder.debug_check_bounds::<InspectPuppetActResponse>(offset);
946            // Delegate to tuple encoding.
947            fidl::encoding::Encode::<InspectPuppetActResponse, D>::encode(
948                (<TestResult as fidl::encoding::ValueTypeMarker>::borrow(&self.result),),
949                encoder,
950                offset,
951                _depth,
952            )
953        }
954    }
955    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TestResult, D>>
956        fidl::encoding::Encode<InspectPuppetActResponse, D> for (T0,)
957    {
958        #[inline]
959        unsafe fn encode(
960            self,
961            encoder: &mut fidl::encoding::Encoder<'_, D>,
962            offset: usize,
963            depth: fidl::encoding::Depth,
964        ) -> fidl::Result<()> {
965            encoder.debug_check_bounds::<InspectPuppetActResponse>(offset);
966            // Zero out padding regions. There's no need to apply masks
967            // because the unmasked parts will be overwritten by fields.
968            // Write the fields.
969            self.0.encode(encoder, offset + 0, depth)?;
970            Ok(())
971        }
972    }
973
974    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
975        for InspectPuppetActResponse
976    {
977        #[inline(always)]
978        fn new_empty() -> Self {
979            Self { result: fidl::new_empty!(TestResult, D) }
980        }
981
982        #[inline]
983        unsafe fn decode(
984            &mut self,
985            decoder: &mut fidl::encoding::Decoder<'_, D>,
986            offset: usize,
987            _depth: fidl::encoding::Depth,
988        ) -> fidl::Result<()> {
989            decoder.debug_check_bounds::<Self>(offset);
990            // Verify that padding bytes are zero.
991            fidl::decode!(TestResult, D, &mut self.result, decoder, offset + 0, _depth)?;
992            Ok(())
993        }
994    }
995
996    impl fidl::encoding::ValueTypeMarker for InspectPuppetInitializeRequest {
997        type Borrowed<'a> = &'a Self;
998        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
999            value
1000        }
1001    }
1002
1003    unsafe impl fidl::encoding::TypeMarker for InspectPuppetInitializeRequest {
1004        type Owned = Self;
1005
1006        #[inline(always)]
1007        fn inline_align(_context: fidl::encoding::Context) -> usize {
1008            8
1009        }
1010
1011        #[inline(always)]
1012        fn inline_size(_context: fidl::encoding::Context) -> usize {
1013            16
1014        }
1015    }
1016
1017    unsafe impl<D: fidl::encoding::ResourceDialect>
1018        fidl::encoding::Encode<InspectPuppetInitializeRequest, D>
1019        for &InspectPuppetInitializeRequest
1020    {
1021        #[inline]
1022        unsafe fn encode(
1023            self,
1024            encoder: &mut fidl::encoding::Encoder<'_, D>,
1025            offset: usize,
1026            _depth: fidl::encoding::Depth,
1027        ) -> fidl::Result<()> {
1028            encoder.debug_check_bounds::<InspectPuppetInitializeRequest>(offset);
1029            // Delegate to tuple encoding.
1030            fidl::encoding::Encode::<InspectPuppetInitializeRequest, D>::encode(
1031                (<InitializationParams as fidl::encoding::ValueTypeMarker>::borrow(&self.params),),
1032                encoder,
1033                offset,
1034                _depth,
1035            )
1036        }
1037    }
1038    unsafe impl<
1039            D: fidl::encoding::ResourceDialect,
1040            T0: fidl::encoding::Encode<InitializationParams, D>,
1041        > fidl::encoding::Encode<InspectPuppetInitializeRequest, D> for (T0,)
1042    {
1043        #[inline]
1044        unsafe fn encode(
1045            self,
1046            encoder: &mut fidl::encoding::Encoder<'_, D>,
1047            offset: usize,
1048            depth: fidl::encoding::Depth,
1049        ) -> fidl::Result<()> {
1050            encoder.debug_check_bounds::<InspectPuppetInitializeRequest>(offset);
1051            // Zero out padding regions. There's no need to apply masks
1052            // because the unmasked parts will be overwritten by fields.
1053            // Write the fields.
1054            self.0.encode(encoder, offset + 0, depth)?;
1055            Ok(())
1056        }
1057    }
1058
1059    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1060        for InspectPuppetInitializeRequest
1061    {
1062        #[inline(always)]
1063        fn new_empty() -> Self {
1064            Self { params: fidl::new_empty!(InitializationParams, D) }
1065        }
1066
1067        #[inline]
1068        unsafe fn decode(
1069            &mut self,
1070            decoder: &mut fidl::encoding::Decoder<'_, D>,
1071            offset: usize,
1072            _depth: fidl::encoding::Depth,
1073        ) -> fidl::Result<()> {
1074            decoder.debug_check_bounds::<Self>(offset);
1075            // Verify that padding bytes are zero.
1076            fidl::decode!(InitializationParams, D, &mut self.params, decoder, offset + 0, _depth)?;
1077            Ok(())
1078        }
1079    }
1080
1081    impl fidl::encoding::ValueTypeMarker for InspectPuppetPublishResponse {
1082        type Borrowed<'a> = &'a Self;
1083        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1084            value
1085        }
1086    }
1087
1088    unsafe impl fidl::encoding::TypeMarker for InspectPuppetPublishResponse {
1089        type Owned = Self;
1090
1091        #[inline(always)]
1092        fn inline_align(_context: fidl::encoding::Context) -> usize {
1093            4
1094        }
1095
1096        #[inline(always)]
1097        fn inline_size(_context: fidl::encoding::Context) -> usize {
1098            4
1099        }
1100    }
1101
1102    unsafe impl<D: fidl::encoding::ResourceDialect>
1103        fidl::encoding::Encode<InspectPuppetPublishResponse, D> for &InspectPuppetPublishResponse
1104    {
1105        #[inline]
1106        unsafe fn encode(
1107            self,
1108            encoder: &mut fidl::encoding::Encoder<'_, D>,
1109            offset: usize,
1110            _depth: fidl::encoding::Depth,
1111        ) -> fidl::Result<()> {
1112            encoder.debug_check_bounds::<InspectPuppetPublishResponse>(offset);
1113            // Delegate to tuple encoding.
1114            fidl::encoding::Encode::<InspectPuppetPublishResponse, D>::encode(
1115                (<TestResult as fidl::encoding::ValueTypeMarker>::borrow(&self.result),),
1116                encoder,
1117                offset,
1118                _depth,
1119            )
1120        }
1121    }
1122    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TestResult, D>>
1123        fidl::encoding::Encode<InspectPuppetPublishResponse, D> for (T0,)
1124    {
1125        #[inline]
1126        unsafe fn encode(
1127            self,
1128            encoder: &mut fidl::encoding::Encoder<'_, D>,
1129            offset: usize,
1130            depth: fidl::encoding::Depth,
1131        ) -> fidl::Result<()> {
1132            encoder.debug_check_bounds::<InspectPuppetPublishResponse>(offset);
1133            // Zero out padding regions. There's no need to apply masks
1134            // because the unmasked parts will be overwritten by fields.
1135            // Write the fields.
1136            self.0.encode(encoder, offset + 0, depth)?;
1137            Ok(())
1138        }
1139    }
1140
1141    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1142        for InspectPuppetPublishResponse
1143    {
1144        #[inline(always)]
1145        fn new_empty() -> Self {
1146            Self { result: fidl::new_empty!(TestResult, 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!(TestResult, D, &mut self.result, decoder, offset + 0, _depth)?;
1159            Ok(())
1160        }
1161    }
1162
1163    impl InitializationParams {
1164        #[inline(always)]
1165        fn max_ordinal_present(&self) -> u64 {
1166            if let Some(_) = self.vmo_size {
1167                return 1;
1168            }
1169            0
1170        }
1171    }
1172
1173    impl fidl::encoding::ValueTypeMarker for InitializationParams {
1174        type Borrowed<'a> = &'a Self;
1175        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1176            value
1177        }
1178    }
1179
1180    unsafe impl fidl::encoding::TypeMarker for InitializationParams {
1181        type Owned = Self;
1182
1183        #[inline(always)]
1184        fn inline_align(_context: fidl::encoding::Context) -> usize {
1185            8
1186        }
1187
1188        #[inline(always)]
1189        fn inline_size(_context: fidl::encoding::Context) -> usize {
1190            16
1191        }
1192    }
1193
1194    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InitializationParams, D>
1195        for &InitializationParams
1196    {
1197        unsafe fn encode(
1198            self,
1199            encoder: &mut fidl::encoding::Encoder<'_, D>,
1200            offset: usize,
1201            mut depth: fidl::encoding::Depth,
1202        ) -> fidl::Result<()> {
1203            encoder.debug_check_bounds::<InitializationParams>(offset);
1204            // Vector header
1205            let max_ordinal: u64 = self.max_ordinal_present();
1206            encoder.write_num(max_ordinal, offset);
1207            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1208            // Calling encoder.out_of_line_offset(0) is not allowed.
1209            if max_ordinal == 0 {
1210                return Ok(());
1211            }
1212            depth.increment()?;
1213            let envelope_size = 8;
1214            let bytes_len = max_ordinal as usize * envelope_size;
1215            #[allow(unused_variables)]
1216            let offset = encoder.out_of_line_offset(bytes_len);
1217            let mut _prev_end_offset: usize = 0;
1218            if 1 > max_ordinal {
1219                return Ok(());
1220            }
1221
1222            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1223            // are envelope_size bytes.
1224            let cur_offset: usize = (1 - 1) * envelope_size;
1225
1226            // Zero reserved fields.
1227            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1228
1229            // Safety:
1230            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1231            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1232            //   envelope_size bytes, there is always sufficient room.
1233            fidl::encoding::encode_in_envelope_optional::<u64, D>(
1234                self.vmo_size.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1235                encoder,
1236                offset + cur_offset,
1237                depth,
1238            )?;
1239
1240            _prev_end_offset = cur_offset + envelope_size;
1241
1242            Ok(())
1243        }
1244    }
1245
1246    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InitializationParams {
1247        #[inline(always)]
1248        fn new_empty() -> Self {
1249            Self::default()
1250        }
1251
1252        unsafe fn decode(
1253            &mut self,
1254            decoder: &mut fidl::encoding::Decoder<'_, D>,
1255            offset: usize,
1256            mut depth: fidl::encoding::Depth,
1257        ) -> fidl::Result<()> {
1258            decoder.debug_check_bounds::<Self>(offset);
1259            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1260                None => return Err(fidl::Error::NotNullable),
1261                Some(len) => len,
1262            };
1263            // Calling decoder.out_of_line_offset(0) is not allowed.
1264            if len == 0 {
1265                return Ok(());
1266            };
1267            depth.increment()?;
1268            let envelope_size = 8;
1269            let bytes_len = len * envelope_size;
1270            let offset = decoder.out_of_line_offset(bytes_len)?;
1271            // Decode the envelope for each type.
1272            let mut _next_ordinal_to_read = 0;
1273            let mut next_offset = offset;
1274            let end_offset = offset + bytes_len;
1275            _next_ordinal_to_read += 1;
1276            if next_offset >= end_offset {
1277                return Ok(());
1278            }
1279
1280            // Decode unknown envelopes for gaps in ordinals.
1281            while _next_ordinal_to_read < 1 {
1282                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1283                _next_ordinal_to_read += 1;
1284                next_offset += envelope_size;
1285            }
1286
1287            let next_out_of_line = decoder.next_out_of_line();
1288            let handles_before = decoder.remaining_handles();
1289            if let Some((inlined, num_bytes, num_handles)) =
1290                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1291            {
1292                let member_inline_size =
1293                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1294                if inlined != (member_inline_size <= 4) {
1295                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1296                }
1297                let inner_offset;
1298                let mut inner_depth = depth.clone();
1299                if inlined {
1300                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1301                    inner_offset = next_offset;
1302                } else {
1303                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1304                    inner_depth.increment()?;
1305                }
1306                let val_ref = self.vmo_size.get_or_insert_with(|| fidl::new_empty!(u64, D));
1307                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1308                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1309                {
1310                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1311                }
1312                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1313                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1314                }
1315            }
1316
1317            next_offset += envelope_size;
1318
1319            // Decode the remaining unknown envelopes.
1320            while next_offset < end_offset {
1321                _next_ordinal_to_read += 1;
1322                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1323                next_offset += envelope_size;
1324            }
1325
1326            Ok(())
1327        }
1328    }
1329
1330    impl fidl::encoding::ValueTypeMarker for Action {
1331        type Borrowed<'a> = &'a Self;
1332        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1333            value
1334        }
1335    }
1336
1337    unsafe impl fidl::encoding::TypeMarker for Action {
1338        type Owned = Self;
1339
1340        #[inline(always)]
1341        fn inline_align(_context: fidl::encoding::Context) -> usize {
1342            8
1343        }
1344
1345        #[inline(always)]
1346        fn inline_size(_context: fidl::encoding::Context) -> usize {
1347            16
1348        }
1349    }
1350
1351    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Action, D> for &Action {
1352        #[inline]
1353        unsafe fn encode(
1354            self,
1355            encoder: &mut fidl::encoding::Encoder<'_, D>,
1356            offset: usize,
1357            _depth: fidl::encoding::Depth,
1358        ) -> fidl::Result<()> {
1359            encoder.debug_check_bounds::<Action>(offset);
1360            encoder.write_num::<u64>(self.ordinal(), offset);
1361            match self {
1362                Action::CreateNode(ref val) => fidl::encoding::encode_in_envelope::<CreateNode, D>(
1363                    <CreateNode as fidl::encoding::ValueTypeMarker>::borrow(val),
1364                    encoder,
1365                    offset + 8,
1366                    _depth,
1367                ),
1368                Action::DeleteNode(ref val) => fidl::encoding::encode_in_envelope::<DeleteNode, D>(
1369                    <DeleteNode as fidl::encoding::ValueTypeMarker>::borrow(val),
1370                    encoder,
1371                    offset + 8,
1372                    _depth,
1373                ),
1374                Action::CreateNumericProperty(ref val) => {
1375                    fidl::encoding::encode_in_envelope::<CreateNumericProperty, D>(
1376                        <CreateNumericProperty as fidl::encoding::ValueTypeMarker>::borrow(val),
1377                        encoder,
1378                        offset + 8,
1379                        _depth,
1380                    )
1381                }
1382                Action::CreateBytesProperty(ref val) => {
1383                    fidl::encoding::encode_in_envelope::<CreateBytesProperty, D>(
1384                        <CreateBytesProperty as fidl::encoding::ValueTypeMarker>::borrow(val),
1385                        encoder,
1386                        offset + 8,
1387                        _depth,
1388                    )
1389                }
1390                Action::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1391            }
1392        }
1393    }
1394
1395    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Action {
1396        #[inline(always)]
1397        fn new_empty() -> Self {
1398            Self::__SourceBreaking { unknown_ordinal: 0 }
1399        }
1400
1401        #[inline]
1402        unsafe fn decode(
1403            &mut self,
1404            decoder: &mut fidl::encoding::Decoder<'_, D>,
1405            offset: usize,
1406            mut depth: fidl::encoding::Depth,
1407        ) -> fidl::Result<()> {
1408            decoder.debug_check_bounds::<Self>(offset);
1409            #[allow(unused_variables)]
1410            let next_out_of_line = decoder.next_out_of_line();
1411            let handles_before = decoder.remaining_handles();
1412            let (ordinal, inlined, num_bytes, num_handles) =
1413                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1414
1415            let member_inline_size = match ordinal {
1416                1 => <CreateNode as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1417                2 => <DeleteNode as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1418                3 => <CreateNumericProperty as fidl::encoding::TypeMarker>::inline_size(
1419                    decoder.context,
1420                ),
1421                4 => <CreateBytesProperty as fidl::encoding::TypeMarker>::inline_size(
1422                    decoder.context,
1423                ),
1424                0 => return Err(fidl::Error::UnknownUnionTag),
1425                _ => num_bytes as usize,
1426            };
1427
1428            if inlined != (member_inline_size <= 4) {
1429                return Err(fidl::Error::InvalidInlineBitInEnvelope);
1430            }
1431            let _inner_offset;
1432            if inlined {
1433                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1434                _inner_offset = offset + 8;
1435            } else {
1436                depth.increment()?;
1437                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1438            }
1439            match ordinal {
1440                1 => {
1441                    #[allow(irrefutable_let_patterns)]
1442                    if let Action::CreateNode(_) = self {
1443                        // Do nothing, read the value into the object
1444                    } else {
1445                        // Initialize `self` to the right variant
1446                        *self = Action::CreateNode(fidl::new_empty!(CreateNode, D));
1447                    }
1448                    #[allow(irrefutable_let_patterns)]
1449                    if let Action::CreateNode(ref mut val) = self {
1450                        fidl::decode!(CreateNode, D, val, decoder, _inner_offset, depth)?;
1451                    } else {
1452                        unreachable!()
1453                    }
1454                }
1455                2 => {
1456                    #[allow(irrefutable_let_patterns)]
1457                    if let Action::DeleteNode(_) = self {
1458                        // Do nothing, read the value into the object
1459                    } else {
1460                        // Initialize `self` to the right variant
1461                        *self = Action::DeleteNode(fidl::new_empty!(DeleteNode, D));
1462                    }
1463                    #[allow(irrefutable_let_patterns)]
1464                    if let Action::DeleteNode(ref mut val) = self {
1465                        fidl::decode!(DeleteNode, D, val, decoder, _inner_offset, depth)?;
1466                    } else {
1467                        unreachable!()
1468                    }
1469                }
1470                3 => {
1471                    #[allow(irrefutable_let_patterns)]
1472                    if let Action::CreateNumericProperty(_) = self {
1473                        // Do nothing, read the value into the object
1474                    } else {
1475                        // Initialize `self` to the right variant
1476                        *self = Action::CreateNumericProperty(fidl::new_empty!(
1477                            CreateNumericProperty,
1478                            D
1479                        ));
1480                    }
1481                    #[allow(irrefutable_let_patterns)]
1482                    if let Action::CreateNumericProperty(ref mut val) = self {
1483                        fidl::decode!(
1484                            CreateNumericProperty,
1485                            D,
1486                            val,
1487                            decoder,
1488                            _inner_offset,
1489                            depth
1490                        )?;
1491                    } else {
1492                        unreachable!()
1493                    }
1494                }
1495                4 => {
1496                    #[allow(irrefutable_let_patterns)]
1497                    if let Action::CreateBytesProperty(_) = self {
1498                        // Do nothing, read the value into the object
1499                    } else {
1500                        // Initialize `self` to the right variant
1501                        *self =
1502                            Action::CreateBytesProperty(fidl::new_empty!(CreateBytesProperty, D));
1503                    }
1504                    #[allow(irrefutable_let_patterns)]
1505                    if let Action::CreateBytesProperty(ref mut val) = self {
1506                        fidl::decode!(CreateBytesProperty, D, val, decoder, _inner_offset, depth)?;
1507                    } else {
1508                        unreachable!()
1509                    }
1510                }
1511                #[allow(deprecated)]
1512                ordinal => {
1513                    for _ in 0..num_handles {
1514                        decoder.drop_next_handle()?;
1515                    }
1516                    *self = Action::__SourceBreaking { unknown_ordinal: ordinal };
1517                }
1518            }
1519            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1520                return Err(fidl::Error::InvalidNumBytesInEnvelope);
1521            }
1522            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1523                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1524            }
1525            Ok(())
1526        }
1527    }
1528
1529    impl fidl::encoding::ValueTypeMarker for Value {
1530        type Borrowed<'a> = &'a Self;
1531        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1532            value
1533        }
1534    }
1535
1536    unsafe impl fidl::encoding::TypeMarker for Value {
1537        type Owned = Self;
1538
1539        #[inline(always)]
1540        fn inline_align(_context: fidl::encoding::Context) -> usize {
1541            8
1542        }
1543
1544        #[inline(always)]
1545        fn inline_size(_context: fidl::encoding::Context) -> usize {
1546            16
1547        }
1548    }
1549
1550    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Value, D> for &Value {
1551        #[inline]
1552        unsafe fn encode(
1553            self,
1554            encoder: &mut fidl::encoding::Encoder<'_, D>,
1555            offset: usize,
1556            _depth: fidl::encoding::Depth,
1557        ) -> fidl::Result<()> {
1558            encoder.debug_check_bounds::<Value>(offset);
1559            encoder.write_num::<u64>(self.ordinal(), offset);
1560            match self {
1561                Value::IntT(ref val) => fidl::encoding::encode_in_envelope::<i64, D>(
1562                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
1563                    encoder,
1564                    offset + 8,
1565                    _depth,
1566                ),
1567                Value::UintT(ref val) => fidl::encoding::encode_in_envelope::<u64, D>(
1568                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
1569                    encoder,
1570                    offset + 8,
1571                    _depth,
1572                ),
1573                Value::DoubleT(ref val) => fidl::encoding::encode_in_envelope::<f64, D>(
1574                    <f64 as fidl::encoding::ValueTypeMarker>::borrow(val),
1575                    encoder,
1576                    offset + 8,
1577                    _depth,
1578                ),
1579                Value::StringT(ref val) => fidl::encoding::encode_in_envelope::<
1580                    fidl::encoding::UnboundedString,
1581                    D,
1582                >(
1583                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
1584                        val,
1585                    ),
1586                    encoder,
1587                    offset + 8,
1588                    _depth,
1589                ),
1590                Value::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1591            }
1592        }
1593    }
1594
1595    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Value {
1596        #[inline(always)]
1597        fn new_empty() -> Self {
1598            Self::__SourceBreaking { unknown_ordinal: 0 }
1599        }
1600
1601        #[inline]
1602        unsafe fn decode(
1603            &mut self,
1604            decoder: &mut fidl::encoding::Decoder<'_, D>,
1605            offset: usize,
1606            mut depth: fidl::encoding::Depth,
1607        ) -> fidl::Result<()> {
1608            decoder.debug_check_bounds::<Self>(offset);
1609            #[allow(unused_variables)]
1610            let next_out_of_line = decoder.next_out_of_line();
1611            let handles_before = decoder.remaining_handles();
1612            let (ordinal, inlined, num_bytes, num_handles) =
1613                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1614
1615            let member_inline_size = match ordinal {
1616                1 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1617                2 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1618                3 => <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1619                4 => <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
1620                    decoder.context,
1621                ),
1622                0 => return Err(fidl::Error::UnknownUnionTag),
1623                _ => num_bytes as usize,
1624            };
1625
1626            if inlined != (member_inline_size <= 4) {
1627                return Err(fidl::Error::InvalidInlineBitInEnvelope);
1628            }
1629            let _inner_offset;
1630            if inlined {
1631                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1632                _inner_offset = offset + 8;
1633            } else {
1634                depth.increment()?;
1635                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1636            }
1637            match ordinal {
1638                1 => {
1639                    #[allow(irrefutable_let_patterns)]
1640                    if let Value::IntT(_) = self {
1641                        // Do nothing, read the value into the object
1642                    } else {
1643                        // Initialize `self` to the right variant
1644                        *self = Value::IntT(fidl::new_empty!(i64, D));
1645                    }
1646                    #[allow(irrefutable_let_patterns)]
1647                    if let Value::IntT(ref mut val) = self {
1648                        fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
1649                    } else {
1650                        unreachable!()
1651                    }
1652                }
1653                2 => {
1654                    #[allow(irrefutable_let_patterns)]
1655                    if let Value::UintT(_) = self {
1656                        // Do nothing, read the value into the object
1657                    } else {
1658                        // Initialize `self` to the right variant
1659                        *self = Value::UintT(fidl::new_empty!(u64, D));
1660                    }
1661                    #[allow(irrefutable_let_patterns)]
1662                    if let Value::UintT(ref mut val) = self {
1663                        fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
1664                    } else {
1665                        unreachable!()
1666                    }
1667                }
1668                3 => {
1669                    #[allow(irrefutable_let_patterns)]
1670                    if let Value::DoubleT(_) = self {
1671                        // Do nothing, read the value into the object
1672                    } else {
1673                        // Initialize `self` to the right variant
1674                        *self = Value::DoubleT(fidl::new_empty!(f64, D));
1675                    }
1676                    #[allow(irrefutable_let_patterns)]
1677                    if let Value::DoubleT(ref mut val) = self {
1678                        fidl::decode!(f64, D, val, decoder, _inner_offset, depth)?;
1679                    } else {
1680                        unreachable!()
1681                    }
1682                }
1683                4 => {
1684                    #[allow(irrefutable_let_patterns)]
1685                    if let Value::StringT(_) = self {
1686                        // Do nothing, read the value into the object
1687                    } else {
1688                        // Initialize `self` to the right variant
1689                        *self =
1690                            Value::StringT(fidl::new_empty!(fidl::encoding::UnboundedString, D));
1691                    }
1692                    #[allow(irrefutable_let_patterns)]
1693                    if let Value::StringT(ref mut val) = self {
1694                        fidl::decode!(
1695                            fidl::encoding::UnboundedString,
1696                            D,
1697                            val,
1698                            decoder,
1699                            _inner_offset,
1700                            depth
1701                        )?;
1702                    } else {
1703                        unreachable!()
1704                    }
1705                }
1706                #[allow(deprecated)]
1707                ordinal => {
1708                    for _ in 0..num_handles {
1709                        decoder.drop_next_handle()?;
1710                    }
1711                    *self = Value::__SourceBreaking { unknown_ordinal: ordinal };
1712                }
1713            }
1714            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1715                return Err(fidl::Error::InvalidNumBytesInEnvelope);
1716            }
1717            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1718                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1719            }
1720            Ok(())
1721        }
1722    }
1723}