Skip to main content

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