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 let protocol_name = <InstallerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
109 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
110 }
111
112 pub fn into_channel(self) -> fidl::Channel {
113 self.client.into_channel()
114 }
115
116 pub fn wait_for_event(
119 &self,
120 deadline: zx::MonotonicInstant,
121 ) -> Result<InstallerEvent, fidl::Error> {
122 InstallerEvent::decode(self.client.wait_for_event(deadline)?)
123 }
124
125 pub fn r#start_update(
145 &self,
146 mut url: &fidl_fuchsia_pkg::PackageUrl,
147 mut options: &Options,
148 mut monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
149 mut reboot_controller: Option<fidl::endpoints::ServerEnd<RebootControllerMarker>>,
150 ___deadline: zx::MonotonicInstant,
151 ) -> Result<InstallerStartUpdateResult, fidl::Error> {
152 let _response =
153 self.client.send_query::<InstallerStartUpdateRequest, fidl::encoding::ResultType<
154 InstallerStartUpdateResponse,
155 UpdateNotStartedReason,
156 >>(
157 (url, options, monitor, reboot_controller),
158 0x2b1c5ba9167c320b,
159 fidl::encoding::DynamicFlags::empty(),
160 ___deadline,
161 )?;
162 Ok(_response.map(|x| x.attempt_id))
163 }
164
165 pub fn r#monitor_update(
176 &self,
177 mut attempt_id: Option<&str>,
178 mut monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
179 ___deadline: zx::MonotonicInstant,
180 ) -> Result<bool, fidl::Error> {
181 let _response = self
182 .client
183 .send_query::<InstallerMonitorUpdateRequest, InstallerMonitorUpdateResponse>(
184 (attempt_id, monitor),
185 0x21d54aa1fd825a32,
186 fidl::encoding::DynamicFlags::empty(),
187 ___deadline,
188 )?;
189 Ok(_response.attached)
190 }
191
192 pub fn r#suspend_update(
197 &self,
198 mut attempt_id: Option<&str>,
199 ___deadline: zx::MonotonicInstant,
200 ) -> Result<InstallerSuspendUpdateResult, fidl::Error> {
201 let _response = self.client.send_query::<
202 InstallerSuspendUpdateRequest,
203 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SuspendError>,
204 >(
205 (attempt_id,),
206 0x788de328461f9950,
207 fidl::encoding::DynamicFlags::empty(),
208 ___deadline,
209 )?;
210 Ok(_response.map(|x| x))
211 }
212
213 pub fn r#resume_update(
218 &self,
219 mut attempt_id: Option<&str>,
220 ___deadline: zx::MonotonicInstant,
221 ) -> Result<InstallerResumeUpdateResult, fidl::Error> {
222 let _response = self.client.send_query::<
223 InstallerResumeUpdateRequest,
224 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ResumeError>,
225 >(
226 (attempt_id,),
227 0x7479e805fec33dd3,
228 fidl::encoding::DynamicFlags::empty(),
229 ___deadline,
230 )?;
231 Ok(_response.map(|x| x))
232 }
233
234 pub fn r#cancel_update(
239 &self,
240 mut attempt_id: Option<&str>,
241 ___deadline: zx::MonotonicInstant,
242 ) -> Result<InstallerCancelUpdateResult, fidl::Error> {
243 let _response = self.client.send_query::<
244 InstallerCancelUpdateRequest,
245 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, CancelError>,
246 >(
247 (attempt_id,),
248 0x472dec9160a1d0f,
249 fidl::encoding::DynamicFlags::empty(),
250 ___deadline,
251 )?;
252 Ok(_response.map(|x| x))
253 }
254}
255
256#[cfg(target_os = "fuchsia")]
257impl From<InstallerSynchronousProxy> for zx::Handle {
258 fn from(value: InstallerSynchronousProxy) -> Self {
259 value.into_channel().into()
260 }
261}
262
263#[cfg(target_os = "fuchsia")]
264impl From<fidl::Channel> for InstallerSynchronousProxy {
265 fn from(value: fidl::Channel) -> Self {
266 Self::new(value)
267 }
268}
269
270#[derive(Debug, Clone)]
271pub struct InstallerProxy {
272 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
273}
274
275impl fidl::endpoints::Proxy for InstallerProxy {
276 type Protocol = InstallerMarker;
277
278 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
279 Self::new(inner)
280 }
281
282 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
283 self.client.into_channel().map_err(|client| Self { client })
284 }
285
286 fn as_channel(&self) -> &::fidl::AsyncChannel {
287 self.client.as_channel()
288 }
289}
290
291impl InstallerProxy {
292 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
294 let protocol_name = <InstallerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
295 Self { client: fidl::client::Client::new(channel, protocol_name) }
296 }
297
298 pub fn take_event_stream(&self) -> InstallerEventStream {
304 InstallerEventStream { event_receiver: self.client.take_event_receiver() }
305 }
306
307 pub fn r#start_update(
327 &self,
328 mut url: &fidl_fuchsia_pkg::PackageUrl,
329 mut options: &Options,
330 mut monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
331 mut reboot_controller: Option<fidl::endpoints::ServerEnd<RebootControllerMarker>>,
332 ) -> fidl::client::QueryResponseFut<
333 InstallerStartUpdateResult,
334 fidl::encoding::DefaultFuchsiaResourceDialect,
335 > {
336 InstallerProxyInterface::r#start_update(self, url, options, monitor, reboot_controller)
337 }
338
339 pub fn r#monitor_update(
350 &self,
351 mut attempt_id: Option<&str>,
352 mut monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
353 ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
354 InstallerProxyInterface::r#monitor_update(self, attempt_id, monitor)
355 }
356
357 pub fn r#suspend_update(
362 &self,
363 mut attempt_id: Option<&str>,
364 ) -> fidl::client::QueryResponseFut<
365 InstallerSuspendUpdateResult,
366 fidl::encoding::DefaultFuchsiaResourceDialect,
367 > {
368 InstallerProxyInterface::r#suspend_update(self, attempt_id)
369 }
370
371 pub fn r#resume_update(
376 &self,
377 mut attempt_id: Option<&str>,
378 ) -> fidl::client::QueryResponseFut<
379 InstallerResumeUpdateResult,
380 fidl::encoding::DefaultFuchsiaResourceDialect,
381 > {
382 InstallerProxyInterface::r#resume_update(self, attempt_id)
383 }
384
385 pub fn r#cancel_update(
390 &self,
391 mut attempt_id: Option<&str>,
392 ) -> fidl::client::QueryResponseFut<
393 InstallerCancelUpdateResult,
394 fidl::encoding::DefaultFuchsiaResourceDialect,
395 > {
396 InstallerProxyInterface::r#cancel_update(self, attempt_id)
397 }
398}
399
400impl InstallerProxyInterface for InstallerProxy {
401 type StartUpdateResponseFut = fidl::client::QueryResponseFut<
402 InstallerStartUpdateResult,
403 fidl::encoding::DefaultFuchsiaResourceDialect,
404 >;
405 fn r#start_update(
406 &self,
407 mut url: &fidl_fuchsia_pkg::PackageUrl,
408 mut options: &Options,
409 mut monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
410 mut reboot_controller: Option<fidl::endpoints::ServerEnd<RebootControllerMarker>>,
411 ) -> Self::StartUpdateResponseFut {
412 fn _decode(
413 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
414 ) -> Result<InstallerStartUpdateResult, fidl::Error> {
415 let _response = fidl::client::decode_transaction_body::<
416 fidl::encoding::ResultType<InstallerStartUpdateResponse, UpdateNotStartedReason>,
417 fidl::encoding::DefaultFuchsiaResourceDialect,
418 0x2b1c5ba9167c320b,
419 >(_buf?)?;
420 Ok(_response.map(|x| x.attempt_id))
421 }
422 self.client
423 .send_query_and_decode::<InstallerStartUpdateRequest, InstallerStartUpdateResult>(
424 (url, options, monitor, reboot_controller),
425 0x2b1c5ba9167c320b,
426 fidl::encoding::DynamicFlags::empty(),
427 _decode,
428 )
429 }
430
431 type MonitorUpdateResponseFut =
432 fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
433 fn r#monitor_update(
434 &self,
435 mut attempt_id: Option<&str>,
436 mut monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
437 ) -> Self::MonitorUpdateResponseFut {
438 fn _decode(
439 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
440 ) -> Result<bool, fidl::Error> {
441 let _response = fidl::client::decode_transaction_body::<
442 InstallerMonitorUpdateResponse,
443 fidl::encoding::DefaultFuchsiaResourceDialect,
444 0x21d54aa1fd825a32,
445 >(_buf?)?;
446 Ok(_response.attached)
447 }
448 self.client.send_query_and_decode::<InstallerMonitorUpdateRequest, bool>(
449 (attempt_id, monitor),
450 0x21d54aa1fd825a32,
451 fidl::encoding::DynamicFlags::empty(),
452 _decode,
453 )
454 }
455
456 type SuspendUpdateResponseFut = fidl::client::QueryResponseFut<
457 InstallerSuspendUpdateResult,
458 fidl::encoding::DefaultFuchsiaResourceDialect,
459 >;
460 fn r#suspend_update(&self, mut attempt_id: Option<&str>) -> Self::SuspendUpdateResponseFut {
461 fn _decode(
462 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
463 ) -> Result<InstallerSuspendUpdateResult, fidl::Error> {
464 let _response = fidl::client::decode_transaction_body::<
465 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SuspendError>,
466 fidl::encoding::DefaultFuchsiaResourceDialect,
467 0x788de328461f9950,
468 >(_buf?)?;
469 Ok(_response.map(|x| x))
470 }
471 self.client
472 .send_query_and_decode::<InstallerSuspendUpdateRequest, InstallerSuspendUpdateResult>(
473 (attempt_id,),
474 0x788de328461f9950,
475 fidl::encoding::DynamicFlags::empty(),
476 _decode,
477 )
478 }
479
480 type ResumeUpdateResponseFut = fidl::client::QueryResponseFut<
481 InstallerResumeUpdateResult,
482 fidl::encoding::DefaultFuchsiaResourceDialect,
483 >;
484 fn r#resume_update(&self, mut attempt_id: Option<&str>) -> Self::ResumeUpdateResponseFut {
485 fn _decode(
486 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
487 ) -> Result<InstallerResumeUpdateResult, fidl::Error> {
488 let _response = fidl::client::decode_transaction_body::<
489 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ResumeError>,
490 fidl::encoding::DefaultFuchsiaResourceDialect,
491 0x7479e805fec33dd3,
492 >(_buf?)?;
493 Ok(_response.map(|x| x))
494 }
495 self.client
496 .send_query_and_decode::<InstallerResumeUpdateRequest, InstallerResumeUpdateResult>(
497 (attempt_id,),
498 0x7479e805fec33dd3,
499 fidl::encoding::DynamicFlags::empty(),
500 _decode,
501 )
502 }
503
504 type CancelUpdateResponseFut = fidl::client::QueryResponseFut<
505 InstallerCancelUpdateResult,
506 fidl::encoding::DefaultFuchsiaResourceDialect,
507 >;
508 fn r#cancel_update(&self, mut attempt_id: Option<&str>) -> Self::CancelUpdateResponseFut {
509 fn _decode(
510 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
511 ) -> Result<InstallerCancelUpdateResult, fidl::Error> {
512 let _response = fidl::client::decode_transaction_body::<
513 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, CancelError>,
514 fidl::encoding::DefaultFuchsiaResourceDialect,
515 0x472dec9160a1d0f,
516 >(_buf?)?;
517 Ok(_response.map(|x| x))
518 }
519 self.client
520 .send_query_and_decode::<InstallerCancelUpdateRequest, InstallerCancelUpdateResult>(
521 (attempt_id,),
522 0x472dec9160a1d0f,
523 fidl::encoding::DynamicFlags::empty(),
524 _decode,
525 )
526 }
527}
528
529pub struct InstallerEventStream {
530 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
531}
532
533impl std::marker::Unpin for InstallerEventStream {}
534
535impl futures::stream::FusedStream for InstallerEventStream {
536 fn is_terminated(&self) -> bool {
537 self.event_receiver.is_terminated()
538 }
539}
540
541impl futures::Stream for InstallerEventStream {
542 type Item = Result<InstallerEvent, fidl::Error>;
543
544 fn poll_next(
545 mut self: std::pin::Pin<&mut Self>,
546 cx: &mut std::task::Context<'_>,
547 ) -> std::task::Poll<Option<Self::Item>> {
548 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
549 &mut self.event_receiver,
550 cx
551 )?) {
552 Some(buf) => std::task::Poll::Ready(Some(InstallerEvent::decode(buf))),
553 None => std::task::Poll::Ready(None),
554 }
555 }
556}
557
558#[derive(Debug)]
559pub enum InstallerEvent {}
560
561impl InstallerEvent {
562 fn decode(
564 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
565 ) -> Result<InstallerEvent, fidl::Error> {
566 let (bytes, _handles) = buf.split_mut();
567 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
568 debug_assert_eq!(tx_header.tx_id, 0);
569 match tx_header.ordinal {
570 _ => Err(fidl::Error::UnknownOrdinal {
571 ordinal: tx_header.ordinal,
572 protocol_name: <InstallerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
573 }),
574 }
575 }
576}
577
578pub struct InstallerRequestStream {
580 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
581 is_terminated: bool,
582}
583
584impl std::marker::Unpin for InstallerRequestStream {}
585
586impl futures::stream::FusedStream for InstallerRequestStream {
587 fn is_terminated(&self) -> bool {
588 self.is_terminated
589 }
590}
591
592impl fidl::endpoints::RequestStream for InstallerRequestStream {
593 type Protocol = InstallerMarker;
594 type ControlHandle = InstallerControlHandle;
595
596 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
597 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
598 }
599
600 fn control_handle(&self) -> Self::ControlHandle {
601 InstallerControlHandle { inner: self.inner.clone() }
602 }
603
604 fn into_inner(
605 self,
606 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
607 {
608 (self.inner, self.is_terminated)
609 }
610
611 fn from_inner(
612 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
613 is_terminated: bool,
614 ) -> Self {
615 Self { inner, is_terminated }
616 }
617}
618
619impl futures::Stream for InstallerRequestStream {
620 type Item = Result<InstallerRequest, fidl::Error>;
621
622 fn poll_next(
623 mut self: std::pin::Pin<&mut Self>,
624 cx: &mut std::task::Context<'_>,
625 ) -> std::task::Poll<Option<Self::Item>> {
626 let this = &mut *self;
627 if this.inner.check_shutdown(cx) {
628 this.is_terminated = true;
629 return std::task::Poll::Ready(None);
630 }
631 if this.is_terminated {
632 panic!("polled InstallerRequestStream after completion");
633 }
634 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
635 |bytes, handles| {
636 match this.inner.channel().read_etc(cx, bytes, handles) {
637 std::task::Poll::Ready(Ok(())) => {}
638 std::task::Poll::Pending => return std::task::Poll::Pending,
639 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
640 this.is_terminated = true;
641 return std::task::Poll::Ready(None);
642 }
643 std::task::Poll::Ready(Err(e)) => {
644 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
645 e.into(),
646 ))))
647 }
648 }
649
650 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
652
653 std::task::Poll::Ready(Some(match header.ordinal {
654 0x2b1c5ba9167c320b => {
655 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
656 let mut req = fidl::new_empty!(
657 InstallerStartUpdateRequest,
658 fidl::encoding::DefaultFuchsiaResourceDialect
659 );
660 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InstallerStartUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
661 let control_handle = InstallerControlHandle { inner: this.inner.clone() };
662 Ok(InstallerRequest::StartUpdate {
663 url: req.url,
664 options: req.options,
665 monitor: req.monitor,
666 reboot_controller: req.reboot_controller,
667
668 responder: InstallerStartUpdateResponder {
669 control_handle: std::mem::ManuallyDrop::new(control_handle),
670 tx_id: header.tx_id,
671 },
672 })
673 }
674 0x21d54aa1fd825a32 => {
675 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
676 let mut req = fidl::new_empty!(
677 InstallerMonitorUpdateRequest,
678 fidl::encoding::DefaultFuchsiaResourceDialect
679 );
680 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InstallerMonitorUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
681 let control_handle = InstallerControlHandle { inner: this.inner.clone() };
682 Ok(InstallerRequest::MonitorUpdate {
683 attempt_id: req.attempt_id,
684 monitor: req.monitor,
685
686 responder: InstallerMonitorUpdateResponder {
687 control_handle: std::mem::ManuallyDrop::new(control_handle),
688 tx_id: header.tx_id,
689 },
690 })
691 }
692 0x788de328461f9950 => {
693 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
694 let mut req = fidl::new_empty!(
695 InstallerSuspendUpdateRequest,
696 fidl::encoding::DefaultFuchsiaResourceDialect
697 );
698 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InstallerSuspendUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
699 let control_handle = InstallerControlHandle { inner: this.inner.clone() };
700 Ok(InstallerRequest::SuspendUpdate {
701 attempt_id: req.attempt_id,
702
703 responder: InstallerSuspendUpdateResponder {
704 control_handle: std::mem::ManuallyDrop::new(control_handle),
705 tx_id: header.tx_id,
706 },
707 })
708 }
709 0x7479e805fec33dd3 => {
710 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
711 let mut req = fidl::new_empty!(
712 InstallerResumeUpdateRequest,
713 fidl::encoding::DefaultFuchsiaResourceDialect
714 );
715 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InstallerResumeUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
716 let control_handle = InstallerControlHandle { inner: this.inner.clone() };
717 Ok(InstallerRequest::ResumeUpdate {
718 attempt_id: req.attempt_id,
719
720 responder: InstallerResumeUpdateResponder {
721 control_handle: std::mem::ManuallyDrop::new(control_handle),
722 tx_id: header.tx_id,
723 },
724 })
725 }
726 0x472dec9160a1d0f => {
727 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
728 let mut req = fidl::new_empty!(
729 InstallerCancelUpdateRequest,
730 fidl::encoding::DefaultFuchsiaResourceDialect
731 );
732 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InstallerCancelUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
733 let control_handle = InstallerControlHandle { inner: this.inner.clone() };
734 Ok(InstallerRequest::CancelUpdate {
735 attempt_id: req.attempt_id,
736
737 responder: InstallerCancelUpdateResponder {
738 control_handle: std::mem::ManuallyDrop::new(control_handle),
739 tx_id: header.tx_id,
740 },
741 })
742 }
743 _ => Err(fidl::Error::UnknownOrdinal {
744 ordinal: header.ordinal,
745 protocol_name:
746 <InstallerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
747 }),
748 }))
749 },
750 )
751 }
752}
753
754#[derive(Debug)]
759pub enum InstallerRequest {
760 StartUpdate {
780 url: fidl_fuchsia_pkg::PackageUrl,
781 options: Options,
782 monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
783 reboot_controller: Option<fidl::endpoints::ServerEnd<RebootControllerMarker>>,
784 responder: InstallerStartUpdateResponder,
785 },
786 MonitorUpdate {
797 attempt_id: Option<String>,
798 monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
799 responder: InstallerMonitorUpdateResponder,
800 },
801 SuspendUpdate { attempt_id: Option<String>, responder: InstallerSuspendUpdateResponder },
806 ResumeUpdate { attempt_id: Option<String>, responder: InstallerResumeUpdateResponder },
811 CancelUpdate { attempt_id: Option<String>, responder: InstallerCancelUpdateResponder },
816}
817
818impl InstallerRequest {
819 #[allow(irrefutable_let_patterns)]
820 pub fn into_start_update(
821 self,
822 ) -> Option<(
823 fidl_fuchsia_pkg::PackageUrl,
824 Options,
825 fidl::endpoints::ClientEnd<MonitorMarker>,
826 Option<fidl::endpoints::ServerEnd<RebootControllerMarker>>,
827 InstallerStartUpdateResponder,
828 )> {
829 if let InstallerRequest::StartUpdate {
830 url,
831 options,
832 monitor,
833 reboot_controller,
834 responder,
835 } = self
836 {
837 Some((url, options, monitor, reboot_controller, responder))
838 } else {
839 None
840 }
841 }
842
843 #[allow(irrefutable_let_patterns)]
844 pub fn into_monitor_update(
845 self,
846 ) -> Option<(
847 Option<String>,
848 fidl::endpoints::ClientEnd<MonitorMarker>,
849 InstallerMonitorUpdateResponder,
850 )> {
851 if let InstallerRequest::MonitorUpdate { attempt_id, monitor, responder } = self {
852 Some((attempt_id, monitor, responder))
853 } else {
854 None
855 }
856 }
857
858 #[allow(irrefutable_let_patterns)]
859 pub fn into_suspend_update(self) -> Option<(Option<String>, InstallerSuspendUpdateResponder)> {
860 if let InstallerRequest::SuspendUpdate { attempt_id, responder } = self {
861 Some((attempt_id, responder))
862 } else {
863 None
864 }
865 }
866
867 #[allow(irrefutable_let_patterns)]
868 pub fn into_resume_update(self) -> Option<(Option<String>, InstallerResumeUpdateResponder)> {
869 if let InstallerRequest::ResumeUpdate { attempt_id, responder } = self {
870 Some((attempt_id, responder))
871 } else {
872 None
873 }
874 }
875
876 #[allow(irrefutable_let_patterns)]
877 pub fn into_cancel_update(self) -> Option<(Option<String>, InstallerCancelUpdateResponder)> {
878 if let InstallerRequest::CancelUpdate { attempt_id, responder } = self {
879 Some((attempt_id, responder))
880 } else {
881 None
882 }
883 }
884
885 pub fn method_name(&self) -> &'static str {
887 match *self {
888 InstallerRequest::StartUpdate { .. } => "start_update",
889 InstallerRequest::MonitorUpdate { .. } => "monitor_update",
890 InstallerRequest::SuspendUpdate { .. } => "suspend_update",
891 InstallerRequest::ResumeUpdate { .. } => "resume_update",
892 InstallerRequest::CancelUpdate { .. } => "cancel_update",
893 }
894 }
895}
896
897#[derive(Debug, Clone)]
898pub struct InstallerControlHandle {
899 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
900}
901
902impl fidl::endpoints::ControlHandle for InstallerControlHandle {
903 fn shutdown(&self) {
904 self.inner.shutdown()
905 }
906 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
907 self.inner.shutdown_with_epitaph(status)
908 }
909
910 fn is_closed(&self) -> bool {
911 self.inner.channel().is_closed()
912 }
913 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
914 self.inner.channel().on_closed()
915 }
916
917 #[cfg(target_os = "fuchsia")]
918 fn signal_peer(
919 &self,
920 clear_mask: zx::Signals,
921 set_mask: zx::Signals,
922 ) -> Result<(), zx_status::Status> {
923 use fidl::Peered;
924 self.inner.channel().signal_peer(clear_mask, set_mask)
925 }
926}
927
928impl InstallerControlHandle {}
929
930#[must_use = "FIDL methods require a response to be sent"]
931#[derive(Debug)]
932pub struct InstallerStartUpdateResponder {
933 control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
934 tx_id: u32,
935}
936
937impl std::ops::Drop for InstallerStartUpdateResponder {
941 fn drop(&mut self) {
942 self.control_handle.shutdown();
943 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
945 }
946}
947
948impl fidl::endpoints::Responder for InstallerStartUpdateResponder {
949 type ControlHandle = InstallerControlHandle;
950
951 fn control_handle(&self) -> &InstallerControlHandle {
952 &self.control_handle
953 }
954
955 fn drop_without_shutdown(mut self) {
956 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
958 std::mem::forget(self);
960 }
961}
962
963impl InstallerStartUpdateResponder {
964 pub fn send(self, mut result: Result<&str, UpdateNotStartedReason>) -> Result<(), fidl::Error> {
968 let _result = self.send_raw(result);
969 if _result.is_err() {
970 self.control_handle.shutdown();
971 }
972 self.drop_without_shutdown();
973 _result
974 }
975
976 pub fn send_no_shutdown_on_err(
978 self,
979 mut result: Result<&str, UpdateNotStartedReason>,
980 ) -> Result<(), fidl::Error> {
981 let _result = self.send_raw(result);
982 self.drop_without_shutdown();
983 _result
984 }
985
986 fn send_raw(
987 &self,
988 mut result: Result<&str, UpdateNotStartedReason>,
989 ) -> Result<(), fidl::Error> {
990 self.control_handle.inner.send::<fidl::encoding::ResultType<
991 InstallerStartUpdateResponse,
992 UpdateNotStartedReason,
993 >>(
994 result.map(|attempt_id| (attempt_id,)),
995 self.tx_id,
996 0x2b1c5ba9167c320b,
997 fidl::encoding::DynamicFlags::empty(),
998 )
999 }
1000}
1001
1002#[must_use = "FIDL methods require a response to be sent"]
1003#[derive(Debug)]
1004pub struct InstallerMonitorUpdateResponder {
1005 control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
1006 tx_id: u32,
1007}
1008
1009impl std::ops::Drop for InstallerMonitorUpdateResponder {
1013 fn drop(&mut self) {
1014 self.control_handle.shutdown();
1015 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1017 }
1018}
1019
1020impl fidl::endpoints::Responder for InstallerMonitorUpdateResponder {
1021 type ControlHandle = InstallerControlHandle;
1022
1023 fn control_handle(&self) -> &InstallerControlHandle {
1024 &self.control_handle
1025 }
1026
1027 fn drop_without_shutdown(mut self) {
1028 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1030 std::mem::forget(self);
1032 }
1033}
1034
1035impl InstallerMonitorUpdateResponder {
1036 pub fn send(self, mut attached: bool) -> Result<(), fidl::Error> {
1040 let _result = self.send_raw(attached);
1041 if _result.is_err() {
1042 self.control_handle.shutdown();
1043 }
1044 self.drop_without_shutdown();
1045 _result
1046 }
1047
1048 pub fn send_no_shutdown_on_err(self, mut attached: bool) -> Result<(), fidl::Error> {
1050 let _result = self.send_raw(attached);
1051 self.drop_without_shutdown();
1052 _result
1053 }
1054
1055 fn send_raw(&self, mut attached: bool) -> Result<(), fidl::Error> {
1056 self.control_handle.inner.send::<InstallerMonitorUpdateResponse>(
1057 (attached,),
1058 self.tx_id,
1059 0x21d54aa1fd825a32,
1060 fidl::encoding::DynamicFlags::empty(),
1061 )
1062 }
1063}
1064
1065#[must_use = "FIDL methods require a response to be sent"]
1066#[derive(Debug)]
1067pub struct InstallerSuspendUpdateResponder {
1068 control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
1069 tx_id: u32,
1070}
1071
1072impl std::ops::Drop for InstallerSuspendUpdateResponder {
1076 fn drop(&mut self) {
1077 self.control_handle.shutdown();
1078 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1080 }
1081}
1082
1083impl fidl::endpoints::Responder for InstallerSuspendUpdateResponder {
1084 type ControlHandle = InstallerControlHandle;
1085
1086 fn control_handle(&self) -> &InstallerControlHandle {
1087 &self.control_handle
1088 }
1089
1090 fn drop_without_shutdown(mut self) {
1091 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1093 std::mem::forget(self);
1095 }
1096}
1097
1098impl InstallerSuspendUpdateResponder {
1099 pub fn send(self, mut result: Result<(), SuspendError>) -> Result<(), fidl::Error> {
1103 let _result = self.send_raw(result);
1104 if _result.is_err() {
1105 self.control_handle.shutdown();
1106 }
1107 self.drop_without_shutdown();
1108 _result
1109 }
1110
1111 pub fn send_no_shutdown_on_err(
1113 self,
1114 mut result: Result<(), SuspendError>,
1115 ) -> Result<(), fidl::Error> {
1116 let _result = self.send_raw(result);
1117 self.drop_without_shutdown();
1118 _result
1119 }
1120
1121 fn send_raw(&self, mut result: Result<(), SuspendError>) -> Result<(), fidl::Error> {
1122 self.control_handle.inner.send::<fidl::encoding::ResultType<
1123 fidl::encoding::EmptyStruct,
1124 SuspendError,
1125 >>(
1126 result,
1127 self.tx_id,
1128 0x788de328461f9950,
1129 fidl::encoding::DynamicFlags::empty(),
1130 )
1131 }
1132}
1133
1134#[must_use = "FIDL methods require a response to be sent"]
1135#[derive(Debug)]
1136pub struct InstallerResumeUpdateResponder {
1137 control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
1138 tx_id: u32,
1139}
1140
1141impl std::ops::Drop for InstallerResumeUpdateResponder {
1145 fn drop(&mut self) {
1146 self.control_handle.shutdown();
1147 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1149 }
1150}
1151
1152impl fidl::endpoints::Responder for InstallerResumeUpdateResponder {
1153 type ControlHandle = InstallerControlHandle;
1154
1155 fn control_handle(&self) -> &InstallerControlHandle {
1156 &self.control_handle
1157 }
1158
1159 fn drop_without_shutdown(mut self) {
1160 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1162 std::mem::forget(self);
1164 }
1165}
1166
1167impl InstallerResumeUpdateResponder {
1168 pub fn send(self, mut result: Result<(), ResumeError>) -> Result<(), fidl::Error> {
1172 let _result = self.send_raw(result);
1173 if _result.is_err() {
1174 self.control_handle.shutdown();
1175 }
1176 self.drop_without_shutdown();
1177 _result
1178 }
1179
1180 pub fn send_no_shutdown_on_err(
1182 self,
1183 mut result: Result<(), ResumeError>,
1184 ) -> Result<(), fidl::Error> {
1185 let _result = self.send_raw(result);
1186 self.drop_without_shutdown();
1187 _result
1188 }
1189
1190 fn send_raw(&self, mut result: Result<(), ResumeError>) -> Result<(), fidl::Error> {
1191 self.control_handle.inner.send::<fidl::encoding::ResultType<
1192 fidl::encoding::EmptyStruct,
1193 ResumeError,
1194 >>(
1195 result,
1196 self.tx_id,
1197 0x7479e805fec33dd3,
1198 fidl::encoding::DynamicFlags::empty(),
1199 )
1200 }
1201}
1202
1203#[must_use = "FIDL methods require a response to be sent"]
1204#[derive(Debug)]
1205pub struct InstallerCancelUpdateResponder {
1206 control_handle: std::mem::ManuallyDrop<InstallerControlHandle>,
1207 tx_id: u32,
1208}
1209
1210impl std::ops::Drop for InstallerCancelUpdateResponder {
1214 fn drop(&mut self) {
1215 self.control_handle.shutdown();
1216 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1218 }
1219}
1220
1221impl fidl::endpoints::Responder for InstallerCancelUpdateResponder {
1222 type ControlHandle = InstallerControlHandle;
1223
1224 fn control_handle(&self) -> &InstallerControlHandle {
1225 &self.control_handle
1226 }
1227
1228 fn drop_without_shutdown(mut self) {
1229 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1231 std::mem::forget(self);
1233 }
1234}
1235
1236impl InstallerCancelUpdateResponder {
1237 pub fn send(self, mut result: Result<(), CancelError>) -> Result<(), fidl::Error> {
1241 let _result = self.send_raw(result);
1242 if _result.is_err() {
1243 self.control_handle.shutdown();
1244 }
1245 self.drop_without_shutdown();
1246 _result
1247 }
1248
1249 pub fn send_no_shutdown_on_err(
1251 self,
1252 mut result: Result<(), CancelError>,
1253 ) -> Result<(), fidl::Error> {
1254 let _result = self.send_raw(result);
1255 self.drop_without_shutdown();
1256 _result
1257 }
1258
1259 fn send_raw(&self, mut result: Result<(), CancelError>) -> Result<(), fidl::Error> {
1260 self.control_handle.inner.send::<fidl::encoding::ResultType<
1261 fidl::encoding::EmptyStruct,
1262 CancelError,
1263 >>(
1264 result,
1265 self.tx_id,
1266 0x472dec9160a1d0f,
1267 fidl::encoding::DynamicFlags::empty(),
1268 )
1269 }
1270}
1271
1272#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1273pub struct MonitorMarker;
1274
1275impl fidl::endpoints::ProtocolMarker for MonitorMarker {
1276 type Proxy = MonitorProxy;
1277 type RequestStream = MonitorRequestStream;
1278 #[cfg(target_os = "fuchsia")]
1279 type SynchronousProxy = MonitorSynchronousProxy;
1280
1281 const DEBUG_NAME: &'static str = "(anonymous) Monitor";
1282}
1283
1284pub trait MonitorProxyInterface: Send + Sync {
1285 type OnStateResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1286 fn r#on_state(&self, state: &State) -> Self::OnStateResponseFut;
1287}
1288#[derive(Debug)]
1289#[cfg(target_os = "fuchsia")]
1290pub struct MonitorSynchronousProxy {
1291 client: fidl::client::sync::Client,
1292}
1293
1294#[cfg(target_os = "fuchsia")]
1295impl fidl::endpoints::SynchronousProxy for MonitorSynchronousProxy {
1296 type Proxy = MonitorProxy;
1297 type Protocol = MonitorMarker;
1298
1299 fn from_channel(inner: fidl::Channel) -> Self {
1300 Self::new(inner)
1301 }
1302
1303 fn into_channel(self) -> fidl::Channel {
1304 self.client.into_channel()
1305 }
1306
1307 fn as_channel(&self) -> &fidl::Channel {
1308 self.client.as_channel()
1309 }
1310}
1311
1312#[cfg(target_os = "fuchsia")]
1313impl MonitorSynchronousProxy {
1314 pub fn new(channel: fidl::Channel) -> Self {
1315 let protocol_name = <MonitorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1316 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1317 }
1318
1319 pub fn into_channel(self) -> fidl::Channel {
1320 self.client.into_channel()
1321 }
1322
1323 pub fn wait_for_event(
1326 &self,
1327 deadline: zx::MonotonicInstant,
1328 ) -> Result<MonitorEvent, fidl::Error> {
1329 MonitorEvent::decode(self.client.wait_for_event(deadline)?)
1330 }
1331
1332 pub fn r#on_state(
1353 &self,
1354 mut state: &State,
1355 ___deadline: zx::MonotonicInstant,
1356 ) -> Result<(), fidl::Error> {
1357 let _response =
1358 self.client.send_query::<MonitorOnStateRequest, fidl::encoding::EmptyPayload>(
1359 (state,),
1360 0x574105820d16cf26,
1361 fidl::encoding::DynamicFlags::empty(),
1362 ___deadline,
1363 )?;
1364 Ok(_response)
1365 }
1366}
1367
1368#[cfg(target_os = "fuchsia")]
1369impl From<MonitorSynchronousProxy> for zx::Handle {
1370 fn from(value: MonitorSynchronousProxy) -> Self {
1371 value.into_channel().into()
1372 }
1373}
1374
1375#[cfg(target_os = "fuchsia")]
1376impl From<fidl::Channel> for MonitorSynchronousProxy {
1377 fn from(value: fidl::Channel) -> Self {
1378 Self::new(value)
1379 }
1380}
1381
1382#[derive(Debug, Clone)]
1383pub struct MonitorProxy {
1384 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1385}
1386
1387impl fidl::endpoints::Proxy for MonitorProxy {
1388 type Protocol = MonitorMarker;
1389
1390 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1391 Self::new(inner)
1392 }
1393
1394 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1395 self.client.into_channel().map_err(|client| Self { client })
1396 }
1397
1398 fn as_channel(&self) -> &::fidl::AsyncChannel {
1399 self.client.as_channel()
1400 }
1401}
1402
1403impl MonitorProxy {
1404 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1406 let protocol_name = <MonitorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1407 Self { client: fidl::client::Client::new(channel, protocol_name) }
1408 }
1409
1410 pub fn take_event_stream(&self) -> MonitorEventStream {
1416 MonitorEventStream { event_receiver: self.client.take_event_receiver() }
1417 }
1418
1419 pub fn r#on_state(
1440 &self,
1441 mut state: &State,
1442 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1443 MonitorProxyInterface::r#on_state(self, state)
1444 }
1445}
1446
1447impl MonitorProxyInterface for MonitorProxy {
1448 type OnStateResponseFut =
1449 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1450 fn r#on_state(&self, mut state: &State) -> Self::OnStateResponseFut {
1451 fn _decode(
1452 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1453 ) -> Result<(), fidl::Error> {
1454 let _response = fidl::client::decode_transaction_body::<
1455 fidl::encoding::EmptyPayload,
1456 fidl::encoding::DefaultFuchsiaResourceDialect,
1457 0x574105820d16cf26,
1458 >(_buf?)?;
1459 Ok(_response)
1460 }
1461 self.client.send_query_and_decode::<MonitorOnStateRequest, ()>(
1462 (state,),
1463 0x574105820d16cf26,
1464 fidl::encoding::DynamicFlags::empty(),
1465 _decode,
1466 )
1467 }
1468}
1469
1470pub struct MonitorEventStream {
1471 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1472}
1473
1474impl std::marker::Unpin for MonitorEventStream {}
1475
1476impl futures::stream::FusedStream for MonitorEventStream {
1477 fn is_terminated(&self) -> bool {
1478 self.event_receiver.is_terminated()
1479 }
1480}
1481
1482impl futures::Stream for MonitorEventStream {
1483 type Item = Result<MonitorEvent, fidl::Error>;
1484
1485 fn poll_next(
1486 mut self: std::pin::Pin<&mut Self>,
1487 cx: &mut std::task::Context<'_>,
1488 ) -> std::task::Poll<Option<Self::Item>> {
1489 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1490 &mut self.event_receiver,
1491 cx
1492 )?) {
1493 Some(buf) => std::task::Poll::Ready(Some(MonitorEvent::decode(buf))),
1494 None => std::task::Poll::Ready(None),
1495 }
1496 }
1497}
1498
1499#[derive(Debug)]
1500pub enum MonitorEvent {}
1501
1502impl MonitorEvent {
1503 fn decode(
1505 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1506 ) -> Result<MonitorEvent, fidl::Error> {
1507 let (bytes, _handles) = buf.split_mut();
1508 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1509 debug_assert_eq!(tx_header.tx_id, 0);
1510 match tx_header.ordinal {
1511 _ => Err(fidl::Error::UnknownOrdinal {
1512 ordinal: tx_header.ordinal,
1513 protocol_name: <MonitorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1514 }),
1515 }
1516 }
1517}
1518
1519pub struct MonitorRequestStream {
1521 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1522 is_terminated: bool,
1523}
1524
1525impl std::marker::Unpin for MonitorRequestStream {}
1526
1527impl futures::stream::FusedStream for MonitorRequestStream {
1528 fn is_terminated(&self) -> bool {
1529 self.is_terminated
1530 }
1531}
1532
1533impl fidl::endpoints::RequestStream for MonitorRequestStream {
1534 type Protocol = MonitorMarker;
1535 type ControlHandle = MonitorControlHandle;
1536
1537 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1538 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1539 }
1540
1541 fn control_handle(&self) -> Self::ControlHandle {
1542 MonitorControlHandle { inner: self.inner.clone() }
1543 }
1544
1545 fn into_inner(
1546 self,
1547 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1548 {
1549 (self.inner, self.is_terminated)
1550 }
1551
1552 fn from_inner(
1553 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1554 is_terminated: bool,
1555 ) -> Self {
1556 Self { inner, is_terminated }
1557 }
1558}
1559
1560impl futures::Stream for MonitorRequestStream {
1561 type Item = Result<MonitorRequest, fidl::Error>;
1562
1563 fn poll_next(
1564 mut self: std::pin::Pin<&mut Self>,
1565 cx: &mut std::task::Context<'_>,
1566 ) -> std::task::Poll<Option<Self::Item>> {
1567 let this = &mut *self;
1568 if this.inner.check_shutdown(cx) {
1569 this.is_terminated = true;
1570 return std::task::Poll::Ready(None);
1571 }
1572 if this.is_terminated {
1573 panic!("polled MonitorRequestStream after completion");
1574 }
1575 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1576 |bytes, handles| {
1577 match this.inner.channel().read_etc(cx, bytes, handles) {
1578 std::task::Poll::Ready(Ok(())) => {}
1579 std::task::Poll::Pending => return std::task::Poll::Pending,
1580 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1581 this.is_terminated = true;
1582 return std::task::Poll::Ready(None);
1583 }
1584 std::task::Poll::Ready(Err(e)) => {
1585 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1586 e.into(),
1587 ))))
1588 }
1589 }
1590
1591 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1593
1594 std::task::Poll::Ready(Some(match header.ordinal {
1595 0x574105820d16cf26 => {
1596 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1597 let mut req = fidl::new_empty!(
1598 MonitorOnStateRequest,
1599 fidl::encoding::DefaultFuchsiaResourceDialect
1600 );
1601 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MonitorOnStateRequest>(&header, _body_bytes, handles, &mut req)?;
1602 let control_handle = MonitorControlHandle { inner: this.inner.clone() };
1603 Ok(MonitorRequest::OnState {
1604 state: req.state,
1605
1606 responder: MonitorOnStateResponder {
1607 control_handle: std::mem::ManuallyDrop::new(control_handle),
1608 tx_id: header.tx_id,
1609 },
1610 })
1611 }
1612 _ => Err(fidl::Error::UnknownOrdinal {
1613 ordinal: header.ordinal,
1614 protocol_name:
1615 <MonitorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1616 }),
1617 }))
1618 },
1619 )
1620 }
1621}
1622
1623#[derive(Debug)]
1629pub enum MonitorRequest {
1630 OnState { state: State, responder: MonitorOnStateResponder },
1651}
1652
1653impl MonitorRequest {
1654 #[allow(irrefutable_let_patterns)]
1655 pub fn into_on_state(self) -> Option<(State, MonitorOnStateResponder)> {
1656 if let MonitorRequest::OnState { state, responder } = self {
1657 Some((state, responder))
1658 } else {
1659 None
1660 }
1661 }
1662
1663 pub fn method_name(&self) -> &'static str {
1665 match *self {
1666 MonitorRequest::OnState { .. } => "on_state",
1667 }
1668 }
1669}
1670
1671#[derive(Debug, Clone)]
1672pub struct MonitorControlHandle {
1673 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1674}
1675
1676impl fidl::endpoints::ControlHandle for MonitorControlHandle {
1677 fn shutdown(&self) {
1678 self.inner.shutdown()
1679 }
1680 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1681 self.inner.shutdown_with_epitaph(status)
1682 }
1683
1684 fn is_closed(&self) -> bool {
1685 self.inner.channel().is_closed()
1686 }
1687 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1688 self.inner.channel().on_closed()
1689 }
1690
1691 #[cfg(target_os = "fuchsia")]
1692 fn signal_peer(
1693 &self,
1694 clear_mask: zx::Signals,
1695 set_mask: zx::Signals,
1696 ) -> Result<(), zx_status::Status> {
1697 use fidl::Peered;
1698 self.inner.channel().signal_peer(clear_mask, set_mask)
1699 }
1700}
1701
1702impl MonitorControlHandle {}
1703
1704#[must_use = "FIDL methods require a response to be sent"]
1705#[derive(Debug)]
1706pub struct MonitorOnStateResponder {
1707 control_handle: std::mem::ManuallyDrop<MonitorControlHandle>,
1708 tx_id: u32,
1709}
1710
1711impl std::ops::Drop for MonitorOnStateResponder {
1715 fn drop(&mut self) {
1716 self.control_handle.shutdown();
1717 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1719 }
1720}
1721
1722impl fidl::endpoints::Responder for MonitorOnStateResponder {
1723 type ControlHandle = MonitorControlHandle;
1724
1725 fn control_handle(&self) -> &MonitorControlHandle {
1726 &self.control_handle
1727 }
1728
1729 fn drop_without_shutdown(mut self) {
1730 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1732 std::mem::forget(self);
1734 }
1735}
1736
1737impl MonitorOnStateResponder {
1738 pub fn send(self) -> Result<(), fidl::Error> {
1742 let _result = self.send_raw();
1743 if _result.is_err() {
1744 self.control_handle.shutdown();
1745 }
1746 self.drop_without_shutdown();
1747 _result
1748 }
1749
1750 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1752 let _result = self.send_raw();
1753 self.drop_without_shutdown();
1754 _result
1755 }
1756
1757 fn send_raw(&self) -> Result<(), fidl::Error> {
1758 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1759 (),
1760 self.tx_id,
1761 0x574105820d16cf26,
1762 fidl::encoding::DynamicFlags::empty(),
1763 )
1764 }
1765}
1766
1767#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1768pub struct RebootControllerMarker;
1769
1770impl fidl::endpoints::ProtocolMarker for RebootControllerMarker {
1771 type Proxy = RebootControllerProxy;
1772 type RequestStream = RebootControllerRequestStream;
1773 #[cfg(target_os = "fuchsia")]
1774 type SynchronousProxy = RebootControllerSynchronousProxy;
1775
1776 const DEBUG_NAME: &'static str = "(anonymous) RebootController";
1777}
1778
1779pub trait RebootControllerProxyInterface: Send + Sync {
1780 fn r#unblock(&self) -> Result<(), fidl::Error>;
1781 fn r#detach(&self) -> Result<(), fidl::Error>;
1782}
1783#[derive(Debug)]
1784#[cfg(target_os = "fuchsia")]
1785pub struct RebootControllerSynchronousProxy {
1786 client: fidl::client::sync::Client,
1787}
1788
1789#[cfg(target_os = "fuchsia")]
1790impl fidl::endpoints::SynchronousProxy for RebootControllerSynchronousProxy {
1791 type Proxy = RebootControllerProxy;
1792 type Protocol = RebootControllerMarker;
1793
1794 fn from_channel(inner: fidl::Channel) -> Self {
1795 Self::new(inner)
1796 }
1797
1798 fn into_channel(self) -> fidl::Channel {
1799 self.client.into_channel()
1800 }
1801
1802 fn as_channel(&self) -> &fidl::Channel {
1803 self.client.as_channel()
1804 }
1805}
1806
1807#[cfg(target_os = "fuchsia")]
1808impl RebootControllerSynchronousProxy {
1809 pub fn new(channel: fidl::Channel) -> Self {
1810 let protocol_name = <RebootControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1811 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1812 }
1813
1814 pub fn into_channel(self) -> fidl::Channel {
1815 self.client.into_channel()
1816 }
1817
1818 pub fn wait_for_event(
1821 &self,
1822 deadline: zx::MonotonicInstant,
1823 ) -> Result<RebootControllerEvent, fidl::Error> {
1824 RebootControllerEvent::decode(self.client.wait_for_event(deadline)?)
1825 }
1826
1827 pub fn r#unblock(&self) -> Result<(), fidl::Error> {
1835 self.client.send::<fidl::encoding::EmptyPayload>(
1836 (),
1837 0x5705625395e3d520,
1838 fidl::encoding::DynamicFlags::empty(),
1839 )
1840 }
1841
1842 pub fn r#detach(&self) -> Result<(), fidl::Error> {
1845 self.client.send::<fidl::encoding::EmptyPayload>(
1846 (),
1847 0x1daa560411955f16,
1848 fidl::encoding::DynamicFlags::empty(),
1849 )
1850 }
1851}
1852
1853#[cfg(target_os = "fuchsia")]
1854impl From<RebootControllerSynchronousProxy> for zx::Handle {
1855 fn from(value: RebootControllerSynchronousProxy) -> Self {
1856 value.into_channel().into()
1857 }
1858}
1859
1860#[cfg(target_os = "fuchsia")]
1861impl From<fidl::Channel> for RebootControllerSynchronousProxy {
1862 fn from(value: fidl::Channel) -> Self {
1863 Self::new(value)
1864 }
1865}
1866
1867#[derive(Debug, Clone)]
1868pub struct RebootControllerProxy {
1869 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1870}
1871
1872impl fidl::endpoints::Proxy for RebootControllerProxy {
1873 type Protocol = RebootControllerMarker;
1874
1875 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1876 Self::new(inner)
1877 }
1878
1879 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1880 self.client.into_channel().map_err(|client| Self { client })
1881 }
1882
1883 fn as_channel(&self) -> &::fidl::AsyncChannel {
1884 self.client.as_channel()
1885 }
1886}
1887
1888impl RebootControllerProxy {
1889 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1891 let protocol_name = <RebootControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1892 Self { client: fidl::client::Client::new(channel, protocol_name) }
1893 }
1894
1895 pub fn take_event_stream(&self) -> RebootControllerEventStream {
1901 RebootControllerEventStream { event_receiver: self.client.take_event_receiver() }
1902 }
1903
1904 pub fn r#unblock(&self) -> Result<(), fidl::Error> {
1912 RebootControllerProxyInterface::r#unblock(self)
1913 }
1914
1915 pub fn r#detach(&self) -> Result<(), fidl::Error> {
1918 RebootControllerProxyInterface::r#detach(self)
1919 }
1920}
1921
1922impl RebootControllerProxyInterface for RebootControllerProxy {
1923 fn r#unblock(&self) -> Result<(), fidl::Error> {
1924 self.client.send::<fidl::encoding::EmptyPayload>(
1925 (),
1926 0x5705625395e3d520,
1927 fidl::encoding::DynamicFlags::empty(),
1928 )
1929 }
1930
1931 fn r#detach(&self) -> Result<(), fidl::Error> {
1932 self.client.send::<fidl::encoding::EmptyPayload>(
1933 (),
1934 0x1daa560411955f16,
1935 fidl::encoding::DynamicFlags::empty(),
1936 )
1937 }
1938}
1939
1940pub struct RebootControllerEventStream {
1941 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1942}
1943
1944impl std::marker::Unpin for RebootControllerEventStream {}
1945
1946impl futures::stream::FusedStream for RebootControllerEventStream {
1947 fn is_terminated(&self) -> bool {
1948 self.event_receiver.is_terminated()
1949 }
1950}
1951
1952impl futures::Stream for RebootControllerEventStream {
1953 type Item = Result<RebootControllerEvent, fidl::Error>;
1954
1955 fn poll_next(
1956 mut self: std::pin::Pin<&mut Self>,
1957 cx: &mut std::task::Context<'_>,
1958 ) -> std::task::Poll<Option<Self::Item>> {
1959 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1960 &mut self.event_receiver,
1961 cx
1962 )?) {
1963 Some(buf) => std::task::Poll::Ready(Some(RebootControllerEvent::decode(buf))),
1964 None => std::task::Poll::Ready(None),
1965 }
1966 }
1967}
1968
1969#[derive(Debug)]
1970pub enum RebootControllerEvent {}
1971
1972impl RebootControllerEvent {
1973 fn decode(
1975 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1976 ) -> Result<RebootControllerEvent, fidl::Error> {
1977 let (bytes, _handles) = buf.split_mut();
1978 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1979 debug_assert_eq!(tx_header.tx_id, 0);
1980 match tx_header.ordinal {
1981 _ => Err(fidl::Error::UnknownOrdinal {
1982 ordinal: tx_header.ordinal,
1983 protocol_name:
1984 <RebootControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1985 }),
1986 }
1987 }
1988}
1989
1990pub struct RebootControllerRequestStream {
1992 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1993 is_terminated: bool,
1994}
1995
1996impl std::marker::Unpin for RebootControllerRequestStream {}
1997
1998impl futures::stream::FusedStream for RebootControllerRequestStream {
1999 fn is_terminated(&self) -> bool {
2000 self.is_terminated
2001 }
2002}
2003
2004impl fidl::endpoints::RequestStream for RebootControllerRequestStream {
2005 type Protocol = RebootControllerMarker;
2006 type ControlHandle = RebootControllerControlHandle;
2007
2008 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2009 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2010 }
2011
2012 fn control_handle(&self) -> Self::ControlHandle {
2013 RebootControllerControlHandle { inner: self.inner.clone() }
2014 }
2015
2016 fn into_inner(
2017 self,
2018 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2019 {
2020 (self.inner, self.is_terminated)
2021 }
2022
2023 fn from_inner(
2024 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2025 is_terminated: bool,
2026 ) -> Self {
2027 Self { inner, is_terminated }
2028 }
2029}
2030
2031impl futures::Stream for RebootControllerRequestStream {
2032 type Item = Result<RebootControllerRequest, fidl::Error>;
2033
2034 fn poll_next(
2035 mut self: std::pin::Pin<&mut Self>,
2036 cx: &mut std::task::Context<'_>,
2037 ) -> std::task::Poll<Option<Self::Item>> {
2038 let this = &mut *self;
2039 if this.inner.check_shutdown(cx) {
2040 this.is_terminated = true;
2041 return std::task::Poll::Ready(None);
2042 }
2043 if this.is_terminated {
2044 panic!("polled RebootControllerRequestStream after completion");
2045 }
2046 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2047 |bytes, handles| {
2048 match this.inner.channel().read_etc(cx, bytes, handles) {
2049 std::task::Poll::Ready(Ok(())) => {}
2050 std::task::Poll::Pending => return std::task::Poll::Pending,
2051 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2052 this.is_terminated = true;
2053 return std::task::Poll::Ready(None);
2054 }
2055 std::task::Poll::Ready(Err(e)) => {
2056 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2057 e.into(),
2058 ))))
2059 }
2060 }
2061
2062 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2064
2065 std::task::Poll::Ready(Some(match header.ordinal {
2066 0x5705625395e3d520 => {
2067 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2068 let mut req = fidl::new_empty!(
2069 fidl::encoding::EmptyPayload,
2070 fidl::encoding::DefaultFuchsiaResourceDialect
2071 );
2072 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2073 let control_handle =
2074 RebootControllerControlHandle { inner: this.inner.clone() };
2075 Ok(RebootControllerRequest::Unblock { control_handle })
2076 }
2077 0x1daa560411955f16 => {
2078 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2079 let mut req = fidl::new_empty!(
2080 fidl::encoding::EmptyPayload,
2081 fidl::encoding::DefaultFuchsiaResourceDialect
2082 );
2083 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2084 let control_handle =
2085 RebootControllerControlHandle { inner: this.inner.clone() };
2086 Ok(RebootControllerRequest::Detach { control_handle })
2087 }
2088 _ => Err(fidl::Error::UnknownOrdinal {
2089 ordinal: header.ordinal,
2090 protocol_name:
2091 <RebootControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2092 }),
2093 }))
2094 },
2095 )
2096 }
2097}
2098
2099#[derive(Debug)]
2105pub enum RebootControllerRequest {
2106 Unblock { control_handle: RebootControllerControlHandle },
2114 Detach { control_handle: RebootControllerControlHandle },
2117}
2118
2119impl RebootControllerRequest {
2120 #[allow(irrefutable_let_patterns)]
2121 pub fn into_unblock(self) -> Option<(RebootControllerControlHandle)> {
2122 if let RebootControllerRequest::Unblock { control_handle } = self {
2123 Some((control_handle))
2124 } else {
2125 None
2126 }
2127 }
2128
2129 #[allow(irrefutable_let_patterns)]
2130 pub fn into_detach(self) -> Option<(RebootControllerControlHandle)> {
2131 if let RebootControllerRequest::Detach { control_handle } = self {
2132 Some((control_handle))
2133 } else {
2134 None
2135 }
2136 }
2137
2138 pub fn method_name(&self) -> &'static str {
2140 match *self {
2141 RebootControllerRequest::Unblock { .. } => "unblock",
2142 RebootControllerRequest::Detach { .. } => "detach",
2143 }
2144 }
2145}
2146
2147#[derive(Debug, Clone)]
2148pub struct RebootControllerControlHandle {
2149 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2150}
2151
2152impl fidl::endpoints::ControlHandle for RebootControllerControlHandle {
2153 fn shutdown(&self) {
2154 self.inner.shutdown()
2155 }
2156 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2157 self.inner.shutdown_with_epitaph(status)
2158 }
2159
2160 fn is_closed(&self) -> bool {
2161 self.inner.channel().is_closed()
2162 }
2163 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2164 self.inner.channel().on_closed()
2165 }
2166
2167 #[cfg(target_os = "fuchsia")]
2168 fn signal_peer(
2169 &self,
2170 clear_mask: zx::Signals,
2171 set_mask: zx::Signals,
2172 ) -> Result<(), zx_status::Status> {
2173 use fidl::Peered;
2174 self.inner.channel().signal_peer(clear_mask, set_mask)
2175 }
2176}
2177
2178impl RebootControllerControlHandle {}
2179
2180mod internal {
2181 use super::*;
2182
2183 impl fidl::encoding::ResourceTypeMarker for InstallerMonitorUpdateRequest {
2184 type Borrowed<'a> = &'a mut Self;
2185 fn take_or_borrow<'a>(
2186 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2187 ) -> Self::Borrowed<'a> {
2188 value
2189 }
2190 }
2191
2192 unsafe impl fidl::encoding::TypeMarker for InstallerMonitorUpdateRequest {
2193 type Owned = Self;
2194
2195 #[inline(always)]
2196 fn inline_align(_context: fidl::encoding::Context) -> usize {
2197 8
2198 }
2199
2200 #[inline(always)]
2201 fn inline_size(_context: fidl::encoding::Context) -> usize {
2202 24
2203 }
2204 }
2205
2206 unsafe impl
2207 fidl::encoding::Encode<
2208 InstallerMonitorUpdateRequest,
2209 fidl::encoding::DefaultFuchsiaResourceDialect,
2210 > for &mut InstallerMonitorUpdateRequest
2211 {
2212 #[inline]
2213 unsafe fn encode(
2214 self,
2215 encoder: &mut fidl::encoding::Encoder<
2216 '_,
2217 fidl::encoding::DefaultFuchsiaResourceDialect,
2218 >,
2219 offset: usize,
2220 _depth: fidl::encoding::Depth,
2221 ) -> fidl::Result<()> {
2222 encoder.debug_check_bounds::<InstallerMonitorUpdateRequest>(offset);
2223 fidl::encoding::Encode::<InstallerMonitorUpdateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2225 (
2226 <fidl::encoding::Optional<fidl::encoding::BoundedString<36>> as fidl::encoding::ValueTypeMarker>::borrow(&self.attempt_id),
2227 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.monitor),
2228 ),
2229 encoder, offset, _depth
2230 )
2231 }
2232 }
2233 unsafe impl<
2234 T0: fidl::encoding::Encode<
2235 fidl::encoding::Optional<fidl::encoding::BoundedString<36>>,
2236 fidl::encoding::DefaultFuchsiaResourceDialect,
2237 >,
2238 T1: fidl::encoding::Encode<
2239 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>>,
2240 fidl::encoding::DefaultFuchsiaResourceDialect,
2241 >,
2242 >
2243 fidl::encoding::Encode<
2244 InstallerMonitorUpdateRequest,
2245 fidl::encoding::DefaultFuchsiaResourceDialect,
2246 > for (T0, T1)
2247 {
2248 #[inline]
2249 unsafe fn encode(
2250 self,
2251 encoder: &mut fidl::encoding::Encoder<
2252 '_,
2253 fidl::encoding::DefaultFuchsiaResourceDialect,
2254 >,
2255 offset: usize,
2256 depth: fidl::encoding::Depth,
2257 ) -> fidl::Result<()> {
2258 encoder.debug_check_bounds::<InstallerMonitorUpdateRequest>(offset);
2259 unsafe {
2262 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2263 (ptr as *mut u64).write_unaligned(0);
2264 }
2265 self.0.encode(encoder, offset + 0, depth)?;
2267 self.1.encode(encoder, offset + 16, depth)?;
2268 Ok(())
2269 }
2270 }
2271
2272 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2273 for InstallerMonitorUpdateRequest
2274 {
2275 #[inline(always)]
2276 fn new_empty() -> Self {
2277 Self {
2278 attempt_id: fidl::new_empty!(
2279 fidl::encoding::Optional<fidl::encoding::BoundedString<36>>,
2280 fidl::encoding::DefaultFuchsiaResourceDialect
2281 ),
2282 monitor: fidl::new_empty!(
2283 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>>,
2284 fidl::encoding::DefaultFuchsiaResourceDialect
2285 ),
2286 }
2287 }
2288
2289 #[inline]
2290 unsafe fn decode(
2291 &mut self,
2292 decoder: &mut fidl::encoding::Decoder<
2293 '_,
2294 fidl::encoding::DefaultFuchsiaResourceDialect,
2295 >,
2296 offset: usize,
2297 _depth: fidl::encoding::Depth,
2298 ) -> fidl::Result<()> {
2299 decoder.debug_check_bounds::<Self>(offset);
2300 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2302 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2303 let mask = 0xffffffff00000000u64;
2304 let maskedval = padval & mask;
2305 if maskedval != 0 {
2306 return Err(fidl::Error::NonZeroPadding {
2307 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2308 });
2309 }
2310 fidl::decode!(
2311 fidl::encoding::Optional<fidl::encoding::BoundedString<36>>,
2312 fidl::encoding::DefaultFuchsiaResourceDialect,
2313 &mut self.attempt_id,
2314 decoder,
2315 offset + 0,
2316 _depth
2317 )?;
2318 fidl::decode!(
2319 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>>,
2320 fidl::encoding::DefaultFuchsiaResourceDialect,
2321 &mut self.monitor,
2322 decoder,
2323 offset + 16,
2324 _depth
2325 )?;
2326 Ok(())
2327 }
2328 }
2329
2330 impl fidl::encoding::ResourceTypeMarker for InstallerStartUpdateRequest {
2331 type Borrowed<'a> = &'a mut Self;
2332 fn take_or_borrow<'a>(
2333 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2334 ) -> Self::Borrowed<'a> {
2335 value
2336 }
2337 }
2338
2339 unsafe impl fidl::encoding::TypeMarker for InstallerStartUpdateRequest {
2340 type Owned = Self;
2341
2342 #[inline(always)]
2343 fn inline_align(_context: fidl::encoding::Context) -> usize {
2344 8
2345 }
2346
2347 #[inline(always)]
2348 fn inline_size(_context: fidl::encoding::Context) -> usize {
2349 40
2350 }
2351 }
2352
2353 unsafe impl
2354 fidl::encoding::Encode<
2355 InstallerStartUpdateRequest,
2356 fidl::encoding::DefaultFuchsiaResourceDialect,
2357 > for &mut InstallerStartUpdateRequest
2358 {
2359 #[inline]
2360 unsafe fn encode(
2361 self,
2362 encoder: &mut fidl::encoding::Encoder<
2363 '_,
2364 fidl::encoding::DefaultFuchsiaResourceDialect,
2365 >,
2366 offset: usize,
2367 _depth: fidl::encoding::Depth,
2368 ) -> fidl::Result<()> {
2369 encoder.debug_check_bounds::<InstallerStartUpdateRequest>(offset);
2370 fidl::encoding::Encode::<InstallerStartUpdateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2372 (
2373 <fidl_fuchsia_pkg::PackageUrl as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
2374 <Options as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
2375 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.monitor),
2376 <fidl::encoding::Optional<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RebootControllerMarker>>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reboot_controller),
2377 ),
2378 encoder, offset, _depth
2379 )
2380 }
2381 }
2382 unsafe impl<
2383 T0: fidl::encoding::Encode<
2384 fidl_fuchsia_pkg::PackageUrl,
2385 fidl::encoding::DefaultFuchsiaResourceDialect,
2386 >,
2387 T1: fidl::encoding::Encode<Options, fidl::encoding::DefaultFuchsiaResourceDialect>,
2388 T2: fidl::encoding::Encode<
2389 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>>,
2390 fidl::encoding::DefaultFuchsiaResourceDialect,
2391 >,
2392 T3: fidl::encoding::Encode<
2393 fidl::encoding::Optional<
2394 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RebootControllerMarker>>,
2395 >,
2396 fidl::encoding::DefaultFuchsiaResourceDialect,
2397 >,
2398 >
2399 fidl::encoding::Encode<
2400 InstallerStartUpdateRequest,
2401 fidl::encoding::DefaultFuchsiaResourceDialect,
2402 > for (T0, T1, T2, T3)
2403 {
2404 #[inline]
2405 unsafe fn encode(
2406 self,
2407 encoder: &mut fidl::encoding::Encoder<
2408 '_,
2409 fidl::encoding::DefaultFuchsiaResourceDialect,
2410 >,
2411 offset: usize,
2412 depth: fidl::encoding::Depth,
2413 ) -> fidl::Result<()> {
2414 encoder.debug_check_bounds::<InstallerStartUpdateRequest>(offset);
2415 self.0.encode(encoder, offset + 0, depth)?;
2419 self.1.encode(encoder, offset + 16, depth)?;
2420 self.2.encode(encoder, offset + 32, depth)?;
2421 self.3.encode(encoder, offset + 36, depth)?;
2422 Ok(())
2423 }
2424 }
2425
2426 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2427 for InstallerStartUpdateRequest
2428 {
2429 #[inline(always)]
2430 fn new_empty() -> Self {
2431 Self {
2432 url: fidl::new_empty!(
2433 fidl_fuchsia_pkg::PackageUrl,
2434 fidl::encoding::DefaultFuchsiaResourceDialect
2435 ),
2436 options: fidl::new_empty!(Options, fidl::encoding::DefaultFuchsiaResourceDialect),
2437 monitor: fidl::new_empty!(
2438 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>>,
2439 fidl::encoding::DefaultFuchsiaResourceDialect
2440 ),
2441 reboot_controller: fidl::new_empty!(
2442 fidl::encoding::Optional<
2443 fidl::encoding::Endpoint<
2444 fidl::endpoints::ServerEnd<RebootControllerMarker>,
2445 >,
2446 >,
2447 fidl::encoding::DefaultFuchsiaResourceDialect
2448 ),
2449 }
2450 }
2451
2452 #[inline]
2453 unsafe fn decode(
2454 &mut self,
2455 decoder: &mut fidl::encoding::Decoder<
2456 '_,
2457 fidl::encoding::DefaultFuchsiaResourceDialect,
2458 >,
2459 offset: usize,
2460 _depth: fidl::encoding::Depth,
2461 ) -> fidl::Result<()> {
2462 decoder.debug_check_bounds::<Self>(offset);
2463 fidl::decode!(
2465 fidl_fuchsia_pkg::PackageUrl,
2466 fidl::encoding::DefaultFuchsiaResourceDialect,
2467 &mut self.url,
2468 decoder,
2469 offset + 0,
2470 _depth
2471 )?;
2472 fidl::decode!(
2473 Options,
2474 fidl::encoding::DefaultFuchsiaResourceDialect,
2475 &mut self.options,
2476 decoder,
2477 offset + 16,
2478 _depth
2479 )?;
2480 fidl::decode!(
2481 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>>,
2482 fidl::encoding::DefaultFuchsiaResourceDialect,
2483 &mut self.monitor,
2484 decoder,
2485 offset + 32,
2486 _depth
2487 )?;
2488 fidl::decode!(
2489 fidl::encoding::Optional<
2490 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RebootControllerMarker>>,
2491 >,
2492 fidl::encoding::DefaultFuchsiaResourceDialect,
2493 &mut self.reboot_controller,
2494 decoder,
2495 offset + 36,
2496 _depth
2497 )?;
2498 Ok(())
2499 }
2500 }
2501}