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