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