fidl_fuchsia_netemul__common/
fidl_fuchsia_netemul__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#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
12#[repr(u32)]
13pub enum ConfigurationError {
14    InvalidArguments = 1,
15    RejectedByNetstack = 2,
16    Internal = 4294967295,
17}
18
19impl ConfigurationError {
20    #[inline]
21    pub fn from_primitive(prim: u32) -> Option<Self> {
22        match prim {
23            1 => Some(Self::InvalidArguments),
24            2 => Some(Self::RejectedByNetstack),
25            4294967295 => Some(Self::Internal),
26            _ => None,
27        }
28    }
29
30    #[inline]
31    pub const fn into_primitive(self) -> u32 {
32        self as u32
33    }
34}
35
36#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
37#[repr(u8)]
38pub enum StorageVariant {
39    /// The `data` storage capability variant.
40    Data = 0,
41    /// The `cache` storage capability variant.
42    Cache = 1,
43    /// The `tmp` storage capability variant.
44    Tmp = 2,
45    /// The `custom_artifacts` storage capability variant.
46    ///
47    /// NB: due to the fact that per-component isolated storage is
48    /// destroyed along with the component, the `custom_artifacts`
49    /// storage capability is actually proxied as a *directory*
50    /// capability to components created in a `ManagedRealm`, in order
51    /// to ensure that artifacts are not destroyed when the realm is
52    /// torn down and can be extracted by the test framework. This
53    /// implies that a component that would like to use
54    /// `custom_artifacts` must use it as a directory rather than a
55    /// storage capability.
56    ///
57    /// The netemul sandbox routes a separate subdirectory of its
58    /// `custom_artifacts` storage to each component that requests it to
59    /// ensure per-component isolation.
60    CustomArtifacts = 3,
61}
62
63impl StorageVariant {
64    #[inline]
65    pub fn from_primitive(prim: u8) -> Option<Self> {
66        match prim {
67            0 => Some(Self::Data),
68            1 => Some(Self::Cache),
69            2 => Some(Self::Tmp),
70            3 => Some(Self::CustomArtifacts),
71            _ => None,
72        }
73    }
74
75    #[inline]
76    pub const fn into_primitive(self) -> u8 {
77        self as u8
78    }
79}
80
81#[derive(Clone, Debug, PartialEq)]
82pub struct ChildConfigValue {
83    /// The configuration key to override.
84    pub key: String,
85    /// The configuration value to use instead of the one loaded
86    /// from the package.
87    pub value: fidl_fuchsia_component_decl__common::ConfigValue,
88}
89
90impl fidl::Persistable for ChildConfigValue {}
91
92#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
93pub struct CrashListenerNextResponse {
94    pub crashed_monikers: Vec<String>,
95}
96
97impl fidl::Persistable for CrashListenerNextResponse {}
98
99#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
100pub struct Empty;
101
102impl fidl::Persistable for Empty {}
103
104#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
105pub struct ManagedRealmGetMonikerResponse {
106    pub moniker: String,
107}
108
109impl fidl::Persistable for ManagedRealmGetMonikerResponse {}
110
111#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
112pub struct ManagedRealmRemoveDeviceRequest {
113    pub path: String,
114}
115
116impl fidl::Persistable for ManagedRealmRemoveDeviceRequest {}
117
118#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
119pub struct ManagedRealmStartChildComponentRequest {
120    pub child_name: String,
121}
122
123impl fidl::Persistable for ManagedRealmStartChildComponentRequest {}
124
125#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
126pub struct ManagedRealmStopChildComponentRequest {
127    pub child_name: String,
128}
129
130impl fidl::Persistable for ManagedRealmStopChildComponentRequest {}
131
132#[derive(Clone, Debug, Default, PartialEq)]
133pub struct ChildDep {
134    /// The name of the child exposing the needed
135    /// capability.
136    ///
137    /// If not specified, route assumed to be from "void".
138    pub name: Option<String>,
139    /// The exposed capability.
140    ///
141    /// Required.
142    pub capability: Option<ExposedCapability>,
143    #[doc(hidden)]
144    pub __source_breaking: fidl::marker::SourceBreaking,
145}
146
147impl fidl::Persistable for ChildDep {}
148
149#[derive(Clone, Debug, Default, PartialEq)]
150pub struct DevfsDep {
151    /// The name of the capability being offered.
152    ///
153    /// Required.
154    pub name: Option<String>,
155    /// The subdirectory of `/dev` visible to the
156    /// component.
157    ///
158    /// If not set, the entire contents of `/dev` will
159    /// be visible to the component.
160    pub subdir: Option<String>,
161    #[doc(hidden)]
162    pub __source_breaking: fidl::marker::SourceBreaking,
163}
164
165impl fidl::Persistable for DevfsDep {}
166
167#[derive(Clone, Debug, Default, PartialEq)]
168pub struct StorageDep {
169    /// The variant of the storage capability.
170    ///
171    /// Required.
172    pub variant: Option<StorageVariant>,
173    /// The path at which the storage capability will be
174    /// offered.
175    ///
176    /// Required.
177    pub path: Option<String>,
178    #[doc(hidden)]
179    pub __source_breaking: fidl::marker::SourceBreaking,
180}
181
182impl fidl::Persistable for StorageDep {}
183
184#[derive(Clone, Debug, PartialEq)]
185pub enum Capability {
186    /// The `devfs` instance offered by netemul, where
187    /// virtual devices are mounted.
188    NetemulDevfs(DevfsDep),
189    /// The network context offered by netemul, shared
190    /// between all the managed realms in a given sandbox.
191    NetemulNetworkContext(Empty),
192    /// The [`fuchsia.logger/LogSink`] offered by netemul.
193    ///
194    /// Decorates logs produced by components in the managed
195    /// realm and forwards them to syslog.
196    LogSink(Empty),
197    /// A dependency on a capability exposed by another
198    /// child component in the same test realm.
199    ChildDep(ChildDep),
200    /// A dependency on a storage capability offered by
201    /// netemul.
202    StorageDep(StorageDep),
203    /// A dependency on the capability to register a tracing
204    /// provider.
205    TracingProvider(Empty),
206}
207
208impl Capability {
209    #[inline]
210    pub fn ordinal(&self) -> u64 {
211        match *self {
212            Self::NetemulDevfs(_) => 1,
213            Self::NetemulNetworkContext(_) => 3,
214            Self::LogSink(_) => 4,
215            Self::ChildDep(_) => 5,
216            Self::StorageDep(_) => 6,
217            Self::TracingProvider(_) => 7,
218        }
219    }
220}
221
222impl fidl::Persistable for Capability {}
223
224#[derive(Clone, Debug, PartialEq)]
225pub enum ChildUses {
226    /// The child will be offered each of the specified
227    /// capabilities.
228    ///
229    /// `capabilities` must be unique.
230    Capabilities(Vec<Capability>),
231}
232
233impl ChildUses {
234    #[inline]
235    pub fn ordinal(&self) -> u64 {
236        match *self {
237            Self::Capabilities(_) => 1,
238        }
239    }
240}
241
242impl fidl::Persistable for ChildUses {}
243
244#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
245pub enum ExposedCapability {
246    /// The name of the exposed protocol.
247    Protocol(String),
248    /// The name of the exposed capability.
249    Configuration(String),
250    /// The name of the exposed service.
251    Service(String),
252}
253
254impl ExposedCapability {
255    #[inline]
256    pub fn ordinal(&self) -> u64 {
257        match *self {
258            Self::Protocol(_) => 1,
259            Self::Configuration(_) => 2,
260            Self::Service(_) => 3,
261        }
262    }
263}
264
265impl fidl::Persistable for ExposedCapability {}
266
267pub mod configurable_netstack_ordinals {
268    pub const CONFIGURE_INTERFACE: u64 = 0x64db8deb981ee49;
269}
270
271pub mod crash_listener_ordinals {
272    pub const NEXT: u64 = 0x4ad26b66c3a90dfb;
273}
274
275pub mod managed_realm_ordinals {
276    pub const GET_MONIKER: u64 = 0xec8f2bf894ddc5f;
277    pub const CONNECT_TO_PROTOCOL: u64 = 0x20865b728239813d;
278    pub const ADD_DEVICE: u64 = 0x789925e6f5d47c07;
279    pub const REMOVE_DEVICE: u64 = 0x6cffbba70ac757cc;
280    pub const GET_DEVFS: u64 = 0x707e2b17f65fcadc;
281    pub const START_CHILD_COMPONENT: u64 = 0x20dfa243752906a1;
282    pub const STOP_CHILD_COMPONENT: u64 = 0x5ecfe48430aeeca7;
283    pub const SHUTDOWN: u64 = 0x4750920f723fba9d;
284    pub const OPEN_DIAGNOSTICS_DIRECTORY: u64 = 0x7c5312484aa41c99;
285    pub const ON_SHUTDOWN: u64 = 0x1dff0b58a5b546be;
286    pub const GET_CRASH_LISTENER: u64 = 0x407bab14357e8913;
287}
288
289pub mod sandbox_ordinals {
290    pub const CREATE_REALM: u64 = 0x25d0bc5f1006a0c9;
291    pub const GET_NETWORK_CONTEXT: u64 = 0x140cb104c2605970;
292}
293
294mod internal {
295    use super::*;
296    unsafe impl fidl::encoding::TypeMarker for ConfigurationError {
297        type Owned = Self;
298
299        #[inline(always)]
300        fn inline_align(_context: fidl::encoding::Context) -> usize {
301            std::mem::align_of::<u32>()
302        }
303
304        #[inline(always)]
305        fn inline_size(_context: fidl::encoding::Context) -> usize {
306            std::mem::size_of::<u32>()
307        }
308
309        #[inline(always)]
310        fn encode_is_copy() -> bool {
311            true
312        }
313
314        #[inline(always)]
315        fn decode_is_copy() -> bool {
316            false
317        }
318    }
319
320    impl fidl::encoding::ValueTypeMarker for ConfigurationError {
321        type Borrowed<'a> = Self;
322        #[inline(always)]
323        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
324            *value
325        }
326    }
327
328    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
329        for ConfigurationError
330    {
331        #[inline]
332        unsafe fn encode(
333            self,
334            encoder: &mut fidl::encoding::Encoder<'_, D>,
335            offset: usize,
336            _depth: fidl::encoding::Depth,
337        ) -> fidl::Result<()> {
338            encoder.debug_check_bounds::<Self>(offset);
339            encoder.write_num(self.into_primitive(), offset);
340            Ok(())
341        }
342    }
343
344    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConfigurationError {
345        #[inline(always)]
346        fn new_empty() -> Self {
347            Self::InvalidArguments
348        }
349
350        #[inline]
351        unsafe fn decode(
352            &mut self,
353            decoder: &mut fidl::encoding::Decoder<'_, D>,
354            offset: usize,
355            _depth: fidl::encoding::Depth,
356        ) -> fidl::Result<()> {
357            decoder.debug_check_bounds::<Self>(offset);
358            let prim = decoder.read_num::<u32>(offset);
359
360            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
361            Ok(())
362        }
363    }
364    unsafe impl fidl::encoding::TypeMarker for StorageVariant {
365        type Owned = Self;
366
367        #[inline(always)]
368        fn inline_align(_context: fidl::encoding::Context) -> usize {
369            std::mem::align_of::<u8>()
370        }
371
372        #[inline(always)]
373        fn inline_size(_context: fidl::encoding::Context) -> usize {
374            std::mem::size_of::<u8>()
375        }
376
377        #[inline(always)]
378        fn encode_is_copy() -> bool {
379            true
380        }
381
382        #[inline(always)]
383        fn decode_is_copy() -> bool {
384            false
385        }
386    }
387
388    impl fidl::encoding::ValueTypeMarker for StorageVariant {
389        type Borrowed<'a> = Self;
390        #[inline(always)]
391        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
392            *value
393        }
394    }
395
396    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for StorageVariant {
397        #[inline]
398        unsafe fn encode(
399            self,
400            encoder: &mut fidl::encoding::Encoder<'_, D>,
401            offset: usize,
402            _depth: fidl::encoding::Depth,
403        ) -> fidl::Result<()> {
404            encoder.debug_check_bounds::<Self>(offset);
405            encoder.write_num(self.into_primitive(), offset);
406            Ok(())
407        }
408    }
409
410    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StorageVariant {
411        #[inline(always)]
412        fn new_empty() -> Self {
413            Self::Data
414        }
415
416        #[inline]
417        unsafe fn decode(
418            &mut self,
419            decoder: &mut fidl::encoding::Decoder<'_, D>,
420            offset: usize,
421            _depth: fidl::encoding::Depth,
422        ) -> fidl::Result<()> {
423            decoder.debug_check_bounds::<Self>(offset);
424            let prim = decoder.read_num::<u8>(offset);
425
426            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
427            Ok(())
428        }
429    }
430
431    impl fidl::encoding::ValueTypeMarker for ChildConfigValue {
432        type Borrowed<'a> = &'a Self;
433        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
434            value
435        }
436    }
437
438    unsafe impl fidl::encoding::TypeMarker for ChildConfigValue {
439        type Owned = Self;
440
441        #[inline(always)]
442        fn inline_align(_context: fidl::encoding::Context) -> usize {
443            8
444        }
445
446        #[inline(always)]
447        fn inline_size(_context: fidl::encoding::Context) -> usize {
448            32
449        }
450    }
451
452    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChildConfigValue, D>
453        for &ChildConfigValue
454    {
455        #[inline]
456        unsafe fn encode(
457            self,
458            encoder: &mut fidl::encoding::Encoder<'_, D>,
459            offset: usize,
460            _depth: fidl::encoding::Depth,
461        ) -> fidl::Result<()> {
462            encoder.debug_check_bounds::<ChildConfigValue>(offset);
463            // Delegate to tuple encoding.
464            fidl::encoding::Encode::<ChildConfigValue, D>::encode(
465                (
466                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(&self.key),
467                    <fidl_fuchsia_component_decl__common::ConfigValue as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
468                ),
469                encoder, offset, _depth
470            )
471        }
472    }
473    unsafe impl<
474            D: fidl::encoding::ResourceDialect,
475            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
476            T1: fidl::encoding::Encode<fidl_fuchsia_component_decl__common::ConfigValue, D>,
477        > fidl::encoding::Encode<ChildConfigValue, D> for (T0, T1)
478    {
479        #[inline]
480        unsafe fn encode(
481            self,
482            encoder: &mut fidl::encoding::Encoder<'_, D>,
483            offset: usize,
484            depth: fidl::encoding::Depth,
485        ) -> fidl::Result<()> {
486            encoder.debug_check_bounds::<ChildConfigValue>(offset);
487            // Zero out padding regions. There's no need to apply masks
488            // because the unmasked parts will be overwritten by fields.
489            // Write the fields.
490            self.0.encode(encoder, offset + 0, depth)?;
491            self.1.encode(encoder, offset + 16, depth)?;
492            Ok(())
493        }
494    }
495
496    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChildConfigValue {
497        #[inline(always)]
498        fn new_empty() -> Self {
499            Self {
500                key: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
501                value: fidl::new_empty!(fidl_fuchsia_component_decl__common::ConfigValue, D),
502            }
503        }
504
505        #[inline]
506        unsafe fn decode(
507            &mut self,
508            decoder: &mut fidl::encoding::Decoder<'_, D>,
509            offset: usize,
510            _depth: fidl::encoding::Depth,
511        ) -> fidl::Result<()> {
512            decoder.debug_check_bounds::<Self>(offset);
513            // Verify that padding bytes are zero.
514            fidl::decode!(
515                fidl::encoding::BoundedString<64>,
516                D,
517                &mut self.key,
518                decoder,
519                offset + 0,
520                _depth
521            )?;
522            fidl::decode!(
523                fidl_fuchsia_component_decl__common::ConfigValue,
524                D,
525                &mut self.value,
526                decoder,
527                offset + 16,
528                _depth
529            )?;
530            Ok(())
531        }
532    }
533
534    impl fidl::encoding::ValueTypeMarker for CrashListenerNextResponse {
535        type Borrowed<'a> = &'a Self;
536        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
537            value
538        }
539    }
540
541    unsafe impl fidl::encoding::TypeMarker for CrashListenerNextResponse {
542        type Owned = Self;
543
544        #[inline(always)]
545        fn inline_align(_context: fidl::encoding::Context) -> usize {
546            8
547        }
548
549        #[inline(always)]
550        fn inline_size(_context: fidl::encoding::Context) -> usize {
551            16
552        }
553    }
554
555    unsafe impl<D: fidl::encoding::ResourceDialect>
556        fidl::encoding::Encode<CrashListenerNextResponse, D> for &CrashListenerNextResponse
557    {
558        #[inline]
559        unsafe fn encode(
560            self,
561            encoder: &mut fidl::encoding::Encoder<'_, D>,
562            offset: usize,
563            _depth: fidl::encoding::Depth,
564        ) -> fidl::Result<()> {
565            encoder.debug_check_bounds::<CrashListenerNextResponse>(offset);
566            // Delegate to tuple encoding.
567            fidl::encoding::Encode::<CrashListenerNextResponse, D>::encode(
568                (
569                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<4096>> as fidl::encoding::ValueTypeMarker>::borrow(&self.crashed_monikers),
570                ),
571                encoder, offset, _depth
572            )
573        }
574    }
575    unsafe impl<
576            D: fidl::encoding::ResourceDialect,
577            T0: fidl::encoding::Encode<
578                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<4096>>,
579                D,
580            >,
581        > fidl::encoding::Encode<CrashListenerNextResponse, D> for (T0,)
582    {
583        #[inline]
584        unsafe fn encode(
585            self,
586            encoder: &mut fidl::encoding::Encoder<'_, D>,
587            offset: usize,
588            depth: fidl::encoding::Depth,
589        ) -> fidl::Result<()> {
590            encoder.debug_check_bounds::<CrashListenerNextResponse>(offset);
591            // Zero out padding regions. There's no need to apply masks
592            // because the unmasked parts will be overwritten by fields.
593            // Write the fields.
594            self.0.encode(encoder, offset + 0, depth)?;
595            Ok(())
596        }
597    }
598
599    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
600        for CrashListenerNextResponse
601    {
602        #[inline(always)]
603        fn new_empty() -> Self {
604            Self {
605                crashed_monikers: fidl::new_empty!(
606                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<4096>>,
607                    D
608                ),
609            }
610        }
611
612        #[inline]
613        unsafe fn decode(
614            &mut self,
615            decoder: &mut fidl::encoding::Decoder<'_, D>,
616            offset: usize,
617            _depth: fidl::encoding::Depth,
618        ) -> fidl::Result<()> {
619            decoder.debug_check_bounds::<Self>(offset);
620            // Verify that padding bytes are zero.
621            fidl::decode!(
622                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<4096>>,
623                D,
624                &mut self.crashed_monikers,
625                decoder,
626                offset + 0,
627                _depth
628            )?;
629            Ok(())
630        }
631    }
632
633    impl fidl::encoding::ValueTypeMarker for Empty {
634        type Borrowed<'a> = &'a Self;
635        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
636            value
637        }
638    }
639
640    unsafe impl fidl::encoding::TypeMarker for Empty {
641        type Owned = Self;
642
643        #[inline(always)]
644        fn inline_align(_context: fidl::encoding::Context) -> usize {
645            1
646        }
647
648        #[inline(always)]
649        fn inline_size(_context: fidl::encoding::Context) -> usize {
650            1
651        }
652    }
653
654    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
655        #[inline]
656        unsafe fn encode(
657            self,
658            encoder: &mut fidl::encoding::Encoder<'_, D>,
659            offset: usize,
660            _depth: fidl::encoding::Depth,
661        ) -> fidl::Result<()> {
662            encoder.debug_check_bounds::<Empty>(offset);
663            encoder.write_num(0u8, offset);
664            Ok(())
665        }
666    }
667
668    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
669        #[inline(always)]
670        fn new_empty() -> Self {
671            Self
672        }
673
674        #[inline]
675        unsafe fn decode(
676            &mut self,
677            decoder: &mut fidl::encoding::Decoder<'_, D>,
678            offset: usize,
679            _depth: fidl::encoding::Depth,
680        ) -> fidl::Result<()> {
681            decoder.debug_check_bounds::<Self>(offset);
682            match decoder.read_num::<u8>(offset) {
683                0 => Ok(()),
684                _ => Err(fidl::Error::Invalid),
685            }
686        }
687    }
688
689    impl fidl::encoding::ValueTypeMarker for ManagedRealmGetMonikerResponse {
690        type Borrowed<'a> = &'a Self;
691        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
692            value
693        }
694    }
695
696    unsafe impl fidl::encoding::TypeMarker for ManagedRealmGetMonikerResponse {
697        type Owned = Self;
698
699        #[inline(always)]
700        fn inline_align(_context: fidl::encoding::Context) -> usize {
701            8
702        }
703
704        #[inline(always)]
705        fn inline_size(_context: fidl::encoding::Context) -> usize {
706            16
707        }
708    }
709
710    unsafe impl<D: fidl::encoding::ResourceDialect>
711        fidl::encoding::Encode<ManagedRealmGetMonikerResponse, D>
712        for &ManagedRealmGetMonikerResponse
713    {
714        #[inline]
715        unsafe fn encode(
716            self,
717            encoder: &mut fidl::encoding::Encoder<'_, D>,
718            offset: usize,
719            _depth: fidl::encoding::Depth,
720        ) -> fidl::Result<()> {
721            encoder.debug_check_bounds::<ManagedRealmGetMonikerResponse>(offset);
722            // Delegate to tuple encoding.
723            fidl::encoding::Encode::<ManagedRealmGetMonikerResponse, D>::encode(
724                (<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(
725                    &self.moniker,
726                ),),
727                encoder,
728                offset,
729                _depth,
730            )
731        }
732    }
733    unsafe impl<
734            D: fidl::encoding::ResourceDialect,
735            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>, D>,
736        > fidl::encoding::Encode<ManagedRealmGetMonikerResponse, D> for (T0,)
737    {
738        #[inline]
739        unsafe fn encode(
740            self,
741            encoder: &mut fidl::encoding::Encoder<'_, D>,
742            offset: usize,
743            depth: fidl::encoding::Depth,
744        ) -> fidl::Result<()> {
745            encoder.debug_check_bounds::<ManagedRealmGetMonikerResponse>(offset);
746            // Zero out padding regions. There's no need to apply masks
747            // because the unmasked parts will be overwritten by fields.
748            // Write the fields.
749            self.0.encode(encoder, offset + 0, depth)?;
750            Ok(())
751        }
752    }
753
754    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
755        for ManagedRealmGetMonikerResponse
756    {
757        #[inline(always)]
758        fn new_empty() -> Self {
759            Self { moniker: fidl::new_empty!(fidl::encoding::BoundedString<4096>, D) }
760        }
761
762        #[inline]
763        unsafe fn decode(
764            &mut self,
765            decoder: &mut fidl::encoding::Decoder<'_, D>,
766            offset: usize,
767            _depth: fidl::encoding::Depth,
768        ) -> fidl::Result<()> {
769            decoder.debug_check_bounds::<Self>(offset);
770            // Verify that padding bytes are zero.
771            fidl::decode!(
772                fidl::encoding::BoundedString<4096>,
773                D,
774                &mut self.moniker,
775                decoder,
776                offset + 0,
777                _depth
778            )?;
779            Ok(())
780        }
781    }
782
783    impl fidl::encoding::ValueTypeMarker for ManagedRealmRemoveDeviceRequest {
784        type Borrowed<'a> = &'a Self;
785        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
786            value
787        }
788    }
789
790    unsafe impl fidl::encoding::TypeMarker for ManagedRealmRemoveDeviceRequest {
791        type Owned = Self;
792
793        #[inline(always)]
794        fn inline_align(_context: fidl::encoding::Context) -> usize {
795            8
796        }
797
798        #[inline(always)]
799        fn inline_size(_context: fidl::encoding::Context) -> usize {
800            16
801        }
802    }
803
804    unsafe impl<D: fidl::encoding::ResourceDialect>
805        fidl::encoding::Encode<ManagedRealmRemoveDeviceRequest, D>
806        for &ManagedRealmRemoveDeviceRequest
807    {
808        #[inline]
809        unsafe fn encode(
810            self,
811            encoder: &mut fidl::encoding::Encoder<'_, D>,
812            offset: usize,
813            _depth: fidl::encoding::Depth,
814        ) -> fidl::Result<()> {
815            encoder.debug_check_bounds::<ManagedRealmRemoveDeviceRequest>(offset);
816            // Delegate to tuple encoding.
817            fidl::encoding::Encode::<ManagedRealmRemoveDeviceRequest, D>::encode(
818                (<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
819                    &self.path,
820                ),),
821                encoder,
822                offset,
823                _depth,
824            )
825        }
826    }
827    unsafe impl<
828            D: fidl::encoding::ResourceDialect,
829            T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
830        > fidl::encoding::Encode<ManagedRealmRemoveDeviceRequest, D> for (T0,)
831    {
832        #[inline]
833        unsafe fn encode(
834            self,
835            encoder: &mut fidl::encoding::Encoder<'_, D>,
836            offset: usize,
837            depth: fidl::encoding::Depth,
838        ) -> fidl::Result<()> {
839            encoder.debug_check_bounds::<ManagedRealmRemoveDeviceRequest>(offset);
840            // Zero out padding regions. There's no need to apply masks
841            // because the unmasked parts will be overwritten by fields.
842            // Write the fields.
843            self.0.encode(encoder, offset + 0, depth)?;
844            Ok(())
845        }
846    }
847
848    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
849        for ManagedRealmRemoveDeviceRequest
850    {
851        #[inline(always)]
852        fn new_empty() -> Self {
853            Self { path: fidl::new_empty!(fidl::encoding::UnboundedString, D) }
854        }
855
856        #[inline]
857        unsafe fn decode(
858            &mut self,
859            decoder: &mut fidl::encoding::Decoder<'_, D>,
860            offset: usize,
861            _depth: fidl::encoding::Depth,
862        ) -> fidl::Result<()> {
863            decoder.debug_check_bounds::<Self>(offset);
864            // Verify that padding bytes are zero.
865            fidl::decode!(
866                fidl::encoding::UnboundedString,
867                D,
868                &mut self.path,
869                decoder,
870                offset + 0,
871                _depth
872            )?;
873            Ok(())
874        }
875    }
876
877    impl fidl::encoding::ValueTypeMarker for ManagedRealmStartChildComponentRequest {
878        type Borrowed<'a> = &'a Self;
879        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
880            value
881        }
882    }
883
884    unsafe impl fidl::encoding::TypeMarker for ManagedRealmStartChildComponentRequest {
885        type Owned = Self;
886
887        #[inline(always)]
888        fn inline_align(_context: fidl::encoding::Context) -> usize {
889            8
890        }
891
892        #[inline(always)]
893        fn inline_size(_context: fidl::encoding::Context) -> usize {
894            16
895        }
896    }
897
898    unsafe impl<D: fidl::encoding::ResourceDialect>
899        fidl::encoding::Encode<ManagedRealmStartChildComponentRequest, D>
900        for &ManagedRealmStartChildComponentRequest
901    {
902        #[inline]
903        unsafe fn encode(
904            self,
905            encoder: &mut fidl::encoding::Encoder<'_, D>,
906            offset: usize,
907            _depth: fidl::encoding::Depth,
908        ) -> fidl::Result<()> {
909            encoder.debug_check_bounds::<ManagedRealmStartChildComponentRequest>(offset);
910            // Delegate to tuple encoding.
911            fidl::encoding::Encode::<ManagedRealmStartChildComponentRequest, D>::encode(
912                (<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
913                    &self.child_name,
914                ),),
915                encoder,
916                offset,
917                _depth,
918            )
919        }
920    }
921    unsafe impl<
922            D: fidl::encoding::ResourceDialect,
923            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
924        > fidl::encoding::Encode<ManagedRealmStartChildComponentRequest, D> for (T0,)
925    {
926        #[inline]
927        unsafe fn encode(
928            self,
929            encoder: &mut fidl::encoding::Encoder<'_, D>,
930            offset: usize,
931            depth: fidl::encoding::Depth,
932        ) -> fidl::Result<()> {
933            encoder.debug_check_bounds::<ManagedRealmStartChildComponentRequest>(offset);
934            // Zero out padding regions. There's no need to apply masks
935            // because the unmasked parts will be overwritten by fields.
936            // Write the fields.
937            self.0.encode(encoder, offset + 0, depth)?;
938            Ok(())
939        }
940    }
941
942    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
943        for ManagedRealmStartChildComponentRequest
944    {
945        #[inline(always)]
946        fn new_empty() -> Self {
947            Self { child_name: fidl::new_empty!(fidl::encoding::BoundedString<255>, D) }
948        }
949
950        #[inline]
951        unsafe fn decode(
952            &mut self,
953            decoder: &mut fidl::encoding::Decoder<'_, D>,
954            offset: usize,
955            _depth: fidl::encoding::Depth,
956        ) -> fidl::Result<()> {
957            decoder.debug_check_bounds::<Self>(offset);
958            // Verify that padding bytes are zero.
959            fidl::decode!(
960                fidl::encoding::BoundedString<255>,
961                D,
962                &mut self.child_name,
963                decoder,
964                offset + 0,
965                _depth
966            )?;
967            Ok(())
968        }
969    }
970
971    impl fidl::encoding::ValueTypeMarker for ManagedRealmStopChildComponentRequest {
972        type Borrowed<'a> = &'a Self;
973        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
974            value
975        }
976    }
977
978    unsafe impl fidl::encoding::TypeMarker for ManagedRealmStopChildComponentRequest {
979        type Owned = Self;
980
981        #[inline(always)]
982        fn inline_align(_context: fidl::encoding::Context) -> usize {
983            8
984        }
985
986        #[inline(always)]
987        fn inline_size(_context: fidl::encoding::Context) -> usize {
988            16
989        }
990    }
991
992    unsafe impl<D: fidl::encoding::ResourceDialect>
993        fidl::encoding::Encode<ManagedRealmStopChildComponentRequest, D>
994        for &ManagedRealmStopChildComponentRequest
995    {
996        #[inline]
997        unsafe fn encode(
998            self,
999            encoder: &mut fidl::encoding::Encoder<'_, D>,
1000            offset: usize,
1001            _depth: fidl::encoding::Depth,
1002        ) -> fidl::Result<()> {
1003            encoder.debug_check_bounds::<ManagedRealmStopChildComponentRequest>(offset);
1004            // Delegate to tuple encoding.
1005            fidl::encoding::Encode::<ManagedRealmStopChildComponentRequest, D>::encode(
1006                (<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
1007                    &self.child_name,
1008                ),),
1009                encoder,
1010                offset,
1011                _depth,
1012            )
1013        }
1014    }
1015    unsafe impl<
1016            D: fidl::encoding::ResourceDialect,
1017            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
1018        > fidl::encoding::Encode<ManagedRealmStopChildComponentRequest, D> for (T0,)
1019    {
1020        #[inline]
1021        unsafe fn encode(
1022            self,
1023            encoder: &mut fidl::encoding::Encoder<'_, D>,
1024            offset: usize,
1025            depth: fidl::encoding::Depth,
1026        ) -> fidl::Result<()> {
1027            encoder.debug_check_bounds::<ManagedRealmStopChildComponentRequest>(offset);
1028            // Zero out padding regions. There's no need to apply masks
1029            // because the unmasked parts will be overwritten by fields.
1030            // Write the fields.
1031            self.0.encode(encoder, offset + 0, depth)?;
1032            Ok(())
1033        }
1034    }
1035
1036    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1037        for ManagedRealmStopChildComponentRequest
1038    {
1039        #[inline(always)]
1040        fn new_empty() -> Self {
1041            Self { child_name: fidl::new_empty!(fidl::encoding::BoundedString<255>, D) }
1042        }
1043
1044        #[inline]
1045        unsafe fn decode(
1046            &mut self,
1047            decoder: &mut fidl::encoding::Decoder<'_, D>,
1048            offset: usize,
1049            _depth: fidl::encoding::Depth,
1050        ) -> fidl::Result<()> {
1051            decoder.debug_check_bounds::<Self>(offset);
1052            // Verify that padding bytes are zero.
1053            fidl::decode!(
1054                fidl::encoding::BoundedString<255>,
1055                D,
1056                &mut self.child_name,
1057                decoder,
1058                offset + 0,
1059                _depth
1060            )?;
1061            Ok(())
1062        }
1063    }
1064
1065    impl ChildDep {
1066        #[inline(always)]
1067        fn max_ordinal_present(&self) -> u64 {
1068            if let Some(_) = self.capability {
1069                return 2;
1070            }
1071            if let Some(_) = self.name {
1072                return 1;
1073            }
1074            0
1075        }
1076    }
1077
1078    impl fidl::encoding::ValueTypeMarker for ChildDep {
1079        type Borrowed<'a> = &'a Self;
1080        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1081            value
1082        }
1083    }
1084
1085    unsafe impl fidl::encoding::TypeMarker for ChildDep {
1086        type Owned = Self;
1087
1088        #[inline(always)]
1089        fn inline_align(_context: fidl::encoding::Context) -> usize {
1090            8
1091        }
1092
1093        #[inline(always)]
1094        fn inline_size(_context: fidl::encoding::Context) -> usize {
1095            16
1096        }
1097    }
1098
1099    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChildDep, D> for &ChildDep {
1100        unsafe fn encode(
1101            self,
1102            encoder: &mut fidl::encoding::Encoder<'_, D>,
1103            offset: usize,
1104            mut depth: fidl::encoding::Depth,
1105        ) -> fidl::Result<()> {
1106            encoder.debug_check_bounds::<ChildDep>(offset);
1107            // Vector header
1108            let max_ordinal: u64 = self.max_ordinal_present();
1109            encoder.write_num(max_ordinal, offset);
1110            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1111            // Calling encoder.out_of_line_offset(0) is not allowed.
1112            if max_ordinal == 0 {
1113                return Ok(());
1114            }
1115            depth.increment()?;
1116            let envelope_size = 8;
1117            let bytes_len = max_ordinal as usize * envelope_size;
1118            #[allow(unused_variables)]
1119            let offset = encoder.out_of_line_offset(bytes_len);
1120            let mut _prev_end_offset: usize = 0;
1121            if 1 > max_ordinal {
1122                return Ok(());
1123            }
1124
1125            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1126            // are envelope_size bytes.
1127            let cur_offset: usize = (1 - 1) * envelope_size;
1128
1129            // Zero reserved fields.
1130            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1131
1132            // Safety:
1133            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1134            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1135            //   envelope_size bytes, there is always sufficient room.
1136            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>, D>(
1137                self.name.as_ref().map(
1138                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
1139                ),
1140                encoder,
1141                offset + cur_offset,
1142                depth,
1143            )?;
1144
1145            _prev_end_offset = cur_offset + envelope_size;
1146            if 2 > max_ordinal {
1147                return Ok(());
1148            }
1149
1150            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1151            // are envelope_size bytes.
1152            let cur_offset: usize = (2 - 1) * envelope_size;
1153
1154            // Zero reserved fields.
1155            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1156
1157            // Safety:
1158            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1159            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1160            //   envelope_size bytes, there is always sufficient room.
1161            fidl::encoding::encode_in_envelope_optional::<ExposedCapability, D>(
1162                self.capability
1163                    .as_ref()
1164                    .map(<ExposedCapability as fidl::encoding::ValueTypeMarker>::borrow),
1165                encoder,
1166                offset + cur_offset,
1167                depth,
1168            )?;
1169
1170            _prev_end_offset = cur_offset + envelope_size;
1171
1172            Ok(())
1173        }
1174    }
1175
1176    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChildDep {
1177        #[inline(always)]
1178        fn new_empty() -> Self {
1179            Self::default()
1180        }
1181
1182        unsafe fn decode(
1183            &mut self,
1184            decoder: &mut fidl::encoding::Decoder<'_, D>,
1185            offset: usize,
1186            mut depth: fidl::encoding::Depth,
1187        ) -> fidl::Result<()> {
1188            decoder.debug_check_bounds::<Self>(offset);
1189            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1190                None => return Err(fidl::Error::NotNullable),
1191                Some(len) => len,
1192            };
1193            // Calling decoder.out_of_line_offset(0) is not allowed.
1194            if len == 0 {
1195                return Ok(());
1196            };
1197            depth.increment()?;
1198            let envelope_size = 8;
1199            let bytes_len = len * envelope_size;
1200            let offset = decoder.out_of_line_offset(bytes_len)?;
1201            // Decode the envelope for each type.
1202            let mut _next_ordinal_to_read = 0;
1203            let mut next_offset = offset;
1204            let end_offset = offset + bytes_len;
1205            _next_ordinal_to_read += 1;
1206            if next_offset >= end_offset {
1207                return Ok(());
1208            }
1209
1210            // Decode unknown envelopes for gaps in ordinals.
1211            while _next_ordinal_to_read < 1 {
1212                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1213                _next_ordinal_to_read += 1;
1214                next_offset += envelope_size;
1215            }
1216
1217            let next_out_of_line = decoder.next_out_of_line();
1218            let handles_before = decoder.remaining_handles();
1219            if let Some((inlined, num_bytes, num_handles)) =
1220                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1221            {
1222                let member_inline_size =
1223                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
1224                        decoder.context,
1225                    );
1226                if inlined != (member_inline_size <= 4) {
1227                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1228                }
1229                let inner_offset;
1230                let mut inner_depth = depth.clone();
1231                if inlined {
1232                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1233                    inner_offset = next_offset;
1234                } else {
1235                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1236                    inner_depth.increment()?;
1237                }
1238                let val_ref = self
1239                    .name
1240                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>, D));
1241                fidl::decode!(
1242                    fidl::encoding::BoundedString<255>,
1243                    D,
1244                    val_ref,
1245                    decoder,
1246                    inner_offset,
1247                    inner_depth
1248                )?;
1249                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1250                {
1251                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1252                }
1253                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1254                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1255                }
1256            }
1257
1258            next_offset += envelope_size;
1259            _next_ordinal_to_read += 1;
1260            if next_offset >= end_offset {
1261                return Ok(());
1262            }
1263
1264            // Decode unknown envelopes for gaps in ordinals.
1265            while _next_ordinal_to_read < 2 {
1266                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1267                _next_ordinal_to_read += 1;
1268                next_offset += envelope_size;
1269            }
1270
1271            let next_out_of_line = decoder.next_out_of_line();
1272            let handles_before = decoder.remaining_handles();
1273            if let Some((inlined, num_bytes, num_handles)) =
1274                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1275            {
1276                let member_inline_size =
1277                    <ExposedCapability as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1278                if inlined != (member_inline_size <= 4) {
1279                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1280                }
1281                let inner_offset;
1282                let mut inner_depth = depth.clone();
1283                if inlined {
1284                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1285                    inner_offset = next_offset;
1286                } else {
1287                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1288                    inner_depth.increment()?;
1289                }
1290                let val_ref =
1291                    self.capability.get_or_insert_with(|| fidl::new_empty!(ExposedCapability, D));
1292                fidl::decode!(ExposedCapability, D, val_ref, decoder, inner_offset, inner_depth)?;
1293                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1294                {
1295                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1296                }
1297                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1298                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1299                }
1300            }
1301
1302            next_offset += envelope_size;
1303
1304            // Decode the remaining unknown envelopes.
1305            while next_offset < end_offset {
1306                _next_ordinal_to_read += 1;
1307                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1308                next_offset += envelope_size;
1309            }
1310
1311            Ok(())
1312        }
1313    }
1314
1315    impl DevfsDep {
1316        #[inline(always)]
1317        fn max_ordinal_present(&self) -> u64 {
1318            if let Some(_) = self.subdir {
1319                return 2;
1320            }
1321            if let Some(_) = self.name {
1322                return 1;
1323            }
1324            0
1325        }
1326    }
1327
1328    impl fidl::encoding::ValueTypeMarker for DevfsDep {
1329        type Borrowed<'a> = &'a Self;
1330        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1331            value
1332        }
1333    }
1334
1335    unsafe impl fidl::encoding::TypeMarker for DevfsDep {
1336        type Owned = Self;
1337
1338        #[inline(always)]
1339        fn inline_align(_context: fidl::encoding::Context) -> usize {
1340            8
1341        }
1342
1343        #[inline(always)]
1344        fn inline_size(_context: fidl::encoding::Context) -> usize {
1345            16
1346        }
1347    }
1348
1349    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DevfsDep, D> for &DevfsDep {
1350        unsafe fn encode(
1351            self,
1352            encoder: &mut fidl::encoding::Encoder<'_, D>,
1353            offset: usize,
1354            mut depth: fidl::encoding::Depth,
1355        ) -> fidl::Result<()> {
1356            encoder.debug_check_bounds::<DevfsDep>(offset);
1357            // Vector header
1358            let max_ordinal: u64 = self.max_ordinal_present();
1359            encoder.write_num(max_ordinal, offset);
1360            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1361            // Calling encoder.out_of_line_offset(0) is not allowed.
1362            if max_ordinal == 0 {
1363                return Ok(());
1364            }
1365            depth.increment()?;
1366            let envelope_size = 8;
1367            let bytes_len = max_ordinal as usize * envelope_size;
1368            #[allow(unused_variables)]
1369            let offset = encoder.out_of_line_offset(bytes_len);
1370            let mut _prev_end_offset: usize = 0;
1371            if 1 > max_ordinal {
1372                return Ok(());
1373            }
1374
1375            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1376            // are envelope_size bytes.
1377            let cur_offset: usize = (1 - 1) * envelope_size;
1378
1379            // Zero reserved fields.
1380            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1381
1382            // Safety:
1383            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1384            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1385            //   envelope_size bytes, there is always sufficient room.
1386            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>, D>(
1387                self.name.as_ref().map(
1388                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
1389                ),
1390                encoder,
1391                offset + cur_offset,
1392                depth,
1393            )?;
1394
1395            _prev_end_offset = cur_offset + envelope_size;
1396            if 2 > max_ordinal {
1397                return Ok(());
1398            }
1399
1400            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1401            // are envelope_size bytes.
1402            let cur_offset: usize = (2 - 1) * envelope_size;
1403
1404            // Zero reserved fields.
1405            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1406
1407            // Safety:
1408            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1409            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1410            //   envelope_size bytes, there is always sufficient room.
1411            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4095>, D>(
1412            self.subdir.as_ref().map(<fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow),
1413            encoder, offset + cur_offset, depth
1414        )?;
1415
1416            _prev_end_offset = cur_offset + envelope_size;
1417
1418            Ok(())
1419        }
1420    }
1421
1422    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DevfsDep {
1423        #[inline(always)]
1424        fn new_empty() -> Self {
1425            Self::default()
1426        }
1427
1428        unsafe fn decode(
1429            &mut self,
1430            decoder: &mut fidl::encoding::Decoder<'_, D>,
1431            offset: usize,
1432            mut depth: fidl::encoding::Depth,
1433        ) -> fidl::Result<()> {
1434            decoder.debug_check_bounds::<Self>(offset);
1435            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1436                None => return Err(fidl::Error::NotNullable),
1437                Some(len) => len,
1438            };
1439            // Calling decoder.out_of_line_offset(0) is not allowed.
1440            if len == 0 {
1441                return Ok(());
1442            };
1443            depth.increment()?;
1444            let envelope_size = 8;
1445            let bytes_len = len * envelope_size;
1446            let offset = decoder.out_of_line_offset(bytes_len)?;
1447            // Decode the envelope for each type.
1448            let mut _next_ordinal_to_read = 0;
1449            let mut next_offset = offset;
1450            let end_offset = offset + bytes_len;
1451            _next_ordinal_to_read += 1;
1452            if next_offset >= end_offset {
1453                return Ok(());
1454            }
1455
1456            // Decode unknown envelopes for gaps in ordinals.
1457            while _next_ordinal_to_read < 1 {
1458                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1459                _next_ordinal_to_read += 1;
1460                next_offset += envelope_size;
1461            }
1462
1463            let next_out_of_line = decoder.next_out_of_line();
1464            let handles_before = decoder.remaining_handles();
1465            if let Some((inlined, num_bytes, num_handles)) =
1466                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1467            {
1468                let member_inline_size =
1469                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
1470                        decoder.context,
1471                    );
1472                if inlined != (member_inline_size <= 4) {
1473                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1474                }
1475                let inner_offset;
1476                let mut inner_depth = depth.clone();
1477                if inlined {
1478                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1479                    inner_offset = next_offset;
1480                } else {
1481                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1482                    inner_depth.increment()?;
1483                }
1484                let val_ref = self
1485                    .name
1486                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>, D));
1487                fidl::decode!(
1488                    fidl::encoding::BoundedString<255>,
1489                    D,
1490                    val_ref,
1491                    decoder,
1492                    inner_offset,
1493                    inner_depth
1494                )?;
1495                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1496                {
1497                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1498                }
1499                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1500                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1501                }
1502            }
1503
1504            next_offset += envelope_size;
1505            _next_ordinal_to_read += 1;
1506            if next_offset >= end_offset {
1507                return Ok(());
1508            }
1509
1510            // Decode unknown envelopes for gaps in ordinals.
1511            while _next_ordinal_to_read < 2 {
1512                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1513                _next_ordinal_to_read += 1;
1514                next_offset += envelope_size;
1515            }
1516
1517            let next_out_of_line = decoder.next_out_of_line();
1518            let handles_before = decoder.remaining_handles();
1519            if let Some((inlined, num_bytes, num_handles)) =
1520                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1521            {
1522                let member_inline_size = <fidl::encoding::BoundedString<4095> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1523                if inlined != (member_inline_size <= 4) {
1524                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1525                }
1526                let inner_offset;
1527                let mut inner_depth = depth.clone();
1528                if inlined {
1529                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1530                    inner_offset = next_offset;
1531                } else {
1532                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1533                    inner_depth.increment()?;
1534                }
1535                let val_ref = self.subdir.get_or_insert_with(|| {
1536                    fidl::new_empty!(fidl::encoding::BoundedString<4095>, D)
1537                });
1538                fidl::decode!(
1539                    fidl::encoding::BoundedString<4095>,
1540                    D,
1541                    val_ref,
1542                    decoder,
1543                    inner_offset,
1544                    inner_depth
1545                )?;
1546                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1547                {
1548                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1549                }
1550                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1551                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1552                }
1553            }
1554
1555            next_offset += envelope_size;
1556
1557            // Decode the remaining unknown envelopes.
1558            while next_offset < end_offset {
1559                _next_ordinal_to_read += 1;
1560                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1561                next_offset += envelope_size;
1562            }
1563
1564            Ok(())
1565        }
1566    }
1567
1568    impl StorageDep {
1569        #[inline(always)]
1570        fn max_ordinal_present(&self) -> u64 {
1571            if let Some(_) = self.path {
1572                return 2;
1573            }
1574            if let Some(_) = self.variant {
1575                return 1;
1576            }
1577            0
1578        }
1579    }
1580
1581    impl fidl::encoding::ValueTypeMarker for StorageDep {
1582        type Borrowed<'a> = &'a Self;
1583        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1584            value
1585        }
1586    }
1587
1588    unsafe impl fidl::encoding::TypeMarker for StorageDep {
1589        type Owned = Self;
1590
1591        #[inline(always)]
1592        fn inline_align(_context: fidl::encoding::Context) -> usize {
1593            8
1594        }
1595
1596        #[inline(always)]
1597        fn inline_size(_context: fidl::encoding::Context) -> usize {
1598            16
1599        }
1600    }
1601
1602    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StorageDep, D>
1603        for &StorageDep
1604    {
1605        unsafe fn encode(
1606            self,
1607            encoder: &mut fidl::encoding::Encoder<'_, D>,
1608            offset: usize,
1609            mut depth: fidl::encoding::Depth,
1610        ) -> fidl::Result<()> {
1611            encoder.debug_check_bounds::<StorageDep>(offset);
1612            // Vector header
1613            let max_ordinal: u64 = self.max_ordinal_present();
1614            encoder.write_num(max_ordinal, offset);
1615            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1616            // Calling encoder.out_of_line_offset(0) is not allowed.
1617            if max_ordinal == 0 {
1618                return Ok(());
1619            }
1620            depth.increment()?;
1621            let envelope_size = 8;
1622            let bytes_len = max_ordinal as usize * envelope_size;
1623            #[allow(unused_variables)]
1624            let offset = encoder.out_of_line_offset(bytes_len);
1625            let mut _prev_end_offset: usize = 0;
1626            if 1 > max_ordinal {
1627                return Ok(());
1628            }
1629
1630            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1631            // are envelope_size bytes.
1632            let cur_offset: usize = (1 - 1) * envelope_size;
1633
1634            // Zero reserved fields.
1635            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1636
1637            // Safety:
1638            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1639            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1640            //   envelope_size bytes, there is always sufficient room.
1641            fidl::encoding::encode_in_envelope_optional::<StorageVariant, D>(
1642                self.variant
1643                    .as_ref()
1644                    .map(<StorageVariant as fidl::encoding::ValueTypeMarker>::borrow),
1645                encoder,
1646                offset + cur_offset,
1647                depth,
1648            )?;
1649
1650            _prev_end_offset = cur_offset + envelope_size;
1651            if 2 > max_ordinal {
1652                return Ok(());
1653            }
1654
1655            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1656            // are envelope_size bytes.
1657            let cur_offset: usize = (2 - 1) * envelope_size;
1658
1659            // Zero reserved fields.
1660            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1661
1662            // Safety:
1663            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1664            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1665            //   envelope_size bytes, there is always sufficient room.
1666            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4095>, D>(
1667            self.path.as_ref().map(<fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow),
1668            encoder, offset + cur_offset, depth
1669        )?;
1670
1671            _prev_end_offset = cur_offset + envelope_size;
1672
1673            Ok(())
1674        }
1675    }
1676
1677    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StorageDep {
1678        #[inline(always)]
1679        fn new_empty() -> Self {
1680            Self::default()
1681        }
1682
1683        unsafe fn decode(
1684            &mut self,
1685            decoder: &mut fidl::encoding::Decoder<'_, D>,
1686            offset: usize,
1687            mut depth: fidl::encoding::Depth,
1688        ) -> fidl::Result<()> {
1689            decoder.debug_check_bounds::<Self>(offset);
1690            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1691                None => return Err(fidl::Error::NotNullable),
1692                Some(len) => len,
1693            };
1694            // Calling decoder.out_of_line_offset(0) is not allowed.
1695            if len == 0 {
1696                return Ok(());
1697            };
1698            depth.increment()?;
1699            let envelope_size = 8;
1700            let bytes_len = len * envelope_size;
1701            let offset = decoder.out_of_line_offset(bytes_len)?;
1702            // Decode the envelope for each type.
1703            let mut _next_ordinal_to_read = 0;
1704            let mut next_offset = offset;
1705            let end_offset = offset + bytes_len;
1706            _next_ordinal_to_read += 1;
1707            if next_offset >= end_offset {
1708                return Ok(());
1709            }
1710
1711            // Decode unknown envelopes for gaps in ordinals.
1712            while _next_ordinal_to_read < 1 {
1713                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1714                _next_ordinal_to_read += 1;
1715                next_offset += envelope_size;
1716            }
1717
1718            let next_out_of_line = decoder.next_out_of_line();
1719            let handles_before = decoder.remaining_handles();
1720            if let Some((inlined, num_bytes, num_handles)) =
1721                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1722            {
1723                let member_inline_size =
1724                    <StorageVariant as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1725                if inlined != (member_inline_size <= 4) {
1726                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1727                }
1728                let inner_offset;
1729                let mut inner_depth = depth.clone();
1730                if inlined {
1731                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1732                    inner_offset = next_offset;
1733                } else {
1734                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1735                    inner_depth.increment()?;
1736                }
1737                let val_ref =
1738                    self.variant.get_or_insert_with(|| fidl::new_empty!(StorageVariant, D));
1739                fidl::decode!(StorageVariant, D, val_ref, decoder, inner_offset, inner_depth)?;
1740                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1741                {
1742                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1743                }
1744                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1745                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1746                }
1747            }
1748
1749            next_offset += envelope_size;
1750            _next_ordinal_to_read += 1;
1751            if next_offset >= end_offset {
1752                return Ok(());
1753            }
1754
1755            // Decode unknown envelopes for gaps in ordinals.
1756            while _next_ordinal_to_read < 2 {
1757                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1758                _next_ordinal_to_read += 1;
1759                next_offset += envelope_size;
1760            }
1761
1762            let next_out_of_line = decoder.next_out_of_line();
1763            let handles_before = decoder.remaining_handles();
1764            if let Some((inlined, num_bytes, num_handles)) =
1765                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1766            {
1767                let member_inline_size = <fidl::encoding::BoundedString<4095> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1768                if inlined != (member_inline_size <= 4) {
1769                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1770                }
1771                let inner_offset;
1772                let mut inner_depth = depth.clone();
1773                if inlined {
1774                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1775                    inner_offset = next_offset;
1776                } else {
1777                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1778                    inner_depth.increment()?;
1779                }
1780                let val_ref = self.path.get_or_insert_with(|| {
1781                    fidl::new_empty!(fidl::encoding::BoundedString<4095>, D)
1782                });
1783                fidl::decode!(
1784                    fidl::encoding::BoundedString<4095>,
1785                    D,
1786                    val_ref,
1787                    decoder,
1788                    inner_offset,
1789                    inner_depth
1790                )?;
1791                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1792                {
1793                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1794                }
1795                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1796                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1797                }
1798            }
1799
1800            next_offset += envelope_size;
1801
1802            // Decode the remaining unknown envelopes.
1803            while next_offset < end_offset {
1804                _next_ordinal_to_read += 1;
1805                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1806                next_offset += envelope_size;
1807            }
1808
1809            Ok(())
1810        }
1811    }
1812
1813    impl fidl::encoding::ValueTypeMarker for Capability {
1814        type Borrowed<'a> = &'a Self;
1815        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1816            value
1817        }
1818    }
1819
1820    unsafe impl fidl::encoding::TypeMarker for Capability {
1821        type Owned = Self;
1822
1823        #[inline(always)]
1824        fn inline_align(_context: fidl::encoding::Context) -> usize {
1825            8
1826        }
1827
1828        #[inline(always)]
1829        fn inline_size(_context: fidl::encoding::Context) -> usize {
1830            16
1831        }
1832    }
1833
1834    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Capability, D>
1835        for &Capability
1836    {
1837        #[inline]
1838        unsafe fn encode(
1839            self,
1840            encoder: &mut fidl::encoding::Encoder<'_, D>,
1841            offset: usize,
1842            _depth: fidl::encoding::Depth,
1843        ) -> fidl::Result<()> {
1844            encoder.debug_check_bounds::<Capability>(offset);
1845            encoder.write_num::<u64>(self.ordinal(), offset);
1846            match self {
1847                Capability::NetemulDevfs(ref val) => {
1848                    fidl::encoding::encode_in_envelope::<DevfsDep, D>(
1849                        <DevfsDep as fidl::encoding::ValueTypeMarker>::borrow(val),
1850                        encoder,
1851                        offset + 8,
1852                        _depth,
1853                    )
1854                }
1855                Capability::NetemulNetworkContext(ref val) => {
1856                    fidl::encoding::encode_in_envelope::<Empty, D>(
1857                        <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
1858                        encoder,
1859                        offset + 8,
1860                        _depth,
1861                    )
1862                }
1863                Capability::LogSink(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
1864                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
1865                    encoder,
1866                    offset + 8,
1867                    _depth,
1868                ),
1869                Capability::ChildDep(ref val) => fidl::encoding::encode_in_envelope::<ChildDep, D>(
1870                    <ChildDep as fidl::encoding::ValueTypeMarker>::borrow(val),
1871                    encoder,
1872                    offset + 8,
1873                    _depth,
1874                ),
1875                Capability::StorageDep(ref val) => {
1876                    fidl::encoding::encode_in_envelope::<StorageDep, D>(
1877                        <StorageDep as fidl::encoding::ValueTypeMarker>::borrow(val),
1878                        encoder,
1879                        offset + 8,
1880                        _depth,
1881                    )
1882                }
1883                Capability::TracingProvider(ref val) => {
1884                    fidl::encoding::encode_in_envelope::<Empty, D>(
1885                        <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
1886                        encoder,
1887                        offset + 8,
1888                        _depth,
1889                    )
1890                }
1891            }
1892        }
1893    }
1894
1895    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Capability {
1896        #[inline(always)]
1897        fn new_empty() -> Self {
1898            Self::NetemulDevfs(fidl::new_empty!(DevfsDep, D))
1899        }
1900
1901        #[inline]
1902        unsafe fn decode(
1903            &mut self,
1904            decoder: &mut fidl::encoding::Decoder<'_, D>,
1905            offset: usize,
1906            mut depth: fidl::encoding::Depth,
1907        ) -> fidl::Result<()> {
1908            decoder.debug_check_bounds::<Self>(offset);
1909            #[allow(unused_variables)]
1910            let next_out_of_line = decoder.next_out_of_line();
1911            let handles_before = decoder.remaining_handles();
1912            let (ordinal, inlined, num_bytes, num_handles) =
1913                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1914
1915            let member_inline_size = match ordinal {
1916                1 => <DevfsDep as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1917                3 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1918                4 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1919                5 => <ChildDep as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1920                6 => <StorageDep as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1921                7 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1922                _ => return Err(fidl::Error::UnknownUnionTag),
1923            };
1924
1925            if inlined != (member_inline_size <= 4) {
1926                return Err(fidl::Error::InvalidInlineBitInEnvelope);
1927            }
1928            let _inner_offset;
1929            if inlined {
1930                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1931                _inner_offset = offset + 8;
1932            } else {
1933                depth.increment()?;
1934                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1935            }
1936            match ordinal {
1937                1 => {
1938                    #[allow(irrefutable_let_patterns)]
1939                    if let Capability::NetemulDevfs(_) = self {
1940                        // Do nothing, read the value into the object
1941                    } else {
1942                        // Initialize `self` to the right variant
1943                        *self = Capability::NetemulDevfs(fidl::new_empty!(DevfsDep, D));
1944                    }
1945                    #[allow(irrefutable_let_patterns)]
1946                    if let Capability::NetemulDevfs(ref mut val) = self {
1947                        fidl::decode!(DevfsDep, D, val, decoder, _inner_offset, depth)?;
1948                    } else {
1949                        unreachable!()
1950                    }
1951                }
1952                3 => {
1953                    #[allow(irrefutable_let_patterns)]
1954                    if let Capability::NetemulNetworkContext(_) = self {
1955                        // Do nothing, read the value into the object
1956                    } else {
1957                        // Initialize `self` to the right variant
1958                        *self = Capability::NetemulNetworkContext(fidl::new_empty!(Empty, D));
1959                    }
1960                    #[allow(irrefutable_let_patterns)]
1961                    if let Capability::NetemulNetworkContext(ref mut val) = self {
1962                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
1963                    } else {
1964                        unreachable!()
1965                    }
1966                }
1967                4 => {
1968                    #[allow(irrefutable_let_patterns)]
1969                    if let Capability::LogSink(_) = self {
1970                        // Do nothing, read the value into the object
1971                    } else {
1972                        // Initialize `self` to the right variant
1973                        *self = Capability::LogSink(fidl::new_empty!(Empty, D));
1974                    }
1975                    #[allow(irrefutable_let_patterns)]
1976                    if let Capability::LogSink(ref mut val) = self {
1977                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
1978                    } else {
1979                        unreachable!()
1980                    }
1981                }
1982                5 => {
1983                    #[allow(irrefutable_let_patterns)]
1984                    if let Capability::ChildDep(_) = self {
1985                        // Do nothing, read the value into the object
1986                    } else {
1987                        // Initialize `self` to the right variant
1988                        *self = Capability::ChildDep(fidl::new_empty!(ChildDep, D));
1989                    }
1990                    #[allow(irrefutable_let_patterns)]
1991                    if let Capability::ChildDep(ref mut val) = self {
1992                        fidl::decode!(ChildDep, D, val, decoder, _inner_offset, depth)?;
1993                    } else {
1994                        unreachable!()
1995                    }
1996                }
1997                6 => {
1998                    #[allow(irrefutable_let_patterns)]
1999                    if let Capability::StorageDep(_) = self {
2000                        // Do nothing, read the value into the object
2001                    } else {
2002                        // Initialize `self` to the right variant
2003                        *self = Capability::StorageDep(fidl::new_empty!(StorageDep, D));
2004                    }
2005                    #[allow(irrefutable_let_patterns)]
2006                    if let Capability::StorageDep(ref mut val) = self {
2007                        fidl::decode!(StorageDep, D, val, decoder, _inner_offset, depth)?;
2008                    } else {
2009                        unreachable!()
2010                    }
2011                }
2012                7 => {
2013                    #[allow(irrefutable_let_patterns)]
2014                    if let Capability::TracingProvider(_) = self {
2015                        // Do nothing, read the value into the object
2016                    } else {
2017                        // Initialize `self` to the right variant
2018                        *self = Capability::TracingProvider(fidl::new_empty!(Empty, D));
2019                    }
2020                    #[allow(irrefutable_let_patterns)]
2021                    if let Capability::TracingProvider(ref mut val) = self {
2022                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2023                    } else {
2024                        unreachable!()
2025                    }
2026                }
2027                ordinal => panic!("unexpected ordinal {:?}", ordinal),
2028            }
2029            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2030                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2031            }
2032            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2033                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2034            }
2035            Ok(())
2036        }
2037    }
2038
2039    impl fidl::encoding::ValueTypeMarker for ChildUses {
2040        type Borrowed<'a> = &'a Self;
2041        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2042            value
2043        }
2044    }
2045
2046    unsafe impl fidl::encoding::TypeMarker for ChildUses {
2047        type Owned = Self;
2048
2049        #[inline(always)]
2050        fn inline_align(_context: fidl::encoding::Context) -> usize {
2051            8
2052        }
2053
2054        #[inline(always)]
2055        fn inline_size(_context: fidl::encoding::Context) -> usize {
2056            16
2057        }
2058    }
2059
2060    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChildUses, D>
2061        for &ChildUses
2062    {
2063        #[inline]
2064        unsafe fn encode(
2065            self,
2066            encoder: &mut fidl::encoding::Encoder<'_, D>,
2067            offset: usize,
2068            _depth: fidl::encoding::Depth,
2069        ) -> fidl::Result<()> {
2070            encoder.debug_check_bounds::<ChildUses>(offset);
2071            encoder.write_num::<u64>(self.ordinal(), offset);
2072            match self {
2073            ChildUses::Capabilities(ref val) => {
2074                fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedVector<Capability>, D>(
2075                    <fidl::encoding::UnboundedVector<Capability> as fidl::encoding::ValueTypeMarker>::borrow(val),
2076                    encoder, offset + 8, _depth
2077                )
2078            }
2079        }
2080        }
2081    }
2082
2083    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChildUses {
2084        #[inline(always)]
2085        fn new_empty() -> Self {
2086            Self::Capabilities(fidl::new_empty!(fidl::encoding::UnboundedVector<Capability>, D))
2087        }
2088
2089        #[inline]
2090        unsafe fn decode(
2091            &mut self,
2092            decoder: &mut fidl::encoding::Decoder<'_, D>,
2093            offset: usize,
2094            mut depth: fidl::encoding::Depth,
2095        ) -> fidl::Result<()> {
2096            decoder.debug_check_bounds::<Self>(offset);
2097            #[allow(unused_variables)]
2098            let next_out_of_line = decoder.next_out_of_line();
2099            let handles_before = decoder.remaining_handles();
2100            let (ordinal, inlined, num_bytes, num_handles) =
2101                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2102
2103            let member_inline_size = match ordinal {
2104            1 => <fidl::encoding::UnboundedVector<Capability> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2105            _ => return Err(fidl::Error::UnknownUnionTag),
2106        };
2107
2108            if inlined != (member_inline_size <= 4) {
2109                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2110            }
2111            let _inner_offset;
2112            if inlined {
2113                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2114                _inner_offset = offset + 8;
2115            } else {
2116                depth.increment()?;
2117                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2118            }
2119            match ordinal {
2120                1 => {
2121                    #[allow(irrefutable_let_patterns)]
2122                    if let ChildUses::Capabilities(_) = self {
2123                        // Do nothing, read the value into the object
2124                    } else {
2125                        // Initialize `self` to the right variant
2126                        *self = ChildUses::Capabilities(fidl::new_empty!(
2127                            fidl::encoding::UnboundedVector<Capability>,
2128                            D
2129                        ));
2130                    }
2131                    #[allow(irrefutable_let_patterns)]
2132                    if let ChildUses::Capabilities(ref mut val) = self {
2133                        fidl::decode!(
2134                            fidl::encoding::UnboundedVector<Capability>,
2135                            D,
2136                            val,
2137                            decoder,
2138                            _inner_offset,
2139                            depth
2140                        )?;
2141                    } else {
2142                        unreachable!()
2143                    }
2144                }
2145                ordinal => panic!("unexpected ordinal {:?}", ordinal),
2146            }
2147            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2148                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2149            }
2150            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2151                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2152            }
2153            Ok(())
2154        }
2155    }
2156
2157    impl fidl::encoding::ValueTypeMarker for ExposedCapability {
2158        type Borrowed<'a> = &'a Self;
2159        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2160            value
2161        }
2162    }
2163
2164    unsafe impl fidl::encoding::TypeMarker for ExposedCapability {
2165        type Owned = Self;
2166
2167        #[inline(always)]
2168        fn inline_align(_context: fidl::encoding::Context) -> usize {
2169            8
2170        }
2171
2172        #[inline(always)]
2173        fn inline_size(_context: fidl::encoding::Context) -> usize {
2174            16
2175        }
2176    }
2177
2178    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ExposedCapability, D>
2179        for &ExposedCapability
2180    {
2181        #[inline]
2182        unsafe fn encode(
2183            self,
2184            encoder: &mut fidl::encoding::Encoder<'_, D>,
2185            offset: usize,
2186            _depth: fidl::encoding::Depth,
2187        ) -> fidl::Result<()> {
2188            encoder.debug_check_bounds::<ExposedCapability>(offset);
2189            encoder.write_num::<u64>(self.ordinal(), offset);
2190            match self {
2191                ExposedCapability::Protocol(ref val) => fidl::encoding::encode_in_envelope::<
2192                    fidl::encoding::BoundedString<255>,
2193                    D,
2194                >(
2195                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
2196                        val,
2197                    ),
2198                    encoder,
2199                    offset + 8,
2200                    _depth,
2201                ),
2202                ExposedCapability::Configuration(ref val) => fidl::encoding::encode_in_envelope::<
2203                    fidl::encoding::BoundedString<255>,
2204                    D,
2205                >(
2206                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
2207                        val,
2208                    ),
2209                    encoder,
2210                    offset + 8,
2211                    _depth,
2212                ),
2213                ExposedCapability::Service(ref val) => fidl::encoding::encode_in_envelope::<
2214                    fidl::encoding::BoundedString<255>,
2215                    D,
2216                >(
2217                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
2218                        val,
2219                    ),
2220                    encoder,
2221                    offset + 8,
2222                    _depth,
2223                ),
2224            }
2225        }
2226    }
2227
2228    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ExposedCapability {
2229        #[inline(always)]
2230        fn new_empty() -> Self {
2231            Self::Protocol(fidl::new_empty!(fidl::encoding::BoundedString<255>, D))
2232        }
2233
2234        #[inline]
2235        unsafe fn decode(
2236            &mut self,
2237            decoder: &mut fidl::encoding::Decoder<'_, D>,
2238            offset: usize,
2239            mut depth: fidl::encoding::Depth,
2240        ) -> fidl::Result<()> {
2241            decoder.debug_check_bounds::<Self>(offset);
2242            #[allow(unused_variables)]
2243            let next_out_of_line = decoder.next_out_of_line();
2244            let handles_before = decoder.remaining_handles();
2245            let (ordinal, inlined, num_bytes, num_handles) =
2246                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2247
2248            let member_inline_size = match ordinal {
2249                1 => {
2250                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
2251                        decoder.context,
2252                    )
2253                }
2254                2 => {
2255                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
2256                        decoder.context,
2257                    )
2258                }
2259                3 => {
2260                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
2261                        decoder.context,
2262                    )
2263                }
2264                _ => return Err(fidl::Error::UnknownUnionTag),
2265            };
2266
2267            if inlined != (member_inline_size <= 4) {
2268                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2269            }
2270            let _inner_offset;
2271            if inlined {
2272                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2273                _inner_offset = offset + 8;
2274            } else {
2275                depth.increment()?;
2276                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2277            }
2278            match ordinal {
2279                1 => {
2280                    #[allow(irrefutable_let_patterns)]
2281                    if let ExposedCapability::Protocol(_) = self {
2282                        // Do nothing, read the value into the object
2283                    } else {
2284                        // Initialize `self` to the right variant
2285                        *self = ExposedCapability::Protocol(fidl::new_empty!(
2286                            fidl::encoding::BoundedString<255>,
2287                            D
2288                        ));
2289                    }
2290                    #[allow(irrefutable_let_patterns)]
2291                    if let ExposedCapability::Protocol(ref mut val) = self {
2292                        fidl::decode!(
2293                            fidl::encoding::BoundedString<255>,
2294                            D,
2295                            val,
2296                            decoder,
2297                            _inner_offset,
2298                            depth
2299                        )?;
2300                    } else {
2301                        unreachable!()
2302                    }
2303                }
2304                2 => {
2305                    #[allow(irrefutable_let_patterns)]
2306                    if let ExposedCapability::Configuration(_) = self {
2307                        // Do nothing, read the value into the object
2308                    } else {
2309                        // Initialize `self` to the right variant
2310                        *self = ExposedCapability::Configuration(fidl::new_empty!(
2311                            fidl::encoding::BoundedString<255>,
2312                            D
2313                        ));
2314                    }
2315                    #[allow(irrefutable_let_patterns)]
2316                    if let ExposedCapability::Configuration(ref mut val) = self {
2317                        fidl::decode!(
2318                            fidl::encoding::BoundedString<255>,
2319                            D,
2320                            val,
2321                            decoder,
2322                            _inner_offset,
2323                            depth
2324                        )?;
2325                    } else {
2326                        unreachable!()
2327                    }
2328                }
2329                3 => {
2330                    #[allow(irrefutable_let_patterns)]
2331                    if let ExposedCapability::Service(_) = self {
2332                        // Do nothing, read the value into the object
2333                    } else {
2334                        // Initialize `self` to the right variant
2335                        *self = ExposedCapability::Service(fidl::new_empty!(
2336                            fidl::encoding::BoundedString<255>,
2337                            D
2338                        ));
2339                    }
2340                    #[allow(irrefutable_let_patterns)]
2341                    if let ExposedCapability::Service(ref mut val) = self {
2342                        fidl::decode!(
2343                            fidl::encoding::BoundedString<255>,
2344                            D,
2345                            val,
2346                            decoder,
2347                            _inner_offset,
2348                            depth
2349                        )?;
2350                    } else {
2351                        unreachable!()
2352                    }
2353                }
2354                ordinal => panic!("unexpected ordinal {:?}", ordinal),
2355            }
2356            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2357                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2358            }
2359            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2360                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2361            }
2362            Ok(())
2363        }
2364    }
2365}