fidl_fuchsia_netemul__common/
fidl_fuchsia_netemul__common.rs

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