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