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