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 InstallerControlHandle {
721    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
722        self.inner.shutdown_with_epitaph(status.into())
723    }
724}
725
726impl fdomain_client::fidl::ControlHandle for InstallerControlHandle {
727    fn shutdown(&self) {
728        self.inner.shutdown()
729    }
730
731    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
732        self.inner.shutdown_with_epitaph(status)
733    }
734
735    fn is_closed(&self) -> bool {
736        self.inner.channel().is_closed()
737    }
738    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
739        self.inner.channel().on_closed()
740    }
741}
742
743impl InstallerControlHandle {}
744
745#[must_use = "FIDL methods require a response to be sent"]
746#[derive(Debug)]
747pub struct InstallerStartUpdateResponder {
748    control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
749    tx_id: u32,
750}
751
752/// Set the the channel to be shutdown (see [`InstallerControlHandle::shutdown`])
753/// if the responder is dropped without sending a response, so that the client
754/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
755impl std::ops::Drop for InstallerStartUpdateResponder {
756    fn drop(&mut self) {
757        self.control_handle.shutdown();
758        // Safety: drops once, never accessed again
759        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
760    }
761}
762
763impl fdomain_client::fidl::Responder for InstallerStartUpdateResponder {
764    type ControlHandle = InstallerControlHandle;
765
766    fn control_handle(&self) -> &InstallerControlHandle {
767        &self.control_handle
768    }
769
770    fn drop_without_shutdown(mut self) {
771        // Safety: drops once, never accessed again due to mem::forget
772        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
773        // Prevent Drop from running (which would shut down the channel)
774        std::mem::forget(self);
775    }
776}
777
778impl InstallerStartUpdateResponder {
779    /// Sends a response to the FIDL transaction.
780    ///
781    /// Sets the channel to shutdown if an error occurs.
782    pub fn send(self, mut result: Result<&str, UpdateNotStartedReason>) -> Result<(), fidl::Error> {
783        let _result = self.send_raw(result);
784        if _result.is_err() {
785            self.control_handle.shutdown();
786        }
787        self.drop_without_shutdown();
788        _result
789    }
790
791    /// Similar to "send" but does not shutdown the channel if an error occurs.
792    pub fn send_no_shutdown_on_err(
793        self,
794        mut result: Result<&str, UpdateNotStartedReason>,
795    ) -> Result<(), fidl::Error> {
796        let _result = self.send_raw(result);
797        self.drop_without_shutdown();
798        _result
799    }
800
801    fn send_raw(
802        &self,
803        mut result: Result<&str, UpdateNotStartedReason>,
804    ) -> Result<(), fidl::Error> {
805        self.control_handle.inner.send::<fidl::encoding::ResultType<
806            InstallerStartUpdateResponse,
807            UpdateNotStartedReason,
808        >>(
809            result.map(|attempt_id| (attempt_id,)),
810            self.tx_id,
811            0x2b1c5ba9167c320b,
812            fidl::encoding::DynamicFlags::empty(),
813        )
814    }
815}
816
817#[must_use = "FIDL methods require a response to be sent"]
818#[derive(Debug)]
819pub struct InstallerMonitorUpdateResponder {
820    control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
821    tx_id: u32,
822}
823
824/// Set the the channel to be shutdown (see [`InstallerControlHandle::shutdown`])
825/// if the responder is dropped without sending a response, so that the client
826/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
827impl std::ops::Drop for InstallerMonitorUpdateResponder {
828    fn drop(&mut self) {
829        self.control_handle.shutdown();
830        // Safety: drops once, never accessed again
831        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
832    }
833}
834
835impl fdomain_client::fidl::Responder for InstallerMonitorUpdateResponder {
836    type ControlHandle = InstallerControlHandle;
837
838    fn control_handle(&self) -> &InstallerControlHandle {
839        &self.control_handle
840    }
841
842    fn drop_without_shutdown(mut self) {
843        // Safety: drops once, never accessed again due to mem::forget
844        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
845        // Prevent Drop from running (which would shut down the channel)
846        std::mem::forget(self);
847    }
848}
849
850impl InstallerMonitorUpdateResponder {
851    /// Sends a response to the FIDL transaction.
852    ///
853    /// Sets the channel to shutdown if an error occurs.
854    pub fn send(self, mut attached: bool) -> Result<(), fidl::Error> {
855        let _result = self.send_raw(attached);
856        if _result.is_err() {
857            self.control_handle.shutdown();
858        }
859        self.drop_without_shutdown();
860        _result
861    }
862
863    /// Similar to "send" but does not shutdown the channel if an error occurs.
864    pub fn send_no_shutdown_on_err(self, mut attached: bool) -> Result<(), fidl::Error> {
865        let _result = self.send_raw(attached);
866        self.drop_without_shutdown();
867        _result
868    }
869
870    fn send_raw(&self, mut attached: bool) -> Result<(), fidl::Error> {
871        self.control_handle.inner.send::<InstallerMonitorUpdateResponse>(
872            (attached,),
873            self.tx_id,
874            0x21d54aa1fd825a32,
875            fidl::encoding::DynamicFlags::empty(),
876        )
877    }
878}
879
880#[must_use = "FIDL methods require a response to be sent"]
881#[derive(Debug)]
882pub struct InstallerSuspendUpdateResponder {
883    control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
884    tx_id: u32,
885}
886
887/// Set the the channel to be shutdown (see [`InstallerControlHandle::shutdown`])
888/// if the responder is dropped without sending a response, so that the client
889/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
890impl std::ops::Drop for InstallerSuspendUpdateResponder {
891    fn drop(&mut self) {
892        self.control_handle.shutdown();
893        // Safety: drops once, never accessed again
894        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
895    }
896}
897
898impl fdomain_client::fidl::Responder for InstallerSuspendUpdateResponder {
899    type ControlHandle = InstallerControlHandle;
900
901    fn control_handle(&self) -> &InstallerControlHandle {
902        &self.control_handle
903    }
904
905    fn drop_without_shutdown(mut self) {
906        // Safety: drops once, never accessed again due to mem::forget
907        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
908        // Prevent Drop from running (which would shut down the channel)
909        std::mem::forget(self);
910    }
911}
912
913impl InstallerSuspendUpdateResponder {
914    /// Sends a response to the FIDL transaction.
915    ///
916    /// Sets the channel to shutdown if an error occurs.
917    pub fn send(self, mut result: Result<(), SuspendError>) -> Result<(), fidl::Error> {
918        let _result = self.send_raw(result);
919        if _result.is_err() {
920            self.control_handle.shutdown();
921        }
922        self.drop_without_shutdown();
923        _result
924    }
925
926    /// Similar to "send" but does not shutdown the channel if an error occurs.
927    pub fn send_no_shutdown_on_err(
928        self,
929        mut result: Result<(), SuspendError>,
930    ) -> Result<(), fidl::Error> {
931        let _result = self.send_raw(result);
932        self.drop_without_shutdown();
933        _result
934    }
935
936    fn send_raw(&self, mut result: Result<(), SuspendError>) -> Result<(), fidl::Error> {
937        self.control_handle.inner.send::<fidl::encoding::ResultType<
938            fidl::encoding::EmptyStruct,
939            SuspendError,
940        >>(
941            result,
942            self.tx_id,
943            0x788de328461f9950,
944            fidl::encoding::DynamicFlags::empty(),
945        )
946    }
947}
948
949#[must_use = "FIDL methods require a response to be sent"]
950#[derive(Debug)]
951pub struct InstallerResumeUpdateResponder {
952    control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
953    tx_id: u32,
954}
955
956/// Set the the channel to be shutdown (see [`InstallerControlHandle::shutdown`])
957/// if the responder is dropped without sending a response, so that the client
958/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
959impl std::ops::Drop for InstallerResumeUpdateResponder {
960    fn drop(&mut self) {
961        self.control_handle.shutdown();
962        // Safety: drops once, never accessed again
963        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
964    }
965}
966
967impl fdomain_client::fidl::Responder for InstallerResumeUpdateResponder {
968    type ControlHandle = InstallerControlHandle;
969
970    fn control_handle(&self) -> &InstallerControlHandle {
971        &self.control_handle
972    }
973
974    fn drop_without_shutdown(mut self) {
975        // Safety: drops once, never accessed again due to mem::forget
976        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
977        // Prevent Drop from running (which would shut down the channel)
978        std::mem::forget(self);
979    }
980}
981
982impl InstallerResumeUpdateResponder {
983    /// Sends a response to the FIDL transaction.
984    ///
985    /// Sets the channel to shutdown if an error occurs.
986    pub fn send(self, mut result: Result<(), ResumeError>) -> Result<(), fidl::Error> {
987        let _result = self.send_raw(result);
988        if _result.is_err() {
989            self.control_handle.shutdown();
990        }
991        self.drop_without_shutdown();
992        _result
993    }
994
995    /// Similar to "send" but does not shutdown the channel if an error occurs.
996    pub fn send_no_shutdown_on_err(
997        self,
998        mut result: Result<(), ResumeError>,
999    ) -> Result<(), fidl::Error> {
1000        let _result = self.send_raw(result);
1001        self.drop_without_shutdown();
1002        _result
1003    }
1004
1005    fn send_raw(&self, mut result: Result<(), ResumeError>) -> Result<(), fidl::Error> {
1006        self.control_handle.inner.send::<fidl::encoding::ResultType<
1007            fidl::encoding::EmptyStruct,
1008            ResumeError,
1009        >>(
1010            result,
1011            self.tx_id,
1012            0x7479e805fec33dd3,
1013            fidl::encoding::DynamicFlags::empty(),
1014        )
1015    }
1016}
1017
1018#[must_use = "FIDL methods require a response to be sent"]
1019#[derive(Debug)]
1020pub struct InstallerCancelUpdateResponder {
1021    control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
1022    tx_id: u32,
1023}
1024
1025/// Set the the channel to be shutdown (see [`InstallerControlHandle::shutdown`])
1026/// if the responder is dropped without sending a response, so that the client
1027/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1028impl std::ops::Drop for InstallerCancelUpdateResponder {
1029    fn drop(&mut self) {
1030        self.control_handle.shutdown();
1031        // Safety: drops once, never accessed again
1032        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1033    }
1034}
1035
1036impl fdomain_client::fidl::Responder for InstallerCancelUpdateResponder {
1037    type ControlHandle = InstallerControlHandle;
1038
1039    fn control_handle(&self) -> &InstallerControlHandle {
1040        &self.control_handle
1041    }
1042
1043    fn drop_without_shutdown(mut self) {
1044        // Safety: drops once, never accessed again due to mem::forget
1045        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1046        // Prevent Drop from running (which would shut down the channel)
1047        std::mem::forget(self);
1048    }
1049}
1050
1051impl InstallerCancelUpdateResponder {
1052    /// Sends a response to the FIDL transaction.
1053    ///
1054    /// Sets the channel to shutdown if an error occurs.
1055    pub fn send(self, mut result: Result<(), CancelError>) -> Result<(), fidl::Error> {
1056        let _result = self.send_raw(result);
1057        if _result.is_err() {
1058            self.control_handle.shutdown();
1059        }
1060        self.drop_without_shutdown();
1061        _result
1062    }
1063
1064    /// Similar to "send" but does not shutdown the channel if an error occurs.
1065    pub fn send_no_shutdown_on_err(
1066        self,
1067        mut result: Result<(), CancelError>,
1068    ) -> Result<(), fidl::Error> {
1069        let _result = self.send_raw(result);
1070        self.drop_without_shutdown();
1071        _result
1072    }
1073
1074    fn send_raw(&self, mut result: Result<(), CancelError>) -> Result<(), fidl::Error> {
1075        self.control_handle.inner.send::<fidl::encoding::ResultType<
1076            fidl::encoding::EmptyStruct,
1077            CancelError,
1078        >>(
1079            result,
1080            self.tx_id,
1081            0x472dec9160a1d0f,
1082            fidl::encoding::DynamicFlags::empty(),
1083        )
1084    }
1085}
1086
1087#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1088pub struct MonitorMarker;
1089
1090impl fdomain_client::fidl::ProtocolMarker for MonitorMarker {
1091    type Proxy = MonitorProxy;
1092    type RequestStream = MonitorRequestStream;
1093
1094    const DEBUG_NAME: &'static str = "(anonymous) Monitor";
1095}
1096
1097pub trait MonitorProxyInterface: Send + Sync {
1098    type OnStateResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1099    fn r#on_state(&self, state: &State) -> Self::OnStateResponseFut;
1100}
1101
1102#[derive(Debug, Clone)]
1103pub struct MonitorProxy {
1104    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1105}
1106
1107impl fdomain_client::fidl::Proxy for MonitorProxy {
1108    type Protocol = MonitorMarker;
1109
1110    fn from_channel(inner: fdomain_client::Channel) -> Self {
1111        Self::new(inner)
1112    }
1113
1114    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1115        self.client.into_channel().map_err(|client| Self { client })
1116    }
1117
1118    fn as_channel(&self) -> &fdomain_client::Channel {
1119        self.client.as_channel()
1120    }
1121}
1122
1123impl MonitorProxy {
1124    /// Create a new Proxy for fuchsia.update.installer/Monitor.
1125    pub fn new(channel: fdomain_client::Channel) -> Self {
1126        let protocol_name = <MonitorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1127        Self { client: fidl::client::Client::new(channel, protocol_name) }
1128    }
1129
1130    /// Get a Stream of events from the remote end of the protocol.
1131    ///
1132    /// # Panics
1133    ///
1134    /// Panics if the event stream was already taken.
1135    pub fn take_event_stream(&self) -> MonitorEventStream {
1136        MonitorEventStream { event_receiver: self.client.take_event_receiver() }
1137    }
1138
1139    /// Receives a status update for this installation attempt.
1140    ///
1141    /// This request will be called for all state changes, skipping none.
1142    /// However, message delivery is throttled by the rate at which the
1143    /// implementation acknowledges the messages.
1144    ///
1145    /// The throttled delivery doesn't impact the underlying state of the
1146    /// [`Installer`].  It does not wait for any acknowledgements before it
1147    /// moves on to the next state in its state machine.  The [`Installer`] will
1148    /// simply queue up the states for the [`Monitor`] implementor to receive.
1149    ///
1150    /// During states with data that changes as the updage progress, the
1151    /// [`Installer`] may, at its discretion, collapse redundant information
1152    /// like the fraction completed, in the event that the [`Monitor`]
1153    /// implementation is not responding to the `OnState()` requests in a timely
1154    /// manner.
1155    ///
1156    /// + request `state` The new state of the update installation attempt.
1157    /// - response        The implementation is ready to receive the next
1158    ///                   [`State`] from the [`Installer`].
1159    pub fn r#on_state(
1160        &self,
1161        mut state: &State,
1162    ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
1163        MonitorProxyInterface::r#on_state(self, state)
1164    }
1165}
1166
1167impl MonitorProxyInterface for MonitorProxy {
1168    type OnStateResponseFut =
1169        fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
1170    fn r#on_state(&self, mut state: &State) -> Self::OnStateResponseFut {
1171        fn _decode(
1172            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1173        ) -> Result<(), fidl::Error> {
1174            let _response = fidl::client::decode_transaction_body::<
1175                fidl::encoding::EmptyPayload,
1176                fdomain_client::fidl::FDomainResourceDialect,
1177                0x574105820d16cf26,
1178            >(_buf?)?;
1179            Ok(_response)
1180        }
1181        self.client.send_query_and_decode::<MonitorOnStateRequest, ()>(
1182            (state,),
1183            0x574105820d16cf26,
1184            fidl::encoding::DynamicFlags::empty(),
1185            _decode,
1186        )
1187    }
1188}
1189
1190pub struct MonitorEventStream {
1191    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1192}
1193
1194impl std::marker::Unpin for MonitorEventStream {}
1195
1196impl futures::stream::FusedStream for MonitorEventStream {
1197    fn is_terminated(&self) -> bool {
1198        self.event_receiver.is_terminated()
1199    }
1200}
1201
1202impl futures::Stream for MonitorEventStream {
1203    type Item = Result<MonitorEvent, fidl::Error>;
1204
1205    fn poll_next(
1206        mut self: std::pin::Pin<&mut Self>,
1207        cx: &mut std::task::Context<'_>,
1208    ) -> std::task::Poll<Option<Self::Item>> {
1209        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1210            &mut self.event_receiver,
1211            cx
1212        )?) {
1213            Some(buf) => std::task::Poll::Ready(Some(MonitorEvent::decode(buf))),
1214            None => std::task::Poll::Ready(None),
1215        }
1216    }
1217}
1218
1219#[derive(Debug)]
1220pub enum MonitorEvent {}
1221
1222impl MonitorEvent {
1223    /// Decodes a message buffer as a [`MonitorEvent`].
1224    fn decode(
1225        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1226    ) -> Result<MonitorEvent, fidl::Error> {
1227        let (bytes, _handles) = buf.split_mut();
1228        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1229        debug_assert_eq!(tx_header.tx_id, 0);
1230        match tx_header.ordinal {
1231            _ => Err(fidl::Error::UnknownOrdinal {
1232                ordinal: tx_header.ordinal,
1233                protocol_name: <MonitorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1234            }),
1235        }
1236    }
1237}
1238
1239/// A Stream of incoming requests for fuchsia.update.installer/Monitor.
1240pub struct MonitorRequestStream {
1241    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1242    is_terminated: bool,
1243}
1244
1245impl std::marker::Unpin for MonitorRequestStream {}
1246
1247impl futures::stream::FusedStream for MonitorRequestStream {
1248    fn is_terminated(&self) -> bool {
1249        self.is_terminated
1250    }
1251}
1252
1253impl fdomain_client::fidl::RequestStream for MonitorRequestStream {
1254    type Protocol = MonitorMarker;
1255    type ControlHandle = MonitorControlHandle;
1256
1257    fn from_channel(channel: fdomain_client::Channel) -> Self {
1258        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1259    }
1260
1261    fn control_handle(&self) -> Self::ControlHandle {
1262        MonitorControlHandle { inner: self.inner.clone() }
1263    }
1264
1265    fn into_inner(
1266        self,
1267    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1268    {
1269        (self.inner, self.is_terminated)
1270    }
1271
1272    fn from_inner(
1273        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1274        is_terminated: bool,
1275    ) -> Self {
1276        Self { inner, is_terminated }
1277    }
1278}
1279
1280impl futures::Stream for MonitorRequestStream {
1281    type Item = Result<MonitorRequest, fidl::Error>;
1282
1283    fn poll_next(
1284        mut self: std::pin::Pin<&mut Self>,
1285        cx: &mut std::task::Context<'_>,
1286    ) -> std::task::Poll<Option<Self::Item>> {
1287        let this = &mut *self;
1288        if this.inner.check_shutdown(cx) {
1289            this.is_terminated = true;
1290            return std::task::Poll::Ready(None);
1291        }
1292        if this.is_terminated {
1293            panic!("polled MonitorRequestStream after completion");
1294        }
1295        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1296            |bytes, handles| {
1297                match this.inner.channel().read_etc(cx, bytes, handles) {
1298                    std::task::Poll::Ready(Ok(())) => {}
1299                    std::task::Poll::Pending => return std::task::Poll::Pending,
1300                    std::task::Poll::Ready(Err(None)) => {
1301                        this.is_terminated = true;
1302                        return std::task::Poll::Ready(None);
1303                    }
1304                    std::task::Poll::Ready(Err(Some(e))) => {
1305                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1306                            e.into(),
1307                        ))));
1308                    }
1309                }
1310
1311                // A message has been received from the channel
1312                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1313
1314                std::task::Poll::Ready(Some(match header.ordinal {
1315                    0x574105820d16cf26 => {
1316                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1317                        let mut req = fidl::new_empty!(
1318                            MonitorOnStateRequest,
1319                            fdomain_client::fidl::FDomainResourceDialect
1320                        );
1321                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<MonitorOnStateRequest>(&header, _body_bytes, handles, &mut req)?;
1322                        let control_handle = MonitorControlHandle { inner: this.inner.clone() };
1323                        Ok(MonitorRequest::OnState {
1324                            state: req.state,
1325
1326                            responder: MonitorOnStateResponder {
1327                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1328                                tx_id: header.tx_id,
1329                            },
1330                        })
1331                    }
1332                    _ => Err(fidl::Error::UnknownOrdinal {
1333                        ordinal: header.ordinal,
1334                        protocol_name:
1335                            <MonitorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1336                    }),
1337                }))
1338            },
1339        )
1340    }
1341}
1342
1343/// Monitors a single update installation attempt.
1344///
1345/// Clients interested in receiving progress information for an update attempt
1346/// should implement this protocol and provide the client end to
1347/// [`Installer.StartUpdate`] or [`Installer.MonitorUpdate`].
1348#[derive(Debug)]
1349pub enum MonitorRequest {
1350    /// Receives a status update for this installation attempt.
1351    ///
1352    /// This request will be called for all state changes, skipping none.
1353    /// However, message delivery is throttled by the rate at which the
1354    /// implementation acknowledges the messages.
1355    ///
1356    /// The throttled delivery doesn't impact the underlying state of the
1357    /// [`Installer`].  It does not wait for any acknowledgements before it
1358    /// moves on to the next state in its state machine.  The [`Installer`] will
1359    /// simply queue up the states for the [`Monitor`] implementor to receive.
1360    ///
1361    /// During states with data that changes as the updage progress, the
1362    /// [`Installer`] may, at its discretion, collapse redundant information
1363    /// like the fraction completed, in the event that the [`Monitor`]
1364    /// implementation is not responding to the `OnState()` requests in a timely
1365    /// manner.
1366    ///
1367    /// + request `state` The new state of the update installation attempt.
1368    /// - response        The implementation is ready to receive the next
1369    ///                   [`State`] from the [`Installer`].
1370    OnState { state: State, responder: MonitorOnStateResponder },
1371}
1372
1373impl MonitorRequest {
1374    #[allow(irrefutable_let_patterns)]
1375    pub fn into_on_state(self) -> Option<(State, MonitorOnStateResponder)> {
1376        if let MonitorRequest::OnState { state, responder } = self {
1377            Some((state, responder))
1378        } else {
1379            None
1380        }
1381    }
1382
1383    /// Name of the method defined in FIDL
1384    pub fn method_name(&self) -> &'static str {
1385        match *self {
1386            MonitorRequest::OnState { .. } => "on_state",
1387        }
1388    }
1389}
1390
1391#[derive(Debug, Clone)]
1392pub struct MonitorControlHandle {
1393    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1394}
1395
1396impl MonitorControlHandle {
1397    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1398        self.inner.shutdown_with_epitaph(status.into())
1399    }
1400}
1401
1402impl fdomain_client::fidl::ControlHandle for MonitorControlHandle {
1403    fn shutdown(&self) {
1404        self.inner.shutdown()
1405    }
1406
1407    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1408        self.inner.shutdown_with_epitaph(status)
1409    }
1410
1411    fn is_closed(&self) -> bool {
1412        self.inner.channel().is_closed()
1413    }
1414    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1415        self.inner.channel().on_closed()
1416    }
1417}
1418
1419impl MonitorControlHandle {}
1420
1421#[must_use = "FIDL methods require a response to be sent"]
1422#[derive(Debug)]
1423pub struct MonitorOnStateResponder {
1424    control_handle: std::mem::ManuallyDrop<MonitorControlHandle>,
1425    tx_id: u32,
1426}
1427
1428/// Set the the channel to be shutdown (see [`MonitorControlHandle::shutdown`])
1429/// if the responder is dropped without sending a response, so that the client
1430/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1431impl std::ops::Drop for MonitorOnStateResponder {
1432    fn drop(&mut self) {
1433        self.control_handle.shutdown();
1434        // Safety: drops once, never accessed again
1435        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1436    }
1437}
1438
1439impl fdomain_client::fidl::Responder for MonitorOnStateResponder {
1440    type ControlHandle = MonitorControlHandle;
1441
1442    fn control_handle(&self) -> &MonitorControlHandle {
1443        &self.control_handle
1444    }
1445
1446    fn drop_without_shutdown(mut self) {
1447        // Safety: drops once, never accessed again due to mem::forget
1448        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1449        // Prevent Drop from running (which would shut down the channel)
1450        std::mem::forget(self);
1451    }
1452}
1453
1454impl MonitorOnStateResponder {
1455    /// Sends a response to the FIDL transaction.
1456    ///
1457    /// Sets the channel to shutdown if an error occurs.
1458    pub fn send(self) -> Result<(), fidl::Error> {
1459        let _result = self.send_raw();
1460        if _result.is_err() {
1461            self.control_handle.shutdown();
1462        }
1463        self.drop_without_shutdown();
1464        _result
1465    }
1466
1467    /// Similar to "send" but does not shutdown the channel if an error occurs.
1468    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1469        let _result = self.send_raw();
1470        self.drop_without_shutdown();
1471        _result
1472    }
1473
1474    fn send_raw(&self) -> Result<(), fidl::Error> {
1475        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1476            (),
1477            self.tx_id,
1478            0x574105820d16cf26,
1479            fidl::encoding::DynamicFlags::empty(),
1480        )
1481    }
1482}
1483
1484#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1485pub struct RebootControllerMarker;
1486
1487impl fdomain_client::fidl::ProtocolMarker for RebootControllerMarker {
1488    type Proxy = RebootControllerProxy;
1489    type RequestStream = RebootControllerRequestStream;
1490
1491    const DEBUG_NAME: &'static str = "(anonymous) RebootController";
1492}
1493
1494pub trait RebootControllerProxyInterface: Send + Sync {
1495    fn r#unblock(&self) -> Result<(), fidl::Error>;
1496    fn r#detach(&self) -> Result<(), fidl::Error>;
1497}
1498
1499#[derive(Debug, Clone)]
1500pub struct RebootControllerProxy {
1501    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1502}
1503
1504impl fdomain_client::fidl::Proxy for RebootControllerProxy {
1505    type Protocol = RebootControllerMarker;
1506
1507    fn from_channel(inner: fdomain_client::Channel) -> Self {
1508        Self::new(inner)
1509    }
1510
1511    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1512        self.client.into_channel().map_err(|client| Self { client })
1513    }
1514
1515    fn as_channel(&self) -> &fdomain_client::Channel {
1516        self.client.as_channel()
1517    }
1518}
1519
1520impl RebootControllerProxy {
1521    /// Create a new Proxy for fuchsia.update.installer/RebootController.
1522    pub fn new(channel: fdomain_client::Channel) -> Self {
1523        let protocol_name =
1524            <RebootControllerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1525        Self { client: fidl::client::Client::new(channel, protocol_name) }
1526    }
1527
1528    /// Get a Stream of events from the remote end of the protocol.
1529    ///
1530    /// # Panics
1531    ///
1532    /// Panics if the event stream was already taken.
1533    pub fn take_event_stream(&self) -> RebootControllerEventStream {
1534        RebootControllerEventStream { event_receiver: self.client.take_event_receiver() }
1535    }
1536
1537    /// Informs the update attempt that it may reboot when ready, unblocking a
1538    /// pending reboot if it is already ready to reboot.
1539    ///
1540    /// If a controller is dropped without sending this request or
1541    /// [`RebootController.Detach`], the update attempt reclaims control of the
1542    /// timing of the reboot, behaving as if the update attempt was not given a
1543    /// [`RebootController`] at all.
1544    pub fn r#unblock(&self) -> Result<(), fidl::Error> {
1545        RebootControllerProxyInterface::r#unblock(self)
1546    }
1547
1548    /// Informs the update attempt that it should wait to reboot indefinitely,
1549    /// even if this [`RebootController`] connection is dropped.
1550    pub fn r#detach(&self) -> Result<(), fidl::Error> {
1551        RebootControllerProxyInterface::r#detach(self)
1552    }
1553}
1554
1555impl RebootControllerProxyInterface for RebootControllerProxy {
1556    fn r#unblock(&self) -> Result<(), fidl::Error> {
1557        self.client.send::<fidl::encoding::EmptyPayload>(
1558            (),
1559            0x5705625395e3d520,
1560            fidl::encoding::DynamicFlags::empty(),
1561        )
1562    }
1563
1564    fn r#detach(&self) -> Result<(), fidl::Error> {
1565        self.client.send::<fidl::encoding::EmptyPayload>(
1566            (),
1567            0x1daa560411955f16,
1568            fidl::encoding::DynamicFlags::empty(),
1569        )
1570    }
1571}
1572
1573pub struct RebootControllerEventStream {
1574    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1575}
1576
1577impl std::marker::Unpin for RebootControllerEventStream {}
1578
1579impl futures::stream::FusedStream for RebootControllerEventStream {
1580    fn is_terminated(&self) -> bool {
1581        self.event_receiver.is_terminated()
1582    }
1583}
1584
1585impl futures::Stream for RebootControllerEventStream {
1586    type Item = Result<RebootControllerEvent, fidl::Error>;
1587
1588    fn poll_next(
1589        mut self: std::pin::Pin<&mut Self>,
1590        cx: &mut std::task::Context<'_>,
1591    ) -> std::task::Poll<Option<Self::Item>> {
1592        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1593            &mut self.event_receiver,
1594            cx
1595        )?) {
1596            Some(buf) => std::task::Poll::Ready(Some(RebootControllerEvent::decode(buf))),
1597            None => std::task::Poll::Ready(None),
1598        }
1599    }
1600}
1601
1602#[derive(Debug)]
1603pub enum RebootControllerEvent {}
1604
1605impl RebootControllerEvent {
1606    /// Decodes a message buffer as a [`RebootControllerEvent`].
1607    fn decode(
1608        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1609    ) -> Result<RebootControllerEvent, fidl::Error> {
1610        let (bytes, _handles) = buf.split_mut();
1611        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1612        debug_assert_eq!(tx_header.tx_id, 0);
1613        match tx_header.ordinal {
1614            _ => Err(fidl::Error::UnknownOrdinal {
1615                ordinal: tx_header.ordinal,
1616                protocol_name:
1617                    <RebootControllerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1618            }),
1619        }
1620    }
1621}
1622
1623/// A Stream of incoming requests for fuchsia.update.installer/RebootController.
1624pub struct RebootControllerRequestStream {
1625    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1626    is_terminated: bool,
1627}
1628
1629impl std::marker::Unpin for RebootControllerRequestStream {}
1630
1631impl futures::stream::FusedStream for RebootControllerRequestStream {
1632    fn is_terminated(&self) -> bool {
1633        self.is_terminated
1634    }
1635}
1636
1637impl fdomain_client::fidl::RequestStream for RebootControllerRequestStream {
1638    type Protocol = RebootControllerMarker;
1639    type ControlHandle = RebootControllerControlHandle;
1640
1641    fn from_channel(channel: fdomain_client::Channel) -> Self {
1642        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1643    }
1644
1645    fn control_handle(&self) -> Self::ControlHandle {
1646        RebootControllerControlHandle { inner: self.inner.clone() }
1647    }
1648
1649    fn into_inner(
1650        self,
1651    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1652    {
1653        (self.inner, self.is_terminated)
1654    }
1655
1656    fn from_inner(
1657        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1658        is_terminated: bool,
1659    ) -> Self {
1660        Self { inner, is_terminated }
1661    }
1662}
1663
1664impl futures::Stream for RebootControllerRequestStream {
1665    type Item = Result<RebootControllerRequest, fidl::Error>;
1666
1667    fn poll_next(
1668        mut self: std::pin::Pin<&mut Self>,
1669        cx: &mut std::task::Context<'_>,
1670    ) -> std::task::Poll<Option<Self::Item>> {
1671        let this = &mut *self;
1672        if this.inner.check_shutdown(cx) {
1673            this.is_terminated = true;
1674            return std::task::Poll::Ready(None);
1675        }
1676        if this.is_terminated {
1677            panic!("polled RebootControllerRequestStream after completion");
1678        }
1679        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1680            |bytes, handles| {
1681                match this.inner.channel().read_etc(cx, bytes, handles) {
1682                    std::task::Poll::Ready(Ok(())) => {}
1683                    std::task::Poll::Pending => return std::task::Poll::Pending,
1684                    std::task::Poll::Ready(Err(None)) => {
1685                        this.is_terminated = true;
1686                        return std::task::Poll::Ready(None);
1687                    }
1688                    std::task::Poll::Ready(Err(Some(e))) => {
1689                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1690                            e.into(),
1691                        ))));
1692                    }
1693                }
1694
1695                // A message has been received from the channel
1696                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1697
1698                std::task::Poll::Ready(Some(match header.ordinal {
1699                0x5705625395e3d520 => {
1700                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1701                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
1702                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1703                    let control_handle = RebootControllerControlHandle {
1704                        inner: this.inner.clone(),
1705                    };
1706                    Ok(RebootControllerRequest::Unblock {
1707                        control_handle,
1708                    })
1709                }
1710                0x1daa560411955f16 => {
1711                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1712                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
1713                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1714                    let control_handle = RebootControllerControlHandle {
1715                        inner: this.inner.clone(),
1716                    };
1717                    Ok(RebootControllerRequest::Detach {
1718                        control_handle,
1719                    })
1720                }
1721                _ => Err(fidl::Error::UnknownOrdinal {
1722                    ordinal: header.ordinal,
1723                    protocol_name: <RebootControllerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1724                }),
1725            }))
1726            },
1727        )
1728    }
1729}
1730
1731/// Controls the timing of the reboot into the updated system.
1732///
1733/// If the client end of a [`RebootController`] is closed without calling
1734/// [`RebootController.Detach()`], the update attempt will fall back to the
1735/// default behavior of rebooting as soon as it is ready.
1736#[derive(Debug)]
1737pub enum RebootControllerRequest {
1738    /// Informs the update attempt that it may reboot when ready, unblocking a
1739    /// pending reboot if it is already ready to reboot.
1740    ///
1741    /// If a controller is dropped without sending this request or
1742    /// [`RebootController.Detach`], the update attempt reclaims control of the
1743    /// timing of the reboot, behaving as if the update attempt was not given a
1744    /// [`RebootController`] at all.
1745    Unblock { control_handle: RebootControllerControlHandle },
1746    /// Informs the update attempt that it should wait to reboot indefinitely,
1747    /// even if this [`RebootController`] connection is dropped.
1748    Detach { control_handle: RebootControllerControlHandle },
1749}
1750
1751impl RebootControllerRequest {
1752    #[allow(irrefutable_let_patterns)]
1753    pub fn into_unblock(self) -> Option<(RebootControllerControlHandle)> {
1754        if let RebootControllerRequest::Unblock { control_handle } = self {
1755            Some((control_handle))
1756        } else {
1757            None
1758        }
1759    }
1760
1761    #[allow(irrefutable_let_patterns)]
1762    pub fn into_detach(self) -> Option<(RebootControllerControlHandle)> {
1763        if let RebootControllerRequest::Detach { control_handle } = self {
1764            Some((control_handle))
1765        } else {
1766            None
1767        }
1768    }
1769
1770    /// Name of the method defined in FIDL
1771    pub fn method_name(&self) -> &'static str {
1772        match *self {
1773            RebootControllerRequest::Unblock { .. } => "unblock",
1774            RebootControllerRequest::Detach { .. } => "detach",
1775        }
1776    }
1777}
1778
1779#[derive(Debug, Clone)]
1780pub struct RebootControllerControlHandle {
1781    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1782}
1783
1784impl RebootControllerControlHandle {
1785    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1786        self.inner.shutdown_with_epitaph(status.into())
1787    }
1788}
1789
1790impl fdomain_client::fidl::ControlHandle for RebootControllerControlHandle {
1791    fn shutdown(&self) {
1792        self.inner.shutdown()
1793    }
1794
1795    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1796        self.inner.shutdown_with_epitaph(status)
1797    }
1798
1799    fn is_closed(&self) -> bool {
1800        self.inner.channel().is_closed()
1801    }
1802    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1803        self.inner.channel().on_closed()
1804    }
1805}
1806
1807impl RebootControllerControlHandle {}
1808
1809mod internal {
1810    use super::*;
1811
1812    impl fidl::encoding::ResourceTypeMarker for InstallerMonitorUpdateRequest {
1813        type Borrowed<'a> = &'a mut Self;
1814        fn take_or_borrow<'a>(
1815            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1816        ) -> Self::Borrowed<'a> {
1817            value
1818        }
1819    }
1820
1821    unsafe impl fidl::encoding::TypeMarker for InstallerMonitorUpdateRequest {
1822        type Owned = Self;
1823
1824        #[inline(always)]
1825        fn inline_align(_context: fidl::encoding::Context) -> usize {
1826            8
1827        }
1828
1829        #[inline(always)]
1830        fn inline_size(_context: fidl::encoding::Context) -> usize {
1831            24
1832        }
1833    }
1834
1835    unsafe impl
1836        fidl::encoding::Encode<
1837            InstallerMonitorUpdateRequest,
1838            fdomain_client::fidl::FDomainResourceDialect,
1839        > for &mut InstallerMonitorUpdateRequest
1840    {
1841        #[inline]
1842        unsafe fn encode(
1843            self,
1844            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1845            offset: usize,
1846            _depth: fidl::encoding::Depth,
1847        ) -> fidl::Result<()> {
1848            encoder.debug_check_bounds::<InstallerMonitorUpdateRequest>(offset);
1849            // Delegate to tuple encoding.
1850            fidl::encoding::Encode::<InstallerMonitorUpdateRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
1851                (
1852                    <fidl::encoding::Optional<fidl::encoding::BoundedString<36>> as fidl::encoding::ValueTypeMarker>::borrow(&self.attempt_id),
1853                    <fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<MonitorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.monitor),
1854                ),
1855                encoder, offset, _depth
1856            )
1857        }
1858    }
1859    unsafe impl<
1860        T0: fidl::encoding::Encode<
1861                fidl::encoding::Optional<fidl::encoding::BoundedString<36>>,
1862                fdomain_client::fidl::FDomainResourceDialect,
1863            >,
1864        T1: fidl::encoding::Encode<
1865                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<MonitorMarker>>,
1866                fdomain_client::fidl::FDomainResourceDialect,
1867            >,
1868    >
1869        fidl::encoding::Encode<
1870            InstallerMonitorUpdateRequest,
1871            fdomain_client::fidl::FDomainResourceDialect,
1872        > for (T0, T1)
1873    {
1874        #[inline]
1875        unsafe fn encode(
1876            self,
1877            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1878            offset: usize,
1879            depth: fidl::encoding::Depth,
1880        ) -> fidl::Result<()> {
1881            encoder.debug_check_bounds::<InstallerMonitorUpdateRequest>(offset);
1882            // Zero out padding regions. There's no need to apply masks
1883            // because the unmasked parts will be overwritten by fields.
1884            unsafe {
1885                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1886                (ptr as *mut u64).write_unaligned(0);
1887            }
1888            // Write the fields.
1889            self.0.encode(encoder, offset + 0, depth)?;
1890            self.1.encode(encoder, offset + 16, depth)?;
1891            Ok(())
1892        }
1893    }
1894
1895    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1896        for InstallerMonitorUpdateRequest
1897    {
1898        #[inline(always)]
1899        fn new_empty() -> Self {
1900            Self {
1901                attempt_id: fidl::new_empty!(
1902                    fidl::encoding::Optional<fidl::encoding::BoundedString<36>>,
1903                    fdomain_client::fidl::FDomainResourceDialect
1904                ),
1905                monitor: fidl::new_empty!(
1906                    fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<MonitorMarker>>,
1907                    fdomain_client::fidl::FDomainResourceDialect
1908                ),
1909            }
1910        }
1911
1912        #[inline]
1913        unsafe fn decode(
1914            &mut self,
1915            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1916            offset: usize,
1917            _depth: fidl::encoding::Depth,
1918        ) -> fidl::Result<()> {
1919            decoder.debug_check_bounds::<Self>(offset);
1920            // Verify that padding bytes are zero.
1921            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1922            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1923            let mask = 0xffffffff00000000u64;
1924            let maskedval = padval & mask;
1925            if maskedval != 0 {
1926                return Err(fidl::Error::NonZeroPadding {
1927                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1928                });
1929            }
1930            fidl::decode!(
1931                fidl::encoding::Optional<fidl::encoding::BoundedString<36>>,
1932                fdomain_client::fidl::FDomainResourceDialect,
1933                &mut self.attempt_id,
1934                decoder,
1935                offset + 0,
1936                _depth
1937            )?;
1938            fidl::decode!(
1939                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<MonitorMarker>>,
1940                fdomain_client::fidl::FDomainResourceDialect,
1941                &mut self.monitor,
1942                decoder,
1943                offset + 16,
1944                _depth
1945            )?;
1946            Ok(())
1947        }
1948    }
1949
1950    impl fidl::encoding::ResourceTypeMarker for InstallerStartUpdateRequest {
1951        type Borrowed<'a> = &'a mut Self;
1952        fn take_or_borrow<'a>(
1953            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1954        ) -> Self::Borrowed<'a> {
1955            value
1956        }
1957    }
1958
1959    unsafe impl fidl::encoding::TypeMarker for InstallerStartUpdateRequest {
1960        type Owned = Self;
1961
1962        #[inline(always)]
1963        fn inline_align(_context: fidl::encoding::Context) -> usize {
1964            8
1965        }
1966
1967        #[inline(always)]
1968        fn inline_size(_context: fidl::encoding::Context) -> usize {
1969            40
1970        }
1971    }
1972
1973    unsafe impl
1974        fidl::encoding::Encode<
1975            InstallerStartUpdateRequest,
1976            fdomain_client::fidl::FDomainResourceDialect,
1977        > for &mut InstallerStartUpdateRequest
1978    {
1979        #[inline]
1980        unsafe fn encode(
1981            self,
1982            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1983            offset: usize,
1984            _depth: fidl::encoding::Depth,
1985        ) -> fidl::Result<()> {
1986            encoder.debug_check_bounds::<InstallerStartUpdateRequest>(offset);
1987            // Delegate to tuple encoding.
1988            fidl::encoding::Encode::<InstallerStartUpdateRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
1989                (
1990                    <fdomain_fuchsia_pkg::PackageUrl as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
1991                    <Options as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
1992                    <fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<MonitorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.monitor),
1993                    <fidl::encoding::Optional<fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RebootControllerMarker>>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reboot_controller),
1994                ),
1995                encoder, offset, _depth
1996            )
1997        }
1998    }
1999    unsafe impl<
2000        T0: fidl::encoding::Encode<
2001                fdomain_fuchsia_pkg::PackageUrl,
2002                fdomain_client::fidl::FDomainResourceDialect,
2003            >,
2004        T1: fidl::encoding::Encode<Options, fdomain_client::fidl::FDomainResourceDialect>,
2005        T2: fidl::encoding::Encode<
2006                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<MonitorMarker>>,
2007                fdomain_client::fidl::FDomainResourceDialect,
2008            >,
2009        T3: fidl::encoding::Encode<
2010                fidl::encoding::Optional<
2011                    fidl::encoding::Endpoint<
2012                        fdomain_client::fidl::ServerEnd<RebootControllerMarker>,
2013                    >,
2014                >,
2015                fdomain_client::fidl::FDomainResourceDialect,
2016            >,
2017    >
2018        fidl::encoding::Encode<
2019            InstallerStartUpdateRequest,
2020            fdomain_client::fidl::FDomainResourceDialect,
2021        > for (T0, T1, T2, T3)
2022    {
2023        #[inline]
2024        unsafe fn encode(
2025            self,
2026            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2027            offset: usize,
2028            depth: fidl::encoding::Depth,
2029        ) -> fidl::Result<()> {
2030            encoder.debug_check_bounds::<InstallerStartUpdateRequest>(offset);
2031            // Zero out padding regions. There's no need to apply masks
2032            // because the unmasked parts will be overwritten by fields.
2033            // Write the fields.
2034            self.0.encode(encoder, offset + 0, depth)?;
2035            self.1.encode(encoder, offset + 16, depth)?;
2036            self.2.encode(encoder, offset + 32, depth)?;
2037            self.3.encode(encoder, offset + 36, depth)?;
2038            Ok(())
2039        }
2040    }
2041
2042    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2043        for InstallerStartUpdateRequest
2044    {
2045        #[inline(always)]
2046        fn new_empty() -> Self {
2047            Self {
2048                url: fidl::new_empty!(
2049                    fdomain_fuchsia_pkg::PackageUrl,
2050                    fdomain_client::fidl::FDomainResourceDialect
2051                ),
2052                options: fidl::new_empty!(Options, fdomain_client::fidl::FDomainResourceDialect),
2053                monitor: fidl::new_empty!(
2054                    fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<MonitorMarker>>,
2055                    fdomain_client::fidl::FDomainResourceDialect
2056                ),
2057                reboot_controller: fidl::new_empty!(
2058                    fidl::encoding::Optional<
2059                        fidl::encoding::Endpoint<
2060                            fdomain_client::fidl::ServerEnd<RebootControllerMarker>,
2061                        >,
2062                    >,
2063                    fdomain_client::fidl::FDomainResourceDialect
2064                ),
2065            }
2066        }
2067
2068        #[inline]
2069        unsafe fn decode(
2070            &mut self,
2071            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2072            offset: usize,
2073            _depth: fidl::encoding::Depth,
2074        ) -> fidl::Result<()> {
2075            decoder.debug_check_bounds::<Self>(offset);
2076            // Verify that padding bytes are zero.
2077            fidl::decode!(
2078                fdomain_fuchsia_pkg::PackageUrl,
2079                fdomain_client::fidl::FDomainResourceDialect,
2080                &mut self.url,
2081                decoder,
2082                offset + 0,
2083                _depth
2084            )?;
2085            fidl::decode!(
2086                Options,
2087                fdomain_client::fidl::FDomainResourceDialect,
2088                &mut self.options,
2089                decoder,
2090                offset + 16,
2091                _depth
2092            )?;
2093            fidl::decode!(
2094                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<MonitorMarker>>,
2095                fdomain_client::fidl::FDomainResourceDialect,
2096                &mut self.monitor,
2097                decoder,
2098                offset + 32,
2099                _depth
2100            )?;
2101            fidl::decode!(
2102                fidl::encoding::Optional<
2103                    fidl::encoding::Endpoint<
2104                        fdomain_client::fidl::ServerEnd<RebootControllerMarker>,
2105                    >,
2106                >,
2107                fdomain_client::fidl::FDomainResourceDialect,
2108                &mut self.reboot_controller,
2109                decoder,
2110                offset + 36,
2111                _depth
2112            )?;
2113            Ok(())
2114        }
2115    }
2116}