1#![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 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 pub fn take_event_stream(&self) -> InstallerEventStream {
113 InstallerEventStream { event_receiver: self.client.take_event_receiver() }
114 }
115
116 pub fn r#start_update(
136 &self,
137 mut url: &fdomain_fuchsia_pkg::PackageUrl,
138 mut options: &Options,
139 mut monitor: fdomain_client::fidl::ClientEnd<MonitorMarker>,
140 mut reboot_controller: Option<fdomain_client::fidl::ServerEnd<RebootControllerMarker>>,
141 ) -> fidl::client::QueryResponseFut<
142 InstallerStartUpdateResult,
143 fdomain_client::fidl::FDomainResourceDialect,
144 > {
145 InstallerProxyInterface::r#start_update(self, url, options, monitor, reboot_controller)
146 }
147
148 pub fn r#monitor_update(
159 &self,
160 mut attempt_id: Option<&str>,
161 mut monitor: fdomain_client::fidl::ClientEnd<MonitorMarker>,
162 ) -> fidl::client::QueryResponseFut<bool, fdomain_client::fidl::FDomainResourceDialect> {
163 InstallerProxyInterface::r#monitor_update(self, attempt_id, monitor)
164 }
165
166 pub fn r#suspend_update(
171 &self,
172 mut attempt_id: Option<&str>,
173 ) -> fidl::client::QueryResponseFut<
174 InstallerSuspendUpdateResult,
175 fdomain_client::fidl::FDomainResourceDialect,
176 > {
177 InstallerProxyInterface::r#suspend_update(self, attempt_id)
178 }
179
180 pub fn r#resume_update(
185 &self,
186 mut attempt_id: Option<&str>,
187 ) -> fidl::client::QueryResponseFut<
188 InstallerResumeUpdateResult,
189 fdomain_client::fidl::FDomainResourceDialect,
190 > {
191 InstallerProxyInterface::r#resume_update(self, attempt_id)
192 }
193
194 pub fn r#cancel_update(
199 &self,
200 mut attempt_id: Option<&str>,
201 ) -> fidl::client::QueryResponseFut<
202 InstallerCancelUpdateResult,
203 fdomain_client::fidl::FDomainResourceDialect,
204 > {
205 InstallerProxyInterface::r#cancel_update(self, attempt_id)
206 }
207}
208
209impl InstallerProxyInterface for InstallerProxy {
210 type StartUpdateResponseFut = fidl::client::QueryResponseFut<
211 InstallerStartUpdateResult,
212 fdomain_client::fidl::FDomainResourceDialect,
213 >;
214 fn r#start_update(
215 &self,
216 mut url: &fdomain_fuchsia_pkg::PackageUrl,
217 mut options: &Options,
218 mut monitor: fdomain_client::fidl::ClientEnd<MonitorMarker>,
219 mut reboot_controller: Option<fdomain_client::fidl::ServerEnd<RebootControllerMarker>>,
220 ) -> Self::StartUpdateResponseFut {
221 fn _decode(
222 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
223 ) -> Result<InstallerStartUpdateResult, fidl::Error> {
224 let _response = fidl::client::decode_transaction_body::<
225 fidl::encoding::ResultType<InstallerStartUpdateResponse, UpdateNotStartedReason>,
226 fdomain_client::fidl::FDomainResourceDialect,
227 0x2b1c5ba9167c320b,
228 >(_buf?)?;
229 Ok(_response.map(|x| x.attempt_id))
230 }
231 self.client
232 .send_query_and_decode::<InstallerStartUpdateRequest, InstallerStartUpdateResult>(
233 (url, options, monitor, reboot_controller),
234 0x2b1c5ba9167c320b,
235 fidl::encoding::DynamicFlags::empty(),
236 _decode,
237 )
238 }
239
240 type MonitorUpdateResponseFut =
241 fidl::client::QueryResponseFut<bool, fdomain_client::fidl::FDomainResourceDialect>;
242 fn r#monitor_update(
243 &self,
244 mut attempt_id: Option<&str>,
245 mut monitor: fdomain_client::fidl::ClientEnd<MonitorMarker>,
246 ) -> Self::MonitorUpdateResponseFut {
247 fn _decode(
248 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
249 ) -> Result<bool, fidl::Error> {
250 let _response = fidl::client::decode_transaction_body::<
251 InstallerMonitorUpdateResponse,
252 fdomain_client::fidl::FDomainResourceDialect,
253 0x21d54aa1fd825a32,
254 >(_buf?)?;
255 Ok(_response.attached)
256 }
257 self.client.send_query_and_decode::<InstallerMonitorUpdateRequest, bool>(
258 (attempt_id, monitor),
259 0x21d54aa1fd825a32,
260 fidl::encoding::DynamicFlags::empty(),
261 _decode,
262 )
263 }
264
265 type SuspendUpdateResponseFut = fidl::client::QueryResponseFut<
266 InstallerSuspendUpdateResult,
267 fdomain_client::fidl::FDomainResourceDialect,
268 >;
269 fn r#suspend_update(&self, mut attempt_id: Option<&str>) -> Self::SuspendUpdateResponseFut {
270 fn _decode(
271 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
272 ) -> Result<InstallerSuspendUpdateResult, fidl::Error> {
273 let _response = fidl::client::decode_transaction_body::<
274 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SuspendError>,
275 fdomain_client::fidl::FDomainResourceDialect,
276 0x788de328461f9950,
277 >(_buf?)?;
278 Ok(_response.map(|x| x))
279 }
280 self.client
281 .send_query_and_decode::<InstallerSuspendUpdateRequest, InstallerSuspendUpdateResult>(
282 (attempt_id,),
283 0x788de328461f9950,
284 fidl::encoding::DynamicFlags::empty(),
285 _decode,
286 )
287 }
288
289 type ResumeUpdateResponseFut = fidl::client::QueryResponseFut<
290 InstallerResumeUpdateResult,
291 fdomain_client::fidl::FDomainResourceDialect,
292 >;
293 fn r#resume_update(&self, mut attempt_id: Option<&str>) -> Self::ResumeUpdateResponseFut {
294 fn _decode(
295 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
296 ) -> Result<InstallerResumeUpdateResult, fidl::Error> {
297 let _response = fidl::client::decode_transaction_body::<
298 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ResumeError>,
299 fdomain_client::fidl::FDomainResourceDialect,
300 0x7479e805fec33dd3,
301 >(_buf?)?;
302 Ok(_response.map(|x| x))
303 }
304 self.client
305 .send_query_and_decode::<InstallerResumeUpdateRequest, InstallerResumeUpdateResult>(
306 (attempt_id,),
307 0x7479e805fec33dd3,
308 fidl::encoding::DynamicFlags::empty(),
309 _decode,
310 )
311 }
312
313 type CancelUpdateResponseFut = fidl::client::QueryResponseFut<
314 InstallerCancelUpdateResult,
315 fdomain_client::fidl::FDomainResourceDialect,
316 >;
317 fn r#cancel_update(&self, mut attempt_id: Option<&str>) -> Self::CancelUpdateResponseFut {
318 fn _decode(
319 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
320 ) -> Result<InstallerCancelUpdateResult, fidl::Error> {
321 let _response = fidl::client::decode_transaction_body::<
322 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, CancelError>,
323 fdomain_client::fidl::FDomainResourceDialect,
324 0x472dec9160a1d0f,
325 >(_buf?)?;
326 Ok(_response.map(|x| x))
327 }
328 self.client
329 .send_query_and_decode::<InstallerCancelUpdateRequest, InstallerCancelUpdateResult>(
330 (attempt_id,),
331 0x472dec9160a1d0f,
332 fidl::encoding::DynamicFlags::empty(),
333 _decode,
334 )
335 }
336}
337
338pub struct InstallerEventStream {
339 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
340}
341
342impl std::marker::Unpin for InstallerEventStream {}
343
344impl futures::stream::FusedStream for InstallerEventStream {
345 fn is_terminated(&self) -> bool {
346 self.event_receiver.is_terminated()
347 }
348}
349
350impl futures::Stream for InstallerEventStream {
351 type Item = Result<InstallerEvent, fidl::Error>;
352
353 fn poll_next(
354 mut self: std::pin::Pin<&mut Self>,
355 cx: &mut std::task::Context<'_>,
356 ) -> std::task::Poll<Option<Self::Item>> {
357 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
358 &mut self.event_receiver,
359 cx
360 )?) {
361 Some(buf) => std::task::Poll::Ready(Some(InstallerEvent::decode(buf))),
362 None => std::task::Poll::Ready(None),
363 }
364 }
365}
366
367#[derive(Debug)]
368pub enum InstallerEvent {}
369
370impl InstallerEvent {
371 fn decode(
373 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
374 ) -> Result<InstallerEvent, fidl::Error> {
375 let (bytes, _handles) = buf.split_mut();
376 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
377 debug_assert_eq!(tx_header.tx_id, 0);
378 match tx_header.ordinal {
379 _ => Err(fidl::Error::UnknownOrdinal {
380 ordinal: tx_header.ordinal,
381 protocol_name:
382 <InstallerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
383 }),
384 }
385 }
386}
387
388pub struct InstallerRequestStream {
390 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
391 is_terminated: bool,
392}
393
394impl std::marker::Unpin for InstallerRequestStream {}
395
396impl futures::stream::FusedStream for InstallerRequestStream {
397 fn is_terminated(&self) -> bool {
398 self.is_terminated
399 }
400}
401
402impl fdomain_client::fidl::RequestStream for InstallerRequestStream {
403 type Protocol = InstallerMarker;
404 type ControlHandle = InstallerControlHandle;
405
406 fn from_channel(channel: fdomain_client::Channel) -> Self {
407 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
408 }
409
410 fn control_handle(&self) -> Self::ControlHandle {
411 InstallerControlHandle { inner: self.inner.clone() }
412 }
413
414 fn into_inner(
415 self,
416 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
417 {
418 (self.inner, self.is_terminated)
419 }
420
421 fn from_inner(
422 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
423 is_terminated: bool,
424 ) -> Self {
425 Self { inner, is_terminated }
426 }
427}
428
429impl futures::Stream for InstallerRequestStream {
430 type Item = Result<InstallerRequest, fidl::Error>;
431
432 fn poll_next(
433 mut self: std::pin::Pin<&mut Self>,
434 cx: &mut std::task::Context<'_>,
435 ) -> std::task::Poll<Option<Self::Item>> {
436 let this = &mut *self;
437 if this.inner.check_shutdown(cx) {
438 this.is_terminated = true;
439 return std::task::Poll::Ready(None);
440 }
441 if this.is_terminated {
442 panic!("polled InstallerRequestStream after completion");
443 }
444 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
445 |bytes, handles| {
446 match this.inner.channel().read_etc(cx, bytes, handles) {
447 std::task::Poll::Ready(Ok(())) => {}
448 std::task::Poll::Pending => return std::task::Poll::Pending,
449 std::task::Poll::Ready(Err(None)) => {
450 this.is_terminated = true;
451 return std::task::Poll::Ready(None);
452 }
453 std::task::Poll::Ready(Err(Some(e))) => {
454 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
455 e.into(),
456 ))));
457 }
458 }
459
460 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
462
463 std::task::Poll::Ready(Some(match header.ordinal {
464 0x2b1c5ba9167c320b => {
465 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
466 let mut req = fidl::new_empty!(
467 InstallerStartUpdateRequest,
468 fdomain_client::fidl::FDomainResourceDialect
469 );
470 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<InstallerStartUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
471 let control_handle = InstallerControlHandle { inner: this.inner.clone() };
472 Ok(InstallerRequest::StartUpdate {
473 url: req.url,
474 options: req.options,
475 monitor: req.monitor,
476 reboot_controller: req.reboot_controller,
477
478 responder: InstallerStartUpdateResponder {
479 control_handle: std::mem::ManuallyDrop::new(control_handle),
480 tx_id: header.tx_id,
481 },
482 })
483 }
484 0x21d54aa1fd825a32 => {
485 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
486 let mut req = fidl::new_empty!(
487 InstallerMonitorUpdateRequest,
488 fdomain_client::fidl::FDomainResourceDialect
489 );
490 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<InstallerMonitorUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
491 let control_handle = InstallerControlHandle { inner: this.inner.clone() };
492 Ok(InstallerRequest::MonitorUpdate {
493 attempt_id: req.attempt_id,
494 monitor: req.monitor,
495
496 responder: InstallerMonitorUpdateResponder {
497 control_handle: std::mem::ManuallyDrop::new(control_handle),
498 tx_id: header.tx_id,
499 },
500 })
501 }
502 0x788de328461f9950 => {
503 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
504 let mut req = fidl::new_empty!(
505 InstallerSuspendUpdateRequest,
506 fdomain_client::fidl::FDomainResourceDialect
507 );
508 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<InstallerSuspendUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
509 let control_handle = InstallerControlHandle { inner: this.inner.clone() };
510 Ok(InstallerRequest::SuspendUpdate {
511 attempt_id: req.attempt_id,
512
513 responder: InstallerSuspendUpdateResponder {
514 control_handle: std::mem::ManuallyDrop::new(control_handle),
515 tx_id: header.tx_id,
516 },
517 })
518 }
519 0x7479e805fec33dd3 => {
520 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
521 let mut req = fidl::new_empty!(
522 InstallerResumeUpdateRequest,
523 fdomain_client::fidl::FDomainResourceDialect
524 );
525 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<InstallerResumeUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
526 let control_handle = InstallerControlHandle { inner: this.inner.clone() };
527 Ok(InstallerRequest::ResumeUpdate {
528 attempt_id: req.attempt_id,
529
530 responder: InstallerResumeUpdateResponder {
531 control_handle: std::mem::ManuallyDrop::new(control_handle),
532 tx_id: header.tx_id,
533 },
534 })
535 }
536 0x472dec9160a1d0f => {
537 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
538 let mut req = fidl::new_empty!(
539 InstallerCancelUpdateRequest,
540 fdomain_client::fidl::FDomainResourceDialect
541 );
542 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<InstallerCancelUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
543 let control_handle = InstallerControlHandle { inner: this.inner.clone() };
544 Ok(InstallerRequest::CancelUpdate {
545 attempt_id: req.attempt_id,
546
547 responder: InstallerCancelUpdateResponder {
548 control_handle: std::mem::ManuallyDrop::new(control_handle),
549 tx_id: header.tx_id,
550 },
551 })
552 }
553 _ => Err(fidl::Error::UnknownOrdinal {
554 ordinal: header.ordinal,
555 protocol_name:
556 <InstallerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
557 }),
558 }))
559 },
560 )
561 }
562}
563
564#[derive(Debug)]
569pub enum InstallerRequest {
570 StartUpdate {
590 url: fdomain_fuchsia_pkg::PackageUrl,
591 options: Options,
592 monitor: fdomain_client::fidl::ClientEnd<MonitorMarker>,
593 reboot_controller: Option<fdomain_client::fidl::ServerEnd<RebootControllerMarker>>,
594 responder: InstallerStartUpdateResponder,
595 },
596 MonitorUpdate {
607 attempt_id: Option<String>,
608 monitor: fdomain_client::fidl::ClientEnd<MonitorMarker>,
609 responder: InstallerMonitorUpdateResponder,
610 },
611 SuspendUpdate { attempt_id: Option<String>, responder: InstallerSuspendUpdateResponder },
616 ResumeUpdate { attempt_id: Option<String>, responder: InstallerResumeUpdateResponder },
621 CancelUpdate { attempt_id: Option<String>, responder: InstallerCancelUpdateResponder },
626}
627
628impl InstallerRequest {
629 #[allow(irrefutable_let_patterns)]
630 pub fn into_start_update(
631 self,
632 ) -> Option<(
633 fdomain_fuchsia_pkg::PackageUrl,
634 Options,
635 fdomain_client::fidl::ClientEnd<MonitorMarker>,
636 Option<fdomain_client::fidl::ServerEnd<RebootControllerMarker>>,
637 InstallerStartUpdateResponder,
638 )> {
639 if let InstallerRequest::StartUpdate {
640 url,
641 options,
642 monitor,
643 reboot_controller,
644 responder,
645 } = self
646 {
647 Some((url, options, monitor, reboot_controller, responder))
648 } else {
649 None
650 }
651 }
652
653 #[allow(irrefutable_let_patterns)]
654 pub fn into_monitor_update(
655 self,
656 ) -> Option<(
657 Option<String>,
658 fdomain_client::fidl::ClientEnd<MonitorMarker>,
659 InstallerMonitorUpdateResponder,
660 )> {
661 if let InstallerRequest::MonitorUpdate { attempt_id, monitor, responder } = self {
662 Some((attempt_id, monitor, responder))
663 } else {
664 None
665 }
666 }
667
668 #[allow(irrefutable_let_patterns)]
669 pub fn into_suspend_update(self) -> Option<(Option<String>, InstallerSuspendUpdateResponder)> {
670 if let InstallerRequest::SuspendUpdate { attempt_id, responder } = self {
671 Some((attempt_id, responder))
672 } else {
673 None
674 }
675 }
676
677 #[allow(irrefutable_let_patterns)]
678 pub fn into_resume_update(self) -> Option<(Option<String>, InstallerResumeUpdateResponder)> {
679 if let InstallerRequest::ResumeUpdate { attempt_id, responder } = self {
680 Some((attempt_id, responder))
681 } else {
682 None
683 }
684 }
685
686 #[allow(irrefutable_let_patterns)]
687 pub fn into_cancel_update(self) -> Option<(Option<String>, InstallerCancelUpdateResponder)> {
688 if let InstallerRequest::CancelUpdate { attempt_id, responder } = self {
689 Some((attempt_id, responder))
690 } else {
691 None
692 }
693 }
694
695 pub fn method_name(&self) -> &'static str {
697 match *self {
698 InstallerRequest::StartUpdate { .. } => "start_update",
699 InstallerRequest::MonitorUpdate { .. } => "monitor_update",
700 InstallerRequest::SuspendUpdate { .. } => "suspend_update",
701 InstallerRequest::ResumeUpdate { .. } => "resume_update",
702 InstallerRequest::CancelUpdate { .. } => "cancel_update",
703 }
704 }
705}
706
707#[derive(Debug, Clone)]
708pub struct InstallerControlHandle {
709 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
710}
711
712impl fdomain_client::fidl::ControlHandle for InstallerControlHandle {
713 fn shutdown(&self) {
714 self.inner.shutdown()
715 }
716
717 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
718 self.inner.shutdown_with_epitaph(status)
719 }
720
721 fn is_closed(&self) -> bool {
722 self.inner.channel().is_closed()
723 }
724 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
725 self.inner.channel().on_closed()
726 }
727}
728
729impl InstallerControlHandle {}
730
731#[must_use = "FIDL methods require a response to be sent"]
732#[derive(Debug)]
733pub struct InstallerStartUpdateResponder {
734 control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
735 tx_id: u32,
736}
737
738impl std::ops::Drop for InstallerStartUpdateResponder {
742 fn drop(&mut self) {
743 self.control_handle.shutdown();
744 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
746 }
747}
748
749impl fdomain_client::fidl::Responder for InstallerStartUpdateResponder {
750 type ControlHandle = InstallerControlHandle;
751
752 fn control_handle(&self) -> &InstallerControlHandle {
753 &self.control_handle
754 }
755
756 fn drop_without_shutdown(mut self) {
757 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
759 std::mem::forget(self);
761 }
762}
763
764impl InstallerStartUpdateResponder {
765 pub fn send(self, mut result: Result<&str, UpdateNotStartedReason>) -> Result<(), fidl::Error> {
769 let _result = self.send_raw(result);
770 if _result.is_err() {
771 self.control_handle.shutdown();
772 }
773 self.drop_without_shutdown();
774 _result
775 }
776
777 pub fn send_no_shutdown_on_err(
779 self,
780 mut result: Result<&str, UpdateNotStartedReason>,
781 ) -> Result<(), fidl::Error> {
782 let _result = self.send_raw(result);
783 self.drop_without_shutdown();
784 _result
785 }
786
787 fn send_raw(
788 &self,
789 mut result: Result<&str, UpdateNotStartedReason>,
790 ) -> Result<(), fidl::Error> {
791 self.control_handle.inner.send::<fidl::encoding::ResultType<
792 InstallerStartUpdateResponse,
793 UpdateNotStartedReason,
794 >>(
795 result.map(|attempt_id| (attempt_id,)),
796 self.tx_id,
797 0x2b1c5ba9167c320b,
798 fidl::encoding::DynamicFlags::empty(),
799 )
800 }
801}
802
803#[must_use = "FIDL methods require a response to be sent"]
804#[derive(Debug)]
805pub struct InstallerMonitorUpdateResponder {
806 control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
807 tx_id: u32,
808}
809
810impl std::ops::Drop for InstallerMonitorUpdateResponder {
814 fn drop(&mut self) {
815 self.control_handle.shutdown();
816 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
818 }
819}
820
821impl fdomain_client::fidl::Responder for InstallerMonitorUpdateResponder {
822 type ControlHandle = InstallerControlHandle;
823
824 fn control_handle(&self) -> &InstallerControlHandle {
825 &self.control_handle
826 }
827
828 fn drop_without_shutdown(mut self) {
829 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
831 std::mem::forget(self);
833 }
834}
835
836impl InstallerMonitorUpdateResponder {
837 pub fn send(self, mut attached: bool) -> Result<(), fidl::Error> {
841 let _result = self.send_raw(attached);
842 if _result.is_err() {
843 self.control_handle.shutdown();
844 }
845 self.drop_without_shutdown();
846 _result
847 }
848
849 pub fn send_no_shutdown_on_err(self, mut attached: bool) -> Result<(), fidl::Error> {
851 let _result = self.send_raw(attached);
852 self.drop_without_shutdown();
853 _result
854 }
855
856 fn send_raw(&self, mut attached: bool) -> Result<(), fidl::Error> {
857 self.control_handle.inner.send::<InstallerMonitorUpdateResponse>(
858 (attached,),
859 self.tx_id,
860 0x21d54aa1fd825a32,
861 fidl::encoding::DynamicFlags::empty(),
862 )
863 }
864}
865
866#[must_use = "FIDL methods require a response to be sent"]
867#[derive(Debug)]
868pub struct InstallerSuspendUpdateResponder {
869 control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
870 tx_id: u32,
871}
872
873impl std::ops::Drop for InstallerSuspendUpdateResponder {
877 fn drop(&mut self) {
878 self.control_handle.shutdown();
879 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
881 }
882}
883
884impl fdomain_client::fidl::Responder for InstallerSuspendUpdateResponder {
885 type ControlHandle = InstallerControlHandle;
886
887 fn control_handle(&self) -> &InstallerControlHandle {
888 &self.control_handle
889 }
890
891 fn drop_without_shutdown(mut self) {
892 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
894 std::mem::forget(self);
896 }
897}
898
899impl InstallerSuspendUpdateResponder {
900 pub fn send(self, mut result: Result<(), SuspendError>) -> Result<(), fidl::Error> {
904 let _result = self.send_raw(result);
905 if _result.is_err() {
906 self.control_handle.shutdown();
907 }
908 self.drop_without_shutdown();
909 _result
910 }
911
912 pub fn send_no_shutdown_on_err(
914 self,
915 mut result: Result<(), SuspendError>,
916 ) -> Result<(), fidl::Error> {
917 let _result = self.send_raw(result);
918 self.drop_without_shutdown();
919 _result
920 }
921
922 fn send_raw(&self, mut result: Result<(), SuspendError>) -> Result<(), fidl::Error> {
923 self.control_handle.inner.send::<fidl::encoding::ResultType<
924 fidl::encoding::EmptyStruct,
925 SuspendError,
926 >>(
927 result,
928 self.tx_id,
929 0x788de328461f9950,
930 fidl::encoding::DynamicFlags::empty(),
931 )
932 }
933}
934
935#[must_use = "FIDL methods require a response to be sent"]
936#[derive(Debug)]
937pub struct InstallerResumeUpdateResponder {
938 control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
939 tx_id: u32,
940}
941
942impl std::ops::Drop for InstallerResumeUpdateResponder {
946 fn drop(&mut self) {
947 self.control_handle.shutdown();
948 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
950 }
951}
952
953impl fdomain_client::fidl::Responder for InstallerResumeUpdateResponder {
954 type ControlHandle = InstallerControlHandle;
955
956 fn control_handle(&self) -> &InstallerControlHandle {
957 &self.control_handle
958 }
959
960 fn drop_without_shutdown(mut self) {
961 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
963 std::mem::forget(self);
965 }
966}
967
968impl InstallerResumeUpdateResponder {
969 pub fn send(self, mut result: Result<(), ResumeError>) -> Result<(), fidl::Error> {
973 let _result = self.send_raw(result);
974 if _result.is_err() {
975 self.control_handle.shutdown();
976 }
977 self.drop_without_shutdown();
978 _result
979 }
980
981 pub fn send_no_shutdown_on_err(
983 self,
984 mut result: Result<(), ResumeError>,
985 ) -> Result<(), fidl::Error> {
986 let _result = self.send_raw(result);
987 self.drop_without_shutdown();
988 _result
989 }
990
991 fn send_raw(&self, mut result: Result<(), ResumeError>) -> Result<(), fidl::Error> {
992 self.control_handle.inner.send::<fidl::encoding::ResultType<
993 fidl::encoding::EmptyStruct,
994 ResumeError,
995 >>(
996 result,
997 self.tx_id,
998 0x7479e805fec33dd3,
999 fidl::encoding::DynamicFlags::empty(),
1000 )
1001 }
1002}
1003
1004#[must_use = "FIDL methods require a response to be sent"]
1005#[derive(Debug)]
1006pub struct InstallerCancelUpdateResponder {
1007 control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
1008 tx_id: u32,
1009}
1010
1011impl std::ops::Drop for InstallerCancelUpdateResponder {
1015 fn drop(&mut self) {
1016 self.control_handle.shutdown();
1017 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1019 }
1020}
1021
1022impl fdomain_client::fidl::Responder for InstallerCancelUpdateResponder {
1023 type ControlHandle = InstallerControlHandle;
1024
1025 fn control_handle(&self) -> &InstallerControlHandle {
1026 &self.control_handle
1027 }
1028
1029 fn drop_without_shutdown(mut self) {
1030 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1032 std::mem::forget(self);
1034 }
1035}
1036
1037impl InstallerCancelUpdateResponder {
1038 pub fn send(self, mut result: Result<(), CancelError>) -> Result<(), fidl::Error> {
1042 let _result = self.send_raw(result);
1043 if _result.is_err() {
1044 self.control_handle.shutdown();
1045 }
1046 self.drop_without_shutdown();
1047 _result
1048 }
1049
1050 pub fn send_no_shutdown_on_err(
1052 self,
1053 mut result: Result<(), CancelError>,
1054 ) -> Result<(), fidl::Error> {
1055 let _result = self.send_raw(result);
1056 self.drop_without_shutdown();
1057 _result
1058 }
1059
1060 fn send_raw(&self, mut result: Result<(), CancelError>) -> Result<(), fidl::Error> {
1061 self.control_handle.inner.send::<fidl::encoding::ResultType<
1062 fidl::encoding::EmptyStruct,
1063 CancelError,
1064 >>(
1065 result,
1066 self.tx_id,
1067 0x472dec9160a1d0f,
1068 fidl::encoding::DynamicFlags::empty(),
1069 )
1070 }
1071}
1072
1073#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1074pub struct MonitorMarker;
1075
1076impl fdomain_client::fidl::ProtocolMarker for MonitorMarker {
1077 type Proxy = MonitorProxy;
1078 type RequestStream = MonitorRequestStream;
1079
1080 const DEBUG_NAME: &'static str = "(anonymous) Monitor";
1081}
1082
1083pub trait MonitorProxyInterface: Send + Sync {
1084 type OnStateResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1085 fn r#on_state(&self, state: &State) -> Self::OnStateResponseFut;
1086}
1087
1088#[derive(Debug, Clone)]
1089pub struct MonitorProxy {
1090 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1091}
1092
1093impl fdomain_client::fidl::Proxy for MonitorProxy {
1094 type Protocol = MonitorMarker;
1095
1096 fn from_channel(inner: fdomain_client::Channel) -> Self {
1097 Self::new(inner)
1098 }
1099
1100 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1101 self.client.into_channel().map_err(|client| Self { client })
1102 }
1103
1104 fn as_channel(&self) -> &fdomain_client::Channel {
1105 self.client.as_channel()
1106 }
1107}
1108
1109impl MonitorProxy {
1110 pub fn new(channel: fdomain_client::Channel) -> Self {
1112 let protocol_name = <MonitorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1113 Self { client: fidl::client::Client::new(channel, protocol_name) }
1114 }
1115
1116 pub fn take_event_stream(&self) -> MonitorEventStream {
1122 MonitorEventStream { event_receiver: self.client.take_event_receiver() }
1123 }
1124
1125 pub fn r#on_state(
1146 &self,
1147 mut state: &State,
1148 ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
1149 MonitorProxyInterface::r#on_state(self, state)
1150 }
1151}
1152
1153impl MonitorProxyInterface for MonitorProxy {
1154 type OnStateResponseFut =
1155 fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
1156 fn r#on_state(&self, mut state: &State) -> Self::OnStateResponseFut {
1157 fn _decode(
1158 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1159 ) -> Result<(), fidl::Error> {
1160 let _response = fidl::client::decode_transaction_body::<
1161 fidl::encoding::EmptyPayload,
1162 fdomain_client::fidl::FDomainResourceDialect,
1163 0x574105820d16cf26,
1164 >(_buf?)?;
1165 Ok(_response)
1166 }
1167 self.client.send_query_and_decode::<MonitorOnStateRequest, ()>(
1168 (state,),
1169 0x574105820d16cf26,
1170 fidl::encoding::DynamicFlags::empty(),
1171 _decode,
1172 )
1173 }
1174}
1175
1176pub struct MonitorEventStream {
1177 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1178}
1179
1180impl std::marker::Unpin for MonitorEventStream {}
1181
1182impl futures::stream::FusedStream for MonitorEventStream {
1183 fn is_terminated(&self) -> bool {
1184 self.event_receiver.is_terminated()
1185 }
1186}
1187
1188impl futures::Stream for MonitorEventStream {
1189 type Item = Result<MonitorEvent, fidl::Error>;
1190
1191 fn poll_next(
1192 mut self: std::pin::Pin<&mut Self>,
1193 cx: &mut std::task::Context<'_>,
1194 ) -> std::task::Poll<Option<Self::Item>> {
1195 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1196 &mut self.event_receiver,
1197 cx
1198 )?) {
1199 Some(buf) => std::task::Poll::Ready(Some(MonitorEvent::decode(buf))),
1200 None => std::task::Poll::Ready(None),
1201 }
1202 }
1203}
1204
1205#[derive(Debug)]
1206pub enum MonitorEvent {}
1207
1208impl MonitorEvent {
1209 fn decode(
1211 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1212 ) -> Result<MonitorEvent, fidl::Error> {
1213 let (bytes, _handles) = buf.split_mut();
1214 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1215 debug_assert_eq!(tx_header.tx_id, 0);
1216 match tx_header.ordinal {
1217 _ => Err(fidl::Error::UnknownOrdinal {
1218 ordinal: tx_header.ordinal,
1219 protocol_name: <MonitorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1220 }),
1221 }
1222 }
1223}
1224
1225pub struct MonitorRequestStream {
1227 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1228 is_terminated: bool,
1229}
1230
1231impl std::marker::Unpin for MonitorRequestStream {}
1232
1233impl futures::stream::FusedStream for MonitorRequestStream {
1234 fn is_terminated(&self) -> bool {
1235 self.is_terminated
1236 }
1237}
1238
1239impl fdomain_client::fidl::RequestStream for MonitorRequestStream {
1240 type Protocol = MonitorMarker;
1241 type ControlHandle = MonitorControlHandle;
1242
1243 fn from_channel(channel: fdomain_client::Channel) -> Self {
1244 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1245 }
1246
1247 fn control_handle(&self) -> Self::ControlHandle {
1248 MonitorControlHandle { inner: self.inner.clone() }
1249 }
1250
1251 fn into_inner(
1252 self,
1253 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1254 {
1255 (self.inner, self.is_terminated)
1256 }
1257
1258 fn from_inner(
1259 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1260 is_terminated: bool,
1261 ) -> Self {
1262 Self { inner, is_terminated }
1263 }
1264}
1265
1266impl futures::Stream for MonitorRequestStream {
1267 type Item = Result<MonitorRequest, fidl::Error>;
1268
1269 fn poll_next(
1270 mut self: std::pin::Pin<&mut Self>,
1271 cx: &mut std::task::Context<'_>,
1272 ) -> std::task::Poll<Option<Self::Item>> {
1273 let this = &mut *self;
1274 if this.inner.check_shutdown(cx) {
1275 this.is_terminated = true;
1276 return std::task::Poll::Ready(None);
1277 }
1278 if this.is_terminated {
1279 panic!("polled MonitorRequestStream after completion");
1280 }
1281 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1282 |bytes, handles| {
1283 match this.inner.channel().read_etc(cx, bytes, handles) {
1284 std::task::Poll::Ready(Ok(())) => {}
1285 std::task::Poll::Pending => return std::task::Poll::Pending,
1286 std::task::Poll::Ready(Err(None)) => {
1287 this.is_terminated = true;
1288 return std::task::Poll::Ready(None);
1289 }
1290 std::task::Poll::Ready(Err(Some(e))) => {
1291 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1292 e.into(),
1293 ))));
1294 }
1295 }
1296
1297 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1299
1300 std::task::Poll::Ready(Some(match header.ordinal {
1301 0x574105820d16cf26 => {
1302 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1303 let mut req = fidl::new_empty!(
1304 MonitorOnStateRequest,
1305 fdomain_client::fidl::FDomainResourceDialect
1306 );
1307 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<MonitorOnStateRequest>(&header, _body_bytes, handles, &mut req)?;
1308 let control_handle = MonitorControlHandle { inner: this.inner.clone() };
1309 Ok(MonitorRequest::OnState {
1310 state: req.state,
1311
1312 responder: MonitorOnStateResponder {
1313 control_handle: std::mem::ManuallyDrop::new(control_handle),
1314 tx_id: header.tx_id,
1315 },
1316 })
1317 }
1318 _ => Err(fidl::Error::UnknownOrdinal {
1319 ordinal: header.ordinal,
1320 protocol_name:
1321 <MonitorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1322 }),
1323 }))
1324 },
1325 )
1326 }
1327}
1328
1329#[derive(Debug)]
1335pub enum MonitorRequest {
1336 OnState { state: State, responder: MonitorOnStateResponder },
1357}
1358
1359impl MonitorRequest {
1360 #[allow(irrefutable_let_patterns)]
1361 pub fn into_on_state(self) -> Option<(State, MonitorOnStateResponder)> {
1362 if let MonitorRequest::OnState { state, responder } = self {
1363 Some((state, responder))
1364 } else {
1365 None
1366 }
1367 }
1368
1369 pub fn method_name(&self) -> &'static str {
1371 match *self {
1372 MonitorRequest::OnState { .. } => "on_state",
1373 }
1374 }
1375}
1376
1377#[derive(Debug, Clone)]
1378pub struct MonitorControlHandle {
1379 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1380}
1381
1382impl fdomain_client::fidl::ControlHandle for MonitorControlHandle {
1383 fn shutdown(&self) {
1384 self.inner.shutdown()
1385 }
1386
1387 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1388 self.inner.shutdown_with_epitaph(status)
1389 }
1390
1391 fn is_closed(&self) -> bool {
1392 self.inner.channel().is_closed()
1393 }
1394 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1395 self.inner.channel().on_closed()
1396 }
1397}
1398
1399impl MonitorControlHandle {}
1400
1401#[must_use = "FIDL methods require a response to be sent"]
1402#[derive(Debug)]
1403pub struct MonitorOnStateResponder {
1404 control_handle: std::mem::ManuallyDrop<MonitorControlHandle>,
1405 tx_id: u32,
1406}
1407
1408impl std::ops::Drop for MonitorOnStateResponder {
1412 fn drop(&mut self) {
1413 self.control_handle.shutdown();
1414 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1416 }
1417}
1418
1419impl fdomain_client::fidl::Responder for MonitorOnStateResponder {
1420 type ControlHandle = MonitorControlHandle;
1421
1422 fn control_handle(&self) -> &MonitorControlHandle {
1423 &self.control_handle
1424 }
1425
1426 fn drop_without_shutdown(mut self) {
1427 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1429 std::mem::forget(self);
1431 }
1432}
1433
1434impl MonitorOnStateResponder {
1435 pub fn send(self) -> Result<(), fidl::Error> {
1439 let _result = self.send_raw();
1440 if _result.is_err() {
1441 self.control_handle.shutdown();
1442 }
1443 self.drop_without_shutdown();
1444 _result
1445 }
1446
1447 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1449 let _result = self.send_raw();
1450 self.drop_without_shutdown();
1451 _result
1452 }
1453
1454 fn send_raw(&self) -> Result<(), fidl::Error> {
1455 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1456 (),
1457 self.tx_id,
1458 0x574105820d16cf26,
1459 fidl::encoding::DynamicFlags::empty(),
1460 )
1461 }
1462}
1463
1464#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1465pub struct RebootControllerMarker;
1466
1467impl fdomain_client::fidl::ProtocolMarker for RebootControllerMarker {
1468 type Proxy = RebootControllerProxy;
1469 type RequestStream = RebootControllerRequestStream;
1470
1471 const DEBUG_NAME: &'static str = "(anonymous) RebootController";
1472}
1473
1474pub trait RebootControllerProxyInterface: Send + Sync {
1475 fn r#unblock(&self) -> Result<(), fidl::Error>;
1476 fn r#detach(&self) -> Result<(), fidl::Error>;
1477}
1478
1479#[derive(Debug, Clone)]
1480pub struct RebootControllerProxy {
1481 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1482}
1483
1484impl fdomain_client::fidl::Proxy for RebootControllerProxy {
1485 type Protocol = RebootControllerMarker;
1486
1487 fn from_channel(inner: fdomain_client::Channel) -> Self {
1488 Self::new(inner)
1489 }
1490
1491 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1492 self.client.into_channel().map_err(|client| Self { client })
1493 }
1494
1495 fn as_channel(&self) -> &fdomain_client::Channel {
1496 self.client.as_channel()
1497 }
1498}
1499
1500impl RebootControllerProxy {
1501 pub fn new(channel: fdomain_client::Channel) -> Self {
1503 let protocol_name =
1504 <RebootControllerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1505 Self { client: fidl::client::Client::new(channel, protocol_name) }
1506 }
1507
1508 pub fn take_event_stream(&self) -> RebootControllerEventStream {
1514 RebootControllerEventStream { event_receiver: self.client.take_event_receiver() }
1515 }
1516
1517 pub fn r#unblock(&self) -> Result<(), fidl::Error> {
1525 RebootControllerProxyInterface::r#unblock(self)
1526 }
1527
1528 pub fn r#detach(&self) -> Result<(), fidl::Error> {
1531 RebootControllerProxyInterface::r#detach(self)
1532 }
1533}
1534
1535impl RebootControllerProxyInterface for RebootControllerProxy {
1536 fn r#unblock(&self) -> Result<(), fidl::Error> {
1537 self.client.send::<fidl::encoding::EmptyPayload>(
1538 (),
1539 0x5705625395e3d520,
1540 fidl::encoding::DynamicFlags::empty(),
1541 )
1542 }
1543
1544 fn r#detach(&self) -> Result<(), fidl::Error> {
1545 self.client.send::<fidl::encoding::EmptyPayload>(
1546 (),
1547 0x1daa560411955f16,
1548 fidl::encoding::DynamicFlags::empty(),
1549 )
1550 }
1551}
1552
1553pub struct RebootControllerEventStream {
1554 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1555}
1556
1557impl std::marker::Unpin for RebootControllerEventStream {}
1558
1559impl futures::stream::FusedStream for RebootControllerEventStream {
1560 fn is_terminated(&self) -> bool {
1561 self.event_receiver.is_terminated()
1562 }
1563}
1564
1565impl futures::Stream for RebootControllerEventStream {
1566 type Item = Result<RebootControllerEvent, fidl::Error>;
1567
1568 fn poll_next(
1569 mut self: std::pin::Pin<&mut Self>,
1570 cx: &mut std::task::Context<'_>,
1571 ) -> std::task::Poll<Option<Self::Item>> {
1572 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1573 &mut self.event_receiver,
1574 cx
1575 )?) {
1576 Some(buf) => std::task::Poll::Ready(Some(RebootControllerEvent::decode(buf))),
1577 None => std::task::Poll::Ready(None),
1578 }
1579 }
1580}
1581
1582#[derive(Debug)]
1583pub enum RebootControllerEvent {}
1584
1585impl RebootControllerEvent {
1586 fn decode(
1588 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1589 ) -> Result<RebootControllerEvent, fidl::Error> {
1590 let (bytes, _handles) = buf.split_mut();
1591 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1592 debug_assert_eq!(tx_header.tx_id, 0);
1593 match tx_header.ordinal {
1594 _ => Err(fidl::Error::UnknownOrdinal {
1595 ordinal: tx_header.ordinal,
1596 protocol_name:
1597 <RebootControllerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1598 }),
1599 }
1600 }
1601}
1602
1603pub struct RebootControllerRequestStream {
1605 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1606 is_terminated: bool,
1607}
1608
1609impl std::marker::Unpin for RebootControllerRequestStream {}
1610
1611impl futures::stream::FusedStream for RebootControllerRequestStream {
1612 fn is_terminated(&self) -> bool {
1613 self.is_terminated
1614 }
1615}
1616
1617impl fdomain_client::fidl::RequestStream for RebootControllerRequestStream {
1618 type Protocol = RebootControllerMarker;
1619 type ControlHandle = RebootControllerControlHandle;
1620
1621 fn from_channel(channel: fdomain_client::Channel) -> Self {
1622 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1623 }
1624
1625 fn control_handle(&self) -> Self::ControlHandle {
1626 RebootControllerControlHandle { inner: self.inner.clone() }
1627 }
1628
1629 fn into_inner(
1630 self,
1631 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1632 {
1633 (self.inner, self.is_terminated)
1634 }
1635
1636 fn from_inner(
1637 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1638 is_terminated: bool,
1639 ) -> Self {
1640 Self { inner, is_terminated }
1641 }
1642}
1643
1644impl futures::Stream for RebootControllerRequestStream {
1645 type Item = Result<RebootControllerRequest, fidl::Error>;
1646
1647 fn poll_next(
1648 mut self: std::pin::Pin<&mut Self>,
1649 cx: &mut std::task::Context<'_>,
1650 ) -> std::task::Poll<Option<Self::Item>> {
1651 let this = &mut *self;
1652 if this.inner.check_shutdown(cx) {
1653 this.is_terminated = true;
1654 return std::task::Poll::Ready(None);
1655 }
1656 if this.is_terminated {
1657 panic!("polled RebootControllerRequestStream after completion");
1658 }
1659 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1660 |bytes, handles| {
1661 match this.inner.channel().read_etc(cx, bytes, handles) {
1662 std::task::Poll::Ready(Ok(())) => {}
1663 std::task::Poll::Pending => return std::task::Poll::Pending,
1664 std::task::Poll::Ready(Err(None)) => {
1665 this.is_terminated = true;
1666 return std::task::Poll::Ready(None);
1667 }
1668 std::task::Poll::Ready(Err(Some(e))) => {
1669 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1670 e.into(),
1671 ))));
1672 }
1673 }
1674
1675 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1677
1678 std::task::Poll::Ready(Some(match header.ordinal {
1679 0x5705625395e3d520 => {
1680 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1681 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
1682 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1683 let control_handle = RebootControllerControlHandle {
1684 inner: this.inner.clone(),
1685 };
1686 Ok(RebootControllerRequest::Unblock {
1687 control_handle,
1688 })
1689 }
1690 0x1daa560411955f16 => {
1691 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1692 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
1693 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1694 let control_handle = RebootControllerControlHandle {
1695 inner: this.inner.clone(),
1696 };
1697 Ok(RebootControllerRequest::Detach {
1698 control_handle,
1699 })
1700 }
1701 _ => Err(fidl::Error::UnknownOrdinal {
1702 ordinal: header.ordinal,
1703 protocol_name: <RebootControllerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1704 }),
1705 }))
1706 },
1707 )
1708 }
1709}
1710
1711#[derive(Debug)]
1717pub enum RebootControllerRequest {
1718 Unblock { control_handle: RebootControllerControlHandle },
1726 Detach { control_handle: RebootControllerControlHandle },
1729}
1730
1731impl RebootControllerRequest {
1732 #[allow(irrefutable_let_patterns)]
1733 pub fn into_unblock(self) -> Option<(RebootControllerControlHandle)> {
1734 if let RebootControllerRequest::Unblock { control_handle } = self {
1735 Some((control_handle))
1736 } else {
1737 None
1738 }
1739 }
1740
1741 #[allow(irrefutable_let_patterns)]
1742 pub fn into_detach(self) -> Option<(RebootControllerControlHandle)> {
1743 if let RebootControllerRequest::Detach { control_handle } = self {
1744 Some((control_handle))
1745 } else {
1746 None
1747 }
1748 }
1749
1750 pub fn method_name(&self) -> &'static str {
1752 match *self {
1753 RebootControllerRequest::Unblock { .. } => "unblock",
1754 RebootControllerRequest::Detach { .. } => "detach",
1755 }
1756 }
1757}
1758
1759#[derive(Debug, Clone)]
1760pub struct RebootControllerControlHandle {
1761 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1762}
1763
1764impl fdomain_client::fidl::ControlHandle for RebootControllerControlHandle {
1765 fn shutdown(&self) {
1766 self.inner.shutdown()
1767 }
1768
1769 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1770 self.inner.shutdown_with_epitaph(status)
1771 }
1772
1773 fn is_closed(&self) -> bool {
1774 self.inner.channel().is_closed()
1775 }
1776 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1777 self.inner.channel().on_closed()
1778 }
1779}
1780
1781impl RebootControllerControlHandle {}
1782
1783mod internal {
1784 use super::*;
1785
1786 impl fidl::encoding::ResourceTypeMarker for InstallerMonitorUpdateRequest {
1787 type Borrowed<'a> = &'a mut Self;
1788 fn take_or_borrow<'a>(
1789 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1790 ) -> Self::Borrowed<'a> {
1791 value
1792 }
1793 }
1794
1795 unsafe impl fidl::encoding::TypeMarker for InstallerMonitorUpdateRequest {
1796 type Owned = Self;
1797
1798 #[inline(always)]
1799 fn inline_align(_context: fidl::encoding::Context) -> usize {
1800 8
1801 }
1802
1803 #[inline(always)]
1804 fn inline_size(_context: fidl::encoding::Context) -> usize {
1805 24
1806 }
1807 }
1808
1809 unsafe impl
1810 fidl::encoding::Encode<
1811 InstallerMonitorUpdateRequest,
1812 fdomain_client::fidl::FDomainResourceDialect,
1813 > for &mut InstallerMonitorUpdateRequest
1814 {
1815 #[inline]
1816 unsafe fn encode(
1817 self,
1818 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1819 offset: usize,
1820 _depth: fidl::encoding::Depth,
1821 ) -> fidl::Result<()> {
1822 encoder.debug_check_bounds::<InstallerMonitorUpdateRequest>(offset);
1823 fidl::encoding::Encode::<InstallerMonitorUpdateRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
1825 (
1826 <fidl::encoding::Optional<fidl::encoding::BoundedString<36>> as fidl::encoding::ValueTypeMarker>::borrow(&self.attempt_id),
1827 <fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<MonitorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.monitor),
1828 ),
1829 encoder, offset, _depth
1830 )
1831 }
1832 }
1833 unsafe impl<
1834 T0: fidl::encoding::Encode<
1835 fidl::encoding::Optional<fidl::encoding::BoundedString<36>>,
1836 fdomain_client::fidl::FDomainResourceDialect,
1837 >,
1838 T1: fidl::encoding::Encode<
1839 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<MonitorMarker>>,
1840 fdomain_client::fidl::FDomainResourceDialect,
1841 >,
1842 >
1843 fidl::encoding::Encode<
1844 InstallerMonitorUpdateRequest,
1845 fdomain_client::fidl::FDomainResourceDialect,
1846 > for (T0, T1)
1847 {
1848 #[inline]
1849 unsafe fn encode(
1850 self,
1851 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1852 offset: usize,
1853 depth: fidl::encoding::Depth,
1854 ) -> fidl::Result<()> {
1855 encoder.debug_check_bounds::<InstallerMonitorUpdateRequest>(offset);
1856 unsafe {
1859 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1860 (ptr as *mut u64).write_unaligned(0);
1861 }
1862 self.0.encode(encoder, offset + 0, depth)?;
1864 self.1.encode(encoder, offset + 16, depth)?;
1865 Ok(())
1866 }
1867 }
1868
1869 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1870 for InstallerMonitorUpdateRequest
1871 {
1872 #[inline(always)]
1873 fn new_empty() -> Self {
1874 Self {
1875 attempt_id: fidl::new_empty!(
1876 fidl::encoding::Optional<fidl::encoding::BoundedString<36>>,
1877 fdomain_client::fidl::FDomainResourceDialect
1878 ),
1879 monitor: fidl::new_empty!(
1880 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<MonitorMarker>>,
1881 fdomain_client::fidl::FDomainResourceDialect
1882 ),
1883 }
1884 }
1885
1886 #[inline]
1887 unsafe fn decode(
1888 &mut self,
1889 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1890 offset: usize,
1891 _depth: fidl::encoding::Depth,
1892 ) -> fidl::Result<()> {
1893 decoder.debug_check_bounds::<Self>(offset);
1894 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1896 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1897 let mask = 0xffffffff00000000u64;
1898 let maskedval = padval & mask;
1899 if maskedval != 0 {
1900 return Err(fidl::Error::NonZeroPadding {
1901 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1902 });
1903 }
1904 fidl::decode!(
1905 fidl::encoding::Optional<fidl::encoding::BoundedString<36>>,
1906 fdomain_client::fidl::FDomainResourceDialect,
1907 &mut self.attempt_id,
1908 decoder,
1909 offset + 0,
1910 _depth
1911 )?;
1912 fidl::decode!(
1913 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<MonitorMarker>>,
1914 fdomain_client::fidl::FDomainResourceDialect,
1915 &mut self.monitor,
1916 decoder,
1917 offset + 16,
1918 _depth
1919 )?;
1920 Ok(())
1921 }
1922 }
1923
1924 impl fidl::encoding::ResourceTypeMarker for InstallerStartUpdateRequest {
1925 type Borrowed<'a> = &'a mut Self;
1926 fn take_or_borrow<'a>(
1927 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1928 ) -> Self::Borrowed<'a> {
1929 value
1930 }
1931 }
1932
1933 unsafe impl fidl::encoding::TypeMarker for InstallerStartUpdateRequest {
1934 type Owned = Self;
1935
1936 #[inline(always)]
1937 fn inline_align(_context: fidl::encoding::Context) -> usize {
1938 8
1939 }
1940
1941 #[inline(always)]
1942 fn inline_size(_context: fidl::encoding::Context) -> usize {
1943 40
1944 }
1945 }
1946
1947 unsafe impl
1948 fidl::encoding::Encode<
1949 InstallerStartUpdateRequest,
1950 fdomain_client::fidl::FDomainResourceDialect,
1951 > for &mut InstallerStartUpdateRequest
1952 {
1953 #[inline]
1954 unsafe fn encode(
1955 self,
1956 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1957 offset: usize,
1958 _depth: fidl::encoding::Depth,
1959 ) -> fidl::Result<()> {
1960 encoder.debug_check_bounds::<InstallerStartUpdateRequest>(offset);
1961 fidl::encoding::Encode::<InstallerStartUpdateRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
1963 (
1964 <fdomain_fuchsia_pkg::PackageUrl as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
1965 <Options as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
1966 <fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<MonitorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.monitor),
1967 <fidl::encoding::Optional<fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RebootControllerMarker>>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reboot_controller),
1968 ),
1969 encoder, offset, _depth
1970 )
1971 }
1972 }
1973 unsafe impl<
1974 T0: fidl::encoding::Encode<
1975 fdomain_fuchsia_pkg::PackageUrl,
1976 fdomain_client::fidl::FDomainResourceDialect,
1977 >,
1978 T1: fidl::encoding::Encode<Options, fdomain_client::fidl::FDomainResourceDialect>,
1979 T2: fidl::encoding::Encode<
1980 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<MonitorMarker>>,
1981 fdomain_client::fidl::FDomainResourceDialect,
1982 >,
1983 T3: fidl::encoding::Encode<
1984 fidl::encoding::Optional<
1985 fidl::encoding::Endpoint<
1986 fdomain_client::fidl::ServerEnd<RebootControllerMarker>,
1987 >,
1988 >,
1989 fdomain_client::fidl::FDomainResourceDialect,
1990 >,
1991 >
1992 fidl::encoding::Encode<
1993 InstallerStartUpdateRequest,
1994 fdomain_client::fidl::FDomainResourceDialect,
1995 > for (T0, T1, T2, T3)
1996 {
1997 #[inline]
1998 unsafe fn encode(
1999 self,
2000 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2001 offset: usize,
2002 depth: fidl::encoding::Depth,
2003 ) -> fidl::Result<()> {
2004 encoder.debug_check_bounds::<InstallerStartUpdateRequest>(offset);
2005 self.0.encode(encoder, offset + 0, depth)?;
2009 self.1.encode(encoder, offset + 16, depth)?;
2010 self.2.encode(encoder, offset + 32, depth)?;
2011 self.3.encode(encoder, offset + 36, depth)?;
2012 Ok(())
2013 }
2014 }
2015
2016 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2017 for InstallerStartUpdateRequest
2018 {
2019 #[inline(always)]
2020 fn new_empty() -> Self {
2021 Self {
2022 url: fidl::new_empty!(
2023 fdomain_fuchsia_pkg::PackageUrl,
2024 fdomain_client::fidl::FDomainResourceDialect
2025 ),
2026 options: fidl::new_empty!(Options, fdomain_client::fidl::FDomainResourceDialect),
2027 monitor: fidl::new_empty!(
2028 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<MonitorMarker>>,
2029 fdomain_client::fidl::FDomainResourceDialect
2030 ),
2031 reboot_controller: fidl::new_empty!(
2032 fidl::encoding::Optional<
2033 fidl::encoding::Endpoint<
2034 fdomain_client::fidl::ServerEnd<RebootControllerMarker>,
2035 >,
2036 >,
2037 fdomain_client::fidl::FDomainResourceDialect
2038 ),
2039 }
2040 }
2041
2042 #[inline]
2043 unsafe fn decode(
2044 &mut self,
2045 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2046 offset: usize,
2047 _depth: fidl::encoding::Depth,
2048 ) -> fidl::Result<()> {
2049 decoder.debug_check_bounds::<Self>(offset);
2050 fidl::decode!(
2052 fdomain_fuchsia_pkg::PackageUrl,
2053 fdomain_client::fidl::FDomainResourceDialect,
2054 &mut self.url,
2055 decoder,
2056 offset + 0,
2057 _depth
2058 )?;
2059 fidl::decode!(
2060 Options,
2061 fdomain_client::fidl::FDomainResourceDialect,
2062 &mut self.options,
2063 decoder,
2064 offset + 16,
2065 _depth
2066 )?;
2067 fidl::decode!(
2068 fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<MonitorMarker>>,
2069 fdomain_client::fidl::FDomainResourceDialect,
2070 &mut self.monitor,
2071 decoder,
2072 offset + 32,
2073 _depth
2074 )?;
2075 fidl::decode!(
2076 fidl::encoding::Optional<
2077 fidl::encoding::Endpoint<
2078 fdomain_client::fidl::ServerEnd<RebootControllerMarker>,
2079 >,
2080 >,
2081 fdomain_client::fidl::FDomainResourceDialect,
2082 &mut self.reboot_controller,
2083 decoder,
2084 offset + 36,
2085 _depth
2086 )?;
2087 Ok(())
2088 }
2089 }
2090}