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