fidl_fuchsia_update_installer_common/
fidl_fuchsia_update_installer_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 AttemptId = String;
12
13/// Why cancel failed.
14#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
15#[repr(u32)]
16pub enum CancelError {
17    /// There is no update attempt in progress.
18    NoUpdateInProgress = 1,
19    /// The update attempt has past the point that can be canceled.
20    UpdateCannotBeCanceled = 2,
21    /// The given attempt id does not match the current update attempt.
22    AttemptIdMismatch = 3,
23    /// The number of cancel requests has exceeded the limit.
24    CancelLimitExceeded = 4,
25}
26
27impl CancelError {
28    #[inline]
29    pub fn from_primitive(prim: u32) -> Option<Self> {
30        match prim {
31            1 => Some(Self::NoUpdateInProgress),
32            2 => Some(Self::UpdateCannotBeCanceled),
33            3 => Some(Self::AttemptIdMismatch),
34            4 => Some(Self::CancelLimitExceeded),
35            _ => None,
36        }
37    }
38
39    #[inline]
40    pub const fn into_primitive(self) -> u32 {
41        self as u32
42    }
43}
44
45/// The set of values provided when an installation attempt fails on [`State.fetch`].
46#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
47#[repr(u32)]
48pub enum FetchFailureReason {
49    /// The fetch failed because of some other reason.
50    Internal = 0,
51    /// The fetch failed because the system does not have enough space to fetch a package.
52    OutOfSpace = 1,
53}
54
55impl FetchFailureReason {
56    #[inline]
57    pub fn from_primitive(prim: u32) -> Option<Self> {
58        match prim {
59            0 => Some(Self::Internal),
60            1 => Some(Self::OutOfSpace),
61            _ => None,
62        }
63    }
64
65    #[inline]
66    pub const fn into_primitive(self) -> u32 {
67        self as u32
68    }
69}
70
71/// Who or what initiated the update installation.
72#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
73#[repr(u32)]
74pub enum Initiator {
75    /// The install was initiated by an interactive user, or the user is
76    /// otherwise blocked and waiting for the result of this update.
77    User = 0,
78    /// The install was initiated by a service, in the background.
79    Service = 1,
80}
81
82impl Initiator {
83    #[inline]
84    pub fn from_primitive(prim: u32) -> Option<Self> {
85        match prim {
86            0 => Some(Self::User),
87            1 => Some(Self::Service),
88            _ => None,
89        }
90    }
91
92    #[inline]
93    pub const fn into_primitive(self) -> u32 {
94        self as u32
95    }
96}
97
98/// The set of values provided when an installation attempt fails on [`State.prepare`].
99#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
100#[repr(u32)]
101pub enum PrepareFailureReason {
102    /// The prepare failed because of some other reason.
103    Internal = 0,
104    /// The prepare failed because the system does not have enough space to fetch
105    /// the update package.
106    OutOfSpace = 1,
107    /// The prepare failed because the system cannot downgrade across a version boundary. Not all
108    /// unsupported downgrades will fail with this error -- just the ones the system can detect. For
109    /// more context, see [RFC-0071](/docs/contribute/governance/rfcs/0071_ota_backstop.md).
110    UnsupportedDowngrade = 2,
111}
112
113impl PrepareFailureReason {
114    #[inline]
115    pub fn from_primitive(prim: u32) -> Option<Self> {
116        match prim {
117            0 => Some(Self::Internal),
118            1 => Some(Self::OutOfSpace),
119            2 => Some(Self::UnsupportedDowngrade),
120            _ => None,
121        }
122    }
123
124    #[inline]
125    pub const fn into_primitive(self) -> u32 {
126        self as u32
127    }
128}
129
130/// Why resume failed.
131#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
132#[repr(u32)]
133pub enum ResumeError {
134    /// There is no update attempt in progress.
135    NoUpdateInProgress = 1,
136    /// The given attempt id does not match the current update attempt.
137    AttemptIdMismatch = 2,
138}
139
140impl ResumeError {
141    #[inline]
142    pub fn from_primitive(prim: u32) -> Option<Self> {
143        match prim {
144            1 => Some(Self::NoUpdateInProgress),
145            2 => Some(Self::AttemptIdMismatch),
146            _ => None,
147        }
148    }
149
150    #[inline]
151    pub const fn into_primitive(self) -> u32 {
152        self as u32
153    }
154}
155
156/// The set of values provided when an installation attempt fails on [`State.stage`].
157#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
158#[repr(u32)]
159pub enum StageFailureReason {
160    /// The stage failed because of some other reason.
161    Internal = 0,
162    /// The stage failed because the system does not have enough space to fetch a package.
163    OutOfSpace = 1,
164}
165
166impl StageFailureReason {
167    #[inline]
168    pub fn from_primitive(prim: u32) -> Option<Self> {
169        match prim {
170            0 => Some(Self::Internal),
171            1 => Some(Self::OutOfSpace),
172            _ => None,
173        }
174    }
175
176    #[inline]
177    pub const fn into_primitive(self) -> u32 {
178        self as u32
179    }
180}
181
182/// Why suspend failed.
183#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
184#[repr(u32)]
185pub enum SuspendError {
186    /// There is no update attempt in progress.
187    NoUpdateInProgress = 1,
188    /// The current update attempt has reached its suspend limit.
189    SuspendLimitExceeded = 2,
190    /// The given attempt id does not match the current update attempt.
191    AttemptIdMismatch = 3,
192}
193
194impl SuspendError {
195    #[inline]
196    pub fn from_primitive(prim: u32) -> Option<Self> {
197        match prim {
198            1 => Some(Self::NoUpdateInProgress),
199            2 => Some(Self::SuspendLimitExceeded),
200            3 => Some(Self::AttemptIdMismatch),
201            _ => None,
202        }
203    }
204
205    #[inline]
206    pub const fn into_primitive(self) -> u32 {
207        self as u32
208    }
209}
210
211/// The set of values that are returned by an request to start an update.
212#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
213#[repr(u32)]
214pub enum UpdateNotStartedReason {
215    /// There was already another update attempt in progress when this request was
216    /// made.  A new update attempt will not be started.
217    AlreadyInProgress = 1,
218}
219
220impl UpdateNotStartedReason {
221    #[inline]
222    pub fn from_primitive(prim: u32) -> Option<Self> {
223        match prim {
224            1 => Some(Self::AlreadyInProgress),
225            _ => None,
226        }
227    }
228
229    #[inline]
230    pub const fn into_primitive(self) -> u32 {
231        self as u32
232    }
233}
234
235#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
236pub struct InstallerCancelUpdateRequest {
237    pub attempt_id: Option<String>,
238}
239
240impl fidl::Persistable for InstallerCancelUpdateRequest {}
241
242#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
243pub struct InstallerMonitorUpdateResponse {
244    pub attached: bool,
245}
246
247impl fidl::Persistable for InstallerMonitorUpdateResponse {}
248
249#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
250pub struct InstallerResumeUpdateRequest {
251    pub attempt_id: Option<String>,
252}
253
254impl fidl::Persistable for InstallerResumeUpdateRequest {}
255
256#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
257pub struct InstallerSuspendUpdateRequest {
258    pub attempt_id: Option<String>,
259}
260
261impl fidl::Persistable for InstallerSuspendUpdateRequest {}
262
263#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
264pub struct InstallerStartUpdateResponse {
265    pub attempt_id: String,
266}
267
268impl fidl::Persistable for InstallerStartUpdateResponse {}
269
270#[derive(Clone, Debug, PartialEq)]
271pub struct MonitorOnStateRequest {
272    pub state: State,
273}
274
275impl fidl::Persistable for MonitorOnStateRequest {}
276
277/// Data associated with [`State.canceled`].
278#[derive(Clone, Debug, Default, PartialEq)]
279pub struct CanceledData {
280    #[doc(hidden)]
281    pub __source_breaking: fidl::marker::SourceBreaking,
282}
283
284impl fidl::Persistable for CanceledData {}
285
286/// Data associated with [`State.commit`].
287#[derive(Clone, Debug, Default, PartialEq)]
288pub struct CommitData {
289    pub info: Option<UpdateInfo>,
290    pub progress: Option<InstallationProgress>,
291    #[doc(hidden)]
292    pub __source_breaking: fidl::marker::SourceBreaking,
293}
294
295impl fidl::Persistable for CommitData {}
296
297/// Data associated with [`State.complete`].
298#[derive(Clone, Debug, Default, PartialEq)]
299pub struct CompleteData {
300    pub info: Option<UpdateInfo>,
301    pub progress: Option<InstallationProgress>,
302    #[doc(hidden)]
303    pub __source_breaking: fidl::marker::SourceBreaking,
304}
305
306impl fidl::Persistable for CompleteData {}
307
308/// Data associated with [`State.defer_reboot`].
309#[derive(Clone, Debug, Default, PartialEq)]
310pub struct DeferRebootData {
311    pub info: Option<UpdateInfo>,
312    pub progress: Option<InstallationProgress>,
313    #[doc(hidden)]
314    pub __source_breaking: fidl::marker::SourceBreaking,
315}
316
317impl fidl::Persistable for DeferRebootData {}
318
319/// Data associated with [`State.fail_commit`].
320#[derive(Clone, Debug, Default, PartialEq)]
321pub struct FailCommitData {
322    pub info: Option<UpdateInfo>,
323    pub progress: Option<InstallationProgress>,
324    #[doc(hidden)]
325    pub __source_breaking: fidl::marker::SourceBreaking,
326}
327
328impl fidl::Persistable for FailCommitData {}
329
330/// Data associated with [`State.fail_fetch`].
331#[derive(Clone, Debug, Default, PartialEq)]
332pub struct FailFetchData {
333    pub info: Option<UpdateInfo>,
334    pub progress: Option<InstallationProgress>,
335    pub reason: Option<FetchFailureReason>,
336    #[doc(hidden)]
337    pub __source_breaking: fidl::marker::SourceBreaking,
338}
339
340impl fidl::Persistable for FailFetchData {}
341
342/// Data associated with [`State.fail_prepare`].
343#[derive(Clone, Debug, Default, PartialEq)]
344pub struct FailPrepareData {
345    pub reason: Option<PrepareFailureReason>,
346    #[doc(hidden)]
347    pub __source_breaking: fidl::marker::SourceBreaking,
348}
349
350impl fidl::Persistable for FailPrepareData {}
351
352/// Data associated with [`State.fail_stage`].
353#[derive(Clone, Debug, Default, PartialEq)]
354pub struct FailStageData {
355    pub info: Option<UpdateInfo>,
356    pub progress: Option<InstallationProgress>,
357    pub reason: Option<StageFailureReason>,
358    #[doc(hidden)]
359    pub __source_breaking: fidl::marker::SourceBreaking,
360}
361
362impl fidl::Persistable for FailStageData {}
363
364/// Data associated with [`State.fetch`].
365#[derive(Clone, Debug, Default, PartialEq)]
366pub struct FetchData {
367    pub info: Option<UpdateInfo>,
368    pub progress: Option<InstallationProgress>,
369    #[doc(hidden)]
370    pub __source_breaking: fidl::marker::SourceBreaking,
371}
372
373impl fidl::Persistable for FetchData {}
374
375/// Current progress for an installation attempt.
376#[derive(Clone, Debug, Default, PartialEq)]
377pub struct InstallationProgress {
378    /// The fraction [0-1.0f] of the installation that has been completed.
379    pub fraction_completed: Option<f32>,
380    /// The number of bytes downloaded during this installation attempt. Less
381    /// than or equal to [`UpdateInfo.download_size`] and only present if that
382    /// field is also present.
383    pub bytes_downloaded: Option<u64>,
384    #[doc(hidden)]
385    pub __source_breaking: fidl::marker::SourceBreaking,
386}
387
388impl fidl::Persistable for InstallationProgress {}
389
390/// Configuration options for an update attempt.
391#[derive(Clone, Debug, Default, PartialEq)]
392pub struct Options {
393    /// What initiated this update attempt. Required.
394    pub initiator: Option<Initiator>,
395    /// If an update is already in progress, it's acceptable to instead attach a
396    /// Monitor to that in-progress update instead of failing this request to
397    /// install the update.  Setting this option to true may convert situations
398    /// that would have resulted in the ALREADY_IN_PROGRESS to be treated as
399    /// non-error cases. A controller, if provided, will be ignored if the
400    /// running update attempt already has a controller.
401    pub allow_attach_to_existing_attempt: Option<bool>,
402    /// Determines if the installer should update the recovery partition if an
403    /// update is available.  Defaults to true.
404    pub should_write_recovery: Option<bool>,
405    #[doc(hidden)]
406    pub __source_breaking: fidl::marker::SourceBreaking,
407}
408
409impl fidl::Persistable for Options {}
410
411/// Data associated with [`State.prepare`].
412#[derive(Clone, Debug, Default, PartialEq)]
413pub struct PrepareData {
414    #[doc(hidden)]
415    pub __source_breaking: fidl::marker::SourceBreaking,
416}
417
418impl fidl::Persistable for PrepareData {}
419
420/// Data associated with [`State.reboot`].
421#[derive(Clone, Debug, Default, PartialEq)]
422pub struct RebootData {
423    pub info: Option<UpdateInfo>,
424    pub progress: Option<InstallationProgress>,
425    #[doc(hidden)]
426    pub __source_breaking: fidl::marker::SourceBreaking,
427}
428
429impl fidl::Persistable for RebootData {}
430
431/// Data associated with [`State.stage`].
432#[derive(Clone, Debug, Default, PartialEq)]
433pub struct StageData {
434    pub info: Option<UpdateInfo>,
435    pub progress: Option<InstallationProgress>,
436    #[doc(hidden)]
437    pub __source_breaking: fidl::marker::SourceBreaking,
438}
439
440impl fidl::Persistable for StageData {}
441
442/// Metadata for an update.  Once a field is populated during an installation
443/// attempt, the value will not change.
444#[derive(Clone, Debug, Default, PartialEq)]
445pub struct UpdateInfo {
446    /// The total number of bytes that may be downloaded to apply this update.
447    /// Optional, the installer may not be able to provide this value.
448    pub download_size: Option<u64>,
449    #[doc(hidden)]
450    pub __source_breaking: fidl::marker::SourceBreaking,
451}
452
453impl fidl::Persistable for UpdateInfo {}
454
455/// Data associated with [`State.wait_to_reboot`].
456#[derive(Clone, Debug, Default, PartialEq)]
457pub struct WaitToRebootData {
458    pub info: Option<UpdateInfo>,
459    pub progress: Option<InstallationProgress>,
460    #[doc(hidden)]
461    pub __source_breaking: fidl::marker::SourceBreaking,
462}
463
464impl fidl::Persistable for WaitToRebootData {}
465
466/// The set of states that a [`Monitor`] can receive during an update
467/// installation attempt.
468///
469/// An installation attempt ends when it enters a terminal state, denoted below
470/// as the states on the right-hand side of the diagram with no arrows leading
471/// out of them.
472///
473/// # State Machine Diagram
474///
475/// ```
476///                       +----------------+     +----------------+
477///            +----------|    prepare     |---->|  fail_prepare  |
478///            |          +----------------+     +----------------+
479///            |                  |
480///            |                  v
481///            |          +----------------+     +----------------+
482///            +----------|     stage      |---->|   fail_stage   |
483///            |          +----------------+     +----------------+
484///            |                  |
485///            |                  v
486///            |          +----------------+     +----------------+
487///            +----------|     fetch      |---->|   fail_fetch   |
488///            |          +----------------+     +----------------+
489///            |                  |
490///            |                  v
491///            |          +----------------+     +----------------+
492///            +----------|     commit     |---->|   fail_commit  |
493///            |          +----------------+     +----------------+
494///            v                  |
495///    +----------------+         |              +----------------+
496///    |    canceled    |         +------------> |    complete    |
497///    +----------------+         |              +----------------+
498///                               v
499///                       +----------------+     +----------------+
500///                       | wait_to_reboot |---->|  defer_reboot  |
501///                       +----------------+     +----------------+
502///                               |
503///                               |              +----------------+
504///                               +------------->|     reboot     |
505///                                              +----------------+
506/// ```
507#[derive(Clone, Debug, PartialEq)]
508pub enum State {
509    /// Fetching required metadata to begin the update and verifying system
510    /// state.
511    ///
512    /// Next States:
513    /// * `stage` system is ready to install the update.
514    /// * `fail_prepare` on error.
515    /// * `canceled` on cancel.
516    Prepare(PrepareData),
517    /// Fetching and writing kernel and firmware images.
518    ///
519    /// Next States:
520    /// * `fetch`  required kernel and firmware images are written.
521    /// * `fail_stage`  on error.
522    /// * `canceled` on cancel.
523    Stage(StageData),
524    /// Fetching packages.
525    ///
526    /// Next States:
527    /// * `commit` packages were fetched successfully.
528    /// * `fail_fetch` on error.
529    /// * `canceled` on cancel.
530    Fetch(FetchData),
531    /// Prepare to switch over to the new system by writing the packages
532    /// and switching the active partition.
533    ///
534    /// Next States:
535    /// * `wait_to_reboot` if a reboot is necessary to complete the update.
536    /// * `complete` if no reboot is necessary to complete the update.
537    /// * `fail_commit` on error.
538    /// * `canceled` on cancel.
539    Commit(CommitData),
540    /// The system is configured to boot the updated OS on next boot, and the
541    /// installer is waiting for the trigger to reboot the system.
542    ///
543    /// Next States:
544    /// * `reboot` when the installer decides it is time to initiate the reboot.
545    /// * `defer_reboot` if the initiator specifically requests to not reboot.
546    WaitToReboot(WaitToRebootData),
547    /// The installer has initiated a system reboot into the updated OS.
548    ///
549    /// **This is a terminal state**
550    Reboot(RebootData),
551    /// The initiator specifically requested to skip the reboot, but a reboot is
552    /// still required to complete the update.
553    ///
554    /// **This is a terminal state**
555    DeferReboot(DeferRebootData),
556    /// The update is complete and no reboot was required.
557    ///
558    /// **This is a terminal state**
559    Complete(CompleteData),
560    /// An error occurred while preparing the install.
561    ///
562    /// **This is a terminal state**
563    FailPrepare(FailPrepareData),
564    /// An error occurred while staging the images for the OS.
565    ///
566    /// **This is a terminal state**
567    FailStage(FailStageData),
568    /// An error occurred while fetching the required artifacts.
569    ///
570    /// **This is a terminal state**
571    FailFetch(FailFetchData),
572    /// An error occured while switching partitions.
573    ///
574    /// **This is a terminal state**
575    FailCommit(FailCommitData),
576    /// The update is canceled.
577    ///
578    /// **This is a terminal state**
579    Canceled(CanceledData),
580}
581
582impl State {
583    #[inline]
584    pub fn ordinal(&self) -> u64 {
585        match *self {
586            Self::Prepare(_) => 1,
587            Self::Stage(_) => 2,
588            Self::Fetch(_) => 3,
589            Self::Commit(_) => 4,
590            Self::WaitToReboot(_) => 5,
591            Self::Reboot(_) => 6,
592            Self::DeferReboot(_) => 7,
593            Self::Complete(_) => 8,
594            Self::FailPrepare(_) => 9,
595            Self::FailStage(_) => 10,
596            Self::FailFetch(_) => 11,
597            Self::FailCommit(_) => 12,
598            Self::Canceled(_) => 13,
599        }
600    }
601}
602
603impl fidl::Persistable for State {}
604
605mod internal {
606    use super::*;
607    unsafe impl fidl::encoding::TypeMarker for CancelError {
608        type Owned = Self;
609
610        #[inline(always)]
611        fn inline_align(_context: fidl::encoding::Context) -> usize {
612            std::mem::align_of::<u32>()
613        }
614
615        #[inline(always)]
616        fn inline_size(_context: fidl::encoding::Context) -> usize {
617            std::mem::size_of::<u32>()
618        }
619
620        #[inline(always)]
621        fn encode_is_copy() -> bool {
622            true
623        }
624
625        #[inline(always)]
626        fn decode_is_copy() -> bool {
627            false
628        }
629    }
630
631    impl fidl::encoding::ValueTypeMarker for CancelError {
632        type Borrowed<'a> = Self;
633        #[inline(always)]
634        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
635            *value
636        }
637    }
638
639    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CancelError {
640        #[inline]
641        unsafe fn encode(
642            self,
643            encoder: &mut fidl::encoding::Encoder<'_, D>,
644            offset: usize,
645            _depth: fidl::encoding::Depth,
646        ) -> fidl::Result<()> {
647            encoder.debug_check_bounds::<Self>(offset);
648            encoder.write_num(self.into_primitive(), offset);
649            Ok(())
650        }
651    }
652
653    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CancelError {
654        #[inline(always)]
655        fn new_empty() -> Self {
656            Self::NoUpdateInProgress
657        }
658
659        #[inline]
660        unsafe fn decode(
661            &mut self,
662            decoder: &mut fidl::encoding::Decoder<'_, D>,
663            offset: usize,
664            _depth: fidl::encoding::Depth,
665        ) -> fidl::Result<()> {
666            decoder.debug_check_bounds::<Self>(offset);
667            let prim = decoder.read_num::<u32>(offset);
668
669            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
670            Ok(())
671        }
672    }
673    unsafe impl fidl::encoding::TypeMarker for FetchFailureReason {
674        type Owned = Self;
675
676        #[inline(always)]
677        fn inline_align(_context: fidl::encoding::Context) -> usize {
678            std::mem::align_of::<u32>()
679        }
680
681        #[inline(always)]
682        fn inline_size(_context: fidl::encoding::Context) -> usize {
683            std::mem::size_of::<u32>()
684        }
685
686        #[inline(always)]
687        fn encode_is_copy() -> bool {
688            true
689        }
690
691        #[inline(always)]
692        fn decode_is_copy() -> bool {
693            false
694        }
695    }
696
697    impl fidl::encoding::ValueTypeMarker for FetchFailureReason {
698        type Borrowed<'a> = Self;
699        #[inline(always)]
700        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
701            *value
702        }
703    }
704
705    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
706        for FetchFailureReason
707    {
708        #[inline]
709        unsafe fn encode(
710            self,
711            encoder: &mut fidl::encoding::Encoder<'_, D>,
712            offset: usize,
713            _depth: fidl::encoding::Depth,
714        ) -> fidl::Result<()> {
715            encoder.debug_check_bounds::<Self>(offset);
716            encoder.write_num(self.into_primitive(), offset);
717            Ok(())
718        }
719    }
720
721    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FetchFailureReason {
722        #[inline(always)]
723        fn new_empty() -> Self {
724            Self::Internal
725        }
726
727        #[inline]
728        unsafe fn decode(
729            &mut self,
730            decoder: &mut fidl::encoding::Decoder<'_, D>,
731            offset: usize,
732            _depth: fidl::encoding::Depth,
733        ) -> fidl::Result<()> {
734            decoder.debug_check_bounds::<Self>(offset);
735            let prim = decoder.read_num::<u32>(offset);
736
737            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
738            Ok(())
739        }
740    }
741    unsafe impl fidl::encoding::TypeMarker for Initiator {
742        type Owned = Self;
743
744        #[inline(always)]
745        fn inline_align(_context: fidl::encoding::Context) -> usize {
746            std::mem::align_of::<u32>()
747        }
748
749        #[inline(always)]
750        fn inline_size(_context: fidl::encoding::Context) -> usize {
751            std::mem::size_of::<u32>()
752        }
753
754        #[inline(always)]
755        fn encode_is_copy() -> bool {
756            true
757        }
758
759        #[inline(always)]
760        fn decode_is_copy() -> bool {
761            false
762        }
763    }
764
765    impl fidl::encoding::ValueTypeMarker for Initiator {
766        type Borrowed<'a> = Self;
767        #[inline(always)]
768        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
769            *value
770        }
771    }
772
773    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Initiator {
774        #[inline]
775        unsafe fn encode(
776            self,
777            encoder: &mut fidl::encoding::Encoder<'_, D>,
778            offset: usize,
779            _depth: fidl::encoding::Depth,
780        ) -> fidl::Result<()> {
781            encoder.debug_check_bounds::<Self>(offset);
782            encoder.write_num(self.into_primitive(), offset);
783            Ok(())
784        }
785    }
786
787    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Initiator {
788        #[inline(always)]
789        fn new_empty() -> Self {
790            Self::User
791        }
792
793        #[inline]
794        unsafe fn decode(
795            &mut self,
796            decoder: &mut fidl::encoding::Decoder<'_, D>,
797            offset: usize,
798            _depth: fidl::encoding::Depth,
799        ) -> fidl::Result<()> {
800            decoder.debug_check_bounds::<Self>(offset);
801            let prim = decoder.read_num::<u32>(offset);
802
803            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
804            Ok(())
805        }
806    }
807    unsafe impl fidl::encoding::TypeMarker for PrepareFailureReason {
808        type Owned = Self;
809
810        #[inline(always)]
811        fn inline_align(_context: fidl::encoding::Context) -> usize {
812            std::mem::align_of::<u32>()
813        }
814
815        #[inline(always)]
816        fn inline_size(_context: fidl::encoding::Context) -> usize {
817            std::mem::size_of::<u32>()
818        }
819
820        #[inline(always)]
821        fn encode_is_copy() -> bool {
822            true
823        }
824
825        #[inline(always)]
826        fn decode_is_copy() -> bool {
827            false
828        }
829    }
830
831    impl fidl::encoding::ValueTypeMarker for PrepareFailureReason {
832        type Borrowed<'a> = Self;
833        #[inline(always)]
834        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
835            *value
836        }
837    }
838
839    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
840        for PrepareFailureReason
841    {
842        #[inline]
843        unsafe fn encode(
844            self,
845            encoder: &mut fidl::encoding::Encoder<'_, D>,
846            offset: usize,
847            _depth: fidl::encoding::Depth,
848        ) -> fidl::Result<()> {
849            encoder.debug_check_bounds::<Self>(offset);
850            encoder.write_num(self.into_primitive(), offset);
851            Ok(())
852        }
853    }
854
855    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PrepareFailureReason {
856        #[inline(always)]
857        fn new_empty() -> Self {
858            Self::Internal
859        }
860
861        #[inline]
862        unsafe fn decode(
863            &mut self,
864            decoder: &mut fidl::encoding::Decoder<'_, D>,
865            offset: usize,
866            _depth: fidl::encoding::Depth,
867        ) -> fidl::Result<()> {
868            decoder.debug_check_bounds::<Self>(offset);
869            let prim = decoder.read_num::<u32>(offset);
870
871            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
872            Ok(())
873        }
874    }
875    unsafe impl fidl::encoding::TypeMarker for ResumeError {
876        type Owned = Self;
877
878        #[inline(always)]
879        fn inline_align(_context: fidl::encoding::Context) -> usize {
880            std::mem::align_of::<u32>()
881        }
882
883        #[inline(always)]
884        fn inline_size(_context: fidl::encoding::Context) -> usize {
885            std::mem::size_of::<u32>()
886        }
887
888        #[inline(always)]
889        fn encode_is_copy() -> bool {
890            true
891        }
892
893        #[inline(always)]
894        fn decode_is_copy() -> bool {
895            false
896        }
897    }
898
899    impl fidl::encoding::ValueTypeMarker for ResumeError {
900        type Borrowed<'a> = Self;
901        #[inline(always)]
902        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
903            *value
904        }
905    }
906
907    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ResumeError {
908        #[inline]
909        unsafe fn encode(
910            self,
911            encoder: &mut fidl::encoding::Encoder<'_, D>,
912            offset: usize,
913            _depth: fidl::encoding::Depth,
914        ) -> fidl::Result<()> {
915            encoder.debug_check_bounds::<Self>(offset);
916            encoder.write_num(self.into_primitive(), offset);
917            Ok(())
918        }
919    }
920
921    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ResumeError {
922        #[inline(always)]
923        fn new_empty() -> Self {
924            Self::NoUpdateInProgress
925        }
926
927        #[inline]
928        unsafe fn decode(
929            &mut self,
930            decoder: &mut fidl::encoding::Decoder<'_, D>,
931            offset: usize,
932            _depth: fidl::encoding::Depth,
933        ) -> fidl::Result<()> {
934            decoder.debug_check_bounds::<Self>(offset);
935            let prim = decoder.read_num::<u32>(offset);
936
937            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
938            Ok(())
939        }
940    }
941    unsafe impl fidl::encoding::TypeMarker for StageFailureReason {
942        type Owned = Self;
943
944        #[inline(always)]
945        fn inline_align(_context: fidl::encoding::Context) -> usize {
946            std::mem::align_of::<u32>()
947        }
948
949        #[inline(always)]
950        fn inline_size(_context: fidl::encoding::Context) -> usize {
951            std::mem::size_of::<u32>()
952        }
953
954        #[inline(always)]
955        fn encode_is_copy() -> bool {
956            true
957        }
958
959        #[inline(always)]
960        fn decode_is_copy() -> bool {
961            false
962        }
963    }
964
965    impl fidl::encoding::ValueTypeMarker for StageFailureReason {
966        type Borrowed<'a> = Self;
967        #[inline(always)]
968        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
969            *value
970        }
971    }
972
973    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
974        for StageFailureReason
975    {
976        #[inline]
977        unsafe fn encode(
978            self,
979            encoder: &mut fidl::encoding::Encoder<'_, D>,
980            offset: usize,
981            _depth: fidl::encoding::Depth,
982        ) -> fidl::Result<()> {
983            encoder.debug_check_bounds::<Self>(offset);
984            encoder.write_num(self.into_primitive(), offset);
985            Ok(())
986        }
987    }
988
989    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StageFailureReason {
990        #[inline(always)]
991        fn new_empty() -> Self {
992            Self::Internal
993        }
994
995        #[inline]
996        unsafe fn decode(
997            &mut self,
998            decoder: &mut fidl::encoding::Decoder<'_, D>,
999            offset: usize,
1000            _depth: fidl::encoding::Depth,
1001        ) -> fidl::Result<()> {
1002            decoder.debug_check_bounds::<Self>(offset);
1003            let prim = decoder.read_num::<u32>(offset);
1004
1005            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1006            Ok(())
1007        }
1008    }
1009    unsafe impl fidl::encoding::TypeMarker for SuspendError {
1010        type Owned = Self;
1011
1012        #[inline(always)]
1013        fn inline_align(_context: fidl::encoding::Context) -> usize {
1014            std::mem::align_of::<u32>()
1015        }
1016
1017        #[inline(always)]
1018        fn inline_size(_context: fidl::encoding::Context) -> usize {
1019            std::mem::size_of::<u32>()
1020        }
1021
1022        #[inline(always)]
1023        fn encode_is_copy() -> bool {
1024            true
1025        }
1026
1027        #[inline(always)]
1028        fn decode_is_copy() -> bool {
1029            false
1030        }
1031    }
1032
1033    impl fidl::encoding::ValueTypeMarker for SuspendError {
1034        type Borrowed<'a> = Self;
1035        #[inline(always)]
1036        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1037            *value
1038        }
1039    }
1040
1041    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SuspendError {
1042        #[inline]
1043        unsafe fn encode(
1044            self,
1045            encoder: &mut fidl::encoding::Encoder<'_, D>,
1046            offset: usize,
1047            _depth: fidl::encoding::Depth,
1048        ) -> fidl::Result<()> {
1049            encoder.debug_check_bounds::<Self>(offset);
1050            encoder.write_num(self.into_primitive(), offset);
1051            Ok(())
1052        }
1053    }
1054
1055    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SuspendError {
1056        #[inline(always)]
1057        fn new_empty() -> Self {
1058            Self::NoUpdateInProgress
1059        }
1060
1061        #[inline]
1062        unsafe fn decode(
1063            &mut self,
1064            decoder: &mut fidl::encoding::Decoder<'_, D>,
1065            offset: usize,
1066            _depth: fidl::encoding::Depth,
1067        ) -> fidl::Result<()> {
1068            decoder.debug_check_bounds::<Self>(offset);
1069            let prim = decoder.read_num::<u32>(offset);
1070
1071            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1072            Ok(())
1073        }
1074    }
1075    unsafe impl fidl::encoding::TypeMarker for UpdateNotStartedReason {
1076        type Owned = Self;
1077
1078        #[inline(always)]
1079        fn inline_align(_context: fidl::encoding::Context) -> usize {
1080            std::mem::align_of::<u32>()
1081        }
1082
1083        #[inline(always)]
1084        fn inline_size(_context: fidl::encoding::Context) -> usize {
1085            std::mem::size_of::<u32>()
1086        }
1087
1088        #[inline(always)]
1089        fn encode_is_copy() -> bool {
1090            true
1091        }
1092
1093        #[inline(always)]
1094        fn decode_is_copy() -> bool {
1095            false
1096        }
1097    }
1098
1099    impl fidl::encoding::ValueTypeMarker for UpdateNotStartedReason {
1100        type Borrowed<'a> = Self;
1101        #[inline(always)]
1102        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1103            *value
1104        }
1105    }
1106
1107    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1108        for UpdateNotStartedReason
1109    {
1110        #[inline]
1111        unsafe fn encode(
1112            self,
1113            encoder: &mut fidl::encoding::Encoder<'_, D>,
1114            offset: usize,
1115            _depth: fidl::encoding::Depth,
1116        ) -> fidl::Result<()> {
1117            encoder.debug_check_bounds::<Self>(offset);
1118            encoder.write_num(self.into_primitive(), offset);
1119            Ok(())
1120        }
1121    }
1122
1123    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1124        for UpdateNotStartedReason
1125    {
1126        #[inline(always)]
1127        fn new_empty() -> Self {
1128            Self::AlreadyInProgress
1129        }
1130
1131        #[inline]
1132        unsafe fn decode(
1133            &mut self,
1134            decoder: &mut fidl::encoding::Decoder<'_, D>,
1135            offset: usize,
1136            _depth: fidl::encoding::Depth,
1137        ) -> fidl::Result<()> {
1138            decoder.debug_check_bounds::<Self>(offset);
1139            let prim = decoder.read_num::<u32>(offset);
1140
1141            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1142            Ok(())
1143        }
1144    }
1145
1146    impl fidl::encoding::ValueTypeMarker for InstallerCancelUpdateRequest {
1147        type Borrowed<'a> = &'a Self;
1148        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1149            value
1150        }
1151    }
1152
1153    unsafe impl fidl::encoding::TypeMarker for InstallerCancelUpdateRequest {
1154        type Owned = Self;
1155
1156        #[inline(always)]
1157        fn inline_align(_context: fidl::encoding::Context) -> usize {
1158            8
1159        }
1160
1161        #[inline(always)]
1162        fn inline_size(_context: fidl::encoding::Context) -> usize {
1163            16
1164        }
1165    }
1166
1167    unsafe impl<D: fidl::encoding::ResourceDialect>
1168        fidl::encoding::Encode<InstallerCancelUpdateRequest, D> for &InstallerCancelUpdateRequest
1169    {
1170        #[inline]
1171        unsafe fn encode(
1172            self,
1173            encoder: &mut fidl::encoding::Encoder<'_, D>,
1174            offset: usize,
1175            _depth: fidl::encoding::Depth,
1176        ) -> fidl::Result<()> {
1177            encoder.debug_check_bounds::<InstallerCancelUpdateRequest>(offset);
1178            // Delegate to tuple encoding.
1179            fidl::encoding::Encode::<InstallerCancelUpdateRequest, D>::encode(
1180                (
1181                    <fidl::encoding::Optional<fidl::encoding::BoundedString<36>> as fidl::encoding::ValueTypeMarker>::borrow(&self.attempt_id),
1182                ),
1183                encoder, offset, _depth
1184            )
1185        }
1186    }
1187    unsafe impl<
1188            D: fidl::encoding::ResourceDialect,
1189            T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<36>>, D>,
1190        > fidl::encoding::Encode<InstallerCancelUpdateRequest, D> for (T0,)
1191    {
1192        #[inline]
1193        unsafe fn encode(
1194            self,
1195            encoder: &mut fidl::encoding::Encoder<'_, D>,
1196            offset: usize,
1197            depth: fidl::encoding::Depth,
1198        ) -> fidl::Result<()> {
1199            encoder.debug_check_bounds::<InstallerCancelUpdateRequest>(offset);
1200            // Zero out padding regions. There's no need to apply masks
1201            // because the unmasked parts will be overwritten by fields.
1202            // Write the fields.
1203            self.0.encode(encoder, offset + 0, depth)?;
1204            Ok(())
1205        }
1206    }
1207
1208    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1209        for InstallerCancelUpdateRequest
1210    {
1211        #[inline(always)]
1212        fn new_empty() -> Self {
1213            Self {
1214                attempt_id: fidl::new_empty!(
1215                    fidl::encoding::Optional<fidl::encoding::BoundedString<36>>,
1216                    D
1217                ),
1218            }
1219        }
1220
1221        #[inline]
1222        unsafe fn decode(
1223            &mut self,
1224            decoder: &mut fidl::encoding::Decoder<'_, D>,
1225            offset: usize,
1226            _depth: fidl::encoding::Depth,
1227        ) -> fidl::Result<()> {
1228            decoder.debug_check_bounds::<Self>(offset);
1229            // Verify that padding bytes are zero.
1230            fidl::decode!(
1231                fidl::encoding::Optional<fidl::encoding::BoundedString<36>>,
1232                D,
1233                &mut self.attempt_id,
1234                decoder,
1235                offset + 0,
1236                _depth
1237            )?;
1238            Ok(())
1239        }
1240    }
1241
1242    impl fidl::encoding::ValueTypeMarker for InstallerMonitorUpdateResponse {
1243        type Borrowed<'a> = &'a Self;
1244        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1245            value
1246        }
1247    }
1248
1249    unsafe impl fidl::encoding::TypeMarker for InstallerMonitorUpdateResponse {
1250        type Owned = Self;
1251
1252        #[inline(always)]
1253        fn inline_align(_context: fidl::encoding::Context) -> usize {
1254            1
1255        }
1256
1257        #[inline(always)]
1258        fn inline_size(_context: fidl::encoding::Context) -> usize {
1259            1
1260        }
1261    }
1262
1263    unsafe impl<D: fidl::encoding::ResourceDialect>
1264        fidl::encoding::Encode<InstallerMonitorUpdateResponse, D>
1265        for &InstallerMonitorUpdateResponse
1266    {
1267        #[inline]
1268        unsafe fn encode(
1269            self,
1270            encoder: &mut fidl::encoding::Encoder<'_, D>,
1271            offset: usize,
1272            _depth: fidl::encoding::Depth,
1273        ) -> fidl::Result<()> {
1274            encoder.debug_check_bounds::<InstallerMonitorUpdateResponse>(offset);
1275            // Delegate to tuple encoding.
1276            fidl::encoding::Encode::<InstallerMonitorUpdateResponse, D>::encode(
1277                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.attached),),
1278                encoder,
1279                offset,
1280                _depth,
1281            )
1282        }
1283    }
1284    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1285        fidl::encoding::Encode<InstallerMonitorUpdateResponse, D> for (T0,)
1286    {
1287        #[inline]
1288        unsafe fn encode(
1289            self,
1290            encoder: &mut fidl::encoding::Encoder<'_, D>,
1291            offset: usize,
1292            depth: fidl::encoding::Depth,
1293        ) -> fidl::Result<()> {
1294            encoder.debug_check_bounds::<InstallerMonitorUpdateResponse>(offset);
1295            // Zero out padding regions. There's no need to apply masks
1296            // because the unmasked parts will be overwritten by fields.
1297            // Write the fields.
1298            self.0.encode(encoder, offset + 0, depth)?;
1299            Ok(())
1300        }
1301    }
1302
1303    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1304        for InstallerMonitorUpdateResponse
1305    {
1306        #[inline(always)]
1307        fn new_empty() -> Self {
1308            Self { attached: fidl::new_empty!(bool, D) }
1309        }
1310
1311        #[inline]
1312        unsafe fn decode(
1313            &mut self,
1314            decoder: &mut fidl::encoding::Decoder<'_, D>,
1315            offset: usize,
1316            _depth: fidl::encoding::Depth,
1317        ) -> fidl::Result<()> {
1318            decoder.debug_check_bounds::<Self>(offset);
1319            // Verify that padding bytes are zero.
1320            fidl::decode!(bool, D, &mut self.attached, decoder, offset + 0, _depth)?;
1321            Ok(())
1322        }
1323    }
1324
1325    impl fidl::encoding::ValueTypeMarker for InstallerResumeUpdateRequest {
1326        type Borrowed<'a> = &'a Self;
1327        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1328            value
1329        }
1330    }
1331
1332    unsafe impl fidl::encoding::TypeMarker for InstallerResumeUpdateRequest {
1333        type Owned = Self;
1334
1335        #[inline(always)]
1336        fn inline_align(_context: fidl::encoding::Context) -> usize {
1337            8
1338        }
1339
1340        #[inline(always)]
1341        fn inline_size(_context: fidl::encoding::Context) -> usize {
1342            16
1343        }
1344    }
1345
1346    unsafe impl<D: fidl::encoding::ResourceDialect>
1347        fidl::encoding::Encode<InstallerResumeUpdateRequest, D> for &InstallerResumeUpdateRequest
1348    {
1349        #[inline]
1350        unsafe fn encode(
1351            self,
1352            encoder: &mut fidl::encoding::Encoder<'_, D>,
1353            offset: usize,
1354            _depth: fidl::encoding::Depth,
1355        ) -> fidl::Result<()> {
1356            encoder.debug_check_bounds::<InstallerResumeUpdateRequest>(offset);
1357            // Delegate to tuple encoding.
1358            fidl::encoding::Encode::<InstallerResumeUpdateRequest, D>::encode(
1359                (
1360                    <fidl::encoding::Optional<fidl::encoding::BoundedString<36>> as fidl::encoding::ValueTypeMarker>::borrow(&self.attempt_id),
1361                ),
1362                encoder, offset, _depth
1363            )
1364        }
1365    }
1366    unsafe impl<
1367            D: fidl::encoding::ResourceDialect,
1368            T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<36>>, D>,
1369        > fidl::encoding::Encode<InstallerResumeUpdateRequest, D> for (T0,)
1370    {
1371        #[inline]
1372        unsafe fn encode(
1373            self,
1374            encoder: &mut fidl::encoding::Encoder<'_, D>,
1375            offset: usize,
1376            depth: fidl::encoding::Depth,
1377        ) -> fidl::Result<()> {
1378            encoder.debug_check_bounds::<InstallerResumeUpdateRequest>(offset);
1379            // Zero out padding regions. There's no need to apply masks
1380            // because the unmasked parts will be overwritten by fields.
1381            // Write the fields.
1382            self.0.encode(encoder, offset + 0, depth)?;
1383            Ok(())
1384        }
1385    }
1386
1387    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1388        for InstallerResumeUpdateRequest
1389    {
1390        #[inline(always)]
1391        fn new_empty() -> Self {
1392            Self {
1393                attempt_id: fidl::new_empty!(
1394                    fidl::encoding::Optional<fidl::encoding::BoundedString<36>>,
1395                    D
1396                ),
1397            }
1398        }
1399
1400        #[inline]
1401        unsafe fn decode(
1402            &mut self,
1403            decoder: &mut fidl::encoding::Decoder<'_, D>,
1404            offset: usize,
1405            _depth: fidl::encoding::Depth,
1406        ) -> fidl::Result<()> {
1407            decoder.debug_check_bounds::<Self>(offset);
1408            // Verify that padding bytes are zero.
1409            fidl::decode!(
1410                fidl::encoding::Optional<fidl::encoding::BoundedString<36>>,
1411                D,
1412                &mut self.attempt_id,
1413                decoder,
1414                offset + 0,
1415                _depth
1416            )?;
1417            Ok(())
1418        }
1419    }
1420
1421    impl fidl::encoding::ValueTypeMarker for InstallerSuspendUpdateRequest {
1422        type Borrowed<'a> = &'a Self;
1423        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1424            value
1425        }
1426    }
1427
1428    unsafe impl fidl::encoding::TypeMarker for InstallerSuspendUpdateRequest {
1429        type Owned = Self;
1430
1431        #[inline(always)]
1432        fn inline_align(_context: fidl::encoding::Context) -> usize {
1433            8
1434        }
1435
1436        #[inline(always)]
1437        fn inline_size(_context: fidl::encoding::Context) -> usize {
1438            16
1439        }
1440    }
1441
1442    unsafe impl<D: fidl::encoding::ResourceDialect>
1443        fidl::encoding::Encode<InstallerSuspendUpdateRequest, D>
1444        for &InstallerSuspendUpdateRequest
1445    {
1446        #[inline]
1447        unsafe fn encode(
1448            self,
1449            encoder: &mut fidl::encoding::Encoder<'_, D>,
1450            offset: usize,
1451            _depth: fidl::encoding::Depth,
1452        ) -> fidl::Result<()> {
1453            encoder.debug_check_bounds::<InstallerSuspendUpdateRequest>(offset);
1454            // Delegate to tuple encoding.
1455            fidl::encoding::Encode::<InstallerSuspendUpdateRequest, D>::encode(
1456                (
1457                    <fidl::encoding::Optional<fidl::encoding::BoundedString<36>> as fidl::encoding::ValueTypeMarker>::borrow(&self.attempt_id),
1458                ),
1459                encoder, offset, _depth
1460            )
1461        }
1462    }
1463    unsafe impl<
1464            D: fidl::encoding::ResourceDialect,
1465            T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<36>>, D>,
1466        > fidl::encoding::Encode<InstallerSuspendUpdateRequest, D> for (T0,)
1467    {
1468        #[inline]
1469        unsafe fn encode(
1470            self,
1471            encoder: &mut fidl::encoding::Encoder<'_, D>,
1472            offset: usize,
1473            depth: fidl::encoding::Depth,
1474        ) -> fidl::Result<()> {
1475            encoder.debug_check_bounds::<InstallerSuspendUpdateRequest>(offset);
1476            // Zero out padding regions. There's no need to apply masks
1477            // because the unmasked parts will be overwritten by fields.
1478            // Write the fields.
1479            self.0.encode(encoder, offset + 0, depth)?;
1480            Ok(())
1481        }
1482    }
1483
1484    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1485        for InstallerSuspendUpdateRequest
1486    {
1487        #[inline(always)]
1488        fn new_empty() -> Self {
1489            Self {
1490                attempt_id: fidl::new_empty!(
1491                    fidl::encoding::Optional<fidl::encoding::BoundedString<36>>,
1492                    D
1493                ),
1494            }
1495        }
1496
1497        #[inline]
1498        unsafe fn decode(
1499            &mut self,
1500            decoder: &mut fidl::encoding::Decoder<'_, D>,
1501            offset: usize,
1502            _depth: fidl::encoding::Depth,
1503        ) -> fidl::Result<()> {
1504            decoder.debug_check_bounds::<Self>(offset);
1505            // Verify that padding bytes are zero.
1506            fidl::decode!(
1507                fidl::encoding::Optional<fidl::encoding::BoundedString<36>>,
1508                D,
1509                &mut self.attempt_id,
1510                decoder,
1511                offset + 0,
1512                _depth
1513            )?;
1514            Ok(())
1515        }
1516    }
1517
1518    impl fidl::encoding::ValueTypeMarker for InstallerStartUpdateResponse {
1519        type Borrowed<'a> = &'a Self;
1520        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1521            value
1522        }
1523    }
1524
1525    unsafe impl fidl::encoding::TypeMarker for InstallerStartUpdateResponse {
1526        type Owned = Self;
1527
1528        #[inline(always)]
1529        fn inline_align(_context: fidl::encoding::Context) -> usize {
1530            8
1531        }
1532
1533        #[inline(always)]
1534        fn inline_size(_context: fidl::encoding::Context) -> usize {
1535            16
1536        }
1537    }
1538
1539    unsafe impl<D: fidl::encoding::ResourceDialect>
1540        fidl::encoding::Encode<InstallerStartUpdateResponse, D> for &InstallerStartUpdateResponse
1541    {
1542        #[inline]
1543        unsafe fn encode(
1544            self,
1545            encoder: &mut fidl::encoding::Encoder<'_, D>,
1546            offset: usize,
1547            _depth: fidl::encoding::Depth,
1548        ) -> fidl::Result<()> {
1549            encoder.debug_check_bounds::<InstallerStartUpdateResponse>(offset);
1550            // Delegate to tuple encoding.
1551            fidl::encoding::Encode::<InstallerStartUpdateResponse, D>::encode(
1552                (<fidl::encoding::BoundedString<36> as fidl::encoding::ValueTypeMarker>::borrow(
1553                    &self.attempt_id,
1554                ),),
1555                encoder,
1556                offset,
1557                _depth,
1558            )
1559        }
1560    }
1561    unsafe impl<
1562            D: fidl::encoding::ResourceDialect,
1563            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<36>, D>,
1564        > fidl::encoding::Encode<InstallerStartUpdateResponse, D> for (T0,)
1565    {
1566        #[inline]
1567        unsafe fn encode(
1568            self,
1569            encoder: &mut fidl::encoding::Encoder<'_, D>,
1570            offset: usize,
1571            depth: fidl::encoding::Depth,
1572        ) -> fidl::Result<()> {
1573            encoder.debug_check_bounds::<InstallerStartUpdateResponse>(offset);
1574            // Zero out padding regions. There's no need to apply masks
1575            // because the unmasked parts will be overwritten by fields.
1576            // Write the fields.
1577            self.0.encode(encoder, offset + 0, depth)?;
1578            Ok(())
1579        }
1580    }
1581
1582    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1583        for InstallerStartUpdateResponse
1584    {
1585        #[inline(always)]
1586        fn new_empty() -> Self {
1587            Self { attempt_id: fidl::new_empty!(fidl::encoding::BoundedString<36>, D) }
1588        }
1589
1590        #[inline]
1591        unsafe fn decode(
1592            &mut self,
1593            decoder: &mut fidl::encoding::Decoder<'_, D>,
1594            offset: usize,
1595            _depth: fidl::encoding::Depth,
1596        ) -> fidl::Result<()> {
1597            decoder.debug_check_bounds::<Self>(offset);
1598            // Verify that padding bytes are zero.
1599            fidl::decode!(
1600                fidl::encoding::BoundedString<36>,
1601                D,
1602                &mut self.attempt_id,
1603                decoder,
1604                offset + 0,
1605                _depth
1606            )?;
1607            Ok(())
1608        }
1609    }
1610
1611    impl fidl::encoding::ValueTypeMarker for MonitorOnStateRequest {
1612        type Borrowed<'a> = &'a Self;
1613        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1614            value
1615        }
1616    }
1617
1618    unsafe impl fidl::encoding::TypeMarker for MonitorOnStateRequest {
1619        type Owned = Self;
1620
1621        #[inline(always)]
1622        fn inline_align(_context: fidl::encoding::Context) -> usize {
1623            8
1624        }
1625
1626        #[inline(always)]
1627        fn inline_size(_context: fidl::encoding::Context) -> usize {
1628            16
1629        }
1630    }
1631
1632    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MonitorOnStateRequest, D>
1633        for &MonitorOnStateRequest
1634    {
1635        #[inline]
1636        unsafe fn encode(
1637            self,
1638            encoder: &mut fidl::encoding::Encoder<'_, D>,
1639            offset: usize,
1640            _depth: fidl::encoding::Depth,
1641        ) -> fidl::Result<()> {
1642            encoder.debug_check_bounds::<MonitorOnStateRequest>(offset);
1643            // Delegate to tuple encoding.
1644            fidl::encoding::Encode::<MonitorOnStateRequest, D>::encode(
1645                (<State as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
1646                encoder,
1647                offset,
1648                _depth,
1649            )
1650        }
1651    }
1652    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<State, D>>
1653        fidl::encoding::Encode<MonitorOnStateRequest, D> for (T0,)
1654    {
1655        #[inline]
1656        unsafe fn encode(
1657            self,
1658            encoder: &mut fidl::encoding::Encoder<'_, D>,
1659            offset: usize,
1660            depth: fidl::encoding::Depth,
1661        ) -> fidl::Result<()> {
1662            encoder.debug_check_bounds::<MonitorOnStateRequest>(offset);
1663            // Zero out padding regions. There's no need to apply masks
1664            // because the unmasked parts will be overwritten by fields.
1665            // Write the fields.
1666            self.0.encode(encoder, offset + 0, depth)?;
1667            Ok(())
1668        }
1669    }
1670
1671    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MonitorOnStateRequest {
1672        #[inline(always)]
1673        fn new_empty() -> Self {
1674            Self { state: fidl::new_empty!(State, D) }
1675        }
1676
1677        #[inline]
1678        unsafe fn decode(
1679            &mut self,
1680            decoder: &mut fidl::encoding::Decoder<'_, D>,
1681            offset: usize,
1682            _depth: fidl::encoding::Depth,
1683        ) -> fidl::Result<()> {
1684            decoder.debug_check_bounds::<Self>(offset);
1685            // Verify that padding bytes are zero.
1686            fidl::decode!(State, D, &mut self.state, decoder, offset + 0, _depth)?;
1687            Ok(())
1688        }
1689    }
1690
1691    impl CanceledData {
1692        #[inline(always)]
1693        fn max_ordinal_present(&self) -> u64 {
1694            0
1695        }
1696    }
1697
1698    impl fidl::encoding::ValueTypeMarker for CanceledData {
1699        type Borrowed<'a> = &'a Self;
1700        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1701            value
1702        }
1703    }
1704
1705    unsafe impl fidl::encoding::TypeMarker for CanceledData {
1706        type Owned = Self;
1707
1708        #[inline(always)]
1709        fn inline_align(_context: fidl::encoding::Context) -> usize {
1710            8
1711        }
1712
1713        #[inline(always)]
1714        fn inline_size(_context: fidl::encoding::Context) -> usize {
1715            16
1716        }
1717    }
1718
1719    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CanceledData, D>
1720        for &CanceledData
1721    {
1722        unsafe fn encode(
1723            self,
1724            encoder: &mut fidl::encoding::Encoder<'_, D>,
1725            offset: usize,
1726            mut depth: fidl::encoding::Depth,
1727        ) -> fidl::Result<()> {
1728            encoder.debug_check_bounds::<CanceledData>(offset);
1729            // Vector header
1730            let max_ordinal: u64 = self.max_ordinal_present();
1731            encoder.write_num(max_ordinal, offset);
1732            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1733            // Calling encoder.out_of_line_offset(0) is not allowed.
1734            if max_ordinal == 0 {
1735                return Ok(());
1736            }
1737            depth.increment()?;
1738            let envelope_size = 8;
1739            let bytes_len = max_ordinal as usize * envelope_size;
1740            #[allow(unused_variables)]
1741            let offset = encoder.out_of_line_offset(bytes_len);
1742            let mut _prev_end_offset: usize = 0;
1743
1744            Ok(())
1745        }
1746    }
1747
1748    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CanceledData {
1749        #[inline(always)]
1750        fn new_empty() -> Self {
1751            Self::default()
1752        }
1753
1754        unsafe fn decode(
1755            &mut self,
1756            decoder: &mut fidl::encoding::Decoder<'_, D>,
1757            offset: usize,
1758            mut depth: fidl::encoding::Depth,
1759        ) -> fidl::Result<()> {
1760            decoder.debug_check_bounds::<Self>(offset);
1761            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1762                None => return Err(fidl::Error::NotNullable),
1763                Some(len) => len,
1764            };
1765            // Calling decoder.out_of_line_offset(0) is not allowed.
1766            if len == 0 {
1767                return Ok(());
1768            };
1769            depth.increment()?;
1770            let envelope_size = 8;
1771            let bytes_len = len * envelope_size;
1772            let offset = decoder.out_of_line_offset(bytes_len)?;
1773            // Decode the envelope for each type.
1774            let mut _next_ordinal_to_read = 0;
1775            let mut next_offset = offset;
1776            let end_offset = offset + bytes_len;
1777
1778            // Decode the remaining unknown envelopes.
1779            while next_offset < end_offset {
1780                _next_ordinal_to_read += 1;
1781                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1782                next_offset += envelope_size;
1783            }
1784
1785            Ok(())
1786        }
1787    }
1788
1789    impl CommitData {
1790        #[inline(always)]
1791        fn max_ordinal_present(&self) -> u64 {
1792            if let Some(_) = self.progress {
1793                return 2;
1794            }
1795            if let Some(_) = self.info {
1796                return 1;
1797            }
1798            0
1799        }
1800    }
1801
1802    impl fidl::encoding::ValueTypeMarker for CommitData {
1803        type Borrowed<'a> = &'a Self;
1804        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1805            value
1806        }
1807    }
1808
1809    unsafe impl fidl::encoding::TypeMarker for CommitData {
1810        type Owned = Self;
1811
1812        #[inline(always)]
1813        fn inline_align(_context: fidl::encoding::Context) -> usize {
1814            8
1815        }
1816
1817        #[inline(always)]
1818        fn inline_size(_context: fidl::encoding::Context) -> usize {
1819            16
1820        }
1821    }
1822
1823    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CommitData, D>
1824        for &CommitData
1825    {
1826        unsafe fn encode(
1827            self,
1828            encoder: &mut fidl::encoding::Encoder<'_, D>,
1829            offset: usize,
1830            mut depth: fidl::encoding::Depth,
1831        ) -> fidl::Result<()> {
1832            encoder.debug_check_bounds::<CommitData>(offset);
1833            // Vector header
1834            let max_ordinal: u64 = self.max_ordinal_present();
1835            encoder.write_num(max_ordinal, offset);
1836            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1837            // Calling encoder.out_of_line_offset(0) is not allowed.
1838            if max_ordinal == 0 {
1839                return Ok(());
1840            }
1841            depth.increment()?;
1842            let envelope_size = 8;
1843            let bytes_len = max_ordinal as usize * envelope_size;
1844            #[allow(unused_variables)]
1845            let offset = encoder.out_of_line_offset(bytes_len);
1846            let mut _prev_end_offset: usize = 0;
1847            if 1 > max_ordinal {
1848                return Ok(());
1849            }
1850
1851            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1852            // are envelope_size bytes.
1853            let cur_offset: usize = (1 - 1) * envelope_size;
1854
1855            // Zero reserved fields.
1856            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1857
1858            // Safety:
1859            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1860            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1861            //   envelope_size bytes, there is always sufficient room.
1862            fidl::encoding::encode_in_envelope_optional::<UpdateInfo, D>(
1863                self.info.as_ref().map(<UpdateInfo as fidl::encoding::ValueTypeMarker>::borrow),
1864                encoder,
1865                offset + cur_offset,
1866                depth,
1867            )?;
1868
1869            _prev_end_offset = cur_offset + envelope_size;
1870            if 2 > max_ordinal {
1871                return Ok(());
1872            }
1873
1874            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1875            // are envelope_size bytes.
1876            let cur_offset: usize = (2 - 1) * envelope_size;
1877
1878            // Zero reserved fields.
1879            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1880
1881            // Safety:
1882            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1883            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1884            //   envelope_size bytes, there is always sufficient room.
1885            fidl::encoding::encode_in_envelope_optional::<InstallationProgress, D>(
1886                self.progress
1887                    .as_ref()
1888                    .map(<InstallationProgress as fidl::encoding::ValueTypeMarker>::borrow),
1889                encoder,
1890                offset + cur_offset,
1891                depth,
1892            )?;
1893
1894            _prev_end_offset = cur_offset + envelope_size;
1895
1896            Ok(())
1897        }
1898    }
1899
1900    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CommitData {
1901        #[inline(always)]
1902        fn new_empty() -> Self {
1903            Self::default()
1904        }
1905
1906        unsafe fn decode(
1907            &mut self,
1908            decoder: &mut fidl::encoding::Decoder<'_, D>,
1909            offset: usize,
1910            mut depth: fidl::encoding::Depth,
1911        ) -> fidl::Result<()> {
1912            decoder.debug_check_bounds::<Self>(offset);
1913            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1914                None => return Err(fidl::Error::NotNullable),
1915                Some(len) => len,
1916            };
1917            // Calling decoder.out_of_line_offset(0) is not allowed.
1918            if len == 0 {
1919                return Ok(());
1920            };
1921            depth.increment()?;
1922            let envelope_size = 8;
1923            let bytes_len = len * envelope_size;
1924            let offset = decoder.out_of_line_offset(bytes_len)?;
1925            // Decode the envelope for each type.
1926            let mut _next_ordinal_to_read = 0;
1927            let mut next_offset = offset;
1928            let end_offset = offset + bytes_len;
1929            _next_ordinal_to_read += 1;
1930            if next_offset >= end_offset {
1931                return Ok(());
1932            }
1933
1934            // Decode unknown envelopes for gaps in ordinals.
1935            while _next_ordinal_to_read < 1 {
1936                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1937                _next_ordinal_to_read += 1;
1938                next_offset += envelope_size;
1939            }
1940
1941            let next_out_of_line = decoder.next_out_of_line();
1942            let handles_before = decoder.remaining_handles();
1943            if let Some((inlined, num_bytes, num_handles)) =
1944                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1945            {
1946                let member_inline_size =
1947                    <UpdateInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1948                if inlined != (member_inline_size <= 4) {
1949                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1950                }
1951                let inner_offset;
1952                let mut inner_depth = depth.clone();
1953                if inlined {
1954                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1955                    inner_offset = next_offset;
1956                } else {
1957                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1958                    inner_depth.increment()?;
1959                }
1960                let val_ref = self.info.get_or_insert_with(|| fidl::new_empty!(UpdateInfo, D));
1961                fidl::decode!(UpdateInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
1962                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1963                {
1964                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1965                }
1966                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1967                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1968                }
1969            }
1970
1971            next_offset += envelope_size;
1972            _next_ordinal_to_read += 1;
1973            if next_offset >= end_offset {
1974                return Ok(());
1975            }
1976
1977            // Decode unknown envelopes for gaps in ordinals.
1978            while _next_ordinal_to_read < 2 {
1979                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1980                _next_ordinal_to_read += 1;
1981                next_offset += envelope_size;
1982            }
1983
1984            let next_out_of_line = decoder.next_out_of_line();
1985            let handles_before = decoder.remaining_handles();
1986            if let Some((inlined, num_bytes, num_handles)) =
1987                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1988            {
1989                let member_inline_size =
1990                    <InstallationProgress as fidl::encoding::TypeMarker>::inline_size(
1991                        decoder.context,
1992                    );
1993                if inlined != (member_inline_size <= 4) {
1994                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1995                }
1996                let inner_offset;
1997                let mut inner_depth = depth.clone();
1998                if inlined {
1999                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2000                    inner_offset = next_offset;
2001                } else {
2002                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2003                    inner_depth.increment()?;
2004                }
2005                let val_ref =
2006                    self.progress.get_or_insert_with(|| fidl::new_empty!(InstallationProgress, D));
2007                fidl::decode!(
2008                    InstallationProgress,
2009                    D,
2010                    val_ref,
2011                    decoder,
2012                    inner_offset,
2013                    inner_depth
2014                )?;
2015                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2016                {
2017                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2018                }
2019                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2020                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2021                }
2022            }
2023
2024            next_offset += envelope_size;
2025
2026            // Decode the remaining unknown envelopes.
2027            while next_offset < end_offset {
2028                _next_ordinal_to_read += 1;
2029                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2030                next_offset += envelope_size;
2031            }
2032
2033            Ok(())
2034        }
2035    }
2036
2037    impl CompleteData {
2038        #[inline(always)]
2039        fn max_ordinal_present(&self) -> u64 {
2040            if let Some(_) = self.progress {
2041                return 2;
2042            }
2043            if let Some(_) = self.info {
2044                return 1;
2045            }
2046            0
2047        }
2048    }
2049
2050    impl fidl::encoding::ValueTypeMarker for CompleteData {
2051        type Borrowed<'a> = &'a Self;
2052        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2053            value
2054        }
2055    }
2056
2057    unsafe impl fidl::encoding::TypeMarker for CompleteData {
2058        type Owned = Self;
2059
2060        #[inline(always)]
2061        fn inline_align(_context: fidl::encoding::Context) -> usize {
2062            8
2063        }
2064
2065        #[inline(always)]
2066        fn inline_size(_context: fidl::encoding::Context) -> usize {
2067            16
2068        }
2069    }
2070
2071    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CompleteData, D>
2072        for &CompleteData
2073    {
2074        unsafe fn encode(
2075            self,
2076            encoder: &mut fidl::encoding::Encoder<'_, D>,
2077            offset: usize,
2078            mut depth: fidl::encoding::Depth,
2079        ) -> fidl::Result<()> {
2080            encoder.debug_check_bounds::<CompleteData>(offset);
2081            // Vector header
2082            let max_ordinal: u64 = self.max_ordinal_present();
2083            encoder.write_num(max_ordinal, offset);
2084            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2085            // Calling encoder.out_of_line_offset(0) is not allowed.
2086            if max_ordinal == 0 {
2087                return Ok(());
2088            }
2089            depth.increment()?;
2090            let envelope_size = 8;
2091            let bytes_len = max_ordinal as usize * envelope_size;
2092            #[allow(unused_variables)]
2093            let offset = encoder.out_of_line_offset(bytes_len);
2094            let mut _prev_end_offset: usize = 0;
2095            if 1 > max_ordinal {
2096                return Ok(());
2097            }
2098
2099            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2100            // are envelope_size bytes.
2101            let cur_offset: usize = (1 - 1) * envelope_size;
2102
2103            // Zero reserved fields.
2104            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2105
2106            // Safety:
2107            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2108            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2109            //   envelope_size bytes, there is always sufficient room.
2110            fidl::encoding::encode_in_envelope_optional::<UpdateInfo, D>(
2111                self.info.as_ref().map(<UpdateInfo as fidl::encoding::ValueTypeMarker>::borrow),
2112                encoder,
2113                offset + cur_offset,
2114                depth,
2115            )?;
2116
2117            _prev_end_offset = cur_offset + envelope_size;
2118            if 2 > max_ordinal {
2119                return Ok(());
2120            }
2121
2122            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2123            // are envelope_size bytes.
2124            let cur_offset: usize = (2 - 1) * envelope_size;
2125
2126            // Zero reserved fields.
2127            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2128
2129            // Safety:
2130            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2131            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2132            //   envelope_size bytes, there is always sufficient room.
2133            fidl::encoding::encode_in_envelope_optional::<InstallationProgress, D>(
2134                self.progress
2135                    .as_ref()
2136                    .map(<InstallationProgress as fidl::encoding::ValueTypeMarker>::borrow),
2137                encoder,
2138                offset + cur_offset,
2139                depth,
2140            )?;
2141
2142            _prev_end_offset = cur_offset + envelope_size;
2143
2144            Ok(())
2145        }
2146    }
2147
2148    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CompleteData {
2149        #[inline(always)]
2150        fn new_empty() -> Self {
2151            Self::default()
2152        }
2153
2154        unsafe fn decode(
2155            &mut self,
2156            decoder: &mut fidl::encoding::Decoder<'_, D>,
2157            offset: usize,
2158            mut depth: fidl::encoding::Depth,
2159        ) -> fidl::Result<()> {
2160            decoder.debug_check_bounds::<Self>(offset);
2161            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2162                None => return Err(fidl::Error::NotNullable),
2163                Some(len) => len,
2164            };
2165            // Calling decoder.out_of_line_offset(0) is not allowed.
2166            if len == 0 {
2167                return Ok(());
2168            };
2169            depth.increment()?;
2170            let envelope_size = 8;
2171            let bytes_len = len * envelope_size;
2172            let offset = decoder.out_of_line_offset(bytes_len)?;
2173            // Decode the envelope for each type.
2174            let mut _next_ordinal_to_read = 0;
2175            let mut next_offset = offset;
2176            let end_offset = offset + bytes_len;
2177            _next_ordinal_to_read += 1;
2178            if next_offset >= end_offset {
2179                return Ok(());
2180            }
2181
2182            // Decode unknown envelopes for gaps in ordinals.
2183            while _next_ordinal_to_read < 1 {
2184                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2185                _next_ordinal_to_read += 1;
2186                next_offset += envelope_size;
2187            }
2188
2189            let next_out_of_line = decoder.next_out_of_line();
2190            let handles_before = decoder.remaining_handles();
2191            if let Some((inlined, num_bytes, num_handles)) =
2192                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2193            {
2194                let member_inline_size =
2195                    <UpdateInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2196                if inlined != (member_inline_size <= 4) {
2197                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2198                }
2199                let inner_offset;
2200                let mut inner_depth = depth.clone();
2201                if inlined {
2202                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2203                    inner_offset = next_offset;
2204                } else {
2205                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2206                    inner_depth.increment()?;
2207                }
2208                let val_ref = self.info.get_or_insert_with(|| fidl::new_empty!(UpdateInfo, D));
2209                fidl::decode!(UpdateInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
2210                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2211                {
2212                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2213                }
2214                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2215                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2216                }
2217            }
2218
2219            next_offset += envelope_size;
2220            _next_ordinal_to_read += 1;
2221            if next_offset >= end_offset {
2222                return Ok(());
2223            }
2224
2225            // Decode unknown envelopes for gaps in ordinals.
2226            while _next_ordinal_to_read < 2 {
2227                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2228                _next_ordinal_to_read += 1;
2229                next_offset += envelope_size;
2230            }
2231
2232            let next_out_of_line = decoder.next_out_of_line();
2233            let handles_before = decoder.remaining_handles();
2234            if let Some((inlined, num_bytes, num_handles)) =
2235                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2236            {
2237                let member_inline_size =
2238                    <InstallationProgress as fidl::encoding::TypeMarker>::inline_size(
2239                        decoder.context,
2240                    );
2241                if inlined != (member_inline_size <= 4) {
2242                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2243                }
2244                let inner_offset;
2245                let mut inner_depth = depth.clone();
2246                if inlined {
2247                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2248                    inner_offset = next_offset;
2249                } else {
2250                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2251                    inner_depth.increment()?;
2252                }
2253                let val_ref =
2254                    self.progress.get_or_insert_with(|| fidl::new_empty!(InstallationProgress, D));
2255                fidl::decode!(
2256                    InstallationProgress,
2257                    D,
2258                    val_ref,
2259                    decoder,
2260                    inner_offset,
2261                    inner_depth
2262                )?;
2263                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2264                {
2265                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2266                }
2267                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2268                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2269                }
2270            }
2271
2272            next_offset += envelope_size;
2273
2274            // Decode the remaining unknown envelopes.
2275            while next_offset < end_offset {
2276                _next_ordinal_to_read += 1;
2277                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2278                next_offset += envelope_size;
2279            }
2280
2281            Ok(())
2282        }
2283    }
2284
2285    impl DeferRebootData {
2286        #[inline(always)]
2287        fn max_ordinal_present(&self) -> u64 {
2288            if let Some(_) = self.progress {
2289                return 2;
2290            }
2291            if let Some(_) = self.info {
2292                return 1;
2293            }
2294            0
2295        }
2296    }
2297
2298    impl fidl::encoding::ValueTypeMarker for DeferRebootData {
2299        type Borrowed<'a> = &'a Self;
2300        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2301            value
2302        }
2303    }
2304
2305    unsafe impl fidl::encoding::TypeMarker for DeferRebootData {
2306        type Owned = Self;
2307
2308        #[inline(always)]
2309        fn inline_align(_context: fidl::encoding::Context) -> usize {
2310            8
2311        }
2312
2313        #[inline(always)]
2314        fn inline_size(_context: fidl::encoding::Context) -> usize {
2315            16
2316        }
2317    }
2318
2319    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeferRebootData, D>
2320        for &DeferRebootData
2321    {
2322        unsafe fn encode(
2323            self,
2324            encoder: &mut fidl::encoding::Encoder<'_, D>,
2325            offset: usize,
2326            mut depth: fidl::encoding::Depth,
2327        ) -> fidl::Result<()> {
2328            encoder.debug_check_bounds::<DeferRebootData>(offset);
2329            // Vector header
2330            let max_ordinal: u64 = self.max_ordinal_present();
2331            encoder.write_num(max_ordinal, offset);
2332            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2333            // Calling encoder.out_of_line_offset(0) is not allowed.
2334            if max_ordinal == 0 {
2335                return Ok(());
2336            }
2337            depth.increment()?;
2338            let envelope_size = 8;
2339            let bytes_len = max_ordinal as usize * envelope_size;
2340            #[allow(unused_variables)]
2341            let offset = encoder.out_of_line_offset(bytes_len);
2342            let mut _prev_end_offset: usize = 0;
2343            if 1 > max_ordinal {
2344                return Ok(());
2345            }
2346
2347            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2348            // are envelope_size bytes.
2349            let cur_offset: usize = (1 - 1) * envelope_size;
2350
2351            // Zero reserved fields.
2352            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2353
2354            // Safety:
2355            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2356            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2357            //   envelope_size bytes, there is always sufficient room.
2358            fidl::encoding::encode_in_envelope_optional::<UpdateInfo, D>(
2359                self.info.as_ref().map(<UpdateInfo as fidl::encoding::ValueTypeMarker>::borrow),
2360                encoder,
2361                offset + cur_offset,
2362                depth,
2363            )?;
2364
2365            _prev_end_offset = cur_offset + envelope_size;
2366            if 2 > max_ordinal {
2367                return Ok(());
2368            }
2369
2370            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2371            // are envelope_size bytes.
2372            let cur_offset: usize = (2 - 1) * envelope_size;
2373
2374            // Zero reserved fields.
2375            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2376
2377            // Safety:
2378            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2379            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2380            //   envelope_size bytes, there is always sufficient room.
2381            fidl::encoding::encode_in_envelope_optional::<InstallationProgress, D>(
2382                self.progress
2383                    .as_ref()
2384                    .map(<InstallationProgress as fidl::encoding::ValueTypeMarker>::borrow),
2385                encoder,
2386                offset + cur_offset,
2387                depth,
2388            )?;
2389
2390            _prev_end_offset = cur_offset + envelope_size;
2391
2392            Ok(())
2393        }
2394    }
2395
2396    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeferRebootData {
2397        #[inline(always)]
2398        fn new_empty() -> Self {
2399            Self::default()
2400        }
2401
2402        unsafe fn decode(
2403            &mut self,
2404            decoder: &mut fidl::encoding::Decoder<'_, D>,
2405            offset: usize,
2406            mut depth: fidl::encoding::Depth,
2407        ) -> fidl::Result<()> {
2408            decoder.debug_check_bounds::<Self>(offset);
2409            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2410                None => return Err(fidl::Error::NotNullable),
2411                Some(len) => len,
2412            };
2413            // Calling decoder.out_of_line_offset(0) is not allowed.
2414            if len == 0 {
2415                return Ok(());
2416            };
2417            depth.increment()?;
2418            let envelope_size = 8;
2419            let bytes_len = len * envelope_size;
2420            let offset = decoder.out_of_line_offset(bytes_len)?;
2421            // Decode the envelope for each type.
2422            let mut _next_ordinal_to_read = 0;
2423            let mut next_offset = offset;
2424            let end_offset = offset + bytes_len;
2425            _next_ordinal_to_read += 1;
2426            if next_offset >= end_offset {
2427                return Ok(());
2428            }
2429
2430            // Decode unknown envelopes for gaps in ordinals.
2431            while _next_ordinal_to_read < 1 {
2432                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2433                _next_ordinal_to_read += 1;
2434                next_offset += envelope_size;
2435            }
2436
2437            let next_out_of_line = decoder.next_out_of_line();
2438            let handles_before = decoder.remaining_handles();
2439            if let Some((inlined, num_bytes, num_handles)) =
2440                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2441            {
2442                let member_inline_size =
2443                    <UpdateInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2444                if inlined != (member_inline_size <= 4) {
2445                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2446                }
2447                let inner_offset;
2448                let mut inner_depth = depth.clone();
2449                if inlined {
2450                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2451                    inner_offset = next_offset;
2452                } else {
2453                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2454                    inner_depth.increment()?;
2455                }
2456                let val_ref = self.info.get_or_insert_with(|| fidl::new_empty!(UpdateInfo, D));
2457                fidl::decode!(UpdateInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
2458                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2459                {
2460                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2461                }
2462                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2463                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2464                }
2465            }
2466
2467            next_offset += envelope_size;
2468            _next_ordinal_to_read += 1;
2469            if next_offset >= end_offset {
2470                return Ok(());
2471            }
2472
2473            // Decode unknown envelopes for gaps in ordinals.
2474            while _next_ordinal_to_read < 2 {
2475                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2476                _next_ordinal_to_read += 1;
2477                next_offset += envelope_size;
2478            }
2479
2480            let next_out_of_line = decoder.next_out_of_line();
2481            let handles_before = decoder.remaining_handles();
2482            if let Some((inlined, num_bytes, num_handles)) =
2483                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2484            {
2485                let member_inline_size =
2486                    <InstallationProgress as fidl::encoding::TypeMarker>::inline_size(
2487                        decoder.context,
2488                    );
2489                if inlined != (member_inline_size <= 4) {
2490                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2491                }
2492                let inner_offset;
2493                let mut inner_depth = depth.clone();
2494                if inlined {
2495                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2496                    inner_offset = next_offset;
2497                } else {
2498                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2499                    inner_depth.increment()?;
2500                }
2501                let val_ref =
2502                    self.progress.get_or_insert_with(|| fidl::new_empty!(InstallationProgress, D));
2503                fidl::decode!(
2504                    InstallationProgress,
2505                    D,
2506                    val_ref,
2507                    decoder,
2508                    inner_offset,
2509                    inner_depth
2510                )?;
2511                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2512                {
2513                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2514                }
2515                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2516                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2517                }
2518            }
2519
2520            next_offset += envelope_size;
2521
2522            // Decode the remaining unknown envelopes.
2523            while next_offset < end_offset {
2524                _next_ordinal_to_read += 1;
2525                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2526                next_offset += envelope_size;
2527            }
2528
2529            Ok(())
2530        }
2531    }
2532
2533    impl FailCommitData {
2534        #[inline(always)]
2535        fn max_ordinal_present(&self) -> u64 {
2536            if let Some(_) = self.progress {
2537                return 2;
2538            }
2539            if let Some(_) = self.info {
2540                return 1;
2541            }
2542            0
2543        }
2544    }
2545
2546    impl fidl::encoding::ValueTypeMarker for FailCommitData {
2547        type Borrowed<'a> = &'a Self;
2548        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2549            value
2550        }
2551    }
2552
2553    unsafe impl fidl::encoding::TypeMarker for FailCommitData {
2554        type Owned = Self;
2555
2556        #[inline(always)]
2557        fn inline_align(_context: fidl::encoding::Context) -> usize {
2558            8
2559        }
2560
2561        #[inline(always)]
2562        fn inline_size(_context: fidl::encoding::Context) -> usize {
2563            16
2564        }
2565    }
2566
2567    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FailCommitData, D>
2568        for &FailCommitData
2569    {
2570        unsafe fn encode(
2571            self,
2572            encoder: &mut fidl::encoding::Encoder<'_, D>,
2573            offset: usize,
2574            mut depth: fidl::encoding::Depth,
2575        ) -> fidl::Result<()> {
2576            encoder.debug_check_bounds::<FailCommitData>(offset);
2577            // Vector header
2578            let max_ordinal: u64 = self.max_ordinal_present();
2579            encoder.write_num(max_ordinal, offset);
2580            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2581            // Calling encoder.out_of_line_offset(0) is not allowed.
2582            if max_ordinal == 0 {
2583                return Ok(());
2584            }
2585            depth.increment()?;
2586            let envelope_size = 8;
2587            let bytes_len = max_ordinal as usize * envelope_size;
2588            #[allow(unused_variables)]
2589            let offset = encoder.out_of_line_offset(bytes_len);
2590            let mut _prev_end_offset: usize = 0;
2591            if 1 > max_ordinal {
2592                return Ok(());
2593            }
2594
2595            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2596            // are envelope_size bytes.
2597            let cur_offset: usize = (1 - 1) * envelope_size;
2598
2599            // Zero reserved fields.
2600            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2601
2602            // Safety:
2603            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2604            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2605            //   envelope_size bytes, there is always sufficient room.
2606            fidl::encoding::encode_in_envelope_optional::<UpdateInfo, D>(
2607                self.info.as_ref().map(<UpdateInfo as fidl::encoding::ValueTypeMarker>::borrow),
2608                encoder,
2609                offset + cur_offset,
2610                depth,
2611            )?;
2612
2613            _prev_end_offset = cur_offset + envelope_size;
2614            if 2 > max_ordinal {
2615                return Ok(());
2616            }
2617
2618            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2619            // are envelope_size bytes.
2620            let cur_offset: usize = (2 - 1) * envelope_size;
2621
2622            // Zero reserved fields.
2623            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2624
2625            // Safety:
2626            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2627            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2628            //   envelope_size bytes, there is always sufficient room.
2629            fidl::encoding::encode_in_envelope_optional::<InstallationProgress, D>(
2630                self.progress
2631                    .as_ref()
2632                    .map(<InstallationProgress as fidl::encoding::ValueTypeMarker>::borrow),
2633                encoder,
2634                offset + cur_offset,
2635                depth,
2636            )?;
2637
2638            _prev_end_offset = cur_offset + envelope_size;
2639
2640            Ok(())
2641        }
2642    }
2643
2644    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FailCommitData {
2645        #[inline(always)]
2646        fn new_empty() -> Self {
2647            Self::default()
2648        }
2649
2650        unsafe fn decode(
2651            &mut self,
2652            decoder: &mut fidl::encoding::Decoder<'_, D>,
2653            offset: usize,
2654            mut depth: fidl::encoding::Depth,
2655        ) -> fidl::Result<()> {
2656            decoder.debug_check_bounds::<Self>(offset);
2657            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2658                None => return Err(fidl::Error::NotNullable),
2659                Some(len) => len,
2660            };
2661            // Calling decoder.out_of_line_offset(0) is not allowed.
2662            if len == 0 {
2663                return Ok(());
2664            };
2665            depth.increment()?;
2666            let envelope_size = 8;
2667            let bytes_len = len * envelope_size;
2668            let offset = decoder.out_of_line_offset(bytes_len)?;
2669            // Decode the envelope for each type.
2670            let mut _next_ordinal_to_read = 0;
2671            let mut next_offset = offset;
2672            let end_offset = offset + bytes_len;
2673            _next_ordinal_to_read += 1;
2674            if next_offset >= end_offset {
2675                return Ok(());
2676            }
2677
2678            // Decode unknown envelopes for gaps in ordinals.
2679            while _next_ordinal_to_read < 1 {
2680                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2681                _next_ordinal_to_read += 1;
2682                next_offset += envelope_size;
2683            }
2684
2685            let next_out_of_line = decoder.next_out_of_line();
2686            let handles_before = decoder.remaining_handles();
2687            if let Some((inlined, num_bytes, num_handles)) =
2688                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2689            {
2690                let member_inline_size =
2691                    <UpdateInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2692                if inlined != (member_inline_size <= 4) {
2693                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2694                }
2695                let inner_offset;
2696                let mut inner_depth = depth.clone();
2697                if inlined {
2698                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2699                    inner_offset = next_offset;
2700                } else {
2701                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2702                    inner_depth.increment()?;
2703                }
2704                let val_ref = self.info.get_or_insert_with(|| fidl::new_empty!(UpdateInfo, D));
2705                fidl::decode!(UpdateInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
2706                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2707                {
2708                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2709                }
2710                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2711                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2712                }
2713            }
2714
2715            next_offset += envelope_size;
2716            _next_ordinal_to_read += 1;
2717            if next_offset >= end_offset {
2718                return Ok(());
2719            }
2720
2721            // Decode unknown envelopes for gaps in ordinals.
2722            while _next_ordinal_to_read < 2 {
2723                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2724                _next_ordinal_to_read += 1;
2725                next_offset += envelope_size;
2726            }
2727
2728            let next_out_of_line = decoder.next_out_of_line();
2729            let handles_before = decoder.remaining_handles();
2730            if let Some((inlined, num_bytes, num_handles)) =
2731                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2732            {
2733                let member_inline_size =
2734                    <InstallationProgress as fidl::encoding::TypeMarker>::inline_size(
2735                        decoder.context,
2736                    );
2737                if inlined != (member_inline_size <= 4) {
2738                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2739                }
2740                let inner_offset;
2741                let mut inner_depth = depth.clone();
2742                if inlined {
2743                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2744                    inner_offset = next_offset;
2745                } else {
2746                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2747                    inner_depth.increment()?;
2748                }
2749                let val_ref =
2750                    self.progress.get_or_insert_with(|| fidl::new_empty!(InstallationProgress, D));
2751                fidl::decode!(
2752                    InstallationProgress,
2753                    D,
2754                    val_ref,
2755                    decoder,
2756                    inner_offset,
2757                    inner_depth
2758                )?;
2759                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2760                {
2761                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2762                }
2763                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2764                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2765                }
2766            }
2767
2768            next_offset += envelope_size;
2769
2770            // Decode the remaining unknown envelopes.
2771            while next_offset < end_offset {
2772                _next_ordinal_to_read += 1;
2773                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2774                next_offset += envelope_size;
2775            }
2776
2777            Ok(())
2778        }
2779    }
2780
2781    impl FailFetchData {
2782        #[inline(always)]
2783        fn max_ordinal_present(&self) -> u64 {
2784            if let Some(_) = self.reason {
2785                return 3;
2786            }
2787            if let Some(_) = self.progress {
2788                return 2;
2789            }
2790            if let Some(_) = self.info {
2791                return 1;
2792            }
2793            0
2794        }
2795    }
2796
2797    impl fidl::encoding::ValueTypeMarker for FailFetchData {
2798        type Borrowed<'a> = &'a Self;
2799        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2800            value
2801        }
2802    }
2803
2804    unsafe impl fidl::encoding::TypeMarker for FailFetchData {
2805        type Owned = Self;
2806
2807        #[inline(always)]
2808        fn inline_align(_context: fidl::encoding::Context) -> usize {
2809            8
2810        }
2811
2812        #[inline(always)]
2813        fn inline_size(_context: fidl::encoding::Context) -> usize {
2814            16
2815        }
2816    }
2817
2818    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FailFetchData, D>
2819        for &FailFetchData
2820    {
2821        unsafe fn encode(
2822            self,
2823            encoder: &mut fidl::encoding::Encoder<'_, D>,
2824            offset: usize,
2825            mut depth: fidl::encoding::Depth,
2826        ) -> fidl::Result<()> {
2827            encoder.debug_check_bounds::<FailFetchData>(offset);
2828            // Vector header
2829            let max_ordinal: u64 = self.max_ordinal_present();
2830            encoder.write_num(max_ordinal, offset);
2831            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2832            // Calling encoder.out_of_line_offset(0) is not allowed.
2833            if max_ordinal == 0 {
2834                return Ok(());
2835            }
2836            depth.increment()?;
2837            let envelope_size = 8;
2838            let bytes_len = max_ordinal as usize * envelope_size;
2839            #[allow(unused_variables)]
2840            let offset = encoder.out_of_line_offset(bytes_len);
2841            let mut _prev_end_offset: usize = 0;
2842            if 1 > max_ordinal {
2843                return Ok(());
2844            }
2845
2846            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2847            // are envelope_size bytes.
2848            let cur_offset: usize = (1 - 1) * envelope_size;
2849
2850            // Zero reserved fields.
2851            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2852
2853            // Safety:
2854            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2855            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2856            //   envelope_size bytes, there is always sufficient room.
2857            fidl::encoding::encode_in_envelope_optional::<UpdateInfo, D>(
2858                self.info.as_ref().map(<UpdateInfo as fidl::encoding::ValueTypeMarker>::borrow),
2859                encoder,
2860                offset + cur_offset,
2861                depth,
2862            )?;
2863
2864            _prev_end_offset = cur_offset + envelope_size;
2865            if 2 > max_ordinal {
2866                return Ok(());
2867            }
2868
2869            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2870            // are envelope_size bytes.
2871            let cur_offset: usize = (2 - 1) * envelope_size;
2872
2873            // Zero reserved fields.
2874            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2875
2876            // Safety:
2877            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2878            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2879            //   envelope_size bytes, there is always sufficient room.
2880            fidl::encoding::encode_in_envelope_optional::<InstallationProgress, D>(
2881                self.progress
2882                    .as_ref()
2883                    .map(<InstallationProgress as fidl::encoding::ValueTypeMarker>::borrow),
2884                encoder,
2885                offset + cur_offset,
2886                depth,
2887            )?;
2888
2889            _prev_end_offset = cur_offset + envelope_size;
2890            if 3 > max_ordinal {
2891                return Ok(());
2892            }
2893
2894            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2895            // are envelope_size bytes.
2896            let cur_offset: usize = (3 - 1) * envelope_size;
2897
2898            // Zero reserved fields.
2899            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2900
2901            // Safety:
2902            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2903            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2904            //   envelope_size bytes, there is always sufficient room.
2905            fidl::encoding::encode_in_envelope_optional::<FetchFailureReason, D>(
2906                self.reason
2907                    .as_ref()
2908                    .map(<FetchFailureReason as fidl::encoding::ValueTypeMarker>::borrow),
2909                encoder,
2910                offset + cur_offset,
2911                depth,
2912            )?;
2913
2914            _prev_end_offset = cur_offset + envelope_size;
2915
2916            Ok(())
2917        }
2918    }
2919
2920    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FailFetchData {
2921        #[inline(always)]
2922        fn new_empty() -> Self {
2923            Self::default()
2924        }
2925
2926        unsafe fn decode(
2927            &mut self,
2928            decoder: &mut fidl::encoding::Decoder<'_, D>,
2929            offset: usize,
2930            mut depth: fidl::encoding::Depth,
2931        ) -> fidl::Result<()> {
2932            decoder.debug_check_bounds::<Self>(offset);
2933            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2934                None => return Err(fidl::Error::NotNullable),
2935                Some(len) => len,
2936            };
2937            // Calling decoder.out_of_line_offset(0) is not allowed.
2938            if len == 0 {
2939                return Ok(());
2940            };
2941            depth.increment()?;
2942            let envelope_size = 8;
2943            let bytes_len = len * envelope_size;
2944            let offset = decoder.out_of_line_offset(bytes_len)?;
2945            // Decode the envelope for each type.
2946            let mut _next_ordinal_to_read = 0;
2947            let mut next_offset = offset;
2948            let end_offset = offset + bytes_len;
2949            _next_ordinal_to_read += 1;
2950            if next_offset >= end_offset {
2951                return Ok(());
2952            }
2953
2954            // Decode unknown envelopes for gaps in ordinals.
2955            while _next_ordinal_to_read < 1 {
2956                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2957                _next_ordinal_to_read += 1;
2958                next_offset += envelope_size;
2959            }
2960
2961            let next_out_of_line = decoder.next_out_of_line();
2962            let handles_before = decoder.remaining_handles();
2963            if let Some((inlined, num_bytes, num_handles)) =
2964                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2965            {
2966                let member_inline_size =
2967                    <UpdateInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2968                if inlined != (member_inline_size <= 4) {
2969                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2970                }
2971                let inner_offset;
2972                let mut inner_depth = depth.clone();
2973                if inlined {
2974                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2975                    inner_offset = next_offset;
2976                } else {
2977                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2978                    inner_depth.increment()?;
2979                }
2980                let val_ref = self.info.get_or_insert_with(|| fidl::new_empty!(UpdateInfo, D));
2981                fidl::decode!(UpdateInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
2982                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2983                {
2984                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2985                }
2986                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2987                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2988                }
2989            }
2990
2991            next_offset += envelope_size;
2992            _next_ordinal_to_read += 1;
2993            if next_offset >= end_offset {
2994                return Ok(());
2995            }
2996
2997            // Decode unknown envelopes for gaps in ordinals.
2998            while _next_ordinal_to_read < 2 {
2999                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3000                _next_ordinal_to_read += 1;
3001                next_offset += envelope_size;
3002            }
3003
3004            let next_out_of_line = decoder.next_out_of_line();
3005            let handles_before = decoder.remaining_handles();
3006            if let Some((inlined, num_bytes, num_handles)) =
3007                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3008            {
3009                let member_inline_size =
3010                    <InstallationProgress as fidl::encoding::TypeMarker>::inline_size(
3011                        decoder.context,
3012                    );
3013                if inlined != (member_inline_size <= 4) {
3014                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3015                }
3016                let inner_offset;
3017                let mut inner_depth = depth.clone();
3018                if inlined {
3019                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3020                    inner_offset = next_offset;
3021                } else {
3022                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3023                    inner_depth.increment()?;
3024                }
3025                let val_ref =
3026                    self.progress.get_or_insert_with(|| fidl::new_empty!(InstallationProgress, D));
3027                fidl::decode!(
3028                    InstallationProgress,
3029                    D,
3030                    val_ref,
3031                    decoder,
3032                    inner_offset,
3033                    inner_depth
3034                )?;
3035                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3036                {
3037                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3038                }
3039                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3040                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3041                }
3042            }
3043
3044            next_offset += envelope_size;
3045            _next_ordinal_to_read += 1;
3046            if next_offset >= end_offset {
3047                return Ok(());
3048            }
3049
3050            // Decode unknown envelopes for gaps in ordinals.
3051            while _next_ordinal_to_read < 3 {
3052                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3053                _next_ordinal_to_read += 1;
3054                next_offset += envelope_size;
3055            }
3056
3057            let next_out_of_line = decoder.next_out_of_line();
3058            let handles_before = decoder.remaining_handles();
3059            if let Some((inlined, num_bytes, num_handles)) =
3060                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3061            {
3062                let member_inline_size =
3063                    <FetchFailureReason as fidl::encoding::TypeMarker>::inline_size(
3064                        decoder.context,
3065                    );
3066                if inlined != (member_inline_size <= 4) {
3067                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3068                }
3069                let inner_offset;
3070                let mut inner_depth = depth.clone();
3071                if inlined {
3072                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3073                    inner_offset = next_offset;
3074                } else {
3075                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3076                    inner_depth.increment()?;
3077                }
3078                let val_ref =
3079                    self.reason.get_or_insert_with(|| fidl::new_empty!(FetchFailureReason, D));
3080                fidl::decode!(FetchFailureReason, D, val_ref, decoder, inner_offset, inner_depth)?;
3081                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3082                {
3083                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3084                }
3085                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3086                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3087                }
3088            }
3089
3090            next_offset += envelope_size;
3091
3092            // Decode the remaining unknown envelopes.
3093            while next_offset < end_offset {
3094                _next_ordinal_to_read += 1;
3095                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3096                next_offset += envelope_size;
3097            }
3098
3099            Ok(())
3100        }
3101    }
3102
3103    impl FailPrepareData {
3104        #[inline(always)]
3105        fn max_ordinal_present(&self) -> u64 {
3106            if let Some(_) = self.reason {
3107                return 1;
3108            }
3109            0
3110        }
3111    }
3112
3113    impl fidl::encoding::ValueTypeMarker for FailPrepareData {
3114        type Borrowed<'a> = &'a Self;
3115        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3116            value
3117        }
3118    }
3119
3120    unsafe impl fidl::encoding::TypeMarker for FailPrepareData {
3121        type Owned = Self;
3122
3123        #[inline(always)]
3124        fn inline_align(_context: fidl::encoding::Context) -> usize {
3125            8
3126        }
3127
3128        #[inline(always)]
3129        fn inline_size(_context: fidl::encoding::Context) -> usize {
3130            16
3131        }
3132    }
3133
3134    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FailPrepareData, D>
3135        for &FailPrepareData
3136    {
3137        unsafe fn encode(
3138            self,
3139            encoder: &mut fidl::encoding::Encoder<'_, D>,
3140            offset: usize,
3141            mut depth: fidl::encoding::Depth,
3142        ) -> fidl::Result<()> {
3143            encoder.debug_check_bounds::<FailPrepareData>(offset);
3144            // Vector header
3145            let max_ordinal: u64 = self.max_ordinal_present();
3146            encoder.write_num(max_ordinal, offset);
3147            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3148            // Calling encoder.out_of_line_offset(0) is not allowed.
3149            if max_ordinal == 0 {
3150                return Ok(());
3151            }
3152            depth.increment()?;
3153            let envelope_size = 8;
3154            let bytes_len = max_ordinal as usize * envelope_size;
3155            #[allow(unused_variables)]
3156            let offset = encoder.out_of_line_offset(bytes_len);
3157            let mut _prev_end_offset: usize = 0;
3158            if 1 > max_ordinal {
3159                return Ok(());
3160            }
3161
3162            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3163            // are envelope_size bytes.
3164            let cur_offset: usize = (1 - 1) * envelope_size;
3165
3166            // Zero reserved fields.
3167            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3168
3169            // Safety:
3170            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3171            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3172            //   envelope_size bytes, there is always sufficient room.
3173            fidl::encoding::encode_in_envelope_optional::<PrepareFailureReason, D>(
3174                self.reason
3175                    .as_ref()
3176                    .map(<PrepareFailureReason as fidl::encoding::ValueTypeMarker>::borrow),
3177                encoder,
3178                offset + cur_offset,
3179                depth,
3180            )?;
3181
3182            _prev_end_offset = cur_offset + envelope_size;
3183
3184            Ok(())
3185        }
3186    }
3187
3188    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FailPrepareData {
3189        #[inline(always)]
3190        fn new_empty() -> Self {
3191            Self::default()
3192        }
3193
3194        unsafe fn decode(
3195            &mut self,
3196            decoder: &mut fidl::encoding::Decoder<'_, D>,
3197            offset: usize,
3198            mut depth: fidl::encoding::Depth,
3199        ) -> fidl::Result<()> {
3200            decoder.debug_check_bounds::<Self>(offset);
3201            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3202                None => return Err(fidl::Error::NotNullable),
3203                Some(len) => len,
3204            };
3205            // Calling decoder.out_of_line_offset(0) is not allowed.
3206            if len == 0 {
3207                return Ok(());
3208            };
3209            depth.increment()?;
3210            let envelope_size = 8;
3211            let bytes_len = len * envelope_size;
3212            let offset = decoder.out_of_line_offset(bytes_len)?;
3213            // Decode the envelope for each type.
3214            let mut _next_ordinal_to_read = 0;
3215            let mut next_offset = offset;
3216            let end_offset = offset + bytes_len;
3217            _next_ordinal_to_read += 1;
3218            if next_offset >= end_offset {
3219                return Ok(());
3220            }
3221
3222            // Decode unknown envelopes for gaps in ordinals.
3223            while _next_ordinal_to_read < 1 {
3224                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3225                _next_ordinal_to_read += 1;
3226                next_offset += envelope_size;
3227            }
3228
3229            let next_out_of_line = decoder.next_out_of_line();
3230            let handles_before = decoder.remaining_handles();
3231            if let Some((inlined, num_bytes, num_handles)) =
3232                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3233            {
3234                let member_inline_size =
3235                    <PrepareFailureReason as fidl::encoding::TypeMarker>::inline_size(
3236                        decoder.context,
3237                    );
3238                if inlined != (member_inline_size <= 4) {
3239                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3240                }
3241                let inner_offset;
3242                let mut inner_depth = depth.clone();
3243                if inlined {
3244                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3245                    inner_offset = next_offset;
3246                } else {
3247                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3248                    inner_depth.increment()?;
3249                }
3250                let val_ref =
3251                    self.reason.get_or_insert_with(|| fidl::new_empty!(PrepareFailureReason, D));
3252                fidl::decode!(
3253                    PrepareFailureReason,
3254                    D,
3255                    val_ref,
3256                    decoder,
3257                    inner_offset,
3258                    inner_depth
3259                )?;
3260                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3261                {
3262                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3263                }
3264                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3265                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3266                }
3267            }
3268
3269            next_offset += envelope_size;
3270
3271            // Decode the remaining unknown envelopes.
3272            while next_offset < end_offset {
3273                _next_ordinal_to_read += 1;
3274                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3275                next_offset += envelope_size;
3276            }
3277
3278            Ok(())
3279        }
3280    }
3281
3282    impl FailStageData {
3283        #[inline(always)]
3284        fn max_ordinal_present(&self) -> u64 {
3285            if let Some(_) = self.reason {
3286                return 3;
3287            }
3288            if let Some(_) = self.progress {
3289                return 2;
3290            }
3291            if let Some(_) = self.info {
3292                return 1;
3293            }
3294            0
3295        }
3296    }
3297
3298    impl fidl::encoding::ValueTypeMarker for FailStageData {
3299        type Borrowed<'a> = &'a Self;
3300        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3301            value
3302        }
3303    }
3304
3305    unsafe impl fidl::encoding::TypeMarker for FailStageData {
3306        type Owned = Self;
3307
3308        #[inline(always)]
3309        fn inline_align(_context: fidl::encoding::Context) -> usize {
3310            8
3311        }
3312
3313        #[inline(always)]
3314        fn inline_size(_context: fidl::encoding::Context) -> usize {
3315            16
3316        }
3317    }
3318
3319    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FailStageData, D>
3320        for &FailStageData
3321    {
3322        unsafe fn encode(
3323            self,
3324            encoder: &mut fidl::encoding::Encoder<'_, D>,
3325            offset: usize,
3326            mut depth: fidl::encoding::Depth,
3327        ) -> fidl::Result<()> {
3328            encoder.debug_check_bounds::<FailStageData>(offset);
3329            // Vector header
3330            let max_ordinal: u64 = self.max_ordinal_present();
3331            encoder.write_num(max_ordinal, offset);
3332            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3333            // Calling encoder.out_of_line_offset(0) is not allowed.
3334            if max_ordinal == 0 {
3335                return Ok(());
3336            }
3337            depth.increment()?;
3338            let envelope_size = 8;
3339            let bytes_len = max_ordinal as usize * envelope_size;
3340            #[allow(unused_variables)]
3341            let offset = encoder.out_of_line_offset(bytes_len);
3342            let mut _prev_end_offset: usize = 0;
3343            if 1 > max_ordinal {
3344                return Ok(());
3345            }
3346
3347            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3348            // are envelope_size bytes.
3349            let cur_offset: usize = (1 - 1) * envelope_size;
3350
3351            // Zero reserved fields.
3352            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3353
3354            // Safety:
3355            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3356            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3357            //   envelope_size bytes, there is always sufficient room.
3358            fidl::encoding::encode_in_envelope_optional::<UpdateInfo, D>(
3359                self.info.as_ref().map(<UpdateInfo as fidl::encoding::ValueTypeMarker>::borrow),
3360                encoder,
3361                offset + cur_offset,
3362                depth,
3363            )?;
3364
3365            _prev_end_offset = cur_offset + envelope_size;
3366            if 2 > max_ordinal {
3367                return Ok(());
3368            }
3369
3370            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3371            // are envelope_size bytes.
3372            let cur_offset: usize = (2 - 1) * envelope_size;
3373
3374            // Zero reserved fields.
3375            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3376
3377            // Safety:
3378            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3379            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3380            //   envelope_size bytes, there is always sufficient room.
3381            fidl::encoding::encode_in_envelope_optional::<InstallationProgress, D>(
3382                self.progress
3383                    .as_ref()
3384                    .map(<InstallationProgress as fidl::encoding::ValueTypeMarker>::borrow),
3385                encoder,
3386                offset + cur_offset,
3387                depth,
3388            )?;
3389
3390            _prev_end_offset = cur_offset + envelope_size;
3391            if 3 > max_ordinal {
3392                return Ok(());
3393            }
3394
3395            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3396            // are envelope_size bytes.
3397            let cur_offset: usize = (3 - 1) * envelope_size;
3398
3399            // Zero reserved fields.
3400            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3401
3402            // Safety:
3403            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3404            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3405            //   envelope_size bytes, there is always sufficient room.
3406            fidl::encoding::encode_in_envelope_optional::<StageFailureReason, D>(
3407                self.reason
3408                    .as_ref()
3409                    .map(<StageFailureReason as fidl::encoding::ValueTypeMarker>::borrow),
3410                encoder,
3411                offset + cur_offset,
3412                depth,
3413            )?;
3414
3415            _prev_end_offset = cur_offset + envelope_size;
3416
3417            Ok(())
3418        }
3419    }
3420
3421    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FailStageData {
3422        #[inline(always)]
3423        fn new_empty() -> Self {
3424            Self::default()
3425        }
3426
3427        unsafe fn decode(
3428            &mut self,
3429            decoder: &mut fidl::encoding::Decoder<'_, D>,
3430            offset: usize,
3431            mut depth: fidl::encoding::Depth,
3432        ) -> fidl::Result<()> {
3433            decoder.debug_check_bounds::<Self>(offset);
3434            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3435                None => return Err(fidl::Error::NotNullable),
3436                Some(len) => len,
3437            };
3438            // Calling decoder.out_of_line_offset(0) is not allowed.
3439            if len == 0 {
3440                return Ok(());
3441            };
3442            depth.increment()?;
3443            let envelope_size = 8;
3444            let bytes_len = len * envelope_size;
3445            let offset = decoder.out_of_line_offset(bytes_len)?;
3446            // Decode the envelope for each type.
3447            let mut _next_ordinal_to_read = 0;
3448            let mut next_offset = offset;
3449            let end_offset = offset + bytes_len;
3450            _next_ordinal_to_read += 1;
3451            if next_offset >= end_offset {
3452                return Ok(());
3453            }
3454
3455            // Decode unknown envelopes for gaps in ordinals.
3456            while _next_ordinal_to_read < 1 {
3457                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3458                _next_ordinal_to_read += 1;
3459                next_offset += envelope_size;
3460            }
3461
3462            let next_out_of_line = decoder.next_out_of_line();
3463            let handles_before = decoder.remaining_handles();
3464            if let Some((inlined, num_bytes, num_handles)) =
3465                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3466            {
3467                let member_inline_size =
3468                    <UpdateInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3469                if inlined != (member_inline_size <= 4) {
3470                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3471                }
3472                let inner_offset;
3473                let mut inner_depth = depth.clone();
3474                if inlined {
3475                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3476                    inner_offset = next_offset;
3477                } else {
3478                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3479                    inner_depth.increment()?;
3480                }
3481                let val_ref = self.info.get_or_insert_with(|| fidl::new_empty!(UpdateInfo, D));
3482                fidl::decode!(UpdateInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
3483                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3484                {
3485                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3486                }
3487                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3488                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3489                }
3490            }
3491
3492            next_offset += envelope_size;
3493            _next_ordinal_to_read += 1;
3494            if next_offset >= end_offset {
3495                return Ok(());
3496            }
3497
3498            // Decode unknown envelopes for gaps in ordinals.
3499            while _next_ordinal_to_read < 2 {
3500                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3501                _next_ordinal_to_read += 1;
3502                next_offset += envelope_size;
3503            }
3504
3505            let next_out_of_line = decoder.next_out_of_line();
3506            let handles_before = decoder.remaining_handles();
3507            if let Some((inlined, num_bytes, num_handles)) =
3508                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3509            {
3510                let member_inline_size =
3511                    <InstallationProgress as fidl::encoding::TypeMarker>::inline_size(
3512                        decoder.context,
3513                    );
3514                if inlined != (member_inline_size <= 4) {
3515                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3516                }
3517                let inner_offset;
3518                let mut inner_depth = depth.clone();
3519                if inlined {
3520                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3521                    inner_offset = next_offset;
3522                } else {
3523                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3524                    inner_depth.increment()?;
3525                }
3526                let val_ref =
3527                    self.progress.get_or_insert_with(|| fidl::new_empty!(InstallationProgress, D));
3528                fidl::decode!(
3529                    InstallationProgress,
3530                    D,
3531                    val_ref,
3532                    decoder,
3533                    inner_offset,
3534                    inner_depth
3535                )?;
3536                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3537                {
3538                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3539                }
3540                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3541                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3542                }
3543            }
3544
3545            next_offset += envelope_size;
3546            _next_ordinal_to_read += 1;
3547            if next_offset >= end_offset {
3548                return Ok(());
3549            }
3550
3551            // Decode unknown envelopes for gaps in ordinals.
3552            while _next_ordinal_to_read < 3 {
3553                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3554                _next_ordinal_to_read += 1;
3555                next_offset += envelope_size;
3556            }
3557
3558            let next_out_of_line = decoder.next_out_of_line();
3559            let handles_before = decoder.remaining_handles();
3560            if let Some((inlined, num_bytes, num_handles)) =
3561                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3562            {
3563                let member_inline_size =
3564                    <StageFailureReason as fidl::encoding::TypeMarker>::inline_size(
3565                        decoder.context,
3566                    );
3567                if inlined != (member_inline_size <= 4) {
3568                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3569                }
3570                let inner_offset;
3571                let mut inner_depth = depth.clone();
3572                if inlined {
3573                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3574                    inner_offset = next_offset;
3575                } else {
3576                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3577                    inner_depth.increment()?;
3578                }
3579                let val_ref =
3580                    self.reason.get_or_insert_with(|| fidl::new_empty!(StageFailureReason, D));
3581                fidl::decode!(StageFailureReason, D, val_ref, decoder, inner_offset, inner_depth)?;
3582                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3583                {
3584                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3585                }
3586                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3587                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3588                }
3589            }
3590
3591            next_offset += envelope_size;
3592
3593            // Decode the remaining unknown envelopes.
3594            while next_offset < end_offset {
3595                _next_ordinal_to_read += 1;
3596                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3597                next_offset += envelope_size;
3598            }
3599
3600            Ok(())
3601        }
3602    }
3603
3604    impl FetchData {
3605        #[inline(always)]
3606        fn max_ordinal_present(&self) -> u64 {
3607            if let Some(_) = self.progress {
3608                return 2;
3609            }
3610            if let Some(_) = self.info {
3611                return 1;
3612            }
3613            0
3614        }
3615    }
3616
3617    impl fidl::encoding::ValueTypeMarker for FetchData {
3618        type Borrowed<'a> = &'a Self;
3619        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3620            value
3621        }
3622    }
3623
3624    unsafe impl fidl::encoding::TypeMarker for FetchData {
3625        type Owned = Self;
3626
3627        #[inline(always)]
3628        fn inline_align(_context: fidl::encoding::Context) -> usize {
3629            8
3630        }
3631
3632        #[inline(always)]
3633        fn inline_size(_context: fidl::encoding::Context) -> usize {
3634            16
3635        }
3636    }
3637
3638    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FetchData, D>
3639        for &FetchData
3640    {
3641        unsafe fn encode(
3642            self,
3643            encoder: &mut fidl::encoding::Encoder<'_, D>,
3644            offset: usize,
3645            mut depth: fidl::encoding::Depth,
3646        ) -> fidl::Result<()> {
3647            encoder.debug_check_bounds::<FetchData>(offset);
3648            // Vector header
3649            let max_ordinal: u64 = self.max_ordinal_present();
3650            encoder.write_num(max_ordinal, offset);
3651            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3652            // Calling encoder.out_of_line_offset(0) is not allowed.
3653            if max_ordinal == 0 {
3654                return Ok(());
3655            }
3656            depth.increment()?;
3657            let envelope_size = 8;
3658            let bytes_len = max_ordinal as usize * envelope_size;
3659            #[allow(unused_variables)]
3660            let offset = encoder.out_of_line_offset(bytes_len);
3661            let mut _prev_end_offset: usize = 0;
3662            if 1 > max_ordinal {
3663                return Ok(());
3664            }
3665
3666            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3667            // are envelope_size bytes.
3668            let cur_offset: usize = (1 - 1) * envelope_size;
3669
3670            // Zero reserved fields.
3671            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3672
3673            // Safety:
3674            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3675            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3676            //   envelope_size bytes, there is always sufficient room.
3677            fidl::encoding::encode_in_envelope_optional::<UpdateInfo, D>(
3678                self.info.as_ref().map(<UpdateInfo as fidl::encoding::ValueTypeMarker>::borrow),
3679                encoder,
3680                offset + cur_offset,
3681                depth,
3682            )?;
3683
3684            _prev_end_offset = cur_offset + envelope_size;
3685            if 2 > max_ordinal {
3686                return Ok(());
3687            }
3688
3689            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3690            // are envelope_size bytes.
3691            let cur_offset: usize = (2 - 1) * envelope_size;
3692
3693            // Zero reserved fields.
3694            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3695
3696            // Safety:
3697            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3698            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3699            //   envelope_size bytes, there is always sufficient room.
3700            fidl::encoding::encode_in_envelope_optional::<InstallationProgress, D>(
3701                self.progress
3702                    .as_ref()
3703                    .map(<InstallationProgress as fidl::encoding::ValueTypeMarker>::borrow),
3704                encoder,
3705                offset + cur_offset,
3706                depth,
3707            )?;
3708
3709            _prev_end_offset = cur_offset + envelope_size;
3710
3711            Ok(())
3712        }
3713    }
3714
3715    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FetchData {
3716        #[inline(always)]
3717        fn new_empty() -> Self {
3718            Self::default()
3719        }
3720
3721        unsafe fn decode(
3722            &mut self,
3723            decoder: &mut fidl::encoding::Decoder<'_, D>,
3724            offset: usize,
3725            mut depth: fidl::encoding::Depth,
3726        ) -> fidl::Result<()> {
3727            decoder.debug_check_bounds::<Self>(offset);
3728            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3729                None => return Err(fidl::Error::NotNullable),
3730                Some(len) => len,
3731            };
3732            // Calling decoder.out_of_line_offset(0) is not allowed.
3733            if len == 0 {
3734                return Ok(());
3735            };
3736            depth.increment()?;
3737            let envelope_size = 8;
3738            let bytes_len = len * envelope_size;
3739            let offset = decoder.out_of_line_offset(bytes_len)?;
3740            // Decode the envelope for each type.
3741            let mut _next_ordinal_to_read = 0;
3742            let mut next_offset = offset;
3743            let end_offset = offset + bytes_len;
3744            _next_ordinal_to_read += 1;
3745            if next_offset >= end_offset {
3746                return Ok(());
3747            }
3748
3749            // Decode unknown envelopes for gaps in ordinals.
3750            while _next_ordinal_to_read < 1 {
3751                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3752                _next_ordinal_to_read += 1;
3753                next_offset += envelope_size;
3754            }
3755
3756            let next_out_of_line = decoder.next_out_of_line();
3757            let handles_before = decoder.remaining_handles();
3758            if let Some((inlined, num_bytes, num_handles)) =
3759                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3760            {
3761                let member_inline_size =
3762                    <UpdateInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3763                if inlined != (member_inline_size <= 4) {
3764                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3765                }
3766                let inner_offset;
3767                let mut inner_depth = depth.clone();
3768                if inlined {
3769                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3770                    inner_offset = next_offset;
3771                } else {
3772                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3773                    inner_depth.increment()?;
3774                }
3775                let val_ref = self.info.get_or_insert_with(|| fidl::new_empty!(UpdateInfo, D));
3776                fidl::decode!(UpdateInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
3777                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3778                {
3779                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3780                }
3781                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3782                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3783                }
3784            }
3785
3786            next_offset += envelope_size;
3787            _next_ordinal_to_read += 1;
3788            if next_offset >= end_offset {
3789                return Ok(());
3790            }
3791
3792            // Decode unknown envelopes for gaps in ordinals.
3793            while _next_ordinal_to_read < 2 {
3794                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3795                _next_ordinal_to_read += 1;
3796                next_offset += envelope_size;
3797            }
3798
3799            let next_out_of_line = decoder.next_out_of_line();
3800            let handles_before = decoder.remaining_handles();
3801            if let Some((inlined, num_bytes, num_handles)) =
3802                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3803            {
3804                let member_inline_size =
3805                    <InstallationProgress as fidl::encoding::TypeMarker>::inline_size(
3806                        decoder.context,
3807                    );
3808                if inlined != (member_inline_size <= 4) {
3809                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3810                }
3811                let inner_offset;
3812                let mut inner_depth = depth.clone();
3813                if inlined {
3814                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3815                    inner_offset = next_offset;
3816                } else {
3817                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3818                    inner_depth.increment()?;
3819                }
3820                let val_ref =
3821                    self.progress.get_or_insert_with(|| fidl::new_empty!(InstallationProgress, D));
3822                fidl::decode!(
3823                    InstallationProgress,
3824                    D,
3825                    val_ref,
3826                    decoder,
3827                    inner_offset,
3828                    inner_depth
3829                )?;
3830                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3831                {
3832                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3833                }
3834                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3835                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3836                }
3837            }
3838
3839            next_offset += envelope_size;
3840
3841            // Decode the remaining unknown envelopes.
3842            while next_offset < end_offset {
3843                _next_ordinal_to_read += 1;
3844                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3845                next_offset += envelope_size;
3846            }
3847
3848            Ok(())
3849        }
3850    }
3851
3852    impl InstallationProgress {
3853        #[inline(always)]
3854        fn max_ordinal_present(&self) -> u64 {
3855            if let Some(_) = self.bytes_downloaded {
3856                return 2;
3857            }
3858            if let Some(_) = self.fraction_completed {
3859                return 1;
3860            }
3861            0
3862        }
3863    }
3864
3865    impl fidl::encoding::ValueTypeMarker for InstallationProgress {
3866        type Borrowed<'a> = &'a Self;
3867        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3868            value
3869        }
3870    }
3871
3872    unsafe impl fidl::encoding::TypeMarker for InstallationProgress {
3873        type Owned = Self;
3874
3875        #[inline(always)]
3876        fn inline_align(_context: fidl::encoding::Context) -> usize {
3877            8
3878        }
3879
3880        #[inline(always)]
3881        fn inline_size(_context: fidl::encoding::Context) -> usize {
3882            16
3883        }
3884    }
3885
3886    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InstallationProgress, D>
3887        for &InstallationProgress
3888    {
3889        unsafe fn encode(
3890            self,
3891            encoder: &mut fidl::encoding::Encoder<'_, D>,
3892            offset: usize,
3893            mut depth: fidl::encoding::Depth,
3894        ) -> fidl::Result<()> {
3895            encoder.debug_check_bounds::<InstallationProgress>(offset);
3896            // Vector header
3897            let max_ordinal: u64 = self.max_ordinal_present();
3898            encoder.write_num(max_ordinal, offset);
3899            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3900            // Calling encoder.out_of_line_offset(0) is not allowed.
3901            if max_ordinal == 0 {
3902                return Ok(());
3903            }
3904            depth.increment()?;
3905            let envelope_size = 8;
3906            let bytes_len = max_ordinal as usize * envelope_size;
3907            #[allow(unused_variables)]
3908            let offset = encoder.out_of_line_offset(bytes_len);
3909            let mut _prev_end_offset: usize = 0;
3910            if 1 > max_ordinal {
3911                return Ok(());
3912            }
3913
3914            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3915            // are envelope_size bytes.
3916            let cur_offset: usize = (1 - 1) * envelope_size;
3917
3918            // Zero reserved fields.
3919            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3920
3921            // Safety:
3922            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3923            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3924            //   envelope_size bytes, there is always sufficient room.
3925            fidl::encoding::encode_in_envelope_optional::<f32, D>(
3926                self.fraction_completed
3927                    .as_ref()
3928                    .map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
3929                encoder,
3930                offset + cur_offset,
3931                depth,
3932            )?;
3933
3934            _prev_end_offset = cur_offset + envelope_size;
3935            if 2 > max_ordinal {
3936                return Ok(());
3937            }
3938
3939            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3940            // are envelope_size bytes.
3941            let cur_offset: usize = (2 - 1) * envelope_size;
3942
3943            // Zero reserved fields.
3944            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3945
3946            // Safety:
3947            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3948            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3949            //   envelope_size bytes, there is always sufficient room.
3950            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3951                self.bytes_downloaded
3952                    .as_ref()
3953                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3954                encoder,
3955                offset + cur_offset,
3956                depth,
3957            )?;
3958
3959            _prev_end_offset = cur_offset + envelope_size;
3960
3961            Ok(())
3962        }
3963    }
3964
3965    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InstallationProgress {
3966        #[inline(always)]
3967        fn new_empty() -> Self {
3968            Self::default()
3969        }
3970
3971        unsafe fn decode(
3972            &mut self,
3973            decoder: &mut fidl::encoding::Decoder<'_, D>,
3974            offset: usize,
3975            mut depth: fidl::encoding::Depth,
3976        ) -> fidl::Result<()> {
3977            decoder.debug_check_bounds::<Self>(offset);
3978            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3979                None => return Err(fidl::Error::NotNullable),
3980                Some(len) => len,
3981            };
3982            // Calling decoder.out_of_line_offset(0) is not allowed.
3983            if len == 0 {
3984                return Ok(());
3985            };
3986            depth.increment()?;
3987            let envelope_size = 8;
3988            let bytes_len = len * envelope_size;
3989            let offset = decoder.out_of_line_offset(bytes_len)?;
3990            // Decode the envelope for each type.
3991            let mut _next_ordinal_to_read = 0;
3992            let mut next_offset = offset;
3993            let end_offset = offset + bytes_len;
3994            _next_ordinal_to_read += 1;
3995            if next_offset >= end_offset {
3996                return Ok(());
3997            }
3998
3999            // Decode unknown envelopes for gaps in ordinals.
4000            while _next_ordinal_to_read < 1 {
4001                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4002                _next_ordinal_to_read += 1;
4003                next_offset += envelope_size;
4004            }
4005
4006            let next_out_of_line = decoder.next_out_of_line();
4007            let handles_before = decoder.remaining_handles();
4008            if let Some((inlined, num_bytes, num_handles)) =
4009                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4010            {
4011                let member_inline_size =
4012                    <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4013                if inlined != (member_inline_size <= 4) {
4014                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4015                }
4016                let inner_offset;
4017                let mut inner_depth = depth.clone();
4018                if inlined {
4019                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4020                    inner_offset = next_offset;
4021                } else {
4022                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4023                    inner_depth.increment()?;
4024                }
4025                let val_ref =
4026                    self.fraction_completed.get_or_insert_with(|| fidl::new_empty!(f32, D));
4027                fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
4028                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4029                {
4030                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4031                }
4032                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4033                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4034                }
4035            }
4036
4037            next_offset += envelope_size;
4038            _next_ordinal_to_read += 1;
4039            if next_offset >= end_offset {
4040                return Ok(());
4041            }
4042
4043            // Decode unknown envelopes for gaps in ordinals.
4044            while _next_ordinal_to_read < 2 {
4045                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4046                _next_ordinal_to_read += 1;
4047                next_offset += envelope_size;
4048            }
4049
4050            let next_out_of_line = decoder.next_out_of_line();
4051            let handles_before = decoder.remaining_handles();
4052            if let Some((inlined, num_bytes, num_handles)) =
4053                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4054            {
4055                let member_inline_size =
4056                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4057                if inlined != (member_inline_size <= 4) {
4058                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4059                }
4060                let inner_offset;
4061                let mut inner_depth = depth.clone();
4062                if inlined {
4063                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4064                    inner_offset = next_offset;
4065                } else {
4066                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4067                    inner_depth.increment()?;
4068                }
4069                let val_ref = self.bytes_downloaded.get_or_insert_with(|| fidl::new_empty!(u64, D));
4070                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4071                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4072                {
4073                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4074                }
4075                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4076                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4077                }
4078            }
4079
4080            next_offset += envelope_size;
4081
4082            // Decode the remaining unknown envelopes.
4083            while next_offset < end_offset {
4084                _next_ordinal_to_read += 1;
4085                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4086                next_offset += envelope_size;
4087            }
4088
4089            Ok(())
4090        }
4091    }
4092
4093    impl Options {
4094        #[inline(always)]
4095        fn max_ordinal_present(&self) -> u64 {
4096            if let Some(_) = self.should_write_recovery {
4097                return 3;
4098            }
4099            if let Some(_) = self.allow_attach_to_existing_attempt {
4100                return 2;
4101            }
4102            if let Some(_) = self.initiator {
4103                return 1;
4104            }
4105            0
4106        }
4107    }
4108
4109    impl fidl::encoding::ValueTypeMarker for Options {
4110        type Borrowed<'a> = &'a Self;
4111        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4112            value
4113        }
4114    }
4115
4116    unsafe impl fidl::encoding::TypeMarker for Options {
4117        type Owned = Self;
4118
4119        #[inline(always)]
4120        fn inline_align(_context: fidl::encoding::Context) -> usize {
4121            8
4122        }
4123
4124        #[inline(always)]
4125        fn inline_size(_context: fidl::encoding::Context) -> usize {
4126            16
4127        }
4128    }
4129
4130    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Options, D> for &Options {
4131        unsafe fn encode(
4132            self,
4133            encoder: &mut fidl::encoding::Encoder<'_, D>,
4134            offset: usize,
4135            mut depth: fidl::encoding::Depth,
4136        ) -> fidl::Result<()> {
4137            encoder.debug_check_bounds::<Options>(offset);
4138            // Vector header
4139            let max_ordinal: u64 = self.max_ordinal_present();
4140            encoder.write_num(max_ordinal, offset);
4141            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4142            // Calling encoder.out_of_line_offset(0) is not allowed.
4143            if max_ordinal == 0 {
4144                return Ok(());
4145            }
4146            depth.increment()?;
4147            let envelope_size = 8;
4148            let bytes_len = max_ordinal as usize * envelope_size;
4149            #[allow(unused_variables)]
4150            let offset = encoder.out_of_line_offset(bytes_len);
4151            let mut _prev_end_offset: usize = 0;
4152            if 1 > max_ordinal {
4153                return Ok(());
4154            }
4155
4156            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4157            // are envelope_size bytes.
4158            let cur_offset: usize = (1 - 1) * envelope_size;
4159
4160            // Zero reserved fields.
4161            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4162
4163            // Safety:
4164            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4165            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4166            //   envelope_size bytes, there is always sufficient room.
4167            fidl::encoding::encode_in_envelope_optional::<Initiator, D>(
4168                self.initiator.as_ref().map(<Initiator as fidl::encoding::ValueTypeMarker>::borrow),
4169                encoder,
4170                offset + cur_offset,
4171                depth,
4172            )?;
4173
4174            _prev_end_offset = cur_offset + envelope_size;
4175            if 2 > max_ordinal {
4176                return Ok(());
4177            }
4178
4179            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4180            // are envelope_size bytes.
4181            let cur_offset: usize = (2 - 1) * envelope_size;
4182
4183            // Zero reserved fields.
4184            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4185
4186            // Safety:
4187            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4188            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4189            //   envelope_size bytes, there is always sufficient room.
4190            fidl::encoding::encode_in_envelope_optional::<bool, D>(
4191                self.allow_attach_to_existing_attempt
4192                    .as_ref()
4193                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4194                encoder,
4195                offset + cur_offset,
4196                depth,
4197            )?;
4198
4199            _prev_end_offset = cur_offset + envelope_size;
4200            if 3 > max_ordinal {
4201                return Ok(());
4202            }
4203
4204            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4205            // are envelope_size bytes.
4206            let cur_offset: usize = (3 - 1) * envelope_size;
4207
4208            // Zero reserved fields.
4209            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4210
4211            // Safety:
4212            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4213            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4214            //   envelope_size bytes, there is always sufficient room.
4215            fidl::encoding::encode_in_envelope_optional::<bool, D>(
4216                self.should_write_recovery
4217                    .as_ref()
4218                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4219                encoder,
4220                offset + cur_offset,
4221                depth,
4222            )?;
4223
4224            _prev_end_offset = cur_offset + envelope_size;
4225
4226            Ok(())
4227        }
4228    }
4229
4230    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Options {
4231        #[inline(always)]
4232        fn new_empty() -> Self {
4233            Self::default()
4234        }
4235
4236        unsafe fn decode(
4237            &mut self,
4238            decoder: &mut fidl::encoding::Decoder<'_, D>,
4239            offset: usize,
4240            mut depth: fidl::encoding::Depth,
4241        ) -> fidl::Result<()> {
4242            decoder.debug_check_bounds::<Self>(offset);
4243            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4244                None => return Err(fidl::Error::NotNullable),
4245                Some(len) => len,
4246            };
4247            // Calling decoder.out_of_line_offset(0) is not allowed.
4248            if len == 0 {
4249                return Ok(());
4250            };
4251            depth.increment()?;
4252            let envelope_size = 8;
4253            let bytes_len = len * envelope_size;
4254            let offset = decoder.out_of_line_offset(bytes_len)?;
4255            // Decode the envelope for each type.
4256            let mut _next_ordinal_to_read = 0;
4257            let mut next_offset = offset;
4258            let end_offset = offset + bytes_len;
4259            _next_ordinal_to_read += 1;
4260            if next_offset >= end_offset {
4261                return Ok(());
4262            }
4263
4264            // Decode unknown envelopes for gaps in ordinals.
4265            while _next_ordinal_to_read < 1 {
4266                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4267                _next_ordinal_to_read += 1;
4268                next_offset += envelope_size;
4269            }
4270
4271            let next_out_of_line = decoder.next_out_of_line();
4272            let handles_before = decoder.remaining_handles();
4273            if let Some((inlined, num_bytes, num_handles)) =
4274                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4275            {
4276                let member_inline_size =
4277                    <Initiator as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4278                if inlined != (member_inline_size <= 4) {
4279                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4280                }
4281                let inner_offset;
4282                let mut inner_depth = depth.clone();
4283                if inlined {
4284                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4285                    inner_offset = next_offset;
4286                } else {
4287                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4288                    inner_depth.increment()?;
4289                }
4290                let val_ref = self.initiator.get_or_insert_with(|| fidl::new_empty!(Initiator, D));
4291                fidl::decode!(Initiator, D, val_ref, decoder, inner_offset, inner_depth)?;
4292                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4293                {
4294                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4295                }
4296                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4297                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4298                }
4299            }
4300
4301            next_offset += envelope_size;
4302            _next_ordinal_to_read += 1;
4303            if next_offset >= end_offset {
4304                return Ok(());
4305            }
4306
4307            // Decode unknown envelopes for gaps in ordinals.
4308            while _next_ordinal_to_read < 2 {
4309                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4310                _next_ordinal_to_read += 1;
4311                next_offset += envelope_size;
4312            }
4313
4314            let next_out_of_line = decoder.next_out_of_line();
4315            let handles_before = decoder.remaining_handles();
4316            if let Some((inlined, num_bytes, num_handles)) =
4317                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4318            {
4319                let member_inline_size =
4320                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4321                if inlined != (member_inline_size <= 4) {
4322                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4323                }
4324                let inner_offset;
4325                let mut inner_depth = depth.clone();
4326                if inlined {
4327                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4328                    inner_offset = next_offset;
4329                } else {
4330                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4331                    inner_depth.increment()?;
4332                }
4333                let val_ref = self
4334                    .allow_attach_to_existing_attempt
4335                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
4336                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4337                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4338                {
4339                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4340                }
4341                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4342                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4343                }
4344            }
4345
4346            next_offset += envelope_size;
4347            _next_ordinal_to_read += 1;
4348            if next_offset >= end_offset {
4349                return Ok(());
4350            }
4351
4352            // Decode unknown envelopes for gaps in ordinals.
4353            while _next_ordinal_to_read < 3 {
4354                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4355                _next_ordinal_to_read += 1;
4356                next_offset += envelope_size;
4357            }
4358
4359            let next_out_of_line = decoder.next_out_of_line();
4360            let handles_before = decoder.remaining_handles();
4361            if let Some((inlined, num_bytes, num_handles)) =
4362                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4363            {
4364                let member_inline_size =
4365                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4366                if inlined != (member_inline_size <= 4) {
4367                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4368                }
4369                let inner_offset;
4370                let mut inner_depth = depth.clone();
4371                if inlined {
4372                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4373                    inner_offset = next_offset;
4374                } else {
4375                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4376                    inner_depth.increment()?;
4377                }
4378                let val_ref =
4379                    self.should_write_recovery.get_or_insert_with(|| fidl::new_empty!(bool, D));
4380                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4381                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4382                {
4383                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4384                }
4385                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4386                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4387                }
4388            }
4389
4390            next_offset += envelope_size;
4391
4392            // Decode the remaining unknown envelopes.
4393            while next_offset < end_offset {
4394                _next_ordinal_to_read += 1;
4395                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4396                next_offset += envelope_size;
4397            }
4398
4399            Ok(())
4400        }
4401    }
4402
4403    impl PrepareData {
4404        #[inline(always)]
4405        fn max_ordinal_present(&self) -> u64 {
4406            0
4407        }
4408    }
4409
4410    impl fidl::encoding::ValueTypeMarker for PrepareData {
4411        type Borrowed<'a> = &'a Self;
4412        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4413            value
4414        }
4415    }
4416
4417    unsafe impl fidl::encoding::TypeMarker for PrepareData {
4418        type Owned = Self;
4419
4420        #[inline(always)]
4421        fn inline_align(_context: fidl::encoding::Context) -> usize {
4422            8
4423        }
4424
4425        #[inline(always)]
4426        fn inline_size(_context: fidl::encoding::Context) -> usize {
4427            16
4428        }
4429    }
4430
4431    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PrepareData, D>
4432        for &PrepareData
4433    {
4434        unsafe fn encode(
4435            self,
4436            encoder: &mut fidl::encoding::Encoder<'_, D>,
4437            offset: usize,
4438            mut depth: fidl::encoding::Depth,
4439        ) -> fidl::Result<()> {
4440            encoder.debug_check_bounds::<PrepareData>(offset);
4441            // Vector header
4442            let max_ordinal: u64 = self.max_ordinal_present();
4443            encoder.write_num(max_ordinal, offset);
4444            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4445            // Calling encoder.out_of_line_offset(0) is not allowed.
4446            if max_ordinal == 0 {
4447                return Ok(());
4448            }
4449            depth.increment()?;
4450            let envelope_size = 8;
4451            let bytes_len = max_ordinal as usize * envelope_size;
4452            #[allow(unused_variables)]
4453            let offset = encoder.out_of_line_offset(bytes_len);
4454            let mut _prev_end_offset: usize = 0;
4455
4456            Ok(())
4457        }
4458    }
4459
4460    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PrepareData {
4461        #[inline(always)]
4462        fn new_empty() -> Self {
4463            Self::default()
4464        }
4465
4466        unsafe fn decode(
4467            &mut self,
4468            decoder: &mut fidl::encoding::Decoder<'_, D>,
4469            offset: usize,
4470            mut depth: fidl::encoding::Depth,
4471        ) -> fidl::Result<()> {
4472            decoder.debug_check_bounds::<Self>(offset);
4473            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4474                None => return Err(fidl::Error::NotNullable),
4475                Some(len) => len,
4476            };
4477            // Calling decoder.out_of_line_offset(0) is not allowed.
4478            if len == 0 {
4479                return Ok(());
4480            };
4481            depth.increment()?;
4482            let envelope_size = 8;
4483            let bytes_len = len * envelope_size;
4484            let offset = decoder.out_of_line_offset(bytes_len)?;
4485            // Decode the envelope for each type.
4486            let mut _next_ordinal_to_read = 0;
4487            let mut next_offset = offset;
4488            let end_offset = offset + bytes_len;
4489
4490            // Decode the remaining unknown envelopes.
4491            while next_offset < end_offset {
4492                _next_ordinal_to_read += 1;
4493                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4494                next_offset += envelope_size;
4495            }
4496
4497            Ok(())
4498        }
4499    }
4500
4501    impl RebootData {
4502        #[inline(always)]
4503        fn max_ordinal_present(&self) -> u64 {
4504            if let Some(_) = self.progress {
4505                return 2;
4506            }
4507            if let Some(_) = self.info {
4508                return 1;
4509            }
4510            0
4511        }
4512    }
4513
4514    impl fidl::encoding::ValueTypeMarker for RebootData {
4515        type Borrowed<'a> = &'a Self;
4516        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4517            value
4518        }
4519    }
4520
4521    unsafe impl fidl::encoding::TypeMarker for RebootData {
4522        type Owned = Self;
4523
4524        #[inline(always)]
4525        fn inline_align(_context: fidl::encoding::Context) -> usize {
4526            8
4527        }
4528
4529        #[inline(always)]
4530        fn inline_size(_context: fidl::encoding::Context) -> usize {
4531            16
4532        }
4533    }
4534
4535    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RebootData, D>
4536        for &RebootData
4537    {
4538        unsafe fn encode(
4539            self,
4540            encoder: &mut fidl::encoding::Encoder<'_, D>,
4541            offset: usize,
4542            mut depth: fidl::encoding::Depth,
4543        ) -> fidl::Result<()> {
4544            encoder.debug_check_bounds::<RebootData>(offset);
4545            // Vector header
4546            let max_ordinal: u64 = self.max_ordinal_present();
4547            encoder.write_num(max_ordinal, offset);
4548            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4549            // Calling encoder.out_of_line_offset(0) is not allowed.
4550            if max_ordinal == 0 {
4551                return Ok(());
4552            }
4553            depth.increment()?;
4554            let envelope_size = 8;
4555            let bytes_len = max_ordinal as usize * envelope_size;
4556            #[allow(unused_variables)]
4557            let offset = encoder.out_of_line_offset(bytes_len);
4558            let mut _prev_end_offset: usize = 0;
4559            if 1 > max_ordinal {
4560                return Ok(());
4561            }
4562
4563            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4564            // are envelope_size bytes.
4565            let cur_offset: usize = (1 - 1) * envelope_size;
4566
4567            // Zero reserved fields.
4568            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4569
4570            // Safety:
4571            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4572            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4573            //   envelope_size bytes, there is always sufficient room.
4574            fidl::encoding::encode_in_envelope_optional::<UpdateInfo, D>(
4575                self.info.as_ref().map(<UpdateInfo as fidl::encoding::ValueTypeMarker>::borrow),
4576                encoder,
4577                offset + cur_offset,
4578                depth,
4579            )?;
4580
4581            _prev_end_offset = cur_offset + envelope_size;
4582            if 2 > max_ordinal {
4583                return Ok(());
4584            }
4585
4586            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4587            // are envelope_size bytes.
4588            let cur_offset: usize = (2 - 1) * envelope_size;
4589
4590            // Zero reserved fields.
4591            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4592
4593            // Safety:
4594            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4595            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4596            //   envelope_size bytes, there is always sufficient room.
4597            fidl::encoding::encode_in_envelope_optional::<InstallationProgress, D>(
4598                self.progress
4599                    .as_ref()
4600                    .map(<InstallationProgress as fidl::encoding::ValueTypeMarker>::borrow),
4601                encoder,
4602                offset + cur_offset,
4603                depth,
4604            )?;
4605
4606            _prev_end_offset = cur_offset + envelope_size;
4607
4608            Ok(())
4609        }
4610    }
4611
4612    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RebootData {
4613        #[inline(always)]
4614        fn new_empty() -> Self {
4615            Self::default()
4616        }
4617
4618        unsafe fn decode(
4619            &mut self,
4620            decoder: &mut fidl::encoding::Decoder<'_, D>,
4621            offset: usize,
4622            mut depth: fidl::encoding::Depth,
4623        ) -> fidl::Result<()> {
4624            decoder.debug_check_bounds::<Self>(offset);
4625            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4626                None => return Err(fidl::Error::NotNullable),
4627                Some(len) => len,
4628            };
4629            // Calling decoder.out_of_line_offset(0) is not allowed.
4630            if len == 0 {
4631                return Ok(());
4632            };
4633            depth.increment()?;
4634            let envelope_size = 8;
4635            let bytes_len = len * envelope_size;
4636            let offset = decoder.out_of_line_offset(bytes_len)?;
4637            // Decode the envelope for each type.
4638            let mut _next_ordinal_to_read = 0;
4639            let mut next_offset = offset;
4640            let end_offset = offset + bytes_len;
4641            _next_ordinal_to_read += 1;
4642            if next_offset >= end_offset {
4643                return Ok(());
4644            }
4645
4646            // Decode unknown envelopes for gaps in ordinals.
4647            while _next_ordinal_to_read < 1 {
4648                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4649                _next_ordinal_to_read += 1;
4650                next_offset += envelope_size;
4651            }
4652
4653            let next_out_of_line = decoder.next_out_of_line();
4654            let handles_before = decoder.remaining_handles();
4655            if let Some((inlined, num_bytes, num_handles)) =
4656                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4657            {
4658                let member_inline_size =
4659                    <UpdateInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4660                if inlined != (member_inline_size <= 4) {
4661                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4662                }
4663                let inner_offset;
4664                let mut inner_depth = depth.clone();
4665                if inlined {
4666                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4667                    inner_offset = next_offset;
4668                } else {
4669                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4670                    inner_depth.increment()?;
4671                }
4672                let val_ref = self.info.get_or_insert_with(|| fidl::new_empty!(UpdateInfo, D));
4673                fidl::decode!(UpdateInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
4674                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4675                {
4676                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4677                }
4678                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4679                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4680                }
4681            }
4682
4683            next_offset += envelope_size;
4684            _next_ordinal_to_read += 1;
4685            if next_offset >= end_offset {
4686                return Ok(());
4687            }
4688
4689            // Decode unknown envelopes for gaps in ordinals.
4690            while _next_ordinal_to_read < 2 {
4691                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4692                _next_ordinal_to_read += 1;
4693                next_offset += envelope_size;
4694            }
4695
4696            let next_out_of_line = decoder.next_out_of_line();
4697            let handles_before = decoder.remaining_handles();
4698            if let Some((inlined, num_bytes, num_handles)) =
4699                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4700            {
4701                let member_inline_size =
4702                    <InstallationProgress as fidl::encoding::TypeMarker>::inline_size(
4703                        decoder.context,
4704                    );
4705                if inlined != (member_inline_size <= 4) {
4706                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4707                }
4708                let inner_offset;
4709                let mut inner_depth = depth.clone();
4710                if inlined {
4711                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4712                    inner_offset = next_offset;
4713                } else {
4714                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4715                    inner_depth.increment()?;
4716                }
4717                let val_ref =
4718                    self.progress.get_or_insert_with(|| fidl::new_empty!(InstallationProgress, D));
4719                fidl::decode!(
4720                    InstallationProgress,
4721                    D,
4722                    val_ref,
4723                    decoder,
4724                    inner_offset,
4725                    inner_depth
4726                )?;
4727                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4728                {
4729                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4730                }
4731                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4732                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4733                }
4734            }
4735
4736            next_offset += envelope_size;
4737
4738            // Decode the remaining unknown envelopes.
4739            while next_offset < end_offset {
4740                _next_ordinal_to_read += 1;
4741                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4742                next_offset += envelope_size;
4743            }
4744
4745            Ok(())
4746        }
4747    }
4748
4749    impl StageData {
4750        #[inline(always)]
4751        fn max_ordinal_present(&self) -> u64 {
4752            if let Some(_) = self.progress {
4753                return 2;
4754            }
4755            if let Some(_) = self.info {
4756                return 1;
4757            }
4758            0
4759        }
4760    }
4761
4762    impl fidl::encoding::ValueTypeMarker for StageData {
4763        type Borrowed<'a> = &'a Self;
4764        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4765            value
4766        }
4767    }
4768
4769    unsafe impl fidl::encoding::TypeMarker for StageData {
4770        type Owned = Self;
4771
4772        #[inline(always)]
4773        fn inline_align(_context: fidl::encoding::Context) -> usize {
4774            8
4775        }
4776
4777        #[inline(always)]
4778        fn inline_size(_context: fidl::encoding::Context) -> usize {
4779            16
4780        }
4781    }
4782
4783    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StageData, D>
4784        for &StageData
4785    {
4786        unsafe fn encode(
4787            self,
4788            encoder: &mut fidl::encoding::Encoder<'_, D>,
4789            offset: usize,
4790            mut depth: fidl::encoding::Depth,
4791        ) -> fidl::Result<()> {
4792            encoder.debug_check_bounds::<StageData>(offset);
4793            // Vector header
4794            let max_ordinal: u64 = self.max_ordinal_present();
4795            encoder.write_num(max_ordinal, offset);
4796            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4797            // Calling encoder.out_of_line_offset(0) is not allowed.
4798            if max_ordinal == 0 {
4799                return Ok(());
4800            }
4801            depth.increment()?;
4802            let envelope_size = 8;
4803            let bytes_len = max_ordinal as usize * envelope_size;
4804            #[allow(unused_variables)]
4805            let offset = encoder.out_of_line_offset(bytes_len);
4806            let mut _prev_end_offset: usize = 0;
4807            if 1 > max_ordinal {
4808                return Ok(());
4809            }
4810
4811            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4812            // are envelope_size bytes.
4813            let cur_offset: usize = (1 - 1) * envelope_size;
4814
4815            // Zero reserved fields.
4816            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4817
4818            // Safety:
4819            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4820            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4821            //   envelope_size bytes, there is always sufficient room.
4822            fidl::encoding::encode_in_envelope_optional::<UpdateInfo, D>(
4823                self.info.as_ref().map(<UpdateInfo as fidl::encoding::ValueTypeMarker>::borrow),
4824                encoder,
4825                offset + cur_offset,
4826                depth,
4827            )?;
4828
4829            _prev_end_offset = cur_offset + envelope_size;
4830            if 2 > max_ordinal {
4831                return Ok(());
4832            }
4833
4834            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4835            // are envelope_size bytes.
4836            let cur_offset: usize = (2 - 1) * envelope_size;
4837
4838            // Zero reserved fields.
4839            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4840
4841            // Safety:
4842            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4843            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4844            //   envelope_size bytes, there is always sufficient room.
4845            fidl::encoding::encode_in_envelope_optional::<InstallationProgress, D>(
4846                self.progress
4847                    .as_ref()
4848                    .map(<InstallationProgress as fidl::encoding::ValueTypeMarker>::borrow),
4849                encoder,
4850                offset + cur_offset,
4851                depth,
4852            )?;
4853
4854            _prev_end_offset = cur_offset + envelope_size;
4855
4856            Ok(())
4857        }
4858    }
4859
4860    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StageData {
4861        #[inline(always)]
4862        fn new_empty() -> Self {
4863            Self::default()
4864        }
4865
4866        unsafe fn decode(
4867            &mut self,
4868            decoder: &mut fidl::encoding::Decoder<'_, D>,
4869            offset: usize,
4870            mut depth: fidl::encoding::Depth,
4871        ) -> fidl::Result<()> {
4872            decoder.debug_check_bounds::<Self>(offset);
4873            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4874                None => return Err(fidl::Error::NotNullable),
4875                Some(len) => len,
4876            };
4877            // Calling decoder.out_of_line_offset(0) is not allowed.
4878            if len == 0 {
4879                return Ok(());
4880            };
4881            depth.increment()?;
4882            let envelope_size = 8;
4883            let bytes_len = len * envelope_size;
4884            let offset = decoder.out_of_line_offset(bytes_len)?;
4885            // Decode the envelope for each type.
4886            let mut _next_ordinal_to_read = 0;
4887            let mut next_offset = offset;
4888            let end_offset = offset + bytes_len;
4889            _next_ordinal_to_read += 1;
4890            if next_offset >= end_offset {
4891                return Ok(());
4892            }
4893
4894            // Decode unknown envelopes for gaps in ordinals.
4895            while _next_ordinal_to_read < 1 {
4896                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4897                _next_ordinal_to_read += 1;
4898                next_offset += envelope_size;
4899            }
4900
4901            let next_out_of_line = decoder.next_out_of_line();
4902            let handles_before = decoder.remaining_handles();
4903            if let Some((inlined, num_bytes, num_handles)) =
4904                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4905            {
4906                let member_inline_size =
4907                    <UpdateInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4908                if inlined != (member_inline_size <= 4) {
4909                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4910                }
4911                let inner_offset;
4912                let mut inner_depth = depth.clone();
4913                if inlined {
4914                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4915                    inner_offset = next_offset;
4916                } else {
4917                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4918                    inner_depth.increment()?;
4919                }
4920                let val_ref = self.info.get_or_insert_with(|| fidl::new_empty!(UpdateInfo, D));
4921                fidl::decode!(UpdateInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
4922                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4923                {
4924                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4925                }
4926                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4927                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4928                }
4929            }
4930
4931            next_offset += envelope_size;
4932            _next_ordinal_to_read += 1;
4933            if next_offset >= end_offset {
4934                return Ok(());
4935            }
4936
4937            // Decode unknown envelopes for gaps in ordinals.
4938            while _next_ordinal_to_read < 2 {
4939                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4940                _next_ordinal_to_read += 1;
4941                next_offset += envelope_size;
4942            }
4943
4944            let next_out_of_line = decoder.next_out_of_line();
4945            let handles_before = decoder.remaining_handles();
4946            if let Some((inlined, num_bytes, num_handles)) =
4947                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4948            {
4949                let member_inline_size =
4950                    <InstallationProgress as fidl::encoding::TypeMarker>::inline_size(
4951                        decoder.context,
4952                    );
4953                if inlined != (member_inline_size <= 4) {
4954                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4955                }
4956                let inner_offset;
4957                let mut inner_depth = depth.clone();
4958                if inlined {
4959                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4960                    inner_offset = next_offset;
4961                } else {
4962                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4963                    inner_depth.increment()?;
4964                }
4965                let val_ref =
4966                    self.progress.get_or_insert_with(|| fidl::new_empty!(InstallationProgress, D));
4967                fidl::decode!(
4968                    InstallationProgress,
4969                    D,
4970                    val_ref,
4971                    decoder,
4972                    inner_offset,
4973                    inner_depth
4974                )?;
4975                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4976                {
4977                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4978                }
4979                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4980                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4981                }
4982            }
4983
4984            next_offset += envelope_size;
4985
4986            // Decode the remaining unknown envelopes.
4987            while next_offset < end_offset {
4988                _next_ordinal_to_read += 1;
4989                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4990                next_offset += envelope_size;
4991            }
4992
4993            Ok(())
4994        }
4995    }
4996
4997    impl UpdateInfo {
4998        #[inline(always)]
4999        fn max_ordinal_present(&self) -> u64 {
5000            if let Some(_) = self.download_size {
5001                return 1;
5002            }
5003            0
5004        }
5005    }
5006
5007    impl fidl::encoding::ValueTypeMarker for UpdateInfo {
5008        type Borrowed<'a> = &'a Self;
5009        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5010            value
5011        }
5012    }
5013
5014    unsafe impl fidl::encoding::TypeMarker for UpdateInfo {
5015        type Owned = Self;
5016
5017        #[inline(always)]
5018        fn inline_align(_context: fidl::encoding::Context) -> usize {
5019            8
5020        }
5021
5022        #[inline(always)]
5023        fn inline_size(_context: fidl::encoding::Context) -> usize {
5024            16
5025        }
5026    }
5027
5028    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UpdateInfo, D>
5029        for &UpdateInfo
5030    {
5031        unsafe fn encode(
5032            self,
5033            encoder: &mut fidl::encoding::Encoder<'_, D>,
5034            offset: usize,
5035            mut depth: fidl::encoding::Depth,
5036        ) -> fidl::Result<()> {
5037            encoder.debug_check_bounds::<UpdateInfo>(offset);
5038            // Vector header
5039            let max_ordinal: u64 = self.max_ordinal_present();
5040            encoder.write_num(max_ordinal, offset);
5041            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5042            // Calling encoder.out_of_line_offset(0) is not allowed.
5043            if max_ordinal == 0 {
5044                return Ok(());
5045            }
5046            depth.increment()?;
5047            let envelope_size = 8;
5048            let bytes_len = max_ordinal as usize * envelope_size;
5049            #[allow(unused_variables)]
5050            let offset = encoder.out_of_line_offset(bytes_len);
5051            let mut _prev_end_offset: usize = 0;
5052            if 1 > max_ordinal {
5053                return Ok(());
5054            }
5055
5056            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5057            // are envelope_size bytes.
5058            let cur_offset: usize = (1 - 1) * envelope_size;
5059
5060            // Zero reserved fields.
5061            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5062
5063            // Safety:
5064            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5065            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5066            //   envelope_size bytes, there is always sufficient room.
5067            fidl::encoding::encode_in_envelope_optional::<u64, D>(
5068                self.download_size.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
5069                encoder,
5070                offset + cur_offset,
5071                depth,
5072            )?;
5073
5074            _prev_end_offset = cur_offset + envelope_size;
5075
5076            Ok(())
5077        }
5078    }
5079
5080    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UpdateInfo {
5081        #[inline(always)]
5082        fn new_empty() -> Self {
5083            Self::default()
5084        }
5085
5086        unsafe fn decode(
5087            &mut self,
5088            decoder: &mut fidl::encoding::Decoder<'_, D>,
5089            offset: usize,
5090            mut depth: fidl::encoding::Depth,
5091        ) -> fidl::Result<()> {
5092            decoder.debug_check_bounds::<Self>(offset);
5093            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5094                None => return Err(fidl::Error::NotNullable),
5095                Some(len) => len,
5096            };
5097            // Calling decoder.out_of_line_offset(0) is not allowed.
5098            if len == 0 {
5099                return Ok(());
5100            };
5101            depth.increment()?;
5102            let envelope_size = 8;
5103            let bytes_len = len * envelope_size;
5104            let offset = decoder.out_of_line_offset(bytes_len)?;
5105            // Decode the envelope for each type.
5106            let mut _next_ordinal_to_read = 0;
5107            let mut next_offset = offset;
5108            let end_offset = offset + bytes_len;
5109            _next_ordinal_to_read += 1;
5110            if next_offset >= end_offset {
5111                return Ok(());
5112            }
5113
5114            // Decode unknown envelopes for gaps in ordinals.
5115            while _next_ordinal_to_read < 1 {
5116                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5117                _next_ordinal_to_read += 1;
5118                next_offset += envelope_size;
5119            }
5120
5121            let next_out_of_line = decoder.next_out_of_line();
5122            let handles_before = decoder.remaining_handles();
5123            if let Some((inlined, num_bytes, num_handles)) =
5124                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5125            {
5126                let member_inline_size =
5127                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5128                if inlined != (member_inline_size <= 4) {
5129                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5130                }
5131                let inner_offset;
5132                let mut inner_depth = depth.clone();
5133                if inlined {
5134                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5135                    inner_offset = next_offset;
5136                } else {
5137                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5138                    inner_depth.increment()?;
5139                }
5140                let val_ref = self.download_size.get_or_insert_with(|| fidl::new_empty!(u64, D));
5141                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5142                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5143                {
5144                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5145                }
5146                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5147                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5148                }
5149            }
5150
5151            next_offset += envelope_size;
5152
5153            // Decode the remaining unknown envelopes.
5154            while next_offset < end_offset {
5155                _next_ordinal_to_read += 1;
5156                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5157                next_offset += envelope_size;
5158            }
5159
5160            Ok(())
5161        }
5162    }
5163
5164    impl WaitToRebootData {
5165        #[inline(always)]
5166        fn max_ordinal_present(&self) -> u64 {
5167            if let Some(_) = self.progress {
5168                return 2;
5169            }
5170            if let Some(_) = self.info {
5171                return 1;
5172            }
5173            0
5174        }
5175    }
5176
5177    impl fidl::encoding::ValueTypeMarker for WaitToRebootData {
5178        type Borrowed<'a> = &'a Self;
5179        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5180            value
5181        }
5182    }
5183
5184    unsafe impl fidl::encoding::TypeMarker for WaitToRebootData {
5185        type Owned = Self;
5186
5187        #[inline(always)]
5188        fn inline_align(_context: fidl::encoding::Context) -> usize {
5189            8
5190        }
5191
5192        #[inline(always)]
5193        fn inline_size(_context: fidl::encoding::Context) -> usize {
5194            16
5195        }
5196    }
5197
5198    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WaitToRebootData, D>
5199        for &WaitToRebootData
5200    {
5201        unsafe fn encode(
5202            self,
5203            encoder: &mut fidl::encoding::Encoder<'_, D>,
5204            offset: usize,
5205            mut depth: fidl::encoding::Depth,
5206        ) -> fidl::Result<()> {
5207            encoder.debug_check_bounds::<WaitToRebootData>(offset);
5208            // Vector header
5209            let max_ordinal: u64 = self.max_ordinal_present();
5210            encoder.write_num(max_ordinal, offset);
5211            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5212            // Calling encoder.out_of_line_offset(0) is not allowed.
5213            if max_ordinal == 0 {
5214                return Ok(());
5215            }
5216            depth.increment()?;
5217            let envelope_size = 8;
5218            let bytes_len = max_ordinal as usize * envelope_size;
5219            #[allow(unused_variables)]
5220            let offset = encoder.out_of_line_offset(bytes_len);
5221            let mut _prev_end_offset: usize = 0;
5222            if 1 > max_ordinal {
5223                return Ok(());
5224            }
5225
5226            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5227            // are envelope_size bytes.
5228            let cur_offset: usize = (1 - 1) * envelope_size;
5229
5230            // Zero reserved fields.
5231            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5232
5233            // Safety:
5234            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5235            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5236            //   envelope_size bytes, there is always sufficient room.
5237            fidl::encoding::encode_in_envelope_optional::<UpdateInfo, D>(
5238                self.info.as_ref().map(<UpdateInfo as fidl::encoding::ValueTypeMarker>::borrow),
5239                encoder,
5240                offset + cur_offset,
5241                depth,
5242            )?;
5243
5244            _prev_end_offset = cur_offset + envelope_size;
5245            if 2 > max_ordinal {
5246                return Ok(());
5247            }
5248
5249            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5250            // are envelope_size bytes.
5251            let cur_offset: usize = (2 - 1) * envelope_size;
5252
5253            // Zero reserved fields.
5254            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5255
5256            // Safety:
5257            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5258            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5259            //   envelope_size bytes, there is always sufficient room.
5260            fidl::encoding::encode_in_envelope_optional::<InstallationProgress, D>(
5261                self.progress
5262                    .as_ref()
5263                    .map(<InstallationProgress as fidl::encoding::ValueTypeMarker>::borrow),
5264                encoder,
5265                offset + cur_offset,
5266                depth,
5267            )?;
5268
5269            _prev_end_offset = cur_offset + envelope_size;
5270
5271            Ok(())
5272        }
5273    }
5274
5275    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WaitToRebootData {
5276        #[inline(always)]
5277        fn new_empty() -> Self {
5278            Self::default()
5279        }
5280
5281        unsafe fn decode(
5282            &mut self,
5283            decoder: &mut fidl::encoding::Decoder<'_, D>,
5284            offset: usize,
5285            mut depth: fidl::encoding::Depth,
5286        ) -> fidl::Result<()> {
5287            decoder.debug_check_bounds::<Self>(offset);
5288            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5289                None => return Err(fidl::Error::NotNullable),
5290                Some(len) => len,
5291            };
5292            // Calling decoder.out_of_line_offset(0) is not allowed.
5293            if len == 0 {
5294                return Ok(());
5295            };
5296            depth.increment()?;
5297            let envelope_size = 8;
5298            let bytes_len = len * envelope_size;
5299            let offset = decoder.out_of_line_offset(bytes_len)?;
5300            // Decode the envelope for each type.
5301            let mut _next_ordinal_to_read = 0;
5302            let mut next_offset = offset;
5303            let end_offset = offset + bytes_len;
5304            _next_ordinal_to_read += 1;
5305            if next_offset >= end_offset {
5306                return Ok(());
5307            }
5308
5309            // Decode unknown envelopes for gaps in ordinals.
5310            while _next_ordinal_to_read < 1 {
5311                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5312                _next_ordinal_to_read += 1;
5313                next_offset += envelope_size;
5314            }
5315
5316            let next_out_of_line = decoder.next_out_of_line();
5317            let handles_before = decoder.remaining_handles();
5318            if let Some((inlined, num_bytes, num_handles)) =
5319                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5320            {
5321                let member_inline_size =
5322                    <UpdateInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5323                if inlined != (member_inline_size <= 4) {
5324                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5325                }
5326                let inner_offset;
5327                let mut inner_depth = depth.clone();
5328                if inlined {
5329                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5330                    inner_offset = next_offset;
5331                } else {
5332                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5333                    inner_depth.increment()?;
5334                }
5335                let val_ref = self.info.get_or_insert_with(|| fidl::new_empty!(UpdateInfo, D));
5336                fidl::decode!(UpdateInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
5337                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5338                {
5339                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5340                }
5341                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5342                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5343                }
5344            }
5345
5346            next_offset += envelope_size;
5347            _next_ordinal_to_read += 1;
5348            if next_offset >= end_offset {
5349                return Ok(());
5350            }
5351
5352            // Decode unknown envelopes for gaps in ordinals.
5353            while _next_ordinal_to_read < 2 {
5354                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5355                _next_ordinal_to_read += 1;
5356                next_offset += envelope_size;
5357            }
5358
5359            let next_out_of_line = decoder.next_out_of_line();
5360            let handles_before = decoder.remaining_handles();
5361            if let Some((inlined, num_bytes, num_handles)) =
5362                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5363            {
5364                let member_inline_size =
5365                    <InstallationProgress as fidl::encoding::TypeMarker>::inline_size(
5366                        decoder.context,
5367                    );
5368                if inlined != (member_inline_size <= 4) {
5369                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5370                }
5371                let inner_offset;
5372                let mut inner_depth = depth.clone();
5373                if inlined {
5374                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5375                    inner_offset = next_offset;
5376                } else {
5377                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5378                    inner_depth.increment()?;
5379                }
5380                let val_ref =
5381                    self.progress.get_or_insert_with(|| fidl::new_empty!(InstallationProgress, D));
5382                fidl::decode!(
5383                    InstallationProgress,
5384                    D,
5385                    val_ref,
5386                    decoder,
5387                    inner_offset,
5388                    inner_depth
5389                )?;
5390                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5391                {
5392                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5393                }
5394                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5395                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5396                }
5397            }
5398
5399            next_offset += envelope_size;
5400
5401            // Decode the remaining unknown envelopes.
5402            while next_offset < end_offset {
5403                _next_ordinal_to_read += 1;
5404                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5405                next_offset += envelope_size;
5406            }
5407
5408            Ok(())
5409        }
5410    }
5411
5412    impl fidl::encoding::ValueTypeMarker for State {
5413        type Borrowed<'a> = &'a Self;
5414        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5415            value
5416        }
5417    }
5418
5419    unsafe impl fidl::encoding::TypeMarker for State {
5420        type Owned = Self;
5421
5422        #[inline(always)]
5423        fn inline_align(_context: fidl::encoding::Context) -> usize {
5424            8
5425        }
5426
5427        #[inline(always)]
5428        fn inline_size(_context: fidl::encoding::Context) -> usize {
5429            16
5430        }
5431    }
5432
5433    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<State, D> for &State {
5434        #[inline]
5435        unsafe fn encode(
5436            self,
5437            encoder: &mut fidl::encoding::Encoder<'_, D>,
5438            offset: usize,
5439            _depth: fidl::encoding::Depth,
5440        ) -> fidl::Result<()> {
5441            encoder.debug_check_bounds::<State>(offset);
5442            encoder.write_num::<u64>(self.ordinal(), offset);
5443            match self {
5444                State::Prepare(ref val) => fidl::encoding::encode_in_envelope::<PrepareData, D>(
5445                    <PrepareData as fidl::encoding::ValueTypeMarker>::borrow(val),
5446                    encoder,
5447                    offset + 8,
5448                    _depth,
5449                ),
5450                State::Stage(ref val) => fidl::encoding::encode_in_envelope::<StageData, D>(
5451                    <StageData as fidl::encoding::ValueTypeMarker>::borrow(val),
5452                    encoder,
5453                    offset + 8,
5454                    _depth,
5455                ),
5456                State::Fetch(ref val) => fidl::encoding::encode_in_envelope::<FetchData, D>(
5457                    <FetchData as fidl::encoding::ValueTypeMarker>::borrow(val),
5458                    encoder,
5459                    offset + 8,
5460                    _depth,
5461                ),
5462                State::Commit(ref val) => fidl::encoding::encode_in_envelope::<CommitData, D>(
5463                    <CommitData as fidl::encoding::ValueTypeMarker>::borrow(val),
5464                    encoder,
5465                    offset + 8,
5466                    _depth,
5467                ),
5468                State::WaitToReboot(ref val) => {
5469                    fidl::encoding::encode_in_envelope::<WaitToRebootData, D>(
5470                        <WaitToRebootData as fidl::encoding::ValueTypeMarker>::borrow(val),
5471                        encoder,
5472                        offset + 8,
5473                        _depth,
5474                    )
5475                }
5476                State::Reboot(ref val) => fidl::encoding::encode_in_envelope::<RebootData, D>(
5477                    <RebootData as fidl::encoding::ValueTypeMarker>::borrow(val),
5478                    encoder,
5479                    offset + 8,
5480                    _depth,
5481                ),
5482                State::DeferReboot(ref val) => {
5483                    fidl::encoding::encode_in_envelope::<DeferRebootData, D>(
5484                        <DeferRebootData as fidl::encoding::ValueTypeMarker>::borrow(val),
5485                        encoder,
5486                        offset + 8,
5487                        _depth,
5488                    )
5489                }
5490                State::Complete(ref val) => fidl::encoding::encode_in_envelope::<CompleteData, D>(
5491                    <CompleteData as fidl::encoding::ValueTypeMarker>::borrow(val),
5492                    encoder,
5493                    offset + 8,
5494                    _depth,
5495                ),
5496                State::FailPrepare(ref val) => {
5497                    fidl::encoding::encode_in_envelope::<FailPrepareData, D>(
5498                        <FailPrepareData as fidl::encoding::ValueTypeMarker>::borrow(val),
5499                        encoder,
5500                        offset + 8,
5501                        _depth,
5502                    )
5503                }
5504                State::FailStage(ref val) => {
5505                    fidl::encoding::encode_in_envelope::<FailStageData, D>(
5506                        <FailStageData as fidl::encoding::ValueTypeMarker>::borrow(val),
5507                        encoder,
5508                        offset + 8,
5509                        _depth,
5510                    )
5511                }
5512                State::FailFetch(ref val) => {
5513                    fidl::encoding::encode_in_envelope::<FailFetchData, D>(
5514                        <FailFetchData as fidl::encoding::ValueTypeMarker>::borrow(val),
5515                        encoder,
5516                        offset + 8,
5517                        _depth,
5518                    )
5519                }
5520                State::FailCommit(ref val) => {
5521                    fidl::encoding::encode_in_envelope::<FailCommitData, D>(
5522                        <FailCommitData as fidl::encoding::ValueTypeMarker>::borrow(val),
5523                        encoder,
5524                        offset + 8,
5525                        _depth,
5526                    )
5527                }
5528                State::Canceled(ref val) => fidl::encoding::encode_in_envelope::<CanceledData, D>(
5529                    <CanceledData as fidl::encoding::ValueTypeMarker>::borrow(val),
5530                    encoder,
5531                    offset + 8,
5532                    _depth,
5533                ),
5534            }
5535        }
5536    }
5537
5538    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for State {
5539        #[inline(always)]
5540        fn new_empty() -> Self {
5541            Self::Prepare(fidl::new_empty!(PrepareData, D))
5542        }
5543
5544        #[inline]
5545        unsafe fn decode(
5546            &mut self,
5547            decoder: &mut fidl::encoding::Decoder<'_, D>,
5548            offset: usize,
5549            mut depth: fidl::encoding::Depth,
5550        ) -> fidl::Result<()> {
5551            decoder.debug_check_bounds::<Self>(offset);
5552            #[allow(unused_variables)]
5553            let next_out_of_line = decoder.next_out_of_line();
5554            let handles_before = decoder.remaining_handles();
5555            let (ordinal, inlined, num_bytes, num_handles) =
5556                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
5557
5558            let member_inline_size = match ordinal {
5559                1 => <PrepareData as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5560                2 => <StageData as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5561                3 => <FetchData as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5562                4 => <CommitData as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5563                5 => <WaitToRebootData as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5564                6 => <RebootData as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5565                7 => <DeferRebootData as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5566                8 => <CompleteData as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5567                9 => <FailPrepareData as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5568                10 => <FailStageData as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5569                11 => <FailFetchData as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5570                12 => <FailCommitData as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5571                13 => <CanceledData as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5572                _ => return Err(fidl::Error::UnknownUnionTag),
5573            };
5574
5575            if inlined != (member_inline_size <= 4) {
5576                return Err(fidl::Error::InvalidInlineBitInEnvelope);
5577            }
5578            let _inner_offset;
5579            if inlined {
5580                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
5581                _inner_offset = offset + 8;
5582            } else {
5583                depth.increment()?;
5584                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5585            }
5586            match ordinal {
5587                1 => {
5588                    #[allow(irrefutable_let_patterns)]
5589                    if let State::Prepare(_) = self {
5590                        // Do nothing, read the value into the object
5591                    } else {
5592                        // Initialize `self` to the right variant
5593                        *self = State::Prepare(fidl::new_empty!(PrepareData, D));
5594                    }
5595                    #[allow(irrefutable_let_patterns)]
5596                    if let State::Prepare(ref mut val) = self {
5597                        fidl::decode!(PrepareData, D, val, decoder, _inner_offset, depth)?;
5598                    } else {
5599                        unreachable!()
5600                    }
5601                }
5602                2 => {
5603                    #[allow(irrefutable_let_patterns)]
5604                    if let State::Stage(_) = self {
5605                        // Do nothing, read the value into the object
5606                    } else {
5607                        // Initialize `self` to the right variant
5608                        *self = State::Stage(fidl::new_empty!(StageData, D));
5609                    }
5610                    #[allow(irrefutable_let_patterns)]
5611                    if let State::Stage(ref mut val) = self {
5612                        fidl::decode!(StageData, D, val, decoder, _inner_offset, depth)?;
5613                    } else {
5614                        unreachable!()
5615                    }
5616                }
5617                3 => {
5618                    #[allow(irrefutable_let_patterns)]
5619                    if let State::Fetch(_) = self {
5620                        // Do nothing, read the value into the object
5621                    } else {
5622                        // Initialize `self` to the right variant
5623                        *self = State::Fetch(fidl::new_empty!(FetchData, D));
5624                    }
5625                    #[allow(irrefutable_let_patterns)]
5626                    if let State::Fetch(ref mut val) = self {
5627                        fidl::decode!(FetchData, D, val, decoder, _inner_offset, depth)?;
5628                    } else {
5629                        unreachable!()
5630                    }
5631                }
5632                4 => {
5633                    #[allow(irrefutable_let_patterns)]
5634                    if let State::Commit(_) = self {
5635                        // Do nothing, read the value into the object
5636                    } else {
5637                        // Initialize `self` to the right variant
5638                        *self = State::Commit(fidl::new_empty!(CommitData, D));
5639                    }
5640                    #[allow(irrefutable_let_patterns)]
5641                    if let State::Commit(ref mut val) = self {
5642                        fidl::decode!(CommitData, D, val, decoder, _inner_offset, depth)?;
5643                    } else {
5644                        unreachable!()
5645                    }
5646                }
5647                5 => {
5648                    #[allow(irrefutable_let_patterns)]
5649                    if let State::WaitToReboot(_) = self {
5650                        // Do nothing, read the value into the object
5651                    } else {
5652                        // Initialize `self` to the right variant
5653                        *self = State::WaitToReboot(fidl::new_empty!(WaitToRebootData, D));
5654                    }
5655                    #[allow(irrefutable_let_patterns)]
5656                    if let State::WaitToReboot(ref mut val) = self {
5657                        fidl::decode!(WaitToRebootData, D, val, decoder, _inner_offset, depth)?;
5658                    } else {
5659                        unreachable!()
5660                    }
5661                }
5662                6 => {
5663                    #[allow(irrefutable_let_patterns)]
5664                    if let State::Reboot(_) = self {
5665                        // Do nothing, read the value into the object
5666                    } else {
5667                        // Initialize `self` to the right variant
5668                        *self = State::Reboot(fidl::new_empty!(RebootData, D));
5669                    }
5670                    #[allow(irrefutable_let_patterns)]
5671                    if let State::Reboot(ref mut val) = self {
5672                        fidl::decode!(RebootData, D, val, decoder, _inner_offset, depth)?;
5673                    } else {
5674                        unreachable!()
5675                    }
5676                }
5677                7 => {
5678                    #[allow(irrefutable_let_patterns)]
5679                    if let State::DeferReboot(_) = self {
5680                        // Do nothing, read the value into the object
5681                    } else {
5682                        // Initialize `self` to the right variant
5683                        *self = State::DeferReboot(fidl::new_empty!(DeferRebootData, D));
5684                    }
5685                    #[allow(irrefutable_let_patterns)]
5686                    if let State::DeferReboot(ref mut val) = self {
5687                        fidl::decode!(DeferRebootData, D, val, decoder, _inner_offset, depth)?;
5688                    } else {
5689                        unreachable!()
5690                    }
5691                }
5692                8 => {
5693                    #[allow(irrefutable_let_patterns)]
5694                    if let State::Complete(_) = self {
5695                        // Do nothing, read the value into the object
5696                    } else {
5697                        // Initialize `self` to the right variant
5698                        *self = State::Complete(fidl::new_empty!(CompleteData, D));
5699                    }
5700                    #[allow(irrefutable_let_patterns)]
5701                    if let State::Complete(ref mut val) = self {
5702                        fidl::decode!(CompleteData, D, val, decoder, _inner_offset, depth)?;
5703                    } else {
5704                        unreachable!()
5705                    }
5706                }
5707                9 => {
5708                    #[allow(irrefutable_let_patterns)]
5709                    if let State::FailPrepare(_) = self {
5710                        // Do nothing, read the value into the object
5711                    } else {
5712                        // Initialize `self` to the right variant
5713                        *self = State::FailPrepare(fidl::new_empty!(FailPrepareData, D));
5714                    }
5715                    #[allow(irrefutable_let_patterns)]
5716                    if let State::FailPrepare(ref mut val) = self {
5717                        fidl::decode!(FailPrepareData, D, val, decoder, _inner_offset, depth)?;
5718                    } else {
5719                        unreachable!()
5720                    }
5721                }
5722                10 => {
5723                    #[allow(irrefutable_let_patterns)]
5724                    if let State::FailStage(_) = self {
5725                        // Do nothing, read the value into the object
5726                    } else {
5727                        // Initialize `self` to the right variant
5728                        *self = State::FailStage(fidl::new_empty!(FailStageData, D));
5729                    }
5730                    #[allow(irrefutable_let_patterns)]
5731                    if let State::FailStage(ref mut val) = self {
5732                        fidl::decode!(FailStageData, D, val, decoder, _inner_offset, depth)?;
5733                    } else {
5734                        unreachable!()
5735                    }
5736                }
5737                11 => {
5738                    #[allow(irrefutable_let_patterns)]
5739                    if let State::FailFetch(_) = self {
5740                        // Do nothing, read the value into the object
5741                    } else {
5742                        // Initialize `self` to the right variant
5743                        *self = State::FailFetch(fidl::new_empty!(FailFetchData, D));
5744                    }
5745                    #[allow(irrefutable_let_patterns)]
5746                    if let State::FailFetch(ref mut val) = self {
5747                        fidl::decode!(FailFetchData, D, val, decoder, _inner_offset, depth)?;
5748                    } else {
5749                        unreachable!()
5750                    }
5751                }
5752                12 => {
5753                    #[allow(irrefutable_let_patterns)]
5754                    if let State::FailCommit(_) = self {
5755                        // Do nothing, read the value into the object
5756                    } else {
5757                        // Initialize `self` to the right variant
5758                        *self = State::FailCommit(fidl::new_empty!(FailCommitData, D));
5759                    }
5760                    #[allow(irrefutable_let_patterns)]
5761                    if let State::FailCommit(ref mut val) = self {
5762                        fidl::decode!(FailCommitData, D, val, decoder, _inner_offset, depth)?;
5763                    } else {
5764                        unreachable!()
5765                    }
5766                }
5767                13 => {
5768                    #[allow(irrefutable_let_patterns)]
5769                    if let State::Canceled(_) = self {
5770                        // Do nothing, read the value into the object
5771                    } else {
5772                        // Initialize `self` to the right variant
5773                        *self = State::Canceled(fidl::new_empty!(CanceledData, D));
5774                    }
5775                    #[allow(irrefutable_let_patterns)]
5776                    if let State::Canceled(ref mut val) = self {
5777                        fidl::decode!(CanceledData, D, val, decoder, _inner_offset, depth)?;
5778                    } else {
5779                        unreachable!()
5780                    }
5781                }
5782                ordinal => panic!("unexpected ordinal {:?}", ordinal),
5783            }
5784            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
5785                return Err(fidl::Error::InvalidNumBytesInEnvelope);
5786            }
5787            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5788                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5789            }
5790            Ok(())
5791        }
5792    }
5793}