fidl_fuchsia_component__common/
fidl_fuchsia_component__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
11pub type ChildName = String;
12
13pub type Name = String;
14
15pub type UrlScheme = String;
16
17/// The maximum string length of a capability ID.
18/// This value is currently set arbitrarily.
19pub const MAX_CAPABILITY_ID_LENGTH: u64 = 50;
20
21/// The maximum number of children that the a call `ChildIterator.Next`
22/// can return.
23/// Note, this is not a limit on the number of children that can be added
24/// to a component. This is merely a limit for a single invocation of the
25/// `Next` method.
26pub const MAX_CHILD_COUNT: u32 = 128;
27
28pub const MAX_CHILD_NAME_LENGTH: u32 = 1024;
29
30/// The maximum number of dynamic offers that can target a created component.
31pub const MAX_DYNAMIC_OFFER_COUNT: u32 = 128;
32
33/// The maximum string length of an error description.
34pub const MAX_ERROR_DESCRIPTION_LENGTH: u64 = 100;
35
36/// The maximum number of handles that can be passed to a created component.
37pub const MAX_HANDLE_COUNT: u32 = 128;
38
39pub const MAX_MONIKER_LENGTH: u32 = 4096;
40
41pub const MAX_NAMESPACE_COUNT: u32 = 32;
42
43pub const MAX_NAME_LENGTH: u64 = fidl_fuchsia_io__common::MAX_NAME_LENGTH as u64;
44
45/// The maximum number of events that a receiver can listen to.
46pub const MAX_NUM_EVENTS_RECEIVED: u64 = 100;
47
48pub const MAX_PATH_LENGTH: u64 = fidl_fuchsia_io__common::MAX_PATH_LENGTH as u64;
49
50/// The maximum length of a storage instance ID.
51/// A storage instance ID is a 256-bit UUID, which when encoded
52/// in hex notation is 64 characters long.
53pub const MAX_STORAGE_ID_LENGTH: u32 = 64;
54
55/// The maximum number of requests per event subscription.
56pub const MAX_SUBSCRIPTION_REQUESTS: u32 = 2;
57
58pub const MAX_URL_SCHEME_LENGTH: u64 = MAX_NAME_LENGTH as u64;
59
60#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
61#[repr(u32)]
62pub enum DeletionError {
63    /// There was an error sending a request to the storage provider.
64    Connection = 1,
65    /// The storage provider returned an error in response to a protocol
66    /// request.
67    Protocol = 2,
68    /// There was no storage available for deletion.
69    NoneAvailable = 3,
70    /// This call is not supported.
71    Unsupported = 4,
72}
73
74impl DeletionError {
75    #[inline]
76    pub fn from_primitive(prim: u32) -> Option<Self> {
77        match prim {
78            1 => Some(Self::Connection),
79            2 => Some(Self::Protocol),
80            3 => Some(Self::NoneAvailable),
81            4 => Some(Self::Unsupported),
82            _ => None,
83        }
84    }
85
86    #[inline]
87    pub const fn into_primitive(self) -> u32 {
88        self as u32
89    }
90}
91
92/// Standard error codes for component framework protocols.
93#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
94pub enum Error {
95    /// Component manager encountered an otherwise unspecified error while
96    /// performing the operation.
97    Internal,
98    /// At least one argument had an invalid format.
99    InvalidArguments,
100    /// The feature is not yet supported.
101    Unsupported,
102    /// The caller did not have permission to perform the specified operation,
103    /// or one of the handles provided to the call had insufficient rights.
104    AccessDenied,
105    /// The component instance was not found.
106    InstanceNotFound,
107    /// The component instance already exists.
108    InstanceAlreadyExists,
109    /// The component instance could not be started.
110    InstanceCannotStart,
111    /// Failed to resolve the component's declaration.
112    InstanceCannotResolve,
113    /// The component collection was not found.
114    CollectionNotFound,
115    /// There were insufficient resources to perform the operation.
116    ResourceUnavailable,
117    /// The component instance died unexpectedly.
118    InstanceDied,
119    /// The requested resource does not exist.
120    ResourceNotFound,
121    /// Failed to unresolve the component.
122    InstanceCannotUnresolve,
123    /// The component instance has already been started.
124    InstanceAlreadyStarted,
125    /// A capability route would have created a dependency cycle.
126    DependencyCycle,
127    #[doc(hidden)]
128    __SourceBreaking { unknown_ordinal: u32 },
129}
130
131/// Pattern that matches an unknown `Error` member.
132#[macro_export]
133macro_rules! ErrorUnknown {
134    () => {
135        _
136    };
137}
138
139impl Error {
140    #[inline]
141    pub fn from_primitive(prim: u32) -> Option<Self> {
142        match prim {
143            1 => Some(Self::Internal),
144            2 => Some(Self::InvalidArguments),
145            3 => Some(Self::Unsupported),
146            4 => Some(Self::AccessDenied),
147            5 => Some(Self::InstanceNotFound),
148            6 => Some(Self::InstanceAlreadyExists),
149            7 => Some(Self::InstanceCannotStart),
150            8 => Some(Self::InstanceCannotResolve),
151            9 => Some(Self::CollectionNotFound),
152            10 => Some(Self::ResourceUnavailable),
153            11 => Some(Self::InstanceDied),
154            12 => Some(Self::ResourceNotFound),
155            13 => Some(Self::InstanceCannotUnresolve),
156            14 => Some(Self::InstanceAlreadyStarted),
157            15 => Some(Self::DependencyCycle),
158            _ => None,
159        }
160    }
161
162    #[inline]
163    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
164        match prim {
165            1 => Self::Internal,
166            2 => Self::InvalidArguments,
167            3 => Self::Unsupported,
168            4 => Self::AccessDenied,
169            5 => Self::InstanceNotFound,
170            6 => Self::InstanceAlreadyExists,
171            7 => Self::InstanceCannotStart,
172            8 => Self::InstanceCannotResolve,
173            9 => Self::CollectionNotFound,
174            10 => Self::ResourceUnavailable,
175            11 => Self::InstanceDied,
176            12 => Self::ResourceNotFound,
177            13 => Self::InstanceCannotUnresolve,
178            14 => Self::InstanceAlreadyStarted,
179            15 => Self::DependencyCycle,
180            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
181        }
182    }
183
184    #[inline]
185    pub fn unknown() -> Self {
186        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
187    }
188
189    #[inline]
190    pub const fn into_primitive(self) -> u32 {
191        match self {
192            Self::Internal => 1,
193            Self::InvalidArguments => 2,
194            Self::Unsupported => 3,
195            Self::AccessDenied => 4,
196            Self::InstanceNotFound => 5,
197            Self::InstanceAlreadyExists => 6,
198            Self::InstanceCannotStart => 7,
199            Self::InstanceCannotResolve => 8,
200            Self::CollectionNotFound => 9,
201            Self::ResourceUnavailable => 10,
202            Self::InstanceDied => 11,
203            Self::ResourceNotFound => 12,
204            Self::InstanceCannotUnresolve => 13,
205            Self::InstanceAlreadyStarted => 14,
206            Self::DependencyCycle => 15,
207            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
208        }
209    }
210
211    #[inline]
212    pub fn is_unknown(&self) -> bool {
213        match self {
214            Self::__SourceBreaking { unknown_ordinal: _ } => true,
215            _ => false,
216        }
217    }
218}
219
220/// These EventTypes are used for the EventStream protocol.
221/// They are FIDL versions of the EventType enum in hooks.rs and have
222/// the same meaning.
223#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
224#[repr(u32)]
225pub enum EventType {
226    /// A capability provided by this component has been requested. The event
227    /// payload carries the request channel.
228    CapabilityRequested = 1,
229    /// A component instance was discovered. This is the first stage in the lifecycle
230    /// of components. Dispatched for dynamic children when they're created, for static
231    /// children when their parent is resolved, and for the root when the component manager
232    /// starts.
233    Discovered = 3,
234    /// The instance is destroyed and no longer exists.
235    Destroyed = 4,
236    /// An instance's declaration was resolved successfully for the first time.
237    Resolved = 5,
238    /// This instance has started, according to component manager. However, if this is an
239    /// executable component, the runner has further work to do to launch the component.
240    Started = 6,
241    /// An instance was stopped successfully.
242    Stopped = 7,
243    /// Similar to STARTED, except the payload will carry an eventpair that the subscriber
244    /// could use to defer the launch of the component. This allows, e.g., a debugger to
245    /// perform some setup before any processes are created.
246    DebugStarted = 8,
247    /// An instance was unresolved successfully.
248    Unresolved = 9,
249}
250
251impl EventType {
252    #[inline]
253    pub fn from_primitive(prim: u32) -> Option<Self> {
254        match prim {
255            1 => Some(Self::CapabilityRequested),
256            3 => Some(Self::Discovered),
257            4 => Some(Self::Destroyed),
258            5 => Some(Self::Resolved),
259            6 => Some(Self::Started),
260            7 => Some(Self::Stopped),
261            8 => Some(Self::DebugStarted),
262            9 => Some(Self::Unresolved),
263            _ => None,
264        }
265    }
266
267    #[inline]
268    pub const fn into_primitive(self) -> u32 {
269        self as u32
270    }
271}
272
273/// Error returned from methods in [`Namespace`].
274#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
275pub enum NamespaceError {
276    /// The parent of a parent shares a prefix with another namespace entry
277    Shadow,
278    /// Two entries have the same namespace path.
279    Duplicate,
280    /// Failed to convert a namespace dictionary to a directory.
281    Conversion,
282    /// A namespace entry was invalid.
283    BadEntry,
284    /// There was an error reading from one of the dictionaries.
285    DictionaryRead,
286    #[doc(hidden)]
287    __SourceBreaking { unknown_ordinal: u32 },
288}
289
290/// Pattern that matches an unknown `NamespaceError` member.
291#[macro_export]
292macro_rules! NamespaceErrorUnknown {
293    () => {
294        _
295    };
296}
297
298impl NamespaceError {
299    #[inline]
300    pub fn from_primitive(prim: u32) -> Option<Self> {
301        match prim {
302            1 => Some(Self::Shadow),
303            2 => Some(Self::Duplicate),
304            3 => Some(Self::Conversion),
305            4 => Some(Self::BadEntry),
306            5 => Some(Self::DictionaryRead),
307            _ => None,
308        }
309    }
310
311    #[inline]
312    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
313        match prim {
314            1 => Self::Shadow,
315            2 => Self::Duplicate,
316            3 => Self::Conversion,
317            4 => Self::BadEntry,
318            5 => Self::DictionaryRead,
319            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
320        }
321    }
322
323    #[inline]
324    pub fn unknown() -> Self {
325        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
326    }
327
328    #[inline]
329    pub const fn into_primitive(self) -> u32 {
330        match self {
331            Self::Shadow => 1,
332            Self::Duplicate => 2,
333            Self::Conversion => 3,
334            Self::BadEntry => 4,
335            Self::DictionaryRead => 5,
336            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
337        }
338    }
339
340    #[inline]
341    pub fn is_unknown(&self) -> bool {
342        match self {
343            Self::__SourceBreaking { unknown_ordinal: _ } => true,
344            _ => false,
345        }
346    }
347}
348
349#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
350#[repr(u32)]
351pub enum StatusError {
352    /// The storage provider returned an error to a request or the connection
353    /// to the provider unexpectedly closed.
354    Provider = 1,
355    /// Information returned by the storage provider appears to be invalid.
356    ResponseInvalid = 2,
357    /// A call to the storage provider succeeded, but it returned unexpectedly
358    /// empty data.
359    StatusUnknown = 3,
360    /// This call is not supported.
361    Unsupported = 4,
362}
363
364impl StatusError {
365    #[inline]
366    pub fn from_primitive(prim: u32) -> Option<Self> {
367        match prim {
368            1 => Some(Self::Provider),
369            2 => Some(Self::ResponseInvalid),
370            3 => Some(Self::StatusUnknown),
371            4 => Some(Self::Unsupported),
372            _ => None,
373        }
374    }
375
376    #[inline]
377    pub const fn into_primitive(self) -> u32 {
378        self as u32
379    }
380}
381
382#[derive(Clone, Debug, PartialEq)]
383pub struct ChildIteratorNextResponse {
384    pub children: Vec<fidl_fuchsia_component_decl__common::ChildRef>,
385}
386
387impl fidl::Persistable for ChildIteratorNextResponse {}
388
389#[derive(Clone, Debug, PartialEq)]
390pub struct ExecutionControllerOnStopRequest {
391    pub stopped_payload: StoppedPayload,
392}
393
394impl fidl::Persistable for ExecutionControllerOnStopRequest {}
395
396#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
397pub struct IntrospectorGetMonikerResponse {
398    pub moniker: String,
399}
400
401impl fidl::Persistable for IntrospectorGetMonikerResponse {}
402
403#[derive(Clone, Debug, PartialEq)]
404pub struct RealmDestroyChildRequest {
405    pub child: fidl_fuchsia_component_decl__common::ChildRef,
406}
407
408impl fidl::Persistable for RealmDestroyChildRequest {}
409
410#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
411pub struct StorageAdminDeleteComponentStorageRequest {
412    pub relative_moniker: String,
413}
414
415impl fidl::Persistable for StorageAdminDeleteComponentStorageRequest {}
416
417#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
418pub struct StorageIteratorNextResponse {
419    pub relative_monikers: Vec<String>,
420}
421
422impl fidl::Persistable for StorageIteratorNextResponse {}
423
424/// Payload for Destroyed events.
425#[derive(Clone, Debug, Default, PartialEq)]
426pub struct DestroyedPayload {
427    #[doc(hidden)]
428    pub __source_breaking: fidl::marker::SourceBreaking,
429}
430
431impl fidl::Persistable for DestroyedPayload {}
432
433/// Payload for Discovered events.
434#[derive(Clone, Debug, Default, PartialEq)]
435pub struct DiscoveredPayload {
436    #[doc(hidden)]
437    pub __source_breaking: fidl::marker::SourceBreaking,
438}
439
440impl fidl::Persistable for DiscoveredPayload {}
441
442/// A head providing metadata about a target component instance.
443#[derive(Clone, Debug, Default, PartialEq)]
444pub struct EventHeader {
445    /// Event type corresponding to the event
446    pub event_type: Option<EventType>,
447    /// Relative moniker identifying the component instance. Relative to the scope of the event.
448    pub moniker: Option<String>,
449    /// URL used to resolve the component.
450    pub component_url: Option<String>,
451    /// Boot time when the event occurred.
452    pub timestamp: Option<fidl::BootInstant>,
453    #[doc(hidden)]
454    pub __source_breaking: fidl::marker::SourceBreaking,
455}
456
457impl fidl::Persistable for EventHeader {}
458
459/// Payload for Purged events.
460#[derive(Clone, Debug, Default, PartialEq)]
461pub struct PurgedPayload {
462    #[doc(hidden)]
463    pub __source_breaking: fidl::marker::SourceBreaking,
464}
465
466impl fidl::Persistable for PurgedPayload {}
467
468/// Payload for Resolved events.
469#[derive(Clone, Debug, Default, PartialEq)]
470pub struct ResolvedPayload {
471    #[doc(hidden)]
472    pub __source_breaking: fidl::marker::SourceBreaking,
473}
474
475impl fidl::Persistable for ResolvedPayload {}
476
477/// Payload for Started events.
478#[derive(Clone, Debug, Default, PartialEq)]
479pub struct StartedPayload {
480    #[doc(hidden)]
481    pub __source_breaking: fidl::marker::SourceBreaking,
482}
483
484impl fidl::Persistable for StartedPayload {}
485
486/// Payload for Stopped events.
487#[derive(Clone, Debug, Default, PartialEq)]
488pub struct StoppedPayload {
489    /// The epitaph set on the fuchsia.component.runner/ComponentController
490    /// protocol channel. This is the exit status of the component. The
491    /// possible status values and their meaning are described in the definition
492    /// of the ComponentController protocol.
493    pub status: Option<i32>,
494    /// The exit code of the component instance. Note that not all components
495    /// will stop with an exit code.
496    ///
497    /// Many program runtimes have the concept of an exit code. Runners may map
498    /// that value to this field when applicable. For example, the ELF runner
499    /// will publish the Zircon process return code here.
500    pub exit_code: Option<i64>,
501    #[doc(hidden)]
502    pub __source_breaking: fidl::marker::SourceBreaking,
503}
504
505impl fidl::Persistable for StoppedPayload {}
506
507/// Metadata about status of the storage
508#[derive(Clone, Debug, Default, PartialEq)]
509pub struct StorageStatus {
510    pub total_size: Option<u64>,
511    pub used_size: Option<u64>,
512    #[doc(hidden)]
513    pub __source_breaking: fidl::marker::SourceBreaking,
514}
515
516impl fidl::Persistable for StorageStatus {}
517
518/// Payload for Unresolved events.
519#[derive(Clone, Debug, Default, PartialEq)]
520pub struct UnresolvedPayload {
521    #[doc(hidden)]
522    pub __source_breaking: fidl::marker::SourceBreaking,
523}
524
525impl fidl::Persistable for UnresolvedPayload {}
526
527pub mod binder_ordinals {}
528
529pub mod child_iterator_ordinals {
530    pub const NEXT: u64 = 0x40e4c3882b050d08;
531}
532
533pub mod controller_ordinals {
534    pub const START: u64 = 0x68878076b8d2eac5;
535    pub const IS_STARTED: u64 = 0x2155e6e1db2083c3;
536    pub const OPEN_EXPOSED_DIR: u64 = 0x253cabb9a840ed94;
537    pub const GET_EXPOSED_DICTIONARY: u64 = 0x7e48373e5eda1f9b;
538    pub const GET_OUTPUT_DICTIONARY: u64 = 0x3a0c4696620ad221;
539    pub const DESTROY: u64 = 0x74529fa68b5c1741;
540}
541
542pub mod event_stream_ordinals {
543    pub const GET_NEXT: u64 = 0x3f24c9495978eb86;
544    pub const WAIT_FOR_READY: u64 = 0x31331f9578d2e682;
545}
546
547pub mod execution_controller_ordinals {
548    pub const STOP: u64 = 0x56d23cec21036117;
549    pub const ON_STOP: u64 = 0x62d5018e2174f57f;
550}
551
552pub mod introspector_ordinals {
553    pub const GET_MONIKER: u64 = 0x2f980ceb37bf458;
554}
555
556pub mod namespace_ordinals {
557    pub const CREATE: u64 = 0x4329fe12b2a790f9;
558}
559
560pub mod realm_ordinals {
561    pub const OPEN_CONTROLLER: u64 = 0x7150b7898d1b1180;
562    pub const OPEN_EXPOSED_DIR: u64 = 0x7f993235ca59f92c;
563    pub const CREATE_CHILD: u64 = 0x43e48ce8483d7560;
564    pub const DESTROY_CHILD: u64 = 0x71d8caf8850c9222;
565    pub const LIST_CHILDREN: u64 = 0x6888a76683efc0a1;
566    pub const GET_RESOLVED_INFO: u64 = 0x734f744cb7d210a2;
567    pub const GET_CHILD_OUTPUT_DICTIONARY_DEPRECATED: u64 = 0x39245b02aba94364;
568    pub const GET_CHILD_OUTPUT_DICTIONARY: u64 = 0x4259d08d261d5610;
569}
570
571pub mod storage_admin_ordinals {
572    pub const OPEN_STORAGE: u64 = 0x6ceaa5904cfe4377;
573    pub const LIST_STORAGE_IN_REALM: u64 = 0x764f6d1f083e8bfb;
574    pub const OPEN_COMPONENT_STORAGE_BY_ID: u64 = 0x4802102cc55d5df1;
575    pub const DELETE_COMPONENT_STORAGE: u64 = 0x1677c1cdfcdbf45a;
576    pub const GET_STATUS: u64 = 0x7729e325a6c526c8;
577    pub const DELETE_ALL_STORAGE_CONTENTS: u64 = 0x2ee980b4b2d24adb;
578}
579
580pub mod storage_iterator_ordinals {
581    pub const NEXT: u64 = 0x7a6b21f15fd01b72;
582}
583
584mod internal {
585    use super::*;
586    unsafe impl fidl::encoding::TypeMarker for DeletionError {
587        type Owned = Self;
588
589        #[inline(always)]
590        fn inline_align(_context: fidl::encoding::Context) -> usize {
591            std::mem::align_of::<u32>()
592        }
593
594        #[inline(always)]
595        fn inline_size(_context: fidl::encoding::Context) -> usize {
596            std::mem::size_of::<u32>()
597        }
598
599        #[inline(always)]
600        fn encode_is_copy() -> bool {
601            true
602        }
603
604        #[inline(always)]
605        fn decode_is_copy() -> bool {
606            false
607        }
608    }
609
610    impl fidl::encoding::ValueTypeMarker for DeletionError {
611        type Borrowed<'a> = Self;
612        #[inline(always)]
613        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
614            *value
615        }
616    }
617
618    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DeletionError {
619        #[inline]
620        unsafe fn encode(
621            self,
622            encoder: &mut fidl::encoding::Encoder<'_, D>,
623            offset: usize,
624            _depth: fidl::encoding::Depth,
625        ) -> fidl::Result<()> {
626            encoder.debug_check_bounds::<Self>(offset);
627            encoder.write_num(self.into_primitive(), offset);
628            Ok(())
629        }
630    }
631
632    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeletionError {
633        #[inline(always)]
634        fn new_empty() -> Self {
635            Self::Connection
636        }
637
638        #[inline]
639        unsafe fn decode(
640            &mut self,
641            decoder: &mut fidl::encoding::Decoder<'_, D>,
642            offset: usize,
643            _depth: fidl::encoding::Depth,
644        ) -> fidl::Result<()> {
645            decoder.debug_check_bounds::<Self>(offset);
646            let prim = decoder.read_num::<u32>(offset);
647
648            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
649            Ok(())
650        }
651    }
652    unsafe impl fidl::encoding::TypeMarker for Error {
653        type Owned = Self;
654
655        #[inline(always)]
656        fn inline_align(_context: fidl::encoding::Context) -> usize {
657            std::mem::align_of::<u32>()
658        }
659
660        #[inline(always)]
661        fn inline_size(_context: fidl::encoding::Context) -> usize {
662            std::mem::size_of::<u32>()
663        }
664
665        #[inline(always)]
666        fn encode_is_copy() -> bool {
667            false
668        }
669
670        #[inline(always)]
671        fn decode_is_copy() -> bool {
672            false
673        }
674    }
675
676    impl fidl::encoding::ValueTypeMarker for Error {
677        type Borrowed<'a> = Self;
678        #[inline(always)]
679        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
680            *value
681        }
682    }
683
684    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
685        #[inline]
686        unsafe fn encode(
687            self,
688            encoder: &mut fidl::encoding::Encoder<'_, D>,
689            offset: usize,
690            _depth: fidl::encoding::Depth,
691        ) -> fidl::Result<()> {
692            encoder.debug_check_bounds::<Self>(offset);
693            encoder.write_num(self.into_primitive(), offset);
694            Ok(())
695        }
696    }
697
698    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
699        #[inline(always)]
700        fn new_empty() -> Self {
701            Self::unknown()
702        }
703
704        #[inline]
705        unsafe fn decode(
706            &mut self,
707            decoder: &mut fidl::encoding::Decoder<'_, D>,
708            offset: usize,
709            _depth: fidl::encoding::Depth,
710        ) -> fidl::Result<()> {
711            decoder.debug_check_bounds::<Self>(offset);
712            let prim = decoder.read_num::<u32>(offset);
713
714            *self = Self::from_primitive_allow_unknown(prim);
715            Ok(())
716        }
717    }
718    unsafe impl fidl::encoding::TypeMarker for EventType {
719        type Owned = Self;
720
721        #[inline(always)]
722        fn inline_align(_context: fidl::encoding::Context) -> usize {
723            std::mem::align_of::<u32>()
724        }
725
726        #[inline(always)]
727        fn inline_size(_context: fidl::encoding::Context) -> usize {
728            std::mem::size_of::<u32>()
729        }
730
731        #[inline(always)]
732        fn encode_is_copy() -> bool {
733            true
734        }
735
736        #[inline(always)]
737        fn decode_is_copy() -> bool {
738            false
739        }
740    }
741
742    impl fidl::encoding::ValueTypeMarker for EventType {
743        type Borrowed<'a> = Self;
744        #[inline(always)]
745        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
746            *value
747        }
748    }
749
750    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for EventType {
751        #[inline]
752        unsafe fn encode(
753            self,
754            encoder: &mut fidl::encoding::Encoder<'_, D>,
755            offset: usize,
756            _depth: fidl::encoding::Depth,
757        ) -> fidl::Result<()> {
758            encoder.debug_check_bounds::<Self>(offset);
759            encoder.write_num(self.into_primitive(), offset);
760            Ok(())
761        }
762    }
763
764    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EventType {
765        #[inline(always)]
766        fn new_empty() -> Self {
767            Self::CapabilityRequested
768        }
769
770        #[inline]
771        unsafe fn decode(
772            &mut self,
773            decoder: &mut fidl::encoding::Decoder<'_, D>,
774            offset: usize,
775            _depth: fidl::encoding::Depth,
776        ) -> fidl::Result<()> {
777            decoder.debug_check_bounds::<Self>(offset);
778            let prim = decoder.read_num::<u32>(offset);
779
780            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
781            Ok(())
782        }
783    }
784    unsafe impl fidl::encoding::TypeMarker for NamespaceError {
785        type Owned = Self;
786
787        #[inline(always)]
788        fn inline_align(_context: fidl::encoding::Context) -> usize {
789            std::mem::align_of::<u32>()
790        }
791
792        #[inline(always)]
793        fn inline_size(_context: fidl::encoding::Context) -> usize {
794            std::mem::size_of::<u32>()
795        }
796
797        #[inline(always)]
798        fn encode_is_copy() -> bool {
799            false
800        }
801
802        #[inline(always)]
803        fn decode_is_copy() -> bool {
804            false
805        }
806    }
807
808    impl fidl::encoding::ValueTypeMarker for NamespaceError {
809        type Borrowed<'a> = Self;
810        #[inline(always)]
811        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
812            *value
813        }
814    }
815
816    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for NamespaceError {
817        #[inline]
818        unsafe fn encode(
819            self,
820            encoder: &mut fidl::encoding::Encoder<'_, D>,
821            offset: usize,
822            _depth: fidl::encoding::Depth,
823        ) -> fidl::Result<()> {
824            encoder.debug_check_bounds::<Self>(offset);
825            encoder.write_num(self.into_primitive(), offset);
826            Ok(())
827        }
828    }
829
830    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NamespaceError {
831        #[inline(always)]
832        fn new_empty() -> Self {
833            Self::unknown()
834        }
835
836        #[inline]
837        unsafe fn decode(
838            &mut self,
839            decoder: &mut fidl::encoding::Decoder<'_, D>,
840            offset: usize,
841            _depth: fidl::encoding::Depth,
842        ) -> fidl::Result<()> {
843            decoder.debug_check_bounds::<Self>(offset);
844            let prim = decoder.read_num::<u32>(offset);
845
846            *self = Self::from_primitive_allow_unknown(prim);
847            Ok(())
848        }
849    }
850    unsafe impl fidl::encoding::TypeMarker for StatusError {
851        type Owned = Self;
852
853        #[inline(always)]
854        fn inline_align(_context: fidl::encoding::Context) -> usize {
855            std::mem::align_of::<u32>()
856        }
857
858        #[inline(always)]
859        fn inline_size(_context: fidl::encoding::Context) -> usize {
860            std::mem::size_of::<u32>()
861        }
862
863        #[inline(always)]
864        fn encode_is_copy() -> bool {
865            true
866        }
867
868        #[inline(always)]
869        fn decode_is_copy() -> bool {
870            false
871        }
872    }
873
874    impl fidl::encoding::ValueTypeMarker for StatusError {
875        type Borrowed<'a> = Self;
876        #[inline(always)]
877        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
878            *value
879        }
880    }
881
882    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for StatusError {
883        #[inline]
884        unsafe fn encode(
885            self,
886            encoder: &mut fidl::encoding::Encoder<'_, D>,
887            offset: usize,
888            _depth: fidl::encoding::Depth,
889        ) -> fidl::Result<()> {
890            encoder.debug_check_bounds::<Self>(offset);
891            encoder.write_num(self.into_primitive(), offset);
892            Ok(())
893        }
894    }
895
896    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StatusError {
897        #[inline(always)]
898        fn new_empty() -> Self {
899            Self::Provider
900        }
901
902        #[inline]
903        unsafe fn decode(
904            &mut self,
905            decoder: &mut fidl::encoding::Decoder<'_, D>,
906            offset: usize,
907            _depth: fidl::encoding::Depth,
908        ) -> fidl::Result<()> {
909            decoder.debug_check_bounds::<Self>(offset);
910            let prim = decoder.read_num::<u32>(offset);
911
912            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
913            Ok(())
914        }
915    }
916
917    impl fidl::encoding::ValueTypeMarker for ChildIteratorNextResponse {
918        type Borrowed<'a> = &'a Self;
919        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
920            value
921        }
922    }
923
924    unsafe impl fidl::encoding::TypeMarker for ChildIteratorNextResponse {
925        type Owned = Self;
926
927        #[inline(always)]
928        fn inline_align(_context: fidl::encoding::Context) -> usize {
929            8
930        }
931
932        #[inline(always)]
933        fn inline_size(_context: fidl::encoding::Context) -> usize {
934            16
935        }
936    }
937
938    unsafe impl<D: fidl::encoding::ResourceDialect>
939        fidl::encoding::Encode<ChildIteratorNextResponse, D> for &ChildIteratorNextResponse
940    {
941        #[inline]
942        unsafe fn encode(
943            self,
944            encoder: &mut fidl::encoding::Encoder<'_, D>,
945            offset: usize,
946            _depth: fidl::encoding::Depth,
947        ) -> fidl::Result<()> {
948            encoder.debug_check_bounds::<ChildIteratorNextResponse>(offset);
949            // Delegate to tuple encoding.
950            fidl::encoding::Encode::<ChildIteratorNextResponse, D>::encode(
951                (
952                    <fidl::encoding::Vector<fidl_fuchsia_component_decl__common::ChildRef, 128> as fidl::encoding::ValueTypeMarker>::borrow(&self.children),
953                ),
954                encoder, offset, _depth
955            )
956        }
957    }
958    unsafe impl<
959        D: fidl::encoding::ResourceDialect,
960        T0: fidl::encoding::Encode<
961                fidl::encoding::Vector<fidl_fuchsia_component_decl__common::ChildRef, 128>,
962                D,
963            >,
964    > fidl::encoding::Encode<ChildIteratorNextResponse, D> for (T0,)
965    {
966        #[inline]
967        unsafe fn encode(
968            self,
969            encoder: &mut fidl::encoding::Encoder<'_, D>,
970            offset: usize,
971            depth: fidl::encoding::Depth,
972        ) -> fidl::Result<()> {
973            encoder.debug_check_bounds::<ChildIteratorNextResponse>(offset);
974            // Zero out padding regions. There's no need to apply masks
975            // because the unmasked parts will be overwritten by fields.
976            // Write the fields.
977            self.0.encode(encoder, offset + 0, depth)?;
978            Ok(())
979        }
980    }
981
982    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
983        for ChildIteratorNextResponse
984    {
985        #[inline(always)]
986        fn new_empty() -> Self {
987            Self {
988                children: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_component_decl__common::ChildRef, 128>, D),
989            }
990        }
991
992        #[inline]
993        unsafe fn decode(
994            &mut self,
995            decoder: &mut fidl::encoding::Decoder<'_, D>,
996            offset: usize,
997            _depth: fidl::encoding::Depth,
998        ) -> fidl::Result<()> {
999            decoder.debug_check_bounds::<Self>(offset);
1000            // Verify that padding bytes are zero.
1001            fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_component_decl__common::ChildRef, 128>, D, &mut self.children, decoder, offset + 0, _depth)?;
1002            Ok(())
1003        }
1004    }
1005
1006    impl fidl::encoding::ValueTypeMarker for ExecutionControllerOnStopRequest {
1007        type Borrowed<'a> = &'a Self;
1008        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1009            value
1010        }
1011    }
1012
1013    unsafe impl fidl::encoding::TypeMarker for ExecutionControllerOnStopRequest {
1014        type Owned = Self;
1015
1016        #[inline(always)]
1017        fn inline_align(_context: fidl::encoding::Context) -> usize {
1018            8
1019        }
1020
1021        #[inline(always)]
1022        fn inline_size(_context: fidl::encoding::Context) -> usize {
1023            16
1024        }
1025    }
1026
1027    unsafe impl<D: fidl::encoding::ResourceDialect>
1028        fidl::encoding::Encode<ExecutionControllerOnStopRequest, D>
1029        for &ExecutionControllerOnStopRequest
1030    {
1031        #[inline]
1032        unsafe fn encode(
1033            self,
1034            encoder: &mut fidl::encoding::Encoder<'_, D>,
1035            offset: usize,
1036            _depth: fidl::encoding::Depth,
1037        ) -> fidl::Result<()> {
1038            encoder.debug_check_bounds::<ExecutionControllerOnStopRequest>(offset);
1039            // Delegate to tuple encoding.
1040            fidl::encoding::Encode::<ExecutionControllerOnStopRequest, D>::encode(
1041                (<StoppedPayload as fidl::encoding::ValueTypeMarker>::borrow(
1042                    &self.stopped_payload,
1043                ),),
1044                encoder,
1045                offset,
1046                _depth,
1047            )
1048        }
1049    }
1050    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StoppedPayload, D>>
1051        fidl::encoding::Encode<ExecutionControllerOnStopRequest, D> for (T0,)
1052    {
1053        #[inline]
1054        unsafe fn encode(
1055            self,
1056            encoder: &mut fidl::encoding::Encoder<'_, D>,
1057            offset: usize,
1058            depth: fidl::encoding::Depth,
1059        ) -> fidl::Result<()> {
1060            encoder.debug_check_bounds::<ExecutionControllerOnStopRequest>(offset);
1061            // Zero out padding regions. There's no need to apply masks
1062            // because the unmasked parts will be overwritten by fields.
1063            // Write the fields.
1064            self.0.encode(encoder, offset + 0, depth)?;
1065            Ok(())
1066        }
1067    }
1068
1069    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1070        for ExecutionControllerOnStopRequest
1071    {
1072        #[inline(always)]
1073        fn new_empty() -> Self {
1074            Self { stopped_payload: fidl::new_empty!(StoppedPayload, D) }
1075        }
1076
1077        #[inline]
1078        unsafe fn decode(
1079            &mut self,
1080            decoder: &mut fidl::encoding::Decoder<'_, D>,
1081            offset: usize,
1082            _depth: fidl::encoding::Depth,
1083        ) -> fidl::Result<()> {
1084            decoder.debug_check_bounds::<Self>(offset);
1085            // Verify that padding bytes are zero.
1086            fidl::decode!(
1087                StoppedPayload,
1088                D,
1089                &mut self.stopped_payload,
1090                decoder,
1091                offset + 0,
1092                _depth
1093            )?;
1094            Ok(())
1095        }
1096    }
1097
1098    impl fidl::encoding::ValueTypeMarker for IntrospectorGetMonikerResponse {
1099        type Borrowed<'a> = &'a Self;
1100        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1101            value
1102        }
1103    }
1104
1105    unsafe impl fidl::encoding::TypeMarker for IntrospectorGetMonikerResponse {
1106        type Owned = Self;
1107
1108        #[inline(always)]
1109        fn inline_align(_context: fidl::encoding::Context) -> usize {
1110            8
1111        }
1112
1113        #[inline(always)]
1114        fn inline_size(_context: fidl::encoding::Context) -> usize {
1115            16
1116        }
1117    }
1118
1119    unsafe impl<D: fidl::encoding::ResourceDialect>
1120        fidl::encoding::Encode<IntrospectorGetMonikerResponse, D>
1121        for &IntrospectorGetMonikerResponse
1122    {
1123        #[inline]
1124        unsafe fn encode(
1125            self,
1126            encoder: &mut fidl::encoding::Encoder<'_, D>,
1127            offset: usize,
1128            _depth: fidl::encoding::Depth,
1129        ) -> fidl::Result<()> {
1130            encoder.debug_check_bounds::<IntrospectorGetMonikerResponse>(offset);
1131            // Delegate to tuple encoding.
1132            fidl::encoding::Encode::<IntrospectorGetMonikerResponse, D>::encode(
1133                (<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(
1134                    &self.moniker,
1135                ),),
1136                encoder,
1137                offset,
1138                _depth,
1139            )
1140        }
1141    }
1142    unsafe impl<
1143        D: fidl::encoding::ResourceDialect,
1144        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>, D>,
1145    > fidl::encoding::Encode<IntrospectorGetMonikerResponse, D> for (T0,)
1146    {
1147        #[inline]
1148        unsafe fn encode(
1149            self,
1150            encoder: &mut fidl::encoding::Encoder<'_, D>,
1151            offset: usize,
1152            depth: fidl::encoding::Depth,
1153        ) -> fidl::Result<()> {
1154            encoder.debug_check_bounds::<IntrospectorGetMonikerResponse>(offset);
1155            // Zero out padding regions. There's no need to apply masks
1156            // because the unmasked parts will be overwritten by fields.
1157            // Write the fields.
1158            self.0.encode(encoder, offset + 0, depth)?;
1159            Ok(())
1160        }
1161    }
1162
1163    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1164        for IntrospectorGetMonikerResponse
1165    {
1166        #[inline(always)]
1167        fn new_empty() -> Self {
1168            Self { moniker: fidl::new_empty!(fidl::encoding::BoundedString<4096>, D) }
1169        }
1170
1171        #[inline]
1172        unsafe fn decode(
1173            &mut self,
1174            decoder: &mut fidl::encoding::Decoder<'_, D>,
1175            offset: usize,
1176            _depth: fidl::encoding::Depth,
1177        ) -> fidl::Result<()> {
1178            decoder.debug_check_bounds::<Self>(offset);
1179            // Verify that padding bytes are zero.
1180            fidl::decode!(
1181                fidl::encoding::BoundedString<4096>,
1182                D,
1183                &mut self.moniker,
1184                decoder,
1185                offset + 0,
1186                _depth
1187            )?;
1188            Ok(())
1189        }
1190    }
1191
1192    impl fidl::encoding::ValueTypeMarker for RealmDestroyChildRequest {
1193        type Borrowed<'a> = &'a Self;
1194        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1195            value
1196        }
1197    }
1198
1199    unsafe impl fidl::encoding::TypeMarker for RealmDestroyChildRequest {
1200        type Owned = Self;
1201
1202        #[inline(always)]
1203        fn inline_align(_context: fidl::encoding::Context) -> usize {
1204            8
1205        }
1206
1207        #[inline(always)]
1208        fn inline_size(_context: fidl::encoding::Context) -> usize {
1209            32
1210        }
1211    }
1212
1213    unsafe impl<D: fidl::encoding::ResourceDialect>
1214        fidl::encoding::Encode<RealmDestroyChildRequest, D> for &RealmDestroyChildRequest
1215    {
1216        #[inline]
1217        unsafe fn encode(
1218            self,
1219            encoder: &mut fidl::encoding::Encoder<'_, D>,
1220            offset: usize,
1221            _depth: fidl::encoding::Depth,
1222        ) -> fidl::Result<()> {
1223            encoder.debug_check_bounds::<RealmDestroyChildRequest>(offset);
1224            // Delegate to tuple encoding.
1225            fidl::encoding::Encode::<RealmDestroyChildRequest, D>::encode(
1226                (
1227                    <fidl_fuchsia_component_decl__common::ChildRef as fidl::encoding::ValueTypeMarker>::borrow(&self.child),
1228                ),
1229                encoder, offset, _depth
1230            )
1231        }
1232    }
1233    unsafe impl<
1234        D: fidl::encoding::ResourceDialect,
1235        T0: fidl::encoding::Encode<fidl_fuchsia_component_decl__common::ChildRef, D>,
1236    > fidl::encoding::Encode<RealmDestroyChildRequest, D> for (T0,)
1237    {
1238        #[inline]
1239        unsafe fn encode(
1240            self,
1241            encoder: &mut fidl::encoding::Encoder<'_, D>,
1242            offset: usize,
1243            depth: fidl::encoding::Depth,
1244        ) -> fidl::Result<()> {
1245            encoder.debug_check_bounds::<RealmDestroyChildRequest>(offset);
1246            // Zero out padding regions. There's no need to apply masks
1247            // because the unmasked parts will be overwritten by fields.
1248            // Write the fields.
1249            self.0.encode(encoder, offset + 0, depth)?;
1250            Ok(())
1251        }
1252    }
1253
1254    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1255        for RealmDestroyChildRequest
1256    {
1257        #[inline(always)]
1258        fn new_empty() -> Self {
1259            Self { child: fidl::new_empty!(fidl_fuchsia_component_decl__common::ChildRef, D) }
1260        }
1261
1262        #[inline]
1263        unsafe fn decode(
1264            &mut self,
1265            decoder: &mut fidl::encoding::Decoder<'_, D>,
1266            offset: usize,
1267            _depth: fidl::encoding::Depth,
1268        ) -> fidl::Result<()> {
1269            decoder.debug_check_bounds::<Self>(offset);
1270            // Verify that padding bytes are zero.
1271            fidl::decode!(
1272                fidl_fuchsia_component_decl__common::ChildRef,
1273                D,
1274                &mut self.child,
1275                decoder,
1276                offset + 0,
1277                _depth
1278            )?;
1279            Ok(())
1280        }
1281    }
1282
1283    impl fidl::encoding::ValueTypeMarker for StorageAdminDeleteComponentStorageRequest {
1284        type Borrowed<'a> = &'a Self;
1285        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1286            value
1287        }
1288    }
1289
1290    unsafe impl fidl::encoding::TypeMarker for StorageAdminDeleteComponentStorageRequest {
1291        type Owned = Self;
1292
1293        #[inline(always)]
1294        fn inline_align(_context: fidl::encoding::Context) -> usize {
1295            8
1296        }
1297
1298        #[inline(always)]
1299        fn inline_size(_context: fidl::encoding::Context) -> usize {
1300            16
1301        }
1302    }
1303
1304    unsafe impl<D: fidl::encoding::ResourceDialect>
1305        fidl::encoding::Encode<StorageAdminDeleteComponentStorageRequest, D>
1306        for &StorageAdminDeleteComponentStorageRequest
1307    {
1308        #[inline]
1309        unsafe fn encode(
1310            self,
1311            encoder: &mut fidl::encoding::Encoder<'_, D>,
1312            offset: usize,
1313            _depth: fidl::encoding::Depth,
1314        ) -> fidl::Result<()> {
1315            encoder.debug_check_bounds::<StorageAdminDeleteComponentStorageRequest>(offset);
1316            // Delegate to tuple encoding.
1317            fidl::encoding::Encode::<StorageAdminDeleteComponentStorageRequest, D>::encode(
1318                (<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(
1319                    &self.relative_moniker,
1320                ),),
1321                encoder,
1322                offset,
1323                _depth,
1324            )
1325        }
1326    }
1327    unsafe impl<
1328        D: fidl::encoding::ResourceDialect,
1329        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>, D>,
1330    > fidl::encoding::Encode<StorageAdminDeleteComponentStorageRequest, D> for (T0,)
1331    {
1332        #[inline]
1333        unsafe fn encode(
1334            self,
1335            encoder: &mut fidl::encoding::Encoder<'_, D>,
1336            offset: usize,
1337            depth: fidl::encoding::Depth,
1338        ) -> fidl::Result<()> {
1339            encoder.debug_check_bounds::<StorageAdminDeleteComponentStorageRequest>(offset);
1340            // Zero out padding regions. There's no need to apply masks
1341            // because the unmasked parts will be overwritten by fields.
1342            // Write the fields.
1343            self.0.encode(encoder, offset + 0, depth)?;
1344            Ok(())
1345        }
1346    }
1347
1348    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1349        for StorageAdminDeleteComponentStorageRequest
1350    {
1351        #[inline(always)]
1352        fn new_empty() -> Self {
1353            Self { relative_moniker: fidl::new_empty!(fidl::encoding::BoundedString<4096>, D) }
1354        }
1355
1356        #[inline]
1357        unsafe fn decode(
1358            &mut self,
1359            decoder: &mut fidl::encoding::Decoder<'_, D>,
1360            offset: usize,
1361            _depth: fidl::encoding::Depth,
1362        ) -> fidl::Result<()> {
1363            decoder.debug_check_bounds::<Self>(offset);
1364            // Verify that padding bytes are zero.
1365            fidl::decode!(
1366                fidl::encoding::BoundedString<4096>,
1367                D,
1368                &mut self.relative_moniker,
1369                decoder,
1370                offset + 0,
1371                _depth
1372            )?;
1373            Ok(())
1374        }
1375    }
1376
1377    impl fidl::encoding::ValueTypeMarker for StorageIteratorNextResponse {
1378        type Borrowed<'a> = &'a Self;
1379        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1380            value
1381        }
1382    }
1383
1384    unsafe impl fidl::encoding::TypeMarker for StorageIteratorNextResponse {
1385        type Owned = Self;
1386
1387        #[inline(always)]
1388        fn inline_align(_context: fidl::encoding::Context) -> usize {
1389            8
1390        }
1391
1392        #[inline(always)]
1393        fn inline_size(_context: fidl::encoding::Context) -> usize {
1394            16
1395        }
1396    }
1397
1398    unsafe impl<D: fidl::encoding::ResourceDialect>
1399        fidl::encoding::Encode<StorageIteratorNextResponse, D> for &StorageIteratorNextResponse
1400    {
1401        #[inline]
1402        unsafe fn encode(
1403            self,
1404            encoder: &mut fidl::encoding::Encoder<'_, D>,
1405            offset: usize,
1406            _depth: fidl::encoding::Depth,
1407        ) -> fidl::Result<()> {
1408            encoder.debug_check_bounds::<StorageIteratorNextResponse>(offset);
1409            // Delegate to tuple encoding.
1410            fidl::encoding::Encode::<StorageIteratorNextResponse, D>::encode(
1411                (
1412                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<4096>> as fidl::encoding::ValueTypeMarker>::borrow(&self.relative_monikers),
1413                ),
1414                encoder, offset, _depth
1415            )
1416        }
1417    }
1418    unsafe impl<
1419        D: fidl::encoding::ResourceDialect,
1420        T0: fidl::encoding::Encode<
1421                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<4096>>,
1422                D,
1423            >,
1424    > fidl::encoding::Encode<StorageIteratorNextResponse, D> for (T0,)
1425    {
1426        #[inline]
1427        unsafe fn encode(
1428            self,
1429            encoder: &mut fidl::encoding::Encoder<'_, D>,
1430            offset: usize,
1431            depth: fidl::encoding::Depth,
1432        ) -> fidl::Result<()> {
1433            encoder.debug_check_bounds::<StorageIteratorNextResponse>(offset);
1434            // Zero out padding regions. There's no need to apply masks
1435            // because the unmasked parts will be overwritten by fields.
1436            // Write the fields.
1437            self.0.encode(encoder, offset + 0, depth)?;
1438            Ok(())
1439        }
1440    }
1441
1442    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1443        for StorageIteratorNextResponse
1444    {
1445        #[inline(always)]
1446        fn new_empty() -> Self {
1447            Self {
1448                relative_monikers: fidl::new_empty!(
1449                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<4096>>,
1450                    D
1451                ),
1452            }
1453        }
1454
1455        #[inline]
1456        unsafe fn decode(
1457            &mut self,
1458            decoder: &mut fidl::encoding::Decoder<'_, D>,
1459            offset: usize,
1460            _depth: fidl::encoding::Depth,
1461        ) -> fidl::Result<()> {
1462            decoder.debug_check_bounds::<Self>(offset);
1463            // Verify that padding bytes are zero.
1464            fidl::decode!(
1465                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<4096>>,
1466                D,
1467                &mut self.relative_monikers,
1468                decoder,
1469                offset + 0,
1470                _depth
1471            )?;
1472            Ok(())
1473        }
1474    }
1475
1476    impl DestroyedPayload {
1477        #[inline(always)]
1478        fn max_ordinal_present(&self) -> u64 {
1479            0
1480        }
1481    }
1482
1483    impl fidl::encoding::ValueTypeMarker for DestroyedPayload {
1484        type Borrowed<'a> = &'a Self;
1485        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1486            value
1487        }
1488    }
1489
1490    unsafe impl fidl::encoding::TypeMarker for DestroyedPayload {
1491        type Owned = Self;
1492
1493        #[inline(always)]
1494        fn inline_align(_context: fidl::encoding::Context) -> usize {
1495            8
1496        }
1497
1498        #[inline(always)]
1499        fn inline_size(_context: fidl::encoding::Context) -> usize {
1500            16
1501        }
1502    }
1503
1504    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DestroyedPayload, D>
1505        for &DestroyedPayload
1506    {
1507        unsafe fn encode(
1508            self,
1509            encoder: &mut fidl::encoding::Encoder<'_, D>,
1510            offset: usize,
1511            mut depth: fidl::encoding::Depth,
1512        ) -> fidl::Result<()> {
1513            encoder.debug_check_bounds::<DestroyedPayload>(offset);
1514            // Vector header
1515            let max_ordinal: u64 = self.max_ordinal_present();
1516            encoder.write_num(max_ordinal, offset);
1517            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1518            // Calling encoder.out_of_line_offset(0) is not allowed.
1519            if max_ordinal == 0 {
1520                return Ok(());
1521            }
1522            depth.increment()?;
1523            let envelope_size = 8;
1524            let bytes_len = max_ordinal as usize * envelope_size;
1525            #[allow(unused_variables)]
1526            let offset = encoder.out_of_line_offset(bytes_len);
1527            let mut _prev_end_offset: usize = 0;
1528
1529            Ok(())
1530        }
1531    }
1532
1533    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DestroyedPayload {
1534        #[inline(always)]
1535        fn new_empty() -> Self {
1536            Self::default()
1537        }
1538
1539        unsafe fn decode(
1540            &mut self,
1541            decoder: &mut fidl::encoding::Decoder<'_, D>,
1542            offset: usize,
1543            mut depth: fidl::encoding::Depth,
1544        ) -> fidl::Result<()> {
1545            decoder.debug_check_bounds::<Self>(offset);
1546            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1547                None => return Err(fidl::Error::NotNullable),
1548                Some(len) => len,
1549            };
1550            // Calling decoder.out_of_line_offset(0) is not allowed.
1551            if len == 0 {
1552                return Ok(());
1553            };
1554            depth.increment()?;
1555            let envelope_size = 8;
1556            let bytes_len = len * envelope_size;
1557            let offset = decoder.out_of_line_offset(bytes_len)?;
1558            // Decode the envelope for each type.
1559            let mut _next_ordinal_to_read = 0;
1560            let mut next_offset = offset;
1561            let end_offset = offset + bytes_len;
1562
1563            // Decode the remaining unknown envelopes.
1564            while next_offset < end_offset {
1565                _next_ordinal_to_read += 1;
1566                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1567                next_offset += envelope_size;
1568            }
1569
1570            Ok(())
1571        }
1572    }
1573
1574    impl DiscoveredPayload {
1575        #[inline(always)]
1576        fn max_ordinal_present(&self) -> u64 {
1577            0
1578        }
1579    }
1580
1581    impl fidl::encoding::ValueTypeMarker for DiscoveredPayload {
1582        type Borrowed<'a> = &'a Self;
1583        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1584            value
1585        }
1586    }
1587
1588    unsafe impl fidl::encoding::TypeMarker for DiscoveredPayload {
1589        type Owned = Self;
1590
1591        #[inline(always)]
1592        fn inline_align(_context: fidl::encoding::Context) -> usize {
1593            8
1594        }
1595
1596        #[inline(always)]
1597        fn inline_size(_context: fidl::encoding::Context) -> usize {
1598            16
1599        }
1600    }
1601
1602    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DiscoveredPayload, D>
1603        for &DiscoveredPayload
1604    {
1605        unsafe fn encode(
1606            self,
1607            encoder: &mut fidl::encoding::Encoder<'_, D>,
1608            offset: usize,
1609            mut depth: fidl::encoding::Depth,
1610        ) -> fidl::Result<()> {
1611            encoder.debug_check_bounds::<DiscoveredPayload>(offset);
1612            // Vector header
1613            let max_ordinal: u64 = self.max_ordinal_present();
1614            encoder.write_num(max_ordinal, offset);
1615            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1616            // Calling encoder.out_of_line_offset(0) is not allowed.
1617            if max_ordinal == 0 {
1618                return Ok(());
1619            }
1620            depth.increment()?;
1621            let envelope_size = 8;
1622            let bytes_len = max_ordinal as usize * envelope_size;
1623            #[allow(unused_variables)]
1624            let offset = encoder.out_of_line_offset(bytes_len);
1625            let mut _prev_end_offset: usize = 0;
1626
1627            Ok(())
1628        }
1629    }
1630
1631    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DiscoveredPayload {
1632        #[inline(always)]
1633        fn new_empty() -> Self {
1634            Self::default()
1635        }
1636
1637        unsafe fn decode(
1638            &mut self,
1639            decoder: &mut fidl::encoding::Decoder<'_, D>,
1640            offset: usize,
1641            mut depth: fidl::encoding::Depth,
1642        ) -> fidl::Result<()> {
1643            decoder.debug_check_bounds::<Self>(offset);
1644            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1645                None => return Err(fidl::Error::NotNullable),
1646                Some(len) => len,
1647            };
1648            // Calling decoder.out_of_line_offset(0) is not allowed.
1649            if len == 0 {
1650                return Ok(());
1651            };
1652            depth.increment()?;
1653            let envelope_size = 8;
1654            let bytes_len = len * envelope_size;
1655            let offset = decoder.out_of_line_offset(bytes_len)?;
1656            // Decode the envelope for each type.
1657            let mut _next_ordinal_to_read = 0;
1658            let mut next_offset = offset;
1659            let end_offset = offset + bytes_len;
1660
1661            // Decode the remaining unknown envelopes.
1662            while next_offset < end_offset {
1663                _next_ordinal_to_read += 1;
1664                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1665                next_offset += envelope_size;
1666            }
1667
1668            Ok(())
1669        }
1670    }
1671
1672    impl EventHeader {
1673        #[inline(always)]
1674        fn max_ordinal_present(&self) -> u64 {
1675            if let Some(_) = self.timestamp {
1676                return 4;
1677            }
1678            if let Some(_) = self.component_url {
1679                return 3;
1680            }
1681            if let Some(_) = self.moniker {
1682                return 2;
1683            }
1684            if let Some(_) = self.event_type {
1685                return 1;
1686            }
1687            0
1688        }
1689    }
1690
1691    impl fidl::encoding::ValueTypeMarker for EventHeader {
1692        type Borrowed<'a> = &'a Self;
1693        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1694            value
1695        }
1696    }
1697
1698    unsafe impl fidl::encoding::TypeMarker for EventHeader {
1699        type Owned = Self;
1700
1701        #[inline(always)]
1702        fn inline_align(_context: fidl::encoding::Context) -> usize {
1703            8
1704        }
1705
1706        #[inline(always)]
1707        fn inline_size(_context: fidl::encoding::Context) -> usize {
1708            16
1709        }
1710    }
1711
1712    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EventHeader, D>
1713        for &EventHeader
1714    {
1715        unsafe fn encode(
1716            self,
1717            encoder: &mut fidl::encoding::Encoder<'_, D>,
1718            offset: usize,
1719            mut depth: fidl::encoding::Depth,
1720        ) -> fidl::Result<()> {
1721            encoder.debug_check_bounds::<EventHeader>(offset);
1722            // Vector header
1723            let max_ordinal: u64 = self.max_ordinal_present();
1724            encoder.write_num(max_ordinal, offset);
1725            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1726            // Calling encoder.out_of_line_offset(0) is not allowed.
1727            if max_ordinal == 0 {
1728                return Ok(());
1729            }
1730            depth.increment()?;
1731            let envelope_size = 8;
1732            let bytes_len = max_ordinal as usize * envelope_size;
1733            #[allow(unused_variables)]
1734            let offset = encoder.out_of_line_offset(bytes_len);
1735            let mut _prev_end_offset: usize = 0;
1736            if 1 > max_ordinal {
1737                return Ok(());
1738            }
1739
1740            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1741            // are envelope_size bytes.
1742            let cur_offset: usize = (1 - 1) * envelope_size;
1743
1744            // Zero reserved fields.
1745            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1746
1747            // Safety:
1748            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1749            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1750            //   envelope_size bytes, there is always sufficient room.
1751            fidl::encoding::encode_in_envelope_optional::<EventType, D>(
1752                self.event_type
1753                    .as_ref()
1754                    .map(<EventType as fidl::encoding::ValueTypeMarker>::borrow),
1755                encoder,
1756                offset + cur_offset,
1757                depth,
1758            )?;
1759
1760            _prev_end_offset = cur_offset + envelope_size;
1761            if 2 > max_ordinal {
1762                return Ok(());
1763            }
1764
1765            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1766            // are envelope_size bytes.
1767            let cur_offset: usize = (2 - 1) * envelope_size;
1768
1769            // Zero reserved fields.
1770            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1771
1772            // Safety:
1773            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1774            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1775            //   envelope_size bytes, there is always sufficient room.
1776            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, D>(
1777            self.moniker.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
1778            encoder, offset + cur_offset, depth
1779        )?;
1780
1781            _prev_end_offset = cur_offset + envelope_size;
1782            if 3 > max_ordinal {
1783                return Ok(());
1784            }
1785
1786            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1787            // are envelope_size bytes.
1788            let cur_offset: usize = (3 - 1) * envelope_size;
1789
1790            // Zero reserved fields.
1791            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1792
1793            // Safety:
1794            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1795            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1796            //   envelope_size bytes, there is always sufficient room.
1797            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, D>(
1798            self.component_url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
1799            encoder, offset + cur_offset, depth
1800        )?;
1801
1802            _prev_end_offset = cur_offset + envelope_size;
1803            if 4 > max_ordinal {
1804                return Ok(());
1805            }
1806
1807            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1808            // are envelope_size bytes.
1809            let cur_offset: usize = (4 - 1) * envelope_size;
1810
1811            // Zero reserved fields.
1812            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1813
1814            // Safety:
1815            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1816            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1817            //   envelope_size bytes, there is always sufficient room.
1818            fidl::encoding::encode_in_envelope_optional::<fidl::BootInstant, D>(
1819                self.timestamp
1820                    .as_ref()
1821                    .map(<fidl::BootInstant as fidl::encoding::ValueTypeMarker>::borrow),
1822                encoder,
1823                offset + cur_offset,
1824                depth,
1825            )?;
1826
1827            _prev_end_offset = cur_offset + envelope_size;
1828
1829            Ok(())
1830        }
1831    }
1832
1833    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EventHeader {
1834        #[inline(always)]
1835        fn new_empty() -> Self {
1836            Self::default()
1837        }
1838
1839        unsafe fn decode(
1840            &mut self,
1841            decoder: &mut fidl::encoding::Decoder<'_, D>,
1842            offset: usize,
1843            mut depth: fidl::encoding::Depth,
1844        ) -> fidl::Result<()> {
1845            decoder.debug_check_bounds::<Self>(offset);
1846            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1847                None => return Err(fidl::Error::NotNullable),
1848                Some(len) => len,
1849            };
1850            // Calling decoder.out_of_line_offset(0) is not allowed.
1851            if len == 0 {
1852                return Ok(());
1853            };
1854            depth.increment()?;
1855            let envelope_size = 8;
1856            let bytes_len = len * envelope_size;
1857            let offset = decoder.out_of_line_offset(bytes_len)?;
1858            // Decode the envelope for each type.
1859            let mut _next_ordinal_to_read = 0;
1860            let mut next_offset = offset;
1861            let end_offset = offset + bytes_len;
1862            _next_ordinal_to_read += 1;
1863            if next_offset >= end_offset {
1864                return Ok(());
1865            }
1866
1867            // Decode unknown envelopes for gaps in ordinals.
1868            while _next_ordinal_to_read < 1 {
1869                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1870                _next_ordinal_to_read += 1;
1871                next_offset += envelope_size;
1872            }
1873
1874            let next_out_of_line = decoder.next_out_of_line();
1875            let handles_before = decoder.remaining_handles();
1876            if let Some((inlined, num_bytes, num_handles)) =
1877                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1878            {
1879                let member_inline_size =
1880                    <EventType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1881                if inlined != (member_inline_size <= 4) {
1882                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1883                }
1884                let inner_offset;
1885                let mut inner_depth = depth.clone();
1886                if inlined {
1887                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1888                    inner_offset = next_offset;
1889                } else {
1890                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1891                    inner_depth.increment()?;
1892                }
1893                let val_ref = self.event_type.get_or_insert_with(|| fidl::new_empty!(EventType, D));
1894                fidl::decode!(EventType, D, val_ref, decoder, inner_offset, inner_depth)?;
1895                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1896                {
1897                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1898                }
1899                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1900                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1901                }
1902            }
1903
1904            next_offset += envelope_size;
1905            _next_ordinal_to_read += 1;
1906            if next_offset >= end_offset {
1907                return Ok(());
1908            }
1909
1910            // Decode unknown envelopes for gaps in ordinals.
1911            while _next_ordinal_to_read < 2 {
1912                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1913                _next_ordinal_to_read += 1;
1914                next_offset += envelope_size;
1915            }
1916
1917            let next_out_of_line = decoder.next_out_of_line();
1918            let handles_before = decoder.remaining_handles();
1919            if let Some((inlined, num_bytes, num_handles)) =
1920                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1921            {
1922                let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1923                if inlined != (member_inline_size <= 4) {
1924                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1925                }
1926                let inner_offset;
1927                let mut inner_depth = depth.clone();
1928                if inlined {
1929                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1930                    inner_offset = next_offset;
1931                } else {
1932                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1933                    inner_depth.increment()?;
1934                }
1935                let val_ref = self.moniker.get_or_insert_with(|| {
1936                    fidl::new_empty!(fidl::encoding::BoundedString<4096>, D)
1937                });
1938                fidl::decode!(
1939                    fidl::encoding::BoundedString<4096>,
1940                    D,
1941                    val_ref,
1942                    decoder,
1943                    inner_offset,
1944                    inner_depth
1945                )?;
1946                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1947                {
1948                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1949                }
1950                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1951                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1952                }
1953            }
1954
1955            next_offset += envelope_size;
1956            _next_ordinal_to_read += 1;
1957            if next_offset >= end_offset {
1958                return Ok(());
1959            }
1960
1961            // Decode unknown envelopes for gaps in ordinals.
1962            while _next_ordinal_to_read < 3 {
1963                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1964                _next_ordinal_to_read += 1;
1965                next_offset += envelope_size;
1966            }
1967
1968            let next_out_of_line = decoder.next_out_of_line();
1969            let handles_before = decoder.remaining_handles();
1970            if let Some((inlined, num_bytes, num_handles)) =
1971                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1972            {
1973                let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1974                if inlined != (member_inline_size <= 4) {
1975                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1976                }
1977                let inner_offset;
1978                let mut inner_depth = depth.clone();
1979                if inlined {
1980                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1981                    inner_offset = next_offset;
1982                } else {
1983                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1984                    inner_depth.increment()?;
1985                }
1986                let val_ref = self.component_url.get_or_insert_with(|| {
1987                    fidl::new_empty!(fidl::encoding::BoundedString<4096>, D)
1988                });
1989                fidl::decode!(
1990                    fidl::encoding::BoundedString<4096>,
1991                    D,
1992                    val_ref,
1993                    decoder,
1994                    inner_offset,
1995                    inner_depth
1996                )?;
1997                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1998                {
1999                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2000                }
2001                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2002                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2003                }
2004            }
2005
2006            next_offset += envelope_size;
2007            _next_ordinal_to_read += 1;
2008            if next_offset >= end_offset {
2009                return Ok(());
2010            }
2011
2012            // Decode unknown envelopes for gaps in ordinals.
2013            while _next_ordinal_to_read < 4 {
2014                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2015                _next_ordinal_to_read += 1;
2016                next_offset += envelope_size;
2017            }
2018
2019            let next_out_of_line = decoder.next_out_of_line();
2020            let handles_before = decoder.remaining_handles();
2021            if let Some((inlined, num_bytes, num_handles)) =
2022                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2023            {
2024                let member_inline_size =
2025                    <fidl::BootInstant as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2026                if inlined != (member_inline_size <= 4) {
2027                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2028                }
2029                let inner_offset;
2030                let mut inner_depth = depth.clone();
2031                if inlined {
2032                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2033                    inner_offset = next_offset;
2034                } else {
2035                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2036                    inner_depth.increment()?;
2037                }
2038                let val_ref =
2039                    self.timestamp.get_or_insert_with(|| fidl::new_empty!(fidl::BootInstant, D));
2040                fidl::decode!(fidl::BootInstant, D, val_ref, decoder, inner_offset, inner_depth)?;
2041                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2042                {
2043                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2044                }
2045                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2046                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2047                }
2048            }
2049
2050            next_offset += envelope_size;
2051
2052            // Decode the remaining unknown envelopes.
2053            while next_offset < end_offset {
2054                _next_ordinal_to_read += 1;
2055                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2056                next_offset += envelope_size;
2057            }
2058
2059            Ok(())
2060        }
2061    }
2062
2063    impl PurgedPayload {
2064        #[inline(always)]
2065        fn max_ordinal_present(&self) -> u64 {
2066            0
2067        }
2068    }
2069
2070    impl fidl::encoding::ValueTypeMarker for PurgedPayload {
2071        type Borrowed<'a> = &'a Self;
2072        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2073            value
2074        }
2075    }
2076
2077    unsafe impl fidl::encoding::TypeMarker for PurgedPayload {
2078        type Owned = Self;
2079
2080        #[inline(always)]
2081        fn inline_align(_context: fidl::encoding::Context) -> usize {
2082            8
2083        }
2084
2085        #[inline(always)]
2086        fn inline_size(_context: fidl::encoding::Context) -> usize {
2087            16
2088        }
2089    }
2090
2091    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PurgedPayload, D>
2092        for &PurgedPayload
2093    {
2094        unsafe fn encode(
2095            self,
2096            encoder: &mut fidl::encoding::Encoder<'_, D>,
2097            offset: usize,
2098            mut depth: fidl::encoding::Depth,
2099        ) -> fidl::Result<()> {
2100            encoder.debug_check_bounds::<PurgedPayload>(offset);
2101            // Vector header
2102            let max_ordinal: u64 = self.max_ordinal_present();
2103            encoder.write_num(max_ordinal, offset);
2104            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2105            // Calling encoder.out_of_line_offset(0) is not allowed.
2106            if max_ordinal == 0 {
2107                return Ok(());
2108            }
2109            depth.increment()?;
2110            let envelope_size = 8;
2111            let bytes_len = max_ordinal as usize * envelope_size;
2112            #[allow(unused_variables)]
2113            let offset = encoder.out_of_line_offset(bytes_len);
2114            let mut _prev_end_offset: usize = 0;
2115
2116            Ok(())
2117        }
2118    }
2119
2120    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PurgedPayload {
2121        #[inline(always)]
2122        fn new_empty() -> Self {
2123            Self::default()
2124        }
2125
2126        unsafe fn decode(
2127            &mut self,
2128            decoder: &mut fidl::encoding::Decoder<'_, D>,
2129            offset: usize,
2130            mut depth: fidl::encoding::Depth,
2131        ) -> fidl::Result<()> {
2132            decoder.debug_check_bounds::<Self>(offset);
2133            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2134                None => return Err(fidl::Error::NotNullable),
2135                Some(len) => len,
2136            };
2137            // Calling decoder.out_of_line_offset(0) is not allowed.
2138            if len == 0 {
2139                return Ok(());
2140            };
2141            depth.increment()?;
2142            let envelope_size = 8;
2143            let bytes_len = len * envelope_size;
2144            let offset = decoder.out_of_line_offset(bytes_len)?;
2145            // Decode the envelope for each type.
2146            let mut _next_ordinal_to_read = 0;
2147            let mut next_offset = offset;
2148            let end_offset = offset + bytes_len;
2149
2150            // Decode the remaining unknown envelopes.
2151            while next_offset < end_offset {
2152                _next_ordinal_to_read += 1;
2153                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2154                next_offset += envelope_size;
2155            }
2156
2157            Ok(())
2158        }
2159    }
2160
2161    impl ResolvedPayload {
2162        #[inline(always)]
2163        fn max_ordinal_present(&self) -> u64 {
2164            0
2165        }
2166    }
2167
2168    impl fidl::encoding::ValueTypeMarker for ResolvedPayload {
2169        type Borrowed<'a> = &'a Self;
2170        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2171            value
2172        }
2173    }
2174
2175    unsafe impl fidl::encoding::TypeMarker for ResolvedPayload {
2176        type Owned = Self;
2177
2178        #[inline(always)]
2179        fn inline_align(_context: fidl::encoding::Context) -> usize {
2180            8
2181        }
2182
2183        #[inline(always)]
2184        fn inline_size(_context: fidl::encoding::Context) -> usize {
2185            16
2186        }
2187    }
2188
2189    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ResolvedPayload, D>
2190        for &ResolvedPayload
2191    {
2192        unsafe fn encode(
2193            self,
2194            encoder: &mut fidl::encoding::Encoder<'_, D>,
2195            offset: usize,
2196            mut depth: fidl::encoding::Depth,
2197        ) -> fidl::Result<()> {
2198            encoder.debug_check_bounds::<ResolvedPayload>(offset);
2199            // Vector header
2200            let max_ordinal: u64 = self.max_ordinal_present();
2201            encoder.write_num(max_ordinal, offset);
2202            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2203            // Calling encoder.out_of_line_offset(0) is not allowed.
2204            if max_ordinal == 0 {
2205                return Ok(());
2206            }
2207            depth.increment()?;
2208            let envelope_size = 8;
2209            let bytes_len = max_ordinal as usize * envelope_size;
2210            #[allow(unused_variables)]
2211            let offset = encoder.out_of_line_offset(bytes_len);
2212            let mut _prev_end_offset: usize = 0;
2213
2214            Ok(())
2215        }
2216    }
2217
2218    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ResolvedPayload {
2219        #[inline(always)]
2220        fn new_empty() -> Self {
2221            Self::default()
2222        }
2223
2224        unsafe fn decode(
2225            &mut self,
2226            decoder: &mut fidl::encoding::Decoder<'_, D>,
2227            offset: usize,
2228            mut depth: fidl::encoding::Depth,
2229        ) -> fidl::Result<()> {
2230            decoder.debug_check_bounds::<Self>(offset);
2231            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2232                None => return Err(fidl::Error::NotNullable),
2233                Some(len) => len,
2234            };
2235            // Calling decoder.out_of_line_offset(0) is not allowed.
2236            if len == 0 {
2237                return Ok(());
2238            };
2239            depth.increment()?;
2240            let envelope_size = 8;
2241            let bytes_len = len * envelope_size;
2242            let offset = decoder.out_of_line_offset(bytes_len)?;
2243            // Decode the envelope for each type.
2244            let mut _next_ordinal_to_read = 0;
2245            let mut next_offset = offset;
2246            let end_offset = offset + bytes_len;
2247
2248            // Decode the remaining unknown envelopes.
2249            while next_offset < end_offset {
2250                _next_ordinal_to_read += 1;
2251                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2252                next_offset += envelope_size;
2253            }
2254
2255            Ok(())
2256        }
2257    }
2258
2259    impl StartedPayload {
2260        #[inline(always)]
2261        fn max_ordinal_present(&self) -> u64 {
2262            0
2263        }
2264    }
2265
2266    impl fidl::encoding::ValueTypeMarker for StartedPayload {
2267        type Borrowed<'a> = &'a Self;
2268        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2269            value
2270        }
2271    }
2272
2273    unsafe impl fidl::encoding::TypeMarker for StartedPayload {
2274        type Owned = Self;
2275
2276        #[inline(always)]
2277        fn inline_align(_context: fidl::encoding::Context) -> usize {
2278            8
2279        }
2280
2281        #[inline(always)]
2282        fn inline_size(_context: fidl::encoding::Context) -> usize {
2283            16
2284        }
2285    }
2286
2287    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StartedPayload, D>
2288        for &StartedPayload
2289    {
2290        unsafe fn encode(
2291            self,
2292            encoder: &mut fidl::encoding::Encoder<'_, D>,
2293            offset: usize,
2294            mut depth: fidl::encoding::Depth,
2295        ) -> fidl::Result<()> {
2296            encoder.debug_check_bounds::<StartedPayload>(offset);
2297            // Vector header
2298            let max_ordinal: u64 = self.max_ordinal_present();
2299            encoder.write_num(max_ordinal, offset);
2300            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2301            // Calling encoder.out_of_line_offset(0) is not allowed.
2302            if max_ordinal == 0 {
2303                return Ok(());
2304            }
2305            depth.increment()?;
2306            let envelope_size = 8;
2307            let bytes_len = max_ordinal as usize * envelope_size;
2308            #[allow(unused_variables)]
2309            let offset = encoder.out_of_line_offset(bytes_len);
2310            let mut _prev_end_offset: usize = 0;
2311
2312            Ok(())
2313        }
2314    }
2315
2316    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StartedPayload {
2317        #[inline(always)]
2318        fn new_empty() -> Self {
2319            Self::default()
2320        }
2321
2322        unsafe fn decode(
2323            &mut self,
2324            decoder: &mut fidl::encoding::Decoder<'_, D>,
2325            offset: usize,
2326            mut depth: fidl::encoding::Depth,
2327        ) -> fidl::Result<()> {
2328            decoder.debug_check_bounds::<Self>(offset);
2329            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2330                None => return Err(fidl::Error::NotNullable),
2331                Some(len) => len,
2332            };
2333            // Calling decoder.out_of_line_offset(0) is not allowed.
2334            if len == 0 {
2335                return Ok(());
2336            };
2337            depth.increment()?;
2338            let envelope_size = 8;
2339            let bytes_len = len * envelope_size;
2340            let offset = decoder.out_of_line_offset(bytes_len)?;
2341            // Decode the envelope for each type.
2342            let mut _next_ordinal_to_read = 0;
2343            let mut next_offset = offset;
2344            let end_offset = offset + bytes_len;
2345
2346            // Decode the remaining unknown envelopes.
2347            while next_offset < end_offset {
2348                _next_ordinal_to_read += 1;
2349                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2350                next_offset += envelope_size;
2351            }
2352
2353            Ok(())
2354        }
2355    }
2356
2357    impl StoppedPayload {
2358        #[inline(always)]
2359        fn max_ordinal_present(&self) -> u64 {
2360            if let Some(_) = self.exit_code {
2361                return 2;
2362            }
2363            if let Some(_) = self.status {
2364                return 1;
2365            }
2366            0
2367        }
2368    }
2369
2370    impl fidl::encoding::ValueTypeMarker for StoppedPayload {
2371        type Borrowed<'a> = &'a Self;
2372        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2373            value
2374        }
2375    }
2376
2377    unsafe impl fidl::encoding::TypeMarker for StoppedPayload {
2378        type Owned = Self;
2379
2380        #[inline(always)]
2381        fn inline_align(_context: fidl::encoding::Context) -> usize {
2382            8
2383        }
2384
2385        #[inline(always)]
2386        fn inline_size(_context: fidl::encoding::Context) -> usize {
2387            16
2388        }
2389    }
2390
2391    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StoppedPayload, D>
2392        for &StoppedPayload
2393    {
2394        unsafe fn encode(
2395            self,
2396            encoder: &mut fidl::encoding::Encoder<'_, D>,
2397            offset: usize,
2398            mut depth: fidl::encoding::Depth,
2399        ) -> fidl::Result<()> {
2400            encoder.debug_check_bounds::<StoppedPayload>(offset);
2401            // Vector header
2402            let max_ordinal: u64 = self.max_ordinal_present();
2403            encoder.write_num(max_ordinal, offset);
2404            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2405            // Calling encoder.out_of_line_offset(0) is not allowed.
2406            if max_ordinal == 0 {
2407                return Ok(());
2408            }
2409            depth.increment()?;
2410            let envelope_size = 8;
2411            let bytes_len = max_ordinal as usize * envelope_size;
2412            #[allow(unused_variables)]
2413            let offset = encoder.out_of_line_offset(bytes_len);
2414            let mut _prev_end_offset: usize = 0;
2415            if 1 > max_ordinal {
2416                return Ok(());
2417            }
2418
2419            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2420            // are envelope_size bytes.
2421            let cur_offset: usize = (1 - 1) * envelope_size;
2422
2423            // Zero reserved fields.
2424            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2425
2426            // Safety:
2427            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2428            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2429            //   envelope_size bytes, there is always sufficient room.
2430            fidl::encoding::encode_in_envelope_optional::<i32, D>(
2431                self.status.as_ref().map(<i32 as fidl::encoding::ValueTypeMarker>::borrow),
2432                encoder,
2433                offset + cur_offset,
2434                depth,
2435            )?;
2436
2437            _prev_end_offset = cur_offset + envelope_size;
2438            if 2 > max_ordinal {
2439                return Ok(());
2440            }
2441
2442            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2443            // are envelope_size bytes.
2444            let cur_offset: usize = (2 - 1) * envelope_size;
2445
2446            // Zero reserved fields.
2447            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2448
2449            // Safety:
2450            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2451            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2452            //   envelope_size bytes, there is always sufficient room.
2453            fidl::encoding::encode_in_envelope_optional::<i64, D>(
2454                self.exit_code.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2455                encoder,
2456                offset + cur_offset,
2457                depth,
2458            )?;
2459
2460            _prev_end_offset = cur_offset + envelope_size;
2461
2462            Ok(())
2463        }
2464    }
2465
2466    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StoppedPayload {
2467        #[inline(always)]
2468        fn new_empty() -> Self {
2469            Self::default()
2470        }
2471
2472        unsafe fn decode(
2473            &mut self,
2474            decoder: &mut fidl::encoding::Decoder<'_, D>,
2475            offset: usize,
2476            mut depth: fidl::encoding::Depth,
2477        ) -> fidl::Result<()> {
2478            decoder.debug_check_bounds::<Self>(offset);
2479            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2480                None => return Err(fidl::Error::NotNullable),
2481                Some(len) => len,
2482            };
2483            // Calling decoder.out_of_line_offset(0) is not allowed.
2484            if len == 0 {
2485                return Ok(());
2486            };
2487            depth.increment()?;
2488            let envelope_size = 8;
2489            let bytes_len = len * envelope_size;
2490            let offset = decoder.out_of_line_offset(bytes_len)?;
2491            // Decode the envelope for each type.
2492            let mut _next_ordinal_to_read = 0;
2493            let mut next_offset = offset;
2494            let end_offset = offset + bytes_len;
2495            _next_ordinal_to_read += 1;
2496            if next_offset >= end_offset {
2497                return Ok(());
2498            }
2499
2500            // Decode unknown envelopes for gaps in ordinals.
2501            while _next_ordinal_to_read < 1 {
2502                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2503                _next_ordinal_to_read += 1;
2504                next_offset += envelope_size;
2505            }
2506
2507            let next_out_of_line = decoder.next_out_of_line();
2508            let handles_before = decoder.remaining_handles();
2509            if let Some((inlined, num_bytes, num_handles)) =
2510                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2511            {
2512                let member_inline_size =
2513                    <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2514                if inlined != (member_inline_size <= 4) {
2515                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2516                }
2517                let inner_offset;
2518                let mut inner_depth = depth.clone();
2519                if inlined {
2520                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2521                    inner_offset = next_offset;
2522                } else {
2523                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2524                    inner_depth.increment()?;
2525                }
2526                let val_ref = self.status.get_or_insert_with(|| fidl::new_empty!(i32, D));
2527                fidl::decode!(i32, D, val_ref, decoder, inner_offset, inner_depth)?;
2528                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2529                {
2530                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2531                }
2532                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2533                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2534                }
2535            }
2536
2537            next_offset += envelope_size;
2538            _next_ordinal_to_read += 1;
2539            if next_offset >= end_offset {
2540                return Ok(());
2541            }
2542
2543            // Decode unknown envelopes for gaps in ordinals.
2544            while _next_ordinal_to_read < 2 {
2545                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2546                _next_ordinal_to_read += 1;
2547                next_offset += envelope_size;
2548            }
2549
2550            let next_out_of_line = decoder.next_out_of_line();
2551            let handles_before = decoder.remaining_handles();
2552            if let Some((inlined, num_bytes, num_handles)) =
2553                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2554            {
2555                let member_inline_size =
2556                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2557                if inlined != (member_inline_size <= 4) {
2558                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2559                }
2560                let inner_offset;
2561                let mut inner_depth = depth.clone();
2562                if inlined {
2563                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2564                    inner_offset = next_offset;
2565                } else {
2566                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2567                    inner_depth.increment()?;
2568                }
2569                let val_ref = self.exit_code.get_or_insert_with(|| fidl::new_empty!(i64, D));
2570                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
2571                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2572                {
2573                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2574                }
2575                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2576                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2577                }
2578            }
2579
2580            next_offset += envelope_size;
2581
2582            // Decode the remaining unknown envelopes.
2583            while next_offset < end_offset {
2584                _next_ordinal_to_read += 1;
2585                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2586                next_offset += envelope_size;
2587            }
2588
2589            Ok(())
2590        }
2591    }
2592
2593    impl StorageStatus {
2594        #[inline(always)]
2595        fn max_ordinal_present(&self) -> u64 {
2596            if let Some(_) = self.used_size {
2597                return 2;
2598            }
2599            if let Some(_) = self.total_size {
2600                return 1;
2601            }
2602            0
2603        }
2604    }
2605
2606    impl fidl::encoding::ValueTypeMarker for StorageStatus {
2607        type Borrowed<'a> = &'a Self;
2608        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2609            value
2610        }
2611    }
2612
2613    unsafe impl fidl::encoding::TypeMarker for StorageStatus {
2614        type Owned = Self;
2615
2616        #[inline(always)]
2617        fn inline_align(_context: fidl::encoding::Context) -> usize {
2618            8
2619        }
2620
2621        #[inline(always)]
2622        fn inline_size(_context: fidl::encoding::Context) -> usize {
2623            16
2624        }
2625    }
2626
2627    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StorageStatus, D>
2628        for &StorageStatus
2629    {
2630        unsafe fn encode(
2631            self,
2632            encoder: &mut fidl::encoding::Encoder<'_, D>,
2633            offset: usize,
2634            mut depth: fidl::encoding::Depth,
2635        ) -> fidl::Result<()> {
2636            encoder.debug_check_bounds::<StorageStatus>(offset);
2637            // Vector header
2638            let max_ordinal: u64 = self.max_ordinal_present();
2639            encoder.write_num(max_ordinal, offset);
2640            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2641            // Calling encoder.out_of_line_offset(0) is not allowed.
2642            if max_ordinal == 0 {
2643                return Ok(());
2644            }
2645            depth.increment()?;
2646            let envelope_size = 8;
2647            let bytes_len = max_ordinal as usize * envelope_size;
2648            #[allow(unused_variables)]
2649            let offset = encoder.out_of_line_offset(bytes_len);
2650            let mut _prev_end_offset: usize = 0;
2651            if 1 > max_ordinal {
2652                return Ok(());
2653            }
2654
2655            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2656            // are envelope_size bytes.
2657            let cur_offset: usize = (1 - 1) * envelope_size;
2658
2659            // Zero reserved fields.
2660            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2661
2662            // Safety:
2663            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2664            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2665            //   envelope_size bytes, there is always sufficient room.
2666            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2667                self.total_size.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2668                encoder,
2669                offset + cur_offset,
2670                depth,
2671            )?;
2672
2673            _prev_end_offset = cur_offset + envelope_size;
2674            if 2 > max_ordinal {
2675                return Ok(());
2676            }
2677
2678            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2679            // are envelope_size bytes.
2680            let cur_offset: usize = (2 - 1) * envelope_size;
2681
2682            // Zero reserved fields.
2683            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2684
2685            // Safety:
2686            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2687            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2688            //   envelope_size bytes, there is always sufficient room.
2689            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2690                self.used_size.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2691                encoder,
2692                offset + cur_offset,
2693                depth,
2694            )?;
2695
2696            _prev_end_offset = cur_offset + envelope_size;
2697
2698            Ok(())
2699        }
2700    }
2701
2702    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StorageStatus {
2703        #[inline(always)]
2704        fn new_empty() -> Self {
2705            Self::default()
2706        }
2707
2708        unsafe fn decode(
2709            &mut self,
2710            decoder: &mut fidl::encoding::Decoder<'_, D>,
2711            offset: usize,
2712            mut depth: fidl::encoding::Depth,
2713        ) -> fidl::Result<()> {
2714            decoder.debug_check_bounds::<Self>(offset);
2715            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2716                None => return Err(fidl::Error::NotNullable),
2717                Some(len) => len,
2718            };
2719            // Calling decoder.out_of_line_offset(0) is not allowed.
2720            if len == 0 {
2721                return Ok(());
2722            };
2723            depth.increment()?;
2724            let envelope_size = 8;
2725            let bytes_len = len * envelope_size;
2726            let offset = decoder.out_of_line_offset(bytes_len)?;
2727            // Decode the envelope for each type.
2728            let mut _next_ordinal_to_read = 0;
2729            let mut next_offset = offset;
2730            let end_offset = offset + bytes_len;
2731            _next_ordinal_to_read += 1;
2732            if next_offset >= end_offset {
2733                return Ok(());
2734            }
2735
2736            // Decode unknown envelopes for gaps in ordinals.
2737            while _next_ordinal_to_read < 1 {
2738                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2739                _next_ordinal_to_read += 1;
2740                next_offset += envelope_size;
2741            }
2742
2743            let next_out_of_line = decoder.next_out_of_line();
2744            let handles_before = decoder.remaining_handles();
2745            if let Some((inlined, num_bytes, num_handles)) =
2746                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2747            {
2748                let member_inline_size =
2749                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2750                if inlined != (member_inline_size <= 4) {
2751                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2752                }
2753                let inner_offset;
2754                let mut inner_depth = depth.clone();
2755                if inlined {
2756                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2757                    inner_offset = next_offset;
2758                } else {
2759                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2760                    inner_depth.increment()?;
2761                }
2762                let val_ref = self.total_size.get_or_insert_with(|| fidl::new_empty!(u64, D));
2763                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2764                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2765                {
2766                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2767                }
2768                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2769                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2770                }
2771            }
2772
2773            next_offset += envelope_size;
2774            _next_ordinal_to_read += 1;
2775            if next_offset >= end_offset {
2776                return Ok(());
2777            }
2778
2779            // Decode unknown envelopes for gaps in ordinals.
2780            while _next_ordinal_to_read < 2 {
2781                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2782                _next_ordinal_to_read += 1;
2783                next_offset += envelope_size;
2784            }
2785
2786            let next_out_of_line = decoder.next_out_of_line();
2787            let handles_before = decoder.remaining_handles();
2788            if let Some((inlined, num_bytes, num_handles)) =
2789                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2790            {
2791                let member_inline_size =
2792                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2793                if inlined != (member_inline_size <= 4) {
2794                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2795                }
2796                let inner_offset;
2797                let mut inner_depth = depth.clone();
2798                if inlined {
2799                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2800                    inner_offset = next_offset;
2801                } else {
2802                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2803                    inner_depth.increment()?;
2804                }
2805                let val_ref = self.used_size.get_or_insert_with(|| fidl::new_empty!(u64, D));
2806                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2807                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2808                {
2809                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2810                }
2811                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2812                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2813                }
2814            }
2815
2816            next_offset += envelope_size;
2817
2818            // Decode the remaining unknown envelopes.
2819            while next_offset < end_offset {
2820                _next_ordinal_to_read += 1;
2821                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2822                next_offset += envelope_size;
2823            }
2824
2825            Ok(())
2826        }
2827    }
2828
2829    impl UnresolvedPayload {
2830        #[inline(always)]
2831        fn max_ordinal_present(&self) -> u64 {
2832            0
2833        }
2834    }
2835
2836    impl fidl::encoding::ValueTypeMarker for UnresolvedPayload {
2837        type Borrowed<'a> = &'a Self;
2838        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2839            value
2840        }
2841    }
2842
2843    unsafe impl fidl::encoding::TypeMarker for UnresolvedPayload {
2844        type Owned = Self;
2845
2846        #[inline(always)]
2847        fn inline_align(_context: fidl::encoding::Context) -> usize {
2848            8
2849        }
2850
2851        #[inline(always)]
2852        fn inline_size(_context: fidl::encoding::Context) -> usize {
2853            16
2854        }
2855    }
2856
2857    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UnresolvedPayload, D>
2858        for &UnresolvedPayload
2859    {
2860        unsafe fn encode(
2861            self,
2862            encoder: &mut fidl::encoding::Encoder<'_, D>,
2863            offset: usize,
2864            mut depth: fidl::encoding::Depth,
2865        ) -> fidl::Result<()> {
2866            encoder.debug_check_bounds::<UnresolvedPayload>(offset);
2867            // Vector header
2868            let max_ordinal: u64 = self.max_ordinal_present();
2869            encoder.write_num(max_ordinal, offset);
2870            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2871            // Calling encoder.out_of_line_offset(0) is not allowed.
2872            if max_ordinal == 0 {
2873                return Ok(());
2874            }
2875            depth.increment()?;
2876            let envelope_size = 8;
2877            let bytes_len = max_ordinal as usize * envelope_size;
2878            #[allow(unused_variables)]
2879            let offset = encoder.out_of_line_offset(bytes_len);
2880            let mut _prev_end_offset: usize = 0;
2881
2882            Ok(())
2883        }
2884    }
2885
2886    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UnresolvedPayload {
2887        #[inline(always)]
2888        fn new_empty() -> Self {
2889            Self::default()
2890        }
2891
2892        unsafe fn decode(
2893            &mut self,
2894            decoder: &mut fidl::encoding::Decoder<'_, D>,
2895            offset: usize,
2896            mut depth: fidl::encoding::Depth,
2897        ) -> fidl::Result<()> {
2898            decoder.debug_check_bounds::<Self>(offset);
2899            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2900                None => return Err(fidl::Error::NotNullable),
2901                Some(len) => len,
2902            };
2903            // Calling decoder.out_of_line_offset(0) is not allowed.
2904            if len == 0 {
2905                return Ok(());
2906            };
2907            depth.increment()?;
2908            let envelope_size = 8;
2909            let bytes_len = len * envelope_size;
2910            let offset = decoder.out_of_line_offset(bytes_len)?;
2911            // Decode the envelope for each type.
2912            let mut _next_ordinal_to_read = 0;
2913            let mut next_offset = offset;
2914            let end_offset = offset + bytes_len;
2915
2916            // Decode the remaining unknown envelopes.
2917            while next_offset < end_offset {
2918                _next_ordinal_to_read += 1;
2919                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2920                next_offset += envelope_size;
2921            }
2922
2923            Ok(())
2924        }
2925    }
2926}