fidl_fuchsia_update__common/
fidl_fuchsia_update__common.rs

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