Skip to main content

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