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