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