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