Skip to main content

fidl_fuchsia_update_installer/
fidl_fuchsia_update_installer.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 _};
10pub use fidl_fuchsia_update_installer_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct InstallerMonitorUpdateRequest {
16    pub attempt_id: Option<String>,
17    pub monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for InstallerMonitorUpdateRequest
22{
23}
24
25#[derive(Debug, PartialEq)]
26pub struct InstallerStartUpdateRequest {
27    pub url: fidl_fuchsia_pkg::PackageUrl,
28    pub options: Options,
29    pub monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
30    pub reboot_controller: Option<fidl::endpoints::ServerEnd<RebootControllerMarker>>,
31}
32
33impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
34    for InstallerStartUpdateRequest
35{
36}
37
38#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
39pub struct InstallerMarker;
40
41impl fidl::endpoints::ProtocolMarker for InstallerMarker {
42    type Proxy = InstallerProxy;
43    type RequestStream = InstallerRequestStream;
44    #[cfg(target_os = "fuchsia")]
45    type SynchronousProxy = InstallerSynchronousProxy;
46
47    const DEBUG_NAME: &'static str = "fuchsia.update.installer.Installer";
48}
49impl fidl::endpoints::DiscoverableProtocolMarker for InstallerMarker {}
50pub type InstallerStartUpdateResult = Result<String, UpdateNotStartedReason>;
51pub type InstallerSuspendUpdateResult = Result<(), SuspendError>;
52pub type InstallerResumeUpdateResult = Result<(), ResumeError>;
53pub type InstallerCancelUpdateResult = Result<(), CancelError>;
54
55pub trait InstallerProxyInterface: Send + Sync {
56    type StartUpdateResponseFut: std::future::Future<Output = Result<InstallerStartUpdateResult, fidl::Error>>
57        + Send;
58    fn r#start_update(
59        &self,
60        url: &fidl_fuchsia_pkg::PackageUrl,
61        options: &Options,
62        monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
63        reboot_controller: Option<fidl::endpoints::ServerEnd<RebootControllerMarker>>,
64    ) -> Self::StartUpdateResponseFut;
65    type MonitorUpdateResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
66    fn r#monitor_update(
67        &self,
68        attempt_id: Option<&str>,
69        monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
70    ) -> Self::MonitorUpdateResponseFut;
71    type SuspendUpdateResponseFut: std::future::Future<Output = Result<InstallerSuspendUpdateResult, fidl::Error>>
72        + Send;
73    fn r#suspend_update(&self, attempt_id: Option<&str>) -> Self::SuspendUpdateResponseFut;
74    type ResumeUpdateResponseFut: std::future::Future<Output = Result<InstallerResumeUpdateResult, fidl::Error>>
75        + Send;
76    fn r#resume_update(&self, attempt_id: Option<&str>) -> Self::ResumeUpdateResponseFut;
77    type CancelUpdateResponseFut: std::future::Future<Output = Result<InstallerCancelUpdateResult, fidl::Error>>
78        + Send;
79    fn r#cancel_update(&self, attempt_id: Option<&str>) -> Self::CancelUpdateResponseFut;
80}
81#[derive(Debug)]
82#[cfg(target_os = "fuchsia")]
83pub struct InstallerSynchronousProxy {
84    client: fidl::client::sync::Client,
85}
86
87#[cfg(target_os = "fuchsia")]
88impl fidl::endpoints::SynchronousProxy for InstallerSynchronousProxy {
89    type Proxy = InstallerProxy;
90    type Protocol = InstallerMarker;
91
92    fn from_channel(inner: fidl::Channel) -> Self {
93        Self::new(inner)
94    }
95
96    fn into_channel(self) -> fidl::Channel {
97        self.client.into_channel()
98    }
99
100    fn as_channel(&self) -> &fidl::Channel {
101        self.client.as_channel()
102    }
103}
104
105#[cfg(target_os = "fuchsia")]
106impl InstallerSynchronousProxy {
107    pub fn new(channel: fidl::Channel) -> Self {
108        Self { client: fidl::client::sync::Client::new(channel) }
109    }
110
111    pub fn into_channel(self) -> fidl::Channel {
112        self.client.into_channel()
113    }
114
115    /// Waits until an event arrives and returns it. It is safe for other
116    /// threads to make concurrent requests while waiting for an event.
117    pub fn wait_for_event(
118        &self,
119        deadline: zx::MonotonicInstant,
120    ) -> Result<InstallerEvent, fidl::Error> {
121        InstallerEvent::decode(self.client.wait_for_event::<InstallerMarker>(deadline)?)
122    }
123
124    /// Start an update if one is not running, or attach to a pending update
125    /// attempt if one is running and
126    /// [`Options.allow_attach_to_existing_attempt`] is true. If an update
127    /// attempt is started or attached to, provide status updates through
128    /// `monitor`.
129    ///
130    /// + request `url` The URL of the resource that describes the update. Must have one of the
131    /// following schemes:
132    ///     * "fuchsia-pkg": The resource is an [update package](https://fuchsia.dev/fuchsia-src/concepts/packages/update_pkg).
133    ///     * "http[s]": The resource is a blob-based update manifest.
134    ///       TODO(https://fxbug.dev/479283380): Link to RFC
135    /// + request `options` Configuration options for this update attempt.
136    ///     Ignored or merged with the existing `options` if an update attempt
137    ///     is already in progress.
138    /// + request `monitor` A protocol on which to receive progress updates.
139    /// + request `reboot_controller` An optional protocol to control the timing
140    ///     of the reboot into the update system. If not provided, the update
141    ///     attempt will initiate the reboot as soon as it is ready.
142    ///
143    /// - response `attempt_id` UUID identifying this update attempt. For
144    ///     updates that require a reboot, components may use this identifier to
145    ///     disambiguate the completion of this update attempt from new update
146    ///     attempts that start post-reboot.
147    pub fn r#start_update(
148        &self,
149        mut url: &fidl_fuchsia_pkg::PackageUrl,
150        mut options: &Options,
151        mut monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
152        mut reboot_controller: Option<fidl::endpoints::ServerEnd<RebootControllerMarker>>,
153        ___deadline: zx::MonotonicInstant,
154    ) -> Result<InstallerStartUpdateResult, fidl::Error> {
155        let _response =
156            self.client.send_query::<InstallerStartUpdateRequest, fidl::encoding::ResultType<
157                InstallerStartUpdateResponse,
158                UpdateNotStartedReason,
159            >, InstallerMarker>(
160                (url, options, monitor, reboot_controller),
161                0x2b1c5ba9167c320b,
162                fidl::encoding::DynamicFlags::empty(),
163                ___deadline,
164            )?;
165        Ok(_response.map(|x| x.attempt_id))
166    }
167
168    /// Attempt to monitor a specific update attempt, if it exists. This request
169    /// will not start an update if one is not already running.
170    ///
171    /// + request `attempt_id` UUID identifying the requested update attempt. If
172    ///     not given, monitor any active update attempt.
173    /// + request `monitor` A protocol on which to receive progress updates.
174    ///
175    /// - response `attached` Whether or not the provided monitor was attached
176    ///     to an in-progress update attempt. If false, monitor will be closed
177    ///     by the server.
178    pub fn r#monitor_update(
179        &self,
180        mut attempt_id: Option<&str>,
181        mut monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
182        ___deadline: zx::MonotonicInstant,
183    ) -> Result<bool, fidl::Error> {
184        let _response = self.client.send_query::<
185            InstallerMonitorUpdateRequest,
186            InstallerMonitorUpdateResponse,
187            InstallerMarker,
188        >(
189            (attempt_id, monitor,),
190            0x21d54aa1fd825a32,
191            fidl::encoding::DynamicFlags::empty(),
192            ___deadline,
193        )?;
194        Ok(_response.attached)
195    }
196
197    /// Suspend a specific update attempt, if it exists.
198    ///
199    /// + request `attempt_id` UUID identifying the requested update attempt. If
200    ///     not given, suspend any active update attempt.
201    pub fn r#suspend_update(
202        &self,
203        mut attempt_id: Option<&str>,
204        ___deadline: zx::MonotonicInstant,
205    ) -> Result<InstallerSuspendUpdateResult, fidl::Error> {
206        let _response = self.client.send_query::<
207            InstallerSuspendUpdateRequest,
208            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SuspendError>,
209            InstallerMarker,
210        >(
211            (attempt_id,),
212            0x788de328461f9950,
213            fidl::encoding::DynamicFlags::empty(),
214            ___deadline,
215        )?;
216        Ok(_response.map(|x| x))
217    }
218
219    /// Resume a specific update attempt, if it exists.
220    ///
221    /// + request `attempt_id` UUID identifying the requested update attempt. If
222    ///     not given, resume any active update attempt.
223    pub fn r#resume_update(
224        &self,
225        mut attempt_id: Option<&str>,
226        ___deadline: zx::MonotonicInstant,
227    ) -> Result<InstallerResumeUpdateResult, fidl::Error> {
228        let _response = self.client.send_query::<
229            InstallerResumeUpdateRequest,
230            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ResumeError>,
231            InstallerMarker,
232        >(
233            (attempt_id,),
234            0x7479e805fec33dd3,
235            fidl::encoding::DynamicFlags::empty(),
236            ___deadline,
237        )?;
238        Ok(_response.map(|x| x))
239    }
240
241    /// Cancel a specific update attempt, if it exists.
242    ///
243    /// + request `attempt_id` UUID identifying the requested update attempt. If
244    ///     not given, cancel any active update attempt.
245    pub fn r#cancel_update(
246        &self,
247        mut attempt_id: Option<&str>,
248        ___deadline: zx::MonotonicInstant,
249    ) -> Result<InstallerCancelUpdateResult, fidl::Error> {
250        let _response = self.client.send_query::<
251            InstallerCancelUpdateRequest,
252            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, CancelError>,
253            InstallerMarker,
254        >(
255            (attempt_id,),
256            0x472dec9160a1d0f,
257            fidl::encoding::DynamicFlags::empty(),
258            ___deadline,
259        )?;
260        Ok(_response.map(|x| x))
261    }
262}
263
264#[cfg(target_os = "fuchsia")]
265impl From<InstallerSynchronousProxy> for zx::NullableHandle {
266    fn from(value: InstallerSynchronousProxy) -> Self {
267        value.into_channel().into()
268    }
269}
270
271#[cfg(target_os = "fuchsia")]
272impl From<fidl::Channel> for InstallerSynchronousProxy {
273    fn from(value: fidl::Channel) -> Self {
274        Self::new(value)
275    }
276}
277
278#[cfg(target_os = "fuchsia")]
279impl fidl::endpoints::FromClient for InstallerSynchronousProxy {
280    type Protocol = InstallerMarker;
281
282    fn from_client(value: fidl::endpoints::ClientEnd<InstallerMarker>) -> Self {
283        Self::new(value.into_channel())
284    }
285}
286
287#[derive(Debug, Clone)]
288pub struct InstallerProxy {
289    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
290}
291
292impl fidl::endpoints::Proxy for InstallerProxy {
293    type Protocol = InstallerMarker;
294
295    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
296        Self::new(inner)
297    }
298
299    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
300        self.client.into_channel().map_err(|client| Self { client })
301    }
302
303    fn as_channel(&self) -> &::fidl::AsyncChannel {
304        self.client.as_channel()
305    }
306}
307
308impl InstallerProxy {
309    /// Create a new Proxy for fuchsia.update.installer/Installer.
310    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
311        let protocol_name = <InstallerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
312        Self { client: fidl::client::Client::new(channel, protocol_name) }
313    }
314
315    /// Get a Stream of events from the remote end of the protocol.
316    ///
317    /// # Panics
318    ///
319    /// Panics if the event stream was already taken.
320    pub fn take_event_stream(&self) -> InstallerEventStream {
321        InstallerEventStream { event_receiver: self.client.take_event_receiver() }
322    }
323
324    /// Start an update if one is not running, or attach to a pending update
325    /// attempt if one is running and
326    /// [`Options.allow_attach_to_existing_attempt`] is true. If an update
327    /// attempt is started or attached to, provide status updates through
328    /// `monitor`.
329    ///
330    /// + request `url` The URL of the resource that describes the update. Must have one of the
331    /// following schemes:
332    ///     * "fuchsia-pkg": The resource is an [update package](https://fuchsia.dev/fuchsia-src/concepts/packages/update_pkg).
333    ///     * "http[s]": The resource is a blob-based update manifest.
334    ///       TODO(https://fxbug.dev/479283380): Link to RFC
335    /// + request `options` Configuration options for this update attempt.
336    ///     Ignored or merged with the existing `options` if an update attempt
337    ///     is already in progress.
338    /// + request `monitor` A protocol on which to receive progress updates.
339    /// + request `reboot_controller` An optional protocol to control the timing
340    ///     of the reboot into the update system. If not provided, the update
341    ///     attempt will initiate the reboot as soon as it is ready.
342    ///
343    /// - response `attempt_id` UUID identifying this update attempt. For
344    ///     updates that require a reboot, components may use this identifier to
345    ///     disambiguate the completion of this update attempt from new update
346    ///     attempts that start post-reboot.
347    pub fn r#start_update(
348        &self,
349        mut url: &fidl_fuchsia_pkg::PackageUrl,
350        mut options: &Options,
351        mut monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
352        mut reboot_controller: Option<fidl::endpoints::ServerEnd<RebootControllerMarker>>,
353    ) -> fidl::client::QueryResponseFut<
354        InstallerStartUpdateResult,
355        fidl::encoding::DefaultFuchsiaResourceDialect,
356    > {
357        InstallerProxyInterface::r#start_update(self, url, options, monitor, reboot_controller)
358    }
359
360    /// Attempt to monitor a specific update attempt, if it exists. This request
361    /// will not start an update if one is not already running.
362    ///
363    /// + request `attempt_id` UUID identifying the requested update attempt. If
364    ///     not given, monitor any active update attempt.
365    /// + request `monitor` A protocol on which to receive progress updates.
366    ///
367    /// - response `attached` Whether or not the provided monitor was attached
368    ///     to an in-progress update attempt. If false, monitor will be closed
369    ///     by the server.
370    pub fn r#monitor_update(
371        &self,
372        mut attempt_id: Option<&str>,
373        mut monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
374    ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
375        InstallerProxyInterface::r#monitor_update(self, attempt_id, monitor)
376    }
377
378    /// Suspend a specific update attempt, if it exists.
379    ///
380    /// + request `attempt_id` UUID identifying the requested update attempt. If
381    ///     not given, suspend any active update attempt.
382    pub fn r#suspend_update(
383        &self,
384        mut attempt_id: Option<&str>,
385    ) -> fidl::client::QueryResponseFut<
386        InstallerSuspendUpdateResult,
387        fidl::encoding::DefaultFuchsiaResourceDialect,
388    > {
389        InstallerProxyInterface::r#suspend_update(self, attempt_id)
390    }
391
392    /// Resume a specific update attempt, if it exists.
393    ///
394    /// + request `attempt_id` UUID identifying the requested update attempt. If
395    ///     not given, resume any active update attempt.
396    pub fn r#resume_update(
397        &self,
398        mut attempt_id: Option<&str>,
399    ) -> fidl::client::QueryResponseFut<
400        InstallerResumeUpdateResult,
401        fidl::encoding::DefaultFuchsiaResourceDialect,
402    > {
403        InstallerProxyInterface::r#resume_update(self, attempt_id)
404    }
405
406    /// Cancel a specific update attempt, if it exists.
407    ///
408    /// + request `attempt_id` UUID identifying the requested update attempt. If
409    ///     not given, cancel any active update attempt.
410    pub fn r#cancel_update(
411        &self,
412        mut attempt_id: Option<&str>,
413    ) -> fidl::client::QueryResponseFut<
414        InstallerCancelUpdateResult,
415        fidl::encoding::DefaultFuchsiaResourceDialect,
416    > {
417        InstallerProxyInterface::r#cancel_update(self, attempt_id)
418    }
419}
420
421impl InstallerProxyInterface for InstallerProxy {
422    type StartUpdateResponseFut = fidl::client::QueryResponseFut<
423        InstallerStartUpdateResult,
424        fidl::encoding::DefaultFuchsiaResourceDialect,
425    >;
426    fn r#start_update(
427        &self,
428        mut url: &fidl_fuchsia_pkg::PackageUrl,
429        mut options: &Options,
430        mut monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
431        mut reboot_controller: Option<fidl::endpoints::ServerEnd<RebootControllerMarker>>,
432    ) -> Self::StartUpdateResponseFut {
433        fn _decode(
434            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
435        ) -> Result<InstallerStartUpdateResult, fidl::Error> {
436            let _response = fidl::client::decode_transaction_body::<
437                fidl::encoding::ResultType<InstallerStartUpdateResponse, UpdateNotStartedReason>,
438                fidl::encoding::DefaultFuchsiaResourceDialect,
439                0x2b1c5ba9167c320b,
440            >(_buf?)?;
441            Ok(_response.map(|x| x.attempt_id))
442        }
443        self.client
444            .send_query_and_decode::<InstallerStartUpdateRequest, InstallerStartUpdateResult>(
445                (url, options, monitor, reboot_controller),
446                0x2b1c5ba9167c320b,
447                fidl::encoding::DynamicFlags::empty(),
448                _decode,
449            )
450    }
451
452    type MonitorUpdateResponseFut =
453        fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
454    fn r#monitor_update(
455        &self,
456        mut attempt_id: Option<&str>,
457        mut monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
458    ) -> Self::MonitorUpdateResponseFut {
459        fn _decode(
460            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
461        ) -> Result<bool, fidl::Error> {
462            let _response = fidl::client::decode_transaction_body::<
463                InstallerMonitorUpdateResponse,
464                fidl::encoding::DefaultFuchsiaResourceDialect,
465                0x21d54aa1fd825a32,
466            >(_buf?)?;
467            Ok(_response.attached)
468        }
469        self.client.send_query_and_decode::<InstallerMonitorUpdateRequest, bool>(
470            (attempt_id, monitor),
471            0x21d54aa1fd825a32,
472            fidl::encoding::DynamicFlags::empty(),
473            _decode,
474        )
475    }
476
477    type SuspendUpdateResponseFut = fidl::client::QueryResponseFut<
478        InstallerSuspendUpdateResult,
479        fidl::encoding::DefaultFuchsiaResourceDialect,
480    >;
481    fn r#suspend_update(&self, mut attempt_id: Option<&str>) -> Self::SuspendUpdateResponseFut {
482        fn _decode(
483            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
484        ) -> Result<InstallerSuspendUpdateResult, fidl::Error> {
485            let _response = fidl::client::decode_transaction_body::<
486                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SuspendError>,
487                fidl::encoding::DefaultFuchsiaResourceDialect,
488                0x788de328461f9950,
489            >(_buf?)?;
490            Ok(_response.map(|x| x))
491        }
492        self.client
493            .send_query_and_decode::<InstallerSuspendUpdateRequest, InstallerSuspendUpdateResult>(
494                (attempt_id,),
495                0x788de328461f9950,
496                fidl::encoding::DynamicFlags::empty(),
497                _decode,
498            )
499    }
500
501    type ResumeUpdateResponseFut = fidl::client::QueryResponseFut<
502        InstallerResumeUpdateResult,
503        fidl::encoding::DefaultFuchsiaResourceDialect,
504    >;
505    fn r#resume_update(&self, mut attempt_id: Option<&str>) -> Self::ResumeUpdateResponseFut {
506        fn _decode(
507            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
508        ) -> Result<InstallerResumeUpdateResult, fidl::Error> {
509            let _response = fidl::client::decode_transaction_body::<
510                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ResumeError>,
511                fidl::encoding::DefaultFuchsiaResourceDialect,
512                0x7479e805fec33dd3,
513            >(_buf?)?;
514            Ok(_response.map(|x| x))
515        }
516        self.client
517            .send_query_and_decode::<InstallerResumeUpdateRequest, InstallerResumeUpdateResult>(
518                (attempt_id,),
519                0x7479e805fec33dd3,
520                fidl::encoding::DynamicFlags::empty(),
521                _decode,
522            )
523    }
524
525    type CancelUpdateResponseFut = fidl::client::QueryResponseFut<
526        InstallerCancelUpdateResult,
527        fidl::encoding::DefaultFuchsiaResourceDialect,
528    >;
529    fn r#cancel_update(&self, mut attempt_id: Option<&str>) -> Self::CancelUpdateResponseFut {
530        fn _decode(
531            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
532        ) -> Result<InstallerCancelUpdateResult, fidl::Error> {
533            let _response = fidl::client::decode_transaction_body::<
534                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, CancelError>,
535                fidl::encoding::DefaultFuchsiaResourceDialect,
536                0x472dec9160a1d0f,
537            >(_buf?)?;
538            Ok(_response.map(|x| x))
539        }
540        self.client
541            .send_query_and_decode::<InstallerCancelUpdateRequest, InstallerCancelUpdateResult>(
542                (attempt_id,),
543                0x472dec9160a1d0f,
544                fidl::encoding::DynamicFlags::empty(),
545                _decode,
546            )
547    }
548}
549
550pub struct InstallerEventStream {
551    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
552}
553
554impl std::marker::Unpin for InstallerEventStream {}
555
556impl futures::stream::FusedStream for InstallerEventStream {
557    fn is_terminated(&self) -> bool {
558        self.event_receiver.is_terminated()
559    }
560}
561
562impl futures::Stream for InstallerEventStream {
563    type Item = Result<InstallerEvent, fidl::Error>;
564
565    fn poll_next(
566        mut self: std::pin::Pin<&mut Self>,
567        cx: &mut std::task::Context<'_>,
568    ) -> std::task::Poll<Option<Self::Item>> {
569        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
570            &mut self.event_receiver,
571            cx
572        )?) {
573            Some(buf) => std::task::Poll::Ready(Some(InstallerEvent::decode(buf))),
574            None => std::task::Poll::Ready(None),
575        }
576    }
577}
578
579#[derive(Debug)]
580pub enum InstallerEvent {}
581
582impl InstallerEvent {
583    /// Decodes a message buffer as a [`InstallerEvent`].
584    fn decode(
585        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
586    ) -> Result<InstallerEvent, fidl::Error> {
587        let (bytes, _handles) = buf.split_mut();
588        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
589        debug_assert_eq!(tx_header.tx_id, 0);
590        match tx_header.ordinal {
591            _ => Err(fidl::Error::UnknownOrdinal {
592                ordinal: tx_header.ordinal,
593                protocol_name: <InstallerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
594            }),
595        }
596    }
597}
598
599/// A Stream of incoming requests for fuchsia.update.installer/Installer.
600pub struct InstallerRequestStream {
601    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
602    is_terminated: bool,
603}
604
605impl std::marker::Unpin for InstallerRequestStream {}
606
607impl futures::stream::FusedStream for InstallerRequestStream {
608    fn is_terminated(&self) -> bool {
609        self.is_terminated
610    }
611}
612
613impl fidl::endpoints::RequestStream for InstallerRequestStream {
614    type Protocol = InstallerMarker;
615    type ControlHandle = InstallerControlHandle;
616
617    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
618        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
619    }
620
621    fn control_handle(&self) -> Self::ControlHandle {
622        InstallerControlHandle { inner: self.inner.clone() }
623    }
624
625    fn into_inner(
626        self,
627    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
628    {
629        (self.inner, self.is_terminated)
630    }
631
632    fn from_inner(
633        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
634        is_terminated: bool,
635    ) -> Self {
636        Self { inner, is_terminated }
637    }
638}
639
640impl futures::Stream for InstallerRequestStream {
641    type Item = Result<InstallerRequest, fidl::Error>;
642
643    fn poll_next(
644        mut self: std::pin::Pin<&mut Self>,
645        cx: &mut std::task::Context<'_>,
646    ) -> std::task::Poll<Option<Self::Item>> {
647        let this = &mut *self;
648        if this.inner.check_shutdown(cx) {
649            this.is_terminated = true;
650            return std::task::Poll::Ready(None);
651        }
652        if this.is_terminated {
653            panic!("polled InstallerRequestStream after completion");
654        }
655        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
656            |bytes, handles| {
657                match this.inner.channel().read_etc(cx, bytes, handles) {
658                    std::task::Poll::Ready(Ok(())) => {}
659                    std::task::Poll::Pending => return std::task::Poll::Pending,
660                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
661                        this.is_terminated = true;
662                        return std::task::Poll::Ready(None);
663                    }
664                    std::task::Poll::Ready(Err(e)) => {
665                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
666                            e.into(),
667                        ))));
668                    }
669                }
670
671                // A message has been received from the channel
672                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
673
674                std::task::Poll::Ready(Some(match header.ordinal {
675                    0x2b1c5ba9167c320b => {
676                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
677                        let mut req = fidl::new_empty!(
678                            InstallerStartUpdateRequest,
679                            fidl::encoding::DefaultFuchsiaResourceDialect
680                        );
681                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InstallerStartUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
682                        let control_handle = InstallerControlHandle { inner: this.inner.clone() };
683                        Ok(InstallerRequest::StartUpdate {
684                            url: req.url,
685                            options: req.options,
686                            monitor: req.monitor,
687                            reboot_controller: req.reboot_controller,
688
689                            responder: InstallerStartUpdateResponder {
690                                control_handle: std::mem::ManuallyDrop::new(control_handle),
691                                tx_id: header.tx_id,
692                            },
693                        })
694                    }
695                    0x21d54aa1fd825a32 => {
696                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
697                        let mut req = fidl::new_empty!(
698                            InstallerMonitorUpdateRequest,
699                            fidl::encoding::DefaultFuchsiaResourceDialect
700                        );
701                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InstallerMonitorUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
702                        let control_handle = InstallerControlHandle { inner: this.inner.clone() };
703                        Ok(InstallerRequest::MonitorUpdate {
704                            attempt_id: req.attempt_id,
705                            monitor: req.monitor,
706
707                            responder: InstallerMonitorUpdateResponder {
708                                control_handle: std::mem::ManuallyDrop::new(control_handle),
709                                tx_id: header.tx_id,
710                            },
711                        })
712                    }
713                    0x788de328461f9950 => {
714                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
715                        let mut req = fidl::new_empty!(
716                            InstallerSuspendUpdateRequest,
717                            fidl::encoding::DefaultFuchsiaResourceDialect
718                        );
719                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InstallerSuspendUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
720                        let control_handle = InstallerControlHandle { inner: this.inner.clone() };
721                        Ok(InstallerRequest::SuspendUpdate {
722                            attempt_id: req.attempt_id,
723
724                            responder: InstallerSuspendUpdateResponder {
725                                control_handle: std::mem::ManuallyDrop::new(control_handle),
726                                tx_id: header.tx_id,
727                            },
728                        })
729                    }
730                    0x7479e805fec33dd3 => {
731                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
732                        let mut req = fidl::new_empty!(
733                            InstallerResumeUpdateRequest,
734                            fidl::encoding::DefaultFuchsiaResourceDialect
735                        );
736                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InstallerResumeUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
737                        let control_handle = InstallerControlHandle { inner: this.inner.clone() };
738                        Ok(InstallerRequest::ResumeUpdate {
739                            attempt_id: req.attempt_id,
740
741                            responder: InstallerResumeUpdateResponder {
742                                control_handle: std::mem::ManuallyDrop::new(control_handle),
743                                tx_id: header.tx_id,
744                            },
745                        })
746                    }
747                    0x472dec9160a1d0f => {
748                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
749                        let mut req = fidl::new_empty!(
750                            InstallerCancelUpdateRequest,
751                            fidl::encoding::DefaultFuchsiaResourceDialect
752                        );
753                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InstallerCancelUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
754                        let control_handle = InstallerControlHandle { inner: this.inner.clone() };
755                        Ok(InstallerRequest::CancelUpdate {
756                            attempt_id: req.attempt_id,
757
758                            responder: InstallerCancelUpdateResponder {
759                                control_handle: std::mem::ManuallyDrop::new(control_handle),
760                                tx_id: header.tx_id,
761                            },
762                        })
763                    }
764                    _ => Err(fidl::Error::UnknownOrdinal {
765                        ordinal: header.ordinal,
766                        protocol_name:
767                            <InstallerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
768                    }),
769                }))
770            },
771        )
772    }
773}
774
775/// Updates the system.
776///
777/// This protocol is intended to be consumed by a component capable of
778/// discovering when to update and what version of the system to install.
779#[derive(Debug)]
780pub enum InstallerRequest {
781    /// Start an update if one is not running, or attach to a pending update
782    /// attempt if one is running and
783    /// [`Options.allow_attach_to_existing_attempt`] is true. If an update
784    /// attempt is started or attached to, provide status updates through
785    /// `monitor`.
786    ///
787    /// + request `url` The URL of the resource that describes the update. Must have one of the
788    /// following schemes:
789    ///     * "fuchsia-pkg": The resource is an [update package](https://fuchsia.dev/fuchsia-src/concepts/packages/update_pkg).
790    ///     * "http[s]": The resource is a blob-based update manifest.
791    ///       TODO(https://fxbug.dev/479283380): Link to RFC
792    /// + request `options` Configuration options for this update attempt.
793    ///     Ignored or merged with the existing `options` if an update attempt
794    ///     is already in progress.
795    /// + request `monitor` A protocol on which to receive progress updates.
796    /// + request `reboot_controller` An optional protocol to control the timing
797    ///     of the reboot into the update system. If not provided, the update
798    ///     attempt will initiate the reboot as soon as it is ready.
799    ///
800    /// - response `attempt_id` UUID identifying this update attempt. For
801    ///     updates that require a reboot, components may use this identifier to
802    ///     disambiguate the completion of this update attempt from new update
803    ///     attempts that start post-reboot.
804    StartUpdate {
805        url: fidl_fuchsia_pkg::PackageUrl,
806        options: Options,
807        monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
808        reboot_controller: Option<fidl::endpoints::ServerEnd<RebootControllerMarker>>,
809        responder: InstallerStartUpdateResponder,
810    },
811    /// Attempt to monitor a specific update attempt, if it exists. This request
812    /// will not start an update if one is not already running.
813    ///
814    /// + request `attempt_id` UUID identifying the requested update attempt. If
815    ///     not given, monitor any active update attempt.
816    /// + request `monitor` A protocol on which to receive progress updates.
817    ///
818    /// - response `attached` Whether or not the provided monitor was attached
819    ///     to an in-progress update attempt. If false, monitor will be closed
820    ///     by the server.
821    MonitorUpdate {
822        attempt_id: Option<String>,
823        monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
824        responder: InstallerMonitorUpdateResponder,
825    },
826    /// Suspend a specific update attempt, if it exists.
827    ///
828    /// + request `attempt_id` UUID identifying the requested update attempt. If
829    ///     not given, suspend any active update attempt.
830    SuspendUpdate { attempt_id: Option<String>, responder: InstallerSuspendUpdateResponder },
831    /// Resume a specific update attempt, if it exists.
832    ///
833    /// + request `attempt_id` UUID identifying the requested update attempt. If
834    ///     not given, resume any active update attempt.
835    ResumeUpdate { attempt_id: Option<String>, responder: InstallerResumeUpdateResponder },
836    /// Cancel a specific update attempt, if it exists.
837    ///
838    /// + request `attempt_id` UUID identifying the requested update attempt. If
839    ///     not given, cancel any active update attempt.
840    CancelUpdate { attempt_id: Option<String>, responder: InstallerCancelUpdateResponder },
841}
842
843impl InstallerRequest {
844    #[allow(irrefutable_let_patterns)]
845    pub fn into_start_update(
846        self,
847    ) -> Option<(
848        fidl_fuchsia_pkg::PackageUrl,
849        Options,
850        fidl::endpoints::ClientEnd<MonitorMarker>,
851        Option<fidl::endpoints::ServerEnd<RebootControllerMarker>>,
852        InstallerStartUpdateResponder,
853    )> {
854        if let InstallerRequest::StartUpdate {
855            url,
856            options,
857            monitor,
858            reboot_controller,
859            responder,
860        } = self
861        {
862            Some((url, options, monitor, reboot_controller, responder))
863        } else {
864            None
865        }
866    }
867
868    #[allow(irrefutable_let_patterns)]
869    pub fn into_monitor_update(
870        self,
871    ) -> Option<(
872        Option<String>,
873        fidl::endpoints::ClientEnd<MonitorMarker>,
874        InstallerMonitorUpdateResponder,
875    )> {
876        if let InstallerRequest::MonitorUpdate { attempt_id, monitor, responder } = self {
877            Some((attempt_id, monitor, responder))
878        } else {
879            None
880        }
881    }
882
883    #[allow(irrefutable_let_patterns)]
884    pub fn into_suspend_update(self) -> Option<(Option<String>, InstallerSuspendUpdateResponder)> {
885        if let InstallerRequest::SuspendUpdate { attempt_id, responder } = self {
886            Some((attempt_id, responder))
887        } else {
888            None
889        }
890    }
891
892    #[allow(irrefutable_let_patterns)]
893    pub fn into_resume_update(self) -> Option<(Option<String>, InstallerResumeUpdateResponder)> {
894        if let InstallerRequest::ResumeUpdate { attempt_id, responder } = self {
895            Some((attempt_id, responder))
896        } else {
897            None
898        }
899    }
900
901    #[allow(irrefutable_let_patterns)]
902    pub fn into_cancel_update(self) -> Option<(Option<String>, InstallerCancelUpdateResponder)> {
903        if let InstallerRequest::CancelUpdate { attempt_id, responder } = self {
904            Some((attempt_id, responder))
905        } else {
906            None
907        }
908    }
909
910    /// Name of the method defined in FIDL
911    pub fn method_name(&self) -> &'static str {
912        match *self {
913            InstallerRequest::StartUpdate { .. } => "start_update",
914            InstallerRequest::MonitorUpdate { .. } => "monitor_update",
915            InstallerRequest::SuspendUpdate { .. } => "suspend_update",
916            InstallerRequest::ResumeUpdate { .. } => "resume_update",
917            InstallerRequest::CancelUpdate { .. } => "cancel_update",
918        }
919    }
920}
921
922#[derive(Debug, Clone)]
923pub struct InstallerControlHandle {
924    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
925}
926
927impl fidl::endpoints::ControlHandle for InstallerControlHandle {
928    fn shutdown(&self) {
929        self.inner.shutdown()
930    }
931
932    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
933        self.inner.shutdown_with_epitaph(status)
934    }
935
936    fn is_closed(&self) -> bool {
937        self.inner.channel().is_closed()
938    }
939    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
940        self.inner.channel().on_closed()
941    }
942
943    #[cfg(target_os = "fuchsia")]
944    fn signal_peer(
945        &self,
946        clear_mask: zx::Signals,
947        set_mask: zx::Signals,
948    ) -> Result<(), zx_status::Status> {
949        use fidl::Peered;
950        self.inner.channel().signal_peer(clear_mask, set_mask)
951    }
952}
953
954impl InstallerControlHandle {}
955
956#[must_use = "FIDL methods require a response to be sent"]
957#[derive(Debug)]
958pub struct InstallerStartUpdateResponder {
959    control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
960    tx_id: u32,
961}
962
963/// Set the the channel to be shutdown (see [`InstallerControlHandle::shutdown`])
964/// if the responder is dropped without sending a response, so that the client
965/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
966impl std::ops::Drop for InstallerStartUpdateResponder {
967    fn drop(&mut self) {
968        self.control_handle.shutdown();
969        // Safety: drops once, never accessed again
970        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
971    }
972}
973
974impl fidl::endpoints::Responder for InstallerStartUpdateResponder {
975    type ControlHandle = InstallerControlHandle;
976
977    fn control_handle(&self) -> &InstallerControlHandle {
978        &self.control_handle
979    }
980
981    fn drop_without_shutdown(mut self) {
982        // Safety: drops once, never accessed again due to mem::forget
983        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
984        // Prevent Drop from running (which would shut down the channel)
985        std::mem::forget(self);
986    }
987}
988
989impl InstallerStartUpdateResponder {
990    /// Sends a response to the FIDL transaction.
991    ///
992    /// Sets the channel to shutdown if an error occurs.
993    pub fn send(self, mut result: Result<&str, UpdateNotStartedReason>) -> Result<(), fidl::Error> {
994        let _result = self.send_raw(result);
995        if _result.is_err() {
996            self.control_handle.shutdown();
997        }
998        self.drop_without_shutdown();
999        _result
1000    }
1001
1002    /// Similar to "send" but does not shutdown the channel if an error occurs.
1003    pub fn send_no_shutdown_on_err(
1004        self,
1005        mut result: Result<&str, UpdateNotStartedReason>,
1006    ) -> Result<(), fidl::Error> {
1007        let _result = self.send_raw(result);
1008        self.drop_without_shutdown();
1009        _result
1010    }
1011
1012    fn send_raw(
1013        &self,
1014        mut result: Result<&str, UpdateNotStartedReason>,
1015    ) -> Result<(), fidl::Error> {
1016        self.control_handle.inner.send::<fidl::encoding::ResultType<
1017            InstallerStartUpdateResponse,
1018            UpdateNotStartedReason,
1019        >>(
1020            result.map(|attempt_id| (attempt_id,)),
1021            self.tx_id,
1022            0x2b1c5ba9167c320b,
1023            fidl::encoding::DynamicFlags::empty(),
1024        )
1025    }
1026}
1027
1028#[must_use = "FIDL methods require a response to be sent"]
1029#[derive(Debug)]
1030pub struct InstallerMonitorUpdateResponder {
1031    control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
1032    tx_id: u32,
1033}
1034
1035/// Set the the channel to be shutdown (see [`InstallerControlHandle::shutdown`])
1036/// if the responder is dropped without sending a response, so that the client
1037/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1038impl std::ops::Drop for InstallerMonitorUpdateResponder {
1039    fn drop(&mut self) {
1040        self.control_handle.shutdown();
1041        // Safety: drops once, never accessed again
1042        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1043    }
1044}
1045
1046impl fidl::endpoints::Responder for InstallerMonitorUpdateResponder {
1047    type ControlHandle = InstallerControlHandle;
1048
1049    fn control_handle(&self) -> &InstallerControlHandle {
1050        &self.control_handle
1051    }
1052
1053    fn drop_without_shutdown(mut self) {
1054        // Safety: drops once, never accessed again due to mem::forget
1055        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1056        // Prevent Drop from running (which would shut down the channel)
1057        std::mem::forget(self);
1058    }
1059}
1060
1061impl InstallerMonitorUpdateResponder {
1062    /// Sends a response to the FIDL transaction.
1063    ///
1064    /// Sets the channel to shutdown if an error occurs.
1065    pub fn send(self, mut attached: bool) -> Result<(), fidl::Error> {
1066        let _result = self.send_raw(attached);
1067        if _result.is_err() {
1068            self.control_handle.shutdown();
1069        }
1070        self.drop_without_shutdown();
1071        _result
1072    }
1073
1074    /// Similar to "send" but does not shutdown the channel if an error occurs.
1075    pub fn send_no_shutdown_on_err(self, mut attached: bool) -> Result<(), fidl::Error> {
1076        let _result = self.send_raw(attached);
1077        self.drop_without_shutdown();
1078        _result
1079    }
1080
1081    fn send_raw(&self, mut attached: bool) -> Result<(), fidl::Error> {
1082        self.control_handle.inner.send::<InstallerMonitorUpdateResponse>(
1083            (attached,),
1084            self.tx_id,
1085            0x21d54aa1fd825a32,
1086            fidl::encoding::DynamicFlags::empty(),
1087        )
1088    }
1089}
1090
1091#[must_use = "FIDL methods require a response to be sent"]
1092#[derive(Debug)]
1093pub struct InstallerSuspendUpdateResponder {
1094    control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
1095    tx_id: u32,
1096}
1097
1098/// Set the the channel to be shutdown (see [`InstallerControlHandle::shutdown`])
1099/// if the responder is dropped without sending a response, so that the client
1100/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1101impl std::ops::Drop for InstallerSuspendUpdateResponder {
1102    fn drop(&mut self) {
1103        self.control_handle.shutdown();
1104        // Safety: drops once, never accessed again
1105        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1106    }
1107}
1108
1109impl fidl::endpoints::Responder for InstallerSuspendUpdateResponder {
1110    type ControlHandle = InstallerControlHandle;
1111
1112    fn control_handle(&self) -> &InstallerControlHandle {
1113        &self.control_handle
1114    }
1115
1116    fn drop_without_shutdown(mut self) {
1117        // Safety: drops once, never accessed again due to mem::forget
1118        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1119        // Prevent Drop from running (which would shut down the channel)
1120        std::mem::forget(self);
1121    }
1122}
1123
1124impl InstallerSuspendUpdateResponder {
1125    /// Sends a response to the FIDL transaction.
1126    ///
1127    /// Sets the channel to shutdown if an error occurs.
1128    pub fn send(self, mut result: Result<(), SuspendError>) -> Result<(), fidl::Error> {
1129        let _result = self.send_raw(result);
1130        if _result.is_err() {
1131            self.control_handle.shutdown();
1132        }
1133        self.drop_without_shutdown();
1134        _result
1135    }
1136
1137    /// Similar to "send" but does not shutdown the channel if an error occurs.
1138    pub fn send_no_shutdown_on_err(
1139        self,
1140        mut result: Result<(), SuspendError>,
1141    ) -> Result<(), fidl::Error> {
1142        let _result = self.send_raw(result);
1143        self.drop_without_shutdown();
1144        _result
1145    }
1146
1147    fn send_raw(&self, mut result: Result<(), SuspendError>) -> Result<(), fidl::Error> {
1148        self.control_handle.inner.send::<fidl::encoding::ResultType<
1149            fidl::encoding::EmptyStruct,
1150            SuspendError,
1151        >>(
1152            result,
1153            self.tx_id,
1154            0x788de328461f9950,
1155            fidl::encoding::DynamicFlags::empty(),
1156        )
1157    }
1158}
1159
1160#[must_use = "FIDL methods require a response to be sent"]
1161#[derive(Debug)]
1162pub struct InstallerResumeUpdateResponder {
1163    control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
1164    tx_id: u32,
1165}
1166
1167/// Set the the channel to be shutdown (see [`InstallerControlHandle::shutdown`])
1168/// if the responder is dropped without sending a response, so that the client
1169/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1170impl std::ops::Drop for InstallerResumeUpdateResponder {
1171    fn drop(&mut self) {
1172        self.control_handle.shutdown();
1173        // Safety: drops once, never accessed again
1174        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1175    }
1176}
1177
1178impl fidl::endpoints::Responder for InstallerResumeUpdateResponder {
1179    type ControlHandle = InstallerControlHandle;
1180
1181    fn control_handle(&self) -> &InstallerControlHandle {
1182        &self.control_handle
1183    }
1184
1185    fn drop_without_shutdown(mut self) {
1186        // Safety: drops once, never accessed again due to mem::forget
1187        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1188        // Prevent Drop from running (which would shut down the channel)
1189        std::mem::forget(self);
1190    }
1191}
1192
1193impl InstallerResumeUpdateResponder {
1194    /// Sends a response to the FIDL transaction.
1195    ///
1196    /// Sets the channel to shutdown if an error occurs.
1197    pub fn send(self, mut result: Result<(), ResumeError>) -> Result<(), fidl::Error> {
1198        let _result = self.send_raw(result);
1199        if _result.is_err() {
1200            self.control_handle.shutdown();
1201        }
1202        self.drop_without_shutdown();
1203        _result
1204    }
1205
1206    /// Similar to "send" but does not shutdown the channel if an error occurs.
1207    pub fn send_no_shutdown_on_err(
1208        self,
1209        mut result: Result<(), ResumeError>,
1210    ) -> Result<(), fidl::Error> {
1211        let _result = self.send_raw(result);
1212        self.drop_without_shutdown();
1213        _result
1214    }
1215
1216    fn send_raw(&self, mut result: Result<(), ResumeError>) -> Result<(), fidl::Error> {
1217        self.control_handle.inner.send::<fidl::encoding::ResultType<
1218            fidl::encoding::EmptyStruct,
1219            ResumeError,
1220        >>(
1221            result,
1222            self.tx_id,
1223            0x7479e805fec33dd3,
1224            fidl::encoding::DynamicFlags::empty(),
1225        )
1226    }
1227}
1228
1229#[must_use = "FIDL methods require a response to be sent"]
1230#[derive(Debug)]
1231pub struct InstallerCancelUpdateResponder {
1232    control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
1233    tx_id: u32,
1234}
1235
1236/// Set the the channel to be shutdown (see [`InstallerControlHandle::shutdown`])
1237/// if the responder is dropped without sending a response, so that the client
1238/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1239impl std::ops::Drop for InstallerCancelUpdateResponder {
1240    fn drop(&mut self) {
1241        self.control_handle.shutdown();
1242        // Safety: drops once, never accessed again
1243        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1244    }
1245}
1246
1247impl fidl::endpoints::Responder for InstallerCancelUpdateResponder {
1248    type ControlHandle = InstallerControlHandle;
1249
1250    fn control_handle(&self) -> &InstallerControlHandle {
1251        &self.control_handle
1252    }
1253
1254    fn drop_without_shutdown(mut self) {
1255        // Safety: drops once, never accessed again due to mem::forget
1256        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1257        // Prevent Drop from running (which would shut down the channel)
1258        std::mem::forget(self);
1259    }
1260}
1261
1262impl InstallerCancelUpdateResponder {
1263    /// Sends a response to the FIDL transaction.
1264    ///
1265    /// Sets the channel to shutdown if an error occurs.
1266    pub fn send(self, mut result: Result<(), CancelError>) -> Result<(), fidl::Error> {
1267        let _result = self.send_raw(result);
1268        if _result.is_err() {
1269            self.control_handle.shutdown();
1270        }
1271        self.drop_without_shutdown();
1272        _result
1273    }
1274
1275    /// Similar to "send" but does not shutdown the channel if an error occurs.
1276    pub fn send_no_shutdown_on_err(
1277        self,
1278        mut result: Result<(), CancelError>,
1279    ) -> Result<(), fidl::Error> {
1280        let _result = self.send_raw(result);
1281        self.drop_without_shutdown();
1282        _result
1283    }
1284
1285    fn send_raw(&self, mut result: Result<(), CancelError>) -> Result<(), fidl::Error> {
1286        self.control_handle.inner.send::<fidl::encoding::ResultType<
1287            fidl::encoding::EmptyStruct,
1288            CancelError,
1289        >>(
1290            result,
1291            self.tx_id,
1292            0x472dec9160a1d0f,
1293            fidl::encoding::DynamicFlags::empty(),
1294        )
1295    }
1296}
1297
1298#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1299pub struct MonitorMarker;
1300
1301impl fidl::endpoints::ProtocolMarker for MonitorMarker {
1302    type Proxy = MonitorProxy;
1303    type RequestStream = MonitorRequestStream;
1304    #[cfg(target_os = "fuchsia")]
1305    type SynchronousProxy = MonitorSynchronousProxy;
1306
1307    const DEBUG_NAME: &'static str = "(anonymous) Monitor";
1308}
1309
1310pub trait MonitorProxyInterface: Send + Sync {
1311    type OnStateResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1312    fn r#on_state(&self, state: &State) -> Self::OnStateResponseFut;
1313}
1314#[derive(Debug)]
1315#[cfg(target_os = "fuchsia")]
1316pub struct MonitorSynchronousProxy {
1317    client: fidl::client::sync::Client,
1318}
1319
1320#[cfg(target_os = "fuchsia")]
1321impl fidl::endpoints::SynchronousProxy for MonitorSynchronousProxy {
1322    type Proxy = MonitorProxy;
1323    type Protocol = MonitorMarker;
1324
1325    fn from_channel(inner: fidl::Channel) -> Self {
1326        Self::new(inner)
1327    }
1328
1329    fn into_channel(self) -> fidl::Channel {
1330        self.client.into_channel()
1331    }
1332
1333    fn as_channel(&self) -> &fidl::Channel {
1334        self.client.as_channel()
1335    }
1336}
1337
1338#[cfg(target_os = "fuchsia")]
1339impl MonitorSynchronousProxy {
1340    pub fn new(channel: fidl::Channel) -> Self {
1341        Self { client: fidl::client::sync::Client::new(channel) }
1342    }
1343
1344    pub fn into_channel(self) -> fidl::Channel {
1345        self.client.into_channel()
1346    }
1347
1348    /// Waits until an event arrives and returns it. It is safe for other
1349    /// threads to make concurrent requests while waiting for an event.
1350    pub fn wait_for_event(
1351        &self,
1352        deadline: zx::MonotonicInstant,
1353    ) -> Result<MonitorEvent, fidl::Error> {
1354        MonitorEvent::decode(self.client.wait_for_event::<MonitorMarker>(deadline)?)
1355    }
1356
1357    /// Receives a status update for this installation attempt.
1358    ///
1359    /// This request will be called for all state changes, skipping none.
1360    /// However, message delivery is throttled by the rate at which the
1361    /// implementation acknowledges the messages.
1362    ///
1363    /// The throttled delivery doesn't impact the underlying state of the
1364    /// [`Installer`].  It does not wait for any acknowledgements before it
1365    /// moves on to the next state in its state machine.  The [`Installer`] will
1366    /// simply queue up the states for the [`Monitor`] implementor to receive.
1367    ///
1368    /// During states with data that changes as the updage progress, the
1369    /// [`Installer`] may, at its discretion, collapse redundant information
1370    /// like the fraction completed, in the event that the [`Monitor`]
1371    /// implementation is not responding to the `OnState()` requests in a timely
1372    /// manner.
1373    ///
1374    /// + request `state` The new state of the update installation attempt.
1375    /// - response        The implementation is ready to receive the next
1376    ///                   [`State`] from the [`Installer`].
1377    pub fn r#on_state(
1378        &self,
1379        mut state: &State,
1380        ___deadline: zx::MonotonicInstant,
1381    ) -> Result<(), fidl::Error> {
1382        let _response = self
1383            .client
1384            .send_query::<MonitorOnStateRequest, fidl::encoding::EmptyPayload, MonitorMarker>(
1385                (state,),
1386                0x574105820d16cf26,
1387                fidl::encoding::DynamicFlags::empty(),
1388                ___deadline,
1389            )?;
1390        Ok(_response)
1391    }
1392}
1393
1394#[cfg(target_os = "fuchsia")]
1395impl From<MonitorSynchronousProxy> for zx::NullableHandle {
1396    fn from(value: MonitorSynchronousProxy) -> Self {
1397        value.into_channel().into()
1398    }
1399}
1400
1401#[cfg(target_os = "fuchsia")]
1402impl From<fidl::Channel> for MonitorSynchronousProxy {
1403    fn from(value: fidl::Channel) -> Self {
1404        Self::new(value)
1405    }
1406}
1407
1408#[cfg(target_os = "fuchsia")]
1409impl fidl::endpoints::FromClient for MonitorSynchronousProxy {
1410    type Protocol = MonitorMarker;
1411
1412    fn from_client(value: fidl::endpoints::ClientEnd<MonitorMarker>) -> Self {
1413        Self::new(value.into_channel())
1414    }
1415}
1416
1417#[derive(Debug, Clone)]
1418pub struct MonitorProxy {
1419    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1420}
1421
1422impl fidl::endpoints::Proxy for MonitorProxy {
1423    type Protocol = MonitorMarker;
1424
1425    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1426        Self::new(inner)
1427    }
1428
1429    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1430        self.client.into_channel().map_err(|client| Self { client })
1431    }
1432
1433    fn as_channel(&self) -> &::fidl::AsyncChannel {
1434        self.client.as_channel()
1435    }
1436}
1437
1438impl MonitorProxy {
1439    /// Create a new Proxy for fuchsia.update.installer/Monitor.
1440    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1441        let protocol_name = <MonitorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1442        Self { client: fidl::client::Client::new(channel, protocol_name) }
1443    }
1444
1445    /// Get a Stream of events from the remote end of the protocol.
1446    ///
1447    /// # Panics
1448    ///
1449    /// Panics if the event stream was already taken.
1450    pub fn take_event_stream(&self) -> MonitorEventStream {
1451        MonitorEventStream { event_receiver: self.client.take_event_receiver() }
1452    }
1453
1454    /// Receives a status update for this installation attempt.
1455    ///
1456    /// This request will be called for all state changes, skipping none.
1457    /// However, message delivery is throttled by the rate at which the
1458    /// implementation acknowledges the messages.
1459    ///
1460    /// The throttled delivery doesn't impact the underlying state of the
1461    /// [`Installer`].  It does not wait for any acknowledgements before it
1462    /// moves on to the next state in its state machine.  The [`Installer`] will
1463    /// simply queue up the states for the [`Monitor`] implementor to receive.
1464    ///
1465    /// During states with data that changes as the updage progress, the
1466    /// [`Installer`] may, at its discretion, collapse redundant information
1467    /// like the fraction completed, in the event that the [`Monitor`]
1468    /// implementation is not responding to the `OnState()` requests in a timely
1469    /// manner.
1470    ///
1471    /// + request `state` The new state of the update installation attempt.
1472    /// - response        The implementation is ready to receive the next
1473    ///                   [`State`] from the [`Installer`].
1474    pub fn r#on_state(
1475        &self,
1476        mut state: &State,
1477    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1478        MonitorProxyInterface::r#on_state(self, state)
1479    }
1480}
1481
1482impl MonitorProxyInterface for MonitorProxy {
1483    type OnStateResponseFut =
1484        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1485    fn r#on_state(&self, mut state: &State) -> Self::OnStateResponseFut {
1486        fn _decode(
1487            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1488        ) -> Result<(), fidl::Error> {
1489            let _response = fidl::client::decode_transaction_body::<
1490                fidl::encoding::EmptyPayload,
1491                fidl::encoding::DefaultFuchsiaResourceDialect,
1492                0x574105820d16cf26,
1493            >(_buf?)?;
1494            Ok(_response)
1495        }
1496        self.client.send_query_and_decode::<MonitorOnStateRequest, ()>(
1497            (state,),
1498            0x574105820d16cf26,
1499            fidl::encoding::DynamicFlags::empty(),
1500            _decode,
1501        )
1502    }
1503}
1504
1505pub struct MonitorEventStream {
1506    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1507}
1508
1509impl std::marker::Unpin for MonitorEventStream {}
1510
1511impl futures::stream::FusedStream for MonitorEventStream {
1512    fn is_terminated(&self) -> bool {
1513        self.event_receiver.is_terminated()
1514    }
1515}
1516
1517impl futures::Stream for MonitorEventStream {
1518    type Item = Result<MonitorEvent, fidl::Error>;
1519
1520    fn poll_next(
1521        mut self: std::pin::Pin<&mut Self>,
1522        cx: &mut std::task::Context<'_>,
1523    ) -> std::task::Poll<Option<Self::Item>> {
1524        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1525            &mut self.event_receiver,
1526            cx
1527        )?) {
1528            Some(buf) => std::task::Poll::Ready(Some(MonitorEvent::decode(buf))),
1529            None => std::task::Poll::Ready(None),
1530        }
1531    }
1532}
1533
1534#[derive(Debug)]
1535pub enum MonitorEvent {}
1536
1537impl MonitorEvent {
1538    /// Decodes a message buffer as a [`MonitorEvent`].
1539    fn decode(
1540        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1541    ) -> Result<MonitorEvent, fidl::Error> {
1542        let (bytes, _handles) = buf.split_mut();
1543        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1544        debug_assert_eq!(tx_header.tx_id, 0);
1545        match tx_header.ordinal {
1546            _ => Err(fidl::Error::UnknownOrdinal {
1547                ordinal: tx_header.ordinal,
1548                protocol_name: <MonitorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1549            }),
1550        }
1551    }
1552}
1553
1554/// A Stream of incoming requests for fuchsia.update.installer/Monitor.
1555pub struct MonitorRequestStream {
1556    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1557    is_terminated: bool,
1558}
1559
1560impl std::marker::Unpin for MonitorRequestStream {}
1561
1562impl futures::stream::FusedStream for MonitorRequestStream {
1563    fn is_terminated(&self) -> bool {
1564        self.is_terminated
1565    }
1566}
1567
1568impl fidl::endpoints::RequestStream for MonitorRequestStream {
1569    type Protocol = MonitorMarker;
1570    type ControlHandle = MonitorControlHandle;
1571
1572    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1573        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1574    }
1575
1576    fn control_handle(&self) -> Self::ControlHandle {
1577        MonitorControlHandle { inner: self.inner.clone() }
1578    }
1579
1580    fn into_inner(
1581        self,
1582    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1583    {
1584        (self.inner, self.is_terminated)
1585    }
1586
1587    fn from_inner(
1588        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1589        is_terminated: bool,
1590    ) -> Self {
1591        Self { inner, is_terminated }
1592    }
1593}
1594
1595impl futures::Stream for MonitorRequestStream {
1596    type Item = Result<MonitorRequest, fidl::Error>;
1597
1598    fn poll_next(
1599        mut self: std::pin::Pin<&mut Self>,
1600        cx: &mut std::task::Context<'_>,
1601    ) -> std::task::Poll<Option<Self::Item>> {
1602        let this = &mut *self;
1603        if this.inner.check_shutdown(cx) {
1604            this.is_terminated = true;
1605            return std::task::Poll::Ready(None);
1606        }
1607        if this.is_terminated {
1608            panic!("polled MonitorRequestStream after completion");
1609        }
1610        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1611            |bytes, handles| {
1612                match this.inner.channel().read_etc(cx, bytes, handles) {
1613                    std::task::Poll::Ready(Ok(())) => {}
1614                    std::task::Poll::Pending => return std::task::Poll::Pending,
1615                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1616                        this.is_terminated = true;
1617                        return std::task::Poll::Ready(None);
1618                    }
1619                    std::task::Poll::Ready(Err(e)) => {
1620                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1621                            e.into(),
1622                        ))));
1623                    }
1624                }
1625
1626                // A message has been received from the channel
1627                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1628
1629                std::task::Poll::Ready(Some(match header.ordinal {
1630                    0x574105820d16cf26 => {
1631                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1632                        let mut req = fidl::new_empty!(
1633                            MonitorOnStateRequest,
1634                            fidl::encoding::DefaultFuchsiaResourceDialect
1635                        );
1636                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MonitorOnStateRequest>(&header, _body_bytes, handles, &mut req)?;
1637                        let control_handle = MonitorControlHandle { inner: this.inner.clone() };
1638                        Ok(MonitorRequest::OnState {
1639                            state: req.state,
1640
1641                            responder: MonitorOnStateResponder {
1642                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1643                                tx_id: header.tx_id,
1644                            },
1645                        })
1646                    }
1647                    _ => Err(fidl::Error::UnknownOrdinal {
1648                        ordinal: header.ordinal,
1649                        protocol_name:
1650                            <MonitorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1651                    }),
1652                }))
1653            },
1654        )
1655    }
1656}
1657
1658/// Monitors a single update installation attempt.
1659///
1660/// Clients interested in receiving progress information for an update attempt
1661/// should implement this protocol and provide the client end to
1662/// [`Installer.StartUpdate`] or [`Installer.MonitorUpdate`].
1663#[derive(Debug)]
1664pub enum MonitorRequest {
1665    /// Receives a status update for this installation attempt.
1666    ///
1667    /// This request will be called for all state changes, skipping none.
1668    /// However, message delivery is throttled by the rate at which the
1669    /// implementation acknowledges the messages.
1670    ///
1671    /// The throttled delivery doesn't impact the underlying state of the
1672    /// [`Installer`].  It does not wait for any acknowledgements before it
1673    /// moves on to the next state in its state machine.  The [`Installer`] will
1674    /// simply queue up the states for the [`Monitor`] implementor to receive.
1675    ///
1676    /// During states with data that changes as the updage progress, the
1677    /// [`Installer`] may, at its discretion, collapse redundant information
1678    /// like the fraction completed, in the event that the [`Monitor`]
1679    /// implementation is not responding to the `OnState()` requests in a timely
1680    /// manner.
1681    ///
1682    /// + request `state` The new state of the update installation attempt.
1683    /// - response        The implementation is ready to receive the next
1684    ///                   [`State`] from the [`Installer`].
1685    OnState { state: State, responder: MonitorOnStateResponder },
1686}
1687
1688impl MonitorRequest {
1689    #[allow(irrefutable_let_patterns)]
1690    pub fn into_on_state(self) -> Option<(State, MonitorOnStateResponder)> {
1691        if let MonitorRequest::OnState { state, responder } = self {
1692            Some((state, responder))
1693        } else {
1694            None
1695        }
1696    }
1697
1698    /// Name of the method defined in FIDL
1699    pub fn method_name(&self) -> &'static str {
1700        match *self {
1701            MonitorRequest::OnState { .. } => "on_state",
1702        }
1703    }
1704}
1705
1706#[derive(Debug, Clone)]
1707pub struct MonitorControlHandle {
1708    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1709}
1710
1711impl fidl::endpoints::ControlHandle for MonitorControlHandle {
1712    fn shutdown(&self) {
1713        self.inner.shutdown()
1714    }
1715
1716    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1717        self.inner.shutdown_with_epitaph(status)
1718    }
1719
1720    fn is_closed(&self) -> bool {
1721        self.inner.channel().is_closed()
1722    }
1723    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1724        self.inner.channel().on_closed()
1725    }
1726
1727    #[cfg(target_os = "fuchsia")]
1728    fn signal_peer(
1729        &self,
1730        clear_mask: zx::Signals,
1731        set_mask: zx::Signals,
1732    ) -> Result<(), zx_status::Status> {
1733        use fidl::Peered;
1734        self.inner.channel().signal_peer(clear_mask, set_mask)
1735    }
1736}
1737
1738impl MonitorControlHandle {}
1739
1740#[must_use = "FIDL methods require a response to be sent"]
1741#[derive(Debug)]
1742pub struct MonitorOnStateResponder {
1743    control_handle: std::mem::ManuallyDrop<MonitorControlHandle>,
1744    tx_id: u32,
1745}
1746
1747/// Set the the channel to be shutdown (see [`MonitorControlHandle::shutdown`])
1748/// if the responder is dropped without sending a response, so that the client
1749/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1750impl std::ops::Drop for MonitorOnStateResponder {
1751    fn drop(&mut self) {
1752        self.control_handle.shutdown();
1753        // Safety: drops once, never accessed again
1754        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1755    }
1756}
1757
1758impl fidl::endpoints::Responder for MonitorOnStateResponder {
1759    type ControlHandle = MonitorControlHandle;
1760
1761    fn control_handle(&self) -> &MonitorControlHandle {
1762        &self.control_handle
1763    }
1764
1765    fn drop_without_shutdown(mut self) {
1766        // Safety: drops once, never accessed again due to mem::forget
1767        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1768        // Prevent Drop from running (which would shut down the channel)
1769        std::mem::forget(self);
1770    }
1771}
1772
1773impl MonitorOnStateResponder {
1774    /// Sends a response to the FIDL transaction.
1775    ///
1776    /// Sets the channel to shutdown if an error occurs.
1777    pub fn send(self) -> Result<(), fidl::Error> {
1778        let _result = self.send_raw();
1779        if _result.is_err() {
1780            self.control_handle.shutdown();
1781        }
1782        self.drop_without_shutdown();
1783        _result
1784    }
1785
1786    /// Similar to "send" but does not shutdown the channel if an error occurs.
1787    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1788        let _result = self.send_raw();
1789        self.drop_without_shutdown();
1790        _result
1791    }
1792
1793    fn send_raw(&self) -> Result<(), fidl::Error> {
1794        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1795            (),
1796            self.tx_id,
1797            0x574105820d16cf26,
1798            fidl::encoding::DynamicFlags::empty(),
1799        )
1800    }
1801}
1802
1803#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1804pub struct RebootControllerMarker;
1805
1806impl fidl::endpoints::ProtocolMarker for RebootControllerMarker {
1807    type Proxy = RebootControllerProxy;
1808    type RequestStream = RebootControllerRequestStream;
1809    #[cfg(target_os = "fuchsia")]
1810    type SynchronousProxy = RebootControllerSynchronousProxy;
1811
1812    const DEBUG_NAME: &'static str = "(anonymous) RebootController";
1813}
1814
1815pub trait RebootControllerProxyInterface: Send + Sync {
1816    fn r#unblock(&self) -> Result<(), fidl::Error>;
1817    fn r#detach(&self) -> Result<(), fidl::Error>;
1818}
1819#[derive(Debug)]
1820#[cfg(target_os = "fuchsia")]
1821pub struct RebootControllerSynchronousProxy {
1822    client: fidl::client::sync::Client,
1823}
1824
1825#[cfg(target_os = "fuchsia")]
1826impl fidl::endpoints::SynchronousProxy for RebootControllerSynchronousProxy {
1827    type Proxy = RebootControllerProxy;
1828    type Protocol = RebootControllerMarker;
1829
1830    fn from_channel(inner: fidl::Channel) -> Self {
1831        Self::new(inner)
1832    }
1833
1834    fn into_channel(self) -> fidl::Channel {
1835        self.client.into_channel()
1836    }
1837
1838    fn as_channel(&self) -> &fidl::Channel {
1839        self.client.as_channel()
1840    }
1841}
1842
1843#[cfg(target_os = "fuchsia")]
1844impl RebootControllerSynchronousProxy {
1845    pub fn new(channel: fidl::Channel) -> Self {
1846        Self { client: fidl::client::sync::Client::new(channel) }
1847    }
1848
1849    pub fn into_channel(self) -> fidl::Channel {
1850        self.client.into_channel()
1851    }
1852
1853    /// Waits until an event arrives and returns it. It is safe for other
1854    /// threads to make concurrent requests while waiting for an event.
1855    pub fn wait_for_event(
1856        &self,
1857        deadline: zx::MonotonicInstant,
1858    ) -> Result<RebootControllerEvent, fidl::Error> {
1859        RebootControllerEvent::decode(
1860            self.client.wait_for_event::<RebootControllerMarker>(deadline)?,
1861        )
1862    }
1863
1864    /// Informs the update attempt that it may reboot when ready, unblocking a
1865    /// pending reboot if it is already ready to reboot.
1866    ///
1867    /// If a controller is dropped without sending this request or
1868    /// [`RebootController.Detach`], the update attempt reclaims control of the
1869    /// timing of the reboot, behaving as if the update attempt was not given a
1870    /// [`RebootController`] at all.
1871    pub fn r#unblock(&self) -> Result<(), fidl::Error> {
1872        self.client.send::<fidl::encoding::EmptyPayload>(
1873            (),
1874            0x5705625395e3d520,
1875            fidl::encoding::DynamicFlags::empty(),
1876        )
1877    }
1878
1879    /// Informs the update attempt that it should wait to reboot indefinitely,
1880    /// even if this [`RebootController`] connection is dropped.
1881    pub fn r#detach(&self) -> Result<(), fidl::Error> {
1882        self.client.send::<fidl::encoding::EmptyPayload>(
1883            (),
1884            0x1daa560411955f16,
1885            fidl::encoding::DynamicFlags::empty(),
1886        )
1887    }
1888}
1889
1890#[cfg(target_os = "fuchsia")]
1891impl From<RebootControllerSynchronousProxy> for zx::NullableHandle {
1892    fn from(value: RebootControllerSynchronousProxy) -> Self {
1893        value.into_channel().into()
1894    }
1895}
1896
1897#[cfg(target_os = "fuchsia")]
1898impl From<fidl::Channel> for RebootControllerSynchronousProxy {
1899    fn from(value: fidl::Channel) -> Self {
1900        Self::new(value)
1901    }
1902}
1903
1904#[cfg(target_os = "fuchsia")]
1905impl fidl::endpoints::FromClient for RebootControllerSynchronousProxy {
1906    type Protocol = RebootControllerMarker;
1907
1908    fn from_client(value: fidl::endpoints::ClientEnd<RebootControllerMarker>) -> Self {
1909        Self::new(value.into_channel())
1910    }
1911}
1912
1913#[derive(Debug, Clone)]
1914pub struct RebootControllerProxy {
1915    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1916}
1917
1918impl fidl::endpoints::Proxy for RebootControllerProxy {
1919    type Protocol = RebootControllerMarker;
1920
1921    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1922        Self::new(inner)
1923    }
1924
1925    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1926        self.client.into_channel().map_err(|client| Self { client })
1927    }
1928
1929    fn as_channel(&self) -> &::fidl::AsyncChannel {
1930        self.client.as_channel()
1931    }
1932}
1933
1934impl RebootControllerProxy {
1935    /// Create a new Proxy for fuchsia.update.installer/RebootController.
1936    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1937        let protocol_name = <RebootControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1938        Self { client: fidl::client::Client::new(channel, protocol_name) }
1939    }
1940
1941    /// Get a Stream of events from the remote end of the protocol.
1942    ///
1943    /// # Panics
1944    ///
1945    /// Panics if the event stream was already taken.
1946    pub fn take_event_stream(&self) -> RebootControllerEventStream {
1947        RebootControllerEventStream { event_receiver: self.client.take_event_receiver() }
1948    }
1949
1950    /// Informs the update attempt that it may reboot when ready, unblocking a
1951    /// pending reboot if it is already ready to reboot.
1952    ///
1953    /// If a controller is dropped without sending this request or
1954    /// [`RebootController.Detach`], the update attempt reclaims control of the
1955    /// timing of the reboot, behaving as if the update attempt was not given a
1956    /// [`RebootController`] at all.
1957    pub fn r#unblock(&self) -> Result<(), fidl::Error> {
1958        RebootControllerProxyInterface::r#unblock(self)
1959    }
1960
1961    /// Informs the update attempt that it should wait to reboot indefinitely,
1962    /// even if this [`RebootController`] connection is dropped.
1963    pub fn r#detach(&self) -> Result<(), fidl::Error> {
1964        RebootControllerProxyInterface::r#detach(self)
1965    }
1966}
1967
1968impl RebootControllerProxyInterface for RebootControllerProxy {
1969    fn r#unblock(&self) -> Result<(), fidl::Error> {
1970        self.client.send::<fidl::encoding::EmptyPayload>(
1971            (),
1972            0x5705625395e3d520,
1973            fidl::encoding::DynamicFlags::empty(),
1974        )
1975    }
1976
1977    fn r#detach(&self) -> Result<(), fidl::Error> {
1978        self.client.send::<fidl::encoding::EmptyPayload>(
1979            (),
1980            0x1daa560411955f16,
1981            fidl::encoding::DynamicFlags::empty(),
1982        )
1983    }
1984}
1985
1986pub struct RebootControllerEventStream {
1987    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1988}
1989
1990impl std::marker::Unpin for RebootControllerEventStream {}
1991
1992impl futures::stream::FusedStream for RebootControllerEventStream {
1993    fn is_terminated(&self) -> bool {
1994        self.event_receiver.is_terminated()
1995    }
1996}
1997
1998impl futures::Stream for RebootControllerEventStream {
1999    type Item = Result<RebootControllerEvent, fidl::Error>;
2000
2001    fn poll_next(
2002        mut self: std::pin::Pin<&mut Self>,
2003        cx: &mut std::task::Context<'_>,
2004    ) -> std::task::Poll<Option<Self::Item>> {
2005        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2006            &mut self.event_receiver,
2007            cx
2008        )?) {
2009            Some(buf) => std::task::Poll::Ready(Some(RebootControllerEvent::decode(buf))),
2010            None => std::task::Poll::Ready(None),
2011        }
2012    }
2013}
2014
2015#[derive(Debug)]
2016pub enum RebootControllerEvent {}
2017
2018impl RebootControllerEvent {
2019    /// Decodes a message buffer as a [`RebootControllerEvent`].
2020    fn decode(
2021        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2022    ) -> Result<RebootControllerEvent, fidl::Error> {
2023        let (bytes, _handles) = buf.split_mut();
2024        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2025        debug_assert_eq!(tx_header.tx_id, 0);
2026        match tx_header.ordinal {
2027            _ => Err(fidl::Error::UnknownOrdinal {
2028                ordinal: tx_header.ordinal,
2029                protocol_name:
2030                    <RebootControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2031            }),
2032        }
2033    }
2034}
2035
2036/// A Stream of incoming requests for fuchsia.update.installer/RebootController.
2037pub struct RebootControllerRequestStream {
2038    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2039    is_terminated: bool,
2040}
2041
2042impl std::marker::Unpin for RebootControllerRequestStream {}
2043
2044impl futures::stream::FusedStream for RebootControllerRequestStream {
2045    fn is_terminated(&self) -> bool {
2046        self.is_terminated
2047    }
2048}
2049
2050impl fidl::endpoints::RequestStream for RebootControllerRequestStream {
2051    type Protocol = RebootControllerMarker;
2052    type ControlHandle = RebootControllerControlHandle;
2053
2054    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2055        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2056    }
2057
2058    fn control_handle(&self) -> Self::ControlHandle {
2059        RebootControllerControlHandle { inner: self.inner.clone() }
2060    }
2061
2062    fn into_inner(
2063        self,
2064    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2065    {
2066        (self.inner, self.is_terminated)
2067    }
2068
2069    fn from_inner(
2070        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2071        is_terminated: bool,
2072    ) -> Self {
2073        Self { inner, is_terminated }
2074    }
2075}
2076
2077impl futures::Stream for RebootControllerRequestStream {
2078    type Item = Result<RebootControllerRequest, fidl::Error>;
2079
2080    fn poll_next(
2081        mut self: std::pin::Pin<&mut Self>,
2082        cx: &mut std::task::Context<'_>,
2083    ) -> std::task::Poll<Option<Self::Item>> {
2084        let this = &mut *self;
2085        if this.inner.check_shutdown(cx) {
2086            this.is_terminated = true;
2087            return std::task::Poll::Ready(None);
2088        }
2089        if this.is_terminated {
2090            panic!("polled RebootControllerRequestStream after completion");
2091        }
2092        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2093            |bytes, handles| {
2094                match this.inner.channel().read_etc(cx, bytes, handles) {
2095                    std::task::Poll::Ready(Ok(())) => {}
2096                    std::task::Poll::Pending => return std::task::Poll::Pending,
2097                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2098                        this.is_terminated = true;
2099                        return std::task::Poll::Ready(None);
2100                    }
2101                    std::task::Poll::Ready(Err(e)) => {
2102                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2103                            e.into(),
2104                        ))));
2105                    }
2106                }
2107
2108                // A message has been received from the channel
2109                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2110
2111                std::task::Poll::Ready(Some(match header.ordinal {
2112                    0x5705625395e3d520 => {
2113                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2114                        let mut req = fidl::new_empty!(
2115                            fidl::encoding::EmptyPayload,
2116                            fidl::encoding::DefaultFuchsiaResourceDialect
2117                        );
2118                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2119                        let control_handle =
2120                            RebootControllerControlHandle { inner: this.inner.clone() };
2121                        Ok(RebootControllerRequest::Unblock { control_handle })
2122                    }
2123                    0x1daa560411955f16 => {
2124                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2125                        let mut req = fidl::new_empty!(
2126                            fidl::encoding::EmptyPayload,
2127                            fidl::encoding::DefaultFuchsiaResourceDialect
2128                        );
2129                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2130                        let control_handle =
2131                            RebootControllerControlHandle { inner: this.inner.clone() };
2132                        Ok(RebootControllerRequest::Detach { control_handle })
2133                    }
2134                    _ => Err(fidl::Error::UnknownOrdinal {
2135                        ordinal: header.ordinal,
2136                        protocol_name:
2137                            <RebootControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2138                    }),
2139                }))
2140            },
2141        )
2142    }
2143}
2144
2145/// Controls the timing of the reboot into the updated system.
2146///
2147/// If the client end of a [`RebootController`] is closed without calling
2148/// [`RebootController.Detach()`], the update attempt will fall back to the
2149/// default behavior of rebooting as soon as it is ready.
2150#[derive(Debug)]
2151pub enum RebootControllerRequest {
2152    /// Informs the update attempt that it may reboot when ready, unblocking a
2153    /// pending reboot if it is already ready to reboot.
2154    ///
2155    /// If a controller is dropped without sending this request or
2156    /// [`RebootController.Detach`], the update attempt reclaims control of the
2157    /// timing of the reboot, behaving as if the update attempt was not given a
2158    /// [`RebootController`] at all.
2159    Unblock { control_handle: RebootControllerControlHandle },
2160    /// Informs the update attempt that it should wait to reboot indefinitely,
2161    /// even if this [`RebootController`] connection is dropped.
2162    Detach { control_handle: RebootControllerControlHandle },
2163}
2164
2165impl RebootControllerRequest {
2166    #[allow(irrefutable_let_patterns)]
2167    pub fn into_unblock(self) -> Option<(RebootControllerControlHandle)> {
2168        if let RebootControllerRequest::Unblock { control_handle } = self {
2169            Some((control_handle))
2170        } else {
2171            None
2172        }
2173    }
2174
2175    #[allow(irrefutable_let_patterns)]
2176    pub fn into_detach(self) -> Option<(RebootControllerControlHandle)> {
2177        if let RebootControllerRequest::Detach { control_handle } = self {
2178            Some((control_handle))
2179        } else {
2180            None
2181        }
2182    }
2183
2184    /// Name of the method defined in FIDL
2185    pub fn method_name(&self) -> &'static str {
2186        match *self {
2187            RebootControllerRequest::Unblock { .. } => "unblock",
2188            RebootControllerRequest::Detach { .. } => "detach",
2189        }
2190    }
2191}
2192
2193#[derive(Debug, Clone)]
2194pub struct RebootControllerControlHandle {
2195    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2196}
2197
2198impl fidl::endpoints::ControlHandle for RebootControllerControlHandle {
2199    fn shutdown(&self) {
2200        self.inner.shutdown()
2201    }
2202
2203    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2204        self.inner.shutdown_with_epitaph(status)
2205    }
2206
2207    fn is_closed(&self) -> bool {
2208        self.inner.channel().is_closed()
2209    }
2210    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2211        self.inner.channel().on_closed()
2212    }
2213
2214    #[cfg(target_os = "fuchsia")]
2215    fn signal_peer(
2216        &self,
2217        clear_mask: zx::Signals,
2218        set_mask: zx::Signals,
2219    ) -> Result<(), zx_status::Status> {
2220        use fidl::Peered;
2221        self.inner.channel().signal_peer(clear_mask, set_mask)
2222    }
2223}
2224
2225impl RebootControllerControlHandle {}
2226
2227mod internal {
2228    use super::*;
2229
2230    impl fidl::encoding::ResourceTypeMarker for InstallerMonitorUpdateRequest {
2231        type Borrowed<'a> = &'a mut Self;
2232        fn take_or_borrow<'a>(
2233            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2234        ) -> Self::Borrowed<'a> {
2235            value
2236        }
2237    }
2238
2239    unsafe impl fidl::encoding::TypeMarker for InstallerMonitorUpdateRequest {
2240        type Owned = Self;
2241
2242        #[inline(always)]
2243        fn inline_align(_context: fidl::encoding::Context) -> usize {
2244            8
2245        }
2246
2247        #[inline(always)]
2248        fn inline_size(_context: fidl::encoding::Context) -> usize {
2249            24
2250        }
2251    }
2252
2253    unsafe impl
2254        fidl::encoding::Encode<
2255            InstallerMonitorUpdateRequest,
2256            fidl::encoding::DefaultFuchsiaResourceDialect,
2257        > for &mut InstallerMonitorUpdateRequest
2258    {
2259        #[inline]
2260        unsafe fn encode(
2261            self,
2262            encoder: &mut fidl::encoding::Encoder<
2263                '_,
2264                fidl::encoding::DefaultFuchsiaResourceDialect,
2265            >,
2266            offset: usize,
2267            _depth: fidl::encoding::Depth,
2268        ) -> fidl::Result<()> {
2269            encoder.debug_check_bounds::<InstallerMonitorUpdateRequest>(offset);
2270            // Delegate to tuple encoding.
2271            fidl::encoding::Encode::<InstallerMonitorUpdateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2272                (
2273                    <fidl::encoding::Optional<fidl::encoding::BoundedString<36>> as fidl::encoding::ValueTypeMarker>::borrow(&self.attempt_id),
2274                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.monitor),
2275                ),
2276                encoder, offset, _depth
2277            )
2278        }
2279    }
2280    unsafe impl<
2281        T0: fidl::encoding::Encode<
2282                fidl::encoding::Optional<fidl::encoding::BoundedString<36>>,
2283                fidl::encoding::DefaultFuchsiaResourceDialect,
2284            >,
2285        T1: fidl::encoding::Encode<
2286                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>>,
2287                fidl::encoding::DefaultFuchsiaResourceDialect,
2288            >,
2289    >
2290        fidl::encoding::Encode<
2291            InstallerMonitorUpdateRequest,
2292            fidl::encoding::DefaultFuchsiaResourceDialect,
2293        > for (T0, T1)
2294    {
2295        #[inline]
2296        unsafe fn encode(
2297            self,
2298            encoder: &mut fidl::encoding::Encoder<
2299                '_,
2300                fidl::encoding::DefaultFuchsiaResourceDialect,
2301            >,
2302            offset: usize,
2303            depth: fidl::encoding::Depth,
2304        ) -> fidl::Result<()> {
2305            encoder.debug_check_bounds::<InstallerMonitorUpdateRequest>(offset);
2306            // Zero out padding regions. There's no need to apply masks
2307            // because the unmasked parts will be overwritten by fields.
2308            unsafe {
2309                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2310                (ptr as *mut u64).write_unaligned(0);
2311            }
2312            // Write the fields.
2313            self.0.encode(encoder, offset + 0, depth)?;
2314            self.1.encode(encoder, offset + 16, depth)?;
2315            Ok(())
2316        }
2317    }
2318
2319    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2320        for InstallerMonitorUpdateRequest
2321    {
2322        #[inline(always)]
2323        fn new_empty() -> Self {
2324            Self {
2325                attempt_id: fidl::new_empty!(
2326                    fidl::encoding::Optional<fidl::encoding::BoundedString<36>>,
2327                    fidl::encoding::DefaultFuchsiaResourceDialect
2328                ),
2329                monitor: fidl::new_empty!(
2330                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>>,
2331                    fidl::encoding::DefaultFuchsiaResourceDialect
2332                ),
2333            }
2334        }
2335
2336        #[inline]
2337        unsafe fn decode(
2338            &mut self,
2339            decoder: &mut fidl::encoding::Decoder<
2340                '_,
2341                fidl::encoding::DefaultFuchsiaResourceDialect,
2342            >,
2343            offset: usize,
2344            _depth: fidl::encoding::Depth,
2345        ) -> fidl::Result<()> {
2346            decoder.debug_check_bounds::<Self>(offset);
2347            // Verify that padding bytes are zero.
2348            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2349            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2350            let mask = 0xffffffff00000000u64;
2351            let maskedval = padval & mask;
2352            if maskedval != 0 {
2353                return Err(fidl::Error::NonZeroPadding {
2354                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2355                });
2356            }
2357            fidl::decode!(
2358                fidl::encoding::Optional<fidl::encoding::BoundedString<36>>,
2359                fidl::encoding::DefaultFuchsiaResourceDialect,
2360                &mut self.attempt_id,
2361                decoder,
2362                offset + 0,
2363                _depth
2364            )?;
2365            fidl::decode!(
2366                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>>,
2367                fidl::encoding::DefaultFuchsiaResourceDialect,
2368                &mut self.monitor,
2369                decoder,
2370                offset + 16,
2371                _depth
2372            )?;
2373            Ok(())
2374        }
2375    }
2376
2377    impl fidl::encoding::ResourceTypeMarker for InstallerStartUpdateRequest {
2378        type Borrowed<'a> = &'a mut Self;
2379        fn take_or_borrow<'a>(
2380            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2381        ) -> Self::Borrowed<'a> {
2382            value
2383        }
2384    }
2385
2386    unsafe impl fidl::encoding::TypeMarker for InstallerStartUpdateRequest {
2387        type Owned = Self;
2388
2389        #[inline(always)]
2390        fn inline_align(_context: fidl::encoding::Context) -> usize {
2391            8
2392        }
2393
2394        #[inline(always)]
2395        fn inline_size(_context: fidl::encoding::Context) -> usize {
2396            40
2397        }
2398    }
2399
2400    unsafe impl
2401        fidl::encoding::Encode<
2402            InstallerStartUpdateRequest,
2403            fidl::encoding::DefaultFuchsiaResourceDialect,
2404        > for &mut InstallerStartUpdateRequest
2405    {
2406        #[inline]
2407        unsafe fn encode(
2408            self,
2409            encoder: &mut fidl::encoding::Encoder<
2410                '_,
2411                fidl::encoding::DefaultFuchsiaResourceDialect,
2412            >,
2413            offset: usize,
2414            _depth: fidl::encoding::Depth,
2415        ) -> fidl::Result<()> {
2416            encoder.debug_check_bounds::<InstallerStartUpdateRequest>(offset);
2417            // Delegate to tuple encoding.
2418            fidl::encoding::Encode::<InstallerStartUpdateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2419                (
2420                    <fidl_fuchsia_pkg::PackageUrl as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
2421                    <Options as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
2422                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.monitor),
2423                    <fidl::encoding::Optional<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RebootControllerMarker>>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reboot_controller),
2424                ),
2425                encoder, offset, _depth
2426            )
2427        }
2428    }
2429    unsafe impl<
2430        T0: fidl::encoding::Encode<
2431                fidl_fuchsia_pkg::PackageUrl,
2432                fidl::encoding::DefaultFuchsiaResourceDialect,
2433            >,
2434        T1: fidl::encoding::Encode<Options, fidl::encoding::DefaultFuchsiaResourceDialect>,
2435        T2: fidl::encoding::Encode<
2436                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>>,
2437                fidl::encoding::DefaultFuchsiaResourceDialect,
2438            >,
2439        T3: fidl::encoding::Encode<
2440                fidl::encoding::Optional<
2441                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RebootControllerMarker>>,
2442                >,
2443                fidl::encoding::DefaultFuchsiaResourceDialect,
2444            >,
2445    >
2446        fidl::encoding::Encode<
2447            InstallerStartUpdateRequest,
2448            fidl::encoding::DefaultFuchsiaResourceDialect,
2449        > for (T0, T1, T2, T3)
2450    {
2451        #[inline]
2452        unsafe fn encode(
2453            self,
2454            encoder: &mut fidl::encoding::Encoder<
2455                '_,
2456                fidl::encoding::DefaultFuchsiaResourceDialect,
2457            >,
2458            offset: usize,
2459            depth: fidl::encoding::Depth,
2460        ) -> fidl::Result<()> {
2461            encoder.debug_check_bounds::<InstallerStartUpdateRequest>(offset);
2462            // Zero out padding regions. There's no need to apply masks
2463            // because the unmasked parts will be overwritten by fields.
2464            // Write the fields.
2465            self.0.encode(encoder, offset + 0, depth)?;
2466            self.1.encode(encoder, offset + 16, depth)?;
2467            self.2.encode(encoder, offset + 32, depth)?;
2468            self.3.encode(encoder, offset + 36, depth)?;
2469            Ok(())
2470        }
2471    }
2472
2473    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2474        for InstallerStartUpdateRequest
2475    {
2476        #[inline(always)]
2477        fn new_empty() -> Self {
2478            Self {
2479                url: fidl::new_empty!(
2480                    fidl_fuchsia_pkg::PackageUrl,
2481                    fidl::encoding::DefaultFuchsiaResourceDialect
2482                ),
2483                options: fidl::new_empty!(Options, fidl::encoding::DefaultFuchsiaResourceDialect),
2484                monitor: fidl::new_empty!(
2485                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>>,
2486                    fidl::encoding::DefaultFuchsiaResourceDialect
2487                ),
2488                reboot_controller: fidl::new_empty!(
2489                    fidl::encoding::Optional<
2490                        fidl::encoding::Endpoint<
2491                            fidl::endpoints::ServerEnd<RebootControllerMarker>,
2492                        >,
2493                    >,
2494                    fidl::encoding::DefaultFuchsiaResourceDialect
2495                ),
2496            }
2497        }
2498
2499        #[inline]
2500        unsafe fn decode(
2501            &mut self,
2502            decoder: &mut fidl::encoding::Decoder<
2503                '_,
2504                fidl::encoding::DefaultFuchsiaResourceDialect,
2505            >,
2506            offset: usize,
2507            _depth: fidl::encoding::Depth,
2508        ) -> fidl::Result<()> {
2509            decoder.debug_check_bounds::<Self>(offset);
2510            // Verify that padding bytes are zero.
2511            fidl::decode!(
2512                fidl_fuchsia_pkg::PackageUrl,
2513                fidl::encoding::DefaultFuchsiaResourceDialect,
2514                &mut self.url,
2515                decoder,
2516                offset + 0,
2517                _depth
2518            )?;
2519            fidl::decode!(
2520                Options,
2521                fidl::encoding::DefaultFuchsiaResourceDialect,
2522                &mut self.options,
2523                decoder,
2524                offset + 16,
2525                _depth
2526            )?;
2527            fidl::decode!(
2528                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>>,
2529                fidl::encoding::DefaultFuchsiaResourceDialect,
2530                &mut self.monitor,
2531                decoder,
2532                offset + 32,
2533                _depth
2534            )?;
2535            fidl::decode!(
2536                fidl::encoding::Optional<
2537                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RebootControllerMarker>>,
2538                >,
2539                fidl::encoding::DefaultFuchsiaResourceDialect,
2540                &mut self.reboot_controller,
2541                decoder,
2542                offset + 36,
2543                _depth
2544            )?;
2545            Ok(())
2546        }
2547    }
2548}