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_hardware_power_statecontrol__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct AdminMexecRequest {
16 pub kernel_zbi: fidl::Vmo,
17 pub data_zbi: fidl::Vmo,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for AdminMexecRequest {}
21
22#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23pub struct RebootMethodsWatcherRegisterRegisterWatcherRequest {
24 pub watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
25}
26
27impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
28 for RebootMethodsWatcherRegisterRegisterWatcherRequest
29{
30}
31
32#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
33pub struct ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest {
34 pub watcher: fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>,
35}
36
37impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
38 for ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest
39{
40}
41
42#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
43pub struct ShutdownWatcherRegisterRegisterWatcherRequest {
44 pub watcher: fidl::endpoints::ClientEnd<ShutdownWatcherMarker>,
45}
46
47impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
48 for ShutdownWatcherRegisterRegisterWatcherRequest
49{
50}
51
52#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
53pub struct AdminMarker;
54
55impl fidl::endpoints::ProtocolMarker for AdminMarker {
56 type Proxy = AdminProxy;
57 type RequestStream = AdminRequestStream;
58 #[cfg(target_os = "fuchsia")]
59 type SynchronousProxy = AdminSynchronousProxy;
60
61 const DEBUG_NAME: &'static str = "fuchsia.hardware.power.statecontrol.Admin";
62}
63impl fidl::endpoints::DiscoverableProtocolMarker for AdminMarker {}
64pub type AdminPowerFullyOnResult = Result<(), i32>;
65pub type AdminShutdownResult = Result<(), i32>;
66pub type AdminPerformRebootResult = Result<(), i32>;
67pub type AdminRebootToBootloaderResult = Result<(), i32>;
68pub type AdminRebootToRecoveryResult = Result<(), i32>;
69pub type AdminPoweroffResult = Result<(), i32>;
70pub type AdminMexecResult = Result<(), i32>;
71pub type AdminSuspendToRamResult = Result<(), i32>;
72
73pub trait AdminProxyInterface: Send + Sync {
74 type PowerFullyOnResponseFut: std::future::Future<Output = Result<AdminPowerFullyOnResult, fidl::Error>>
75 + Send;
76 fn r#power_fully_on(&self) -> Self::PowerFullyOnResponseFut;
77 type ShutdownResponseFut: std::future::Future<Output = Result<AdminShutdownResult, fidl::Error>>
78 + Send;
79 fn r#shutdown(&self, options: &ShutdownOptions) -> Self::ShutdownResponseFut;
80 type PerformRebootResponseFut: std::future::Future<Output = Result<AdminPerformRebootResult, fidl::Error>>
81 + Send;
82 fn r#perform_reboot(&self, options: &RebootOptions) -> Self::PerformRebootResponseFut;
83 type RebootToBootloaderResponseFut: std::future::Future<Output = Result<AdminRebootToBootloaderResult, fidl::Error>>
84 + Send;
85 fn r#reboot_to_bootloader(&self) -> Self::RebootToBootloaderResponseFut;
86 type RebootToRecoveryResponseFut: std::future::Future<Output = Result<AdminRebootToRecoveryResult, fidl::Error>>
87 + Send;
88 fn r#reboot_to_recovery(&self) -> Self::RebootToRecoveryResponseFut;
89 type PoweroffResponseFut: std::future::Future<Output = Result<AdminPoweroffResult, fidl::Error>>
90 + Send;
91 fn r#poweroff(&self) -> Self::PoweroffResponseFut;
92 type MexecResponseFut: std::future::Future<Output = Result<AdminMexecResult, fidl::Error>>
93 + Send;
94 fn r#mexec(&self, kernel_zbi: fidl::Vmo, data_zbi: fidl::Vmo) -> Self::MexecResponseFut;
95 type SuspendToRamResponseFut: std::future::Future<Output = Result<AdminSuspendToRamResult, fidl::Error>>
96 + Send;
97 fn r#suspend_to_ram(&self) -> Self::SuspendToRamResponseFut;
98}
99#[derive(Debug)]
100#[cfg(target_os = "fuchsia")]
101pub struct AdminSynchronousProxy {
102 client: fidl::client::sync::Client,
103}
104
105#[cfg(target_os = "fuchsia")]
106impl fidl::endpoints::SynchronousProxy for AdminSynchronousProxy {
107 type Proxy = AdminProxy;
108 type Protocol = AdminMarker;
109
110 fn from_channel(inner: fidl::Channel) -> Self {
111 Self::new(inner)
112 }
113
114 fn into_channel(self) -> fidl::Channel {
115 self.client.into_channel()
116 }
117
118 fn as_channel(&self) -> &fidl::Channel {
119 self.client.as_channel()
120 }
121}
122
123#[cfg(target_os = "fuchsia")]
124impl AdminSynchronousProxy {
125 pub fn new(channel: fidl::Channel) -> Self {
126 let protocol_name = <AdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
127 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
128 }
129
130 pub fn into_channel(self) -> fidl::Channel {
131 self.client.into_channel()
132 }
133
134 pub fn wait_for_event(
137 &self,
138 deadline: zx::MonotonicInstant,
139 ) -> Result<AdminEvent, fidl::Error> {
140 AdminEvent::decode(self.client.wait_for_event(deadline)?)
141 }
142
143 pub fn r#power_fully_on(
145 &self,
146 ___deadline: zx::MonotonicInstant,
147 ) -> Result<AdminPowerFullyOnResult, fidl::Error> {
148 let _response = self.client.send_query::<
149 fidl::encoding::EmptyPayload,
150 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
151 >(
152 (),
153 0xb3272d15e00712f,
154 fidl::encoding::DynamicFlags::empty(),
155 ___deadline,
156 )?;
157 Ok(_response.map(|x| x))
158 }
159
160 pub fn r#shutdown(
168 &self,
169 mut options: &ShutdownOptions,
170 ___deadline: zx::MonotonicInstant,
171 ) -> Result<AdminShutdownResult, fidl::Error> {
172 let _response = self.client.send_query::<
173 AdminShutdownRequest,
174 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
175 >(
176 (options,),
177 0x3722c53e45dc022f,
178 fidl::encoding::DynamicFlags::empty(),
179 ___deadline,
180 )?;
181 Ok(_response.map(|x| x))
182 }
183
184 pub fn r#perform_reboot(
196 &self,
197 mut options: &RebootOptions,
198 ___deadline: zx::MonotonicInstant,
199 ) -> Result<AdminPerformRebootResult, fidl::Error> {
200 let _response = self.client.send_query::<
201 AdminPerformRebootRequest,
202 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
203 >(
204 (options,),
205 0x9416b4d36a80b4,
206 fidl::encoding::DynamicFlags::empty(),
207 ___deadline,
208 )?;
209 Ok(_response.map(|x| x))
210 }
211
212 pub fn r#reboot_to_bootloader(
219 &self,
220 ___deadline: zx::MonotonicInstant,
221 ) -> Result<AdminRebootToBootloaderResult, fidl::Error> {
222 let _response = self.client.send_query::<
223 fidl::encoding::EmptyPayload,
224 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
225 >(
226 (),
227 0x6dce331b33786aa,
228 fidl::encoding::DynamicFlags::empty(),
229 ___deadline,
230 )?;
231 Ok(_response.map(|x| x))
232 }
233
234 pub fn r#reboot_to_recovery(
241 &self,
242 ___deadline: zx::MonotonicInstant,
243 ) -> Result<AdminRebootToRecoveryResult, fidl::Error> {
244 let _response = self.client.send_query::<
245 fidl::encoding::EmptyPayload,
246 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
247 >(
248 (),
249 0x1575c566be54f505,
250 fidl::encoding::DynamicFlags::empty(),
251 ___deadline,
252 )?;
253 Ok(_response.map(|x| x))
254 }
255
256 pub fn r#poweroff(
262 &self,
263 ___deadline: zx::MonotonicInstant,
264 ) -> Result<AdminPoweroffResult, fidl::Error> {
265 let _response = self.client.send_query::<
266 fidl::encoding::EmptyPayload,
267 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
268 >(
269 (),
270 0x24101c5d0b439748,
271 fidl::encoding::DynamicFlags::empty(),
272 ___deadline,
273 )?;
274 Ok(_response.map(|x| x))
275 }
276
277 pub fn r#mexec(
283 &self,
284 mut kernel_zbi: fidl::Vmo,
285 mut data_zbi: fidl::Vmo,
286 ___deadline: zx::MonotonicInstant,
287 ) -> Result<AdminMexecResult, fidl::Error> {
288 let _response = self.client.send_query::<
289 AdminMexecRequest,
290 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
291 >(
292 (kernel_zbi, data_zbi,),
293 0x1f91e77ec781a4c6,
294 fidl::encoding::DynamicFlags::empty(),
295 ___deadline,
296 )?;
297 Ok(_response.map(|x| x))
298 }
299
300 pub fn r#suspend_to_ram(
305 &self,
306 ___deadline: zx::MonotonicInstant,
307 ) -> Result<AdminSuspendToRamResult, fidl::Error> {
308 let _response = self.client.send_query::<
309 fidl::encoding::EmptyPayload,
310 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
311 >(
312 (),
313 0x3b0e356782e7620e,
314 fidl::encoding::DynamicFlags::empty(),
315 ___deadline,
316 )?;
317 Ok(_response.map(|x| x))
318 }
319}
320
321#[cfg(target_os = "fuchsia")]
322impl From<AdminSynchronousProxy> for zx::NullableHandle {
323 fn from(value: AdminSynchronousProxy) -> Self {
324 value.into_channel().into()
325 }
326}
327
328#[cfg(target_os = "fuchsia")]
329impl From<fidl::Channel> for AdminSynchronousProxy {
330 fn from(value: fidl::Channel) -> Self {
331 Self::new(value)
332 }
333}
334
335#[cfg(target_os = "fuchsia")]
336impl fidl::endpoints::FromClient for AdminSynchronousProxy {
337 type Protocol = AdminMarker;
338
339 fn from_client(value: fidl::endpoints::ClientEnd<AdminMarker>) -> Self {
340 Self::new(value.into_channel())
341 }
342}
343
344#[derive(Debug, Clone)]
345pub struct AdminProxy {
346 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
347}
348
349impl fidl::endpoints::Proxy for AdminProxy {
350 type Protocol = AdminMarker;
351
352 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
353 Self::new(inner)
354 }
355
356 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
357 self.client.into_channel().map_err(|client| Self { client })
358 }
359
360 fn as_channel(&self) -> &::fidl::AsyncChannel {
361 self.client.as_channel()
362 }
363}
364
365impl AdminProxy {
366 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
368 let protocol_name = <AdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
369 Self { client: fidl::client::Client::new(channel, protocol_name) }
370 }
371
372 pub fn take_event_stream(&self) -> AdminEventStream {
378 AdminEventStream { event_receiver: self.client.take_event_receiver() }
379 }
380
381 pub fn r#power_fully_on(
383 &self,
384 ) -> fidl::client::QueryResponseFut<
385 AdminPowerFullyOnResult,
386 fidl::encoding::DefaultFuchsiaResourceDialect,
387 > {
388 AdminProxyInterface::r#power_fully_on(self)
389 }
390
391 pub fn r#shutdown(
399 &self,
400 mut options: &ShutdownOptions,
401 ) -> fidl::client::QueryResponseFut<
402 AdminShutdownResult,
403 fidl::encoding::DefaultFuchsiaResourceDialect,
404 > {
405 AdminProxyInterface::r#shutdown(self, options)
406 }
407
408 pub fn r#perform_reboot(
420 &self,
421 mut options: &RebootOptions,
422 ) -> fidl::client::QueryResponseFut<
423 AdminPerformRebootResult,
424 fidl::encoding::DefaultFuchsiaResourceDialect,
425 > {
426 AdminProxyInterface::r#perform_reboot(self, options)
427 }
428
429 pub fn r#reboot_to_bootloader(
436 &self,
437 ) -> fidl::client::QueryResponseFut<
438 AdminRebootToBootloaderResult,
439 fidl::encoding::DefaultFuchsiaResourceDialect,
440 > {
441 AdminProxyInterface::r#reboot_to_bootloader(self)
442 }
443
444 pub fn r#reboot_to_recovery(
451 &self,
452 ) -> fidl::client::QueryResponseFut<
453 AdminRebootToRecoveryResult,
454 fidl::encoding::DefaultFuchsiaResourceDialect,
455 > {
456 AdminProxyInterface::r#reboot_to_recovery(self)
457 }
458
459 pub fn r#poweroff(
465 &self,
466 ) -> fidl::client::QueryResponseFut<
467 AdminPoweroffResult,
468 fidl::encoding::DefaultFuchsiaResourceDialect,
469 > {
470 AdminProxyInterface::r#poweroff(self)
471 }
472
473 pub fn r#mexec(
479 &self,
480 mut kernel_zbi: fidl::Vmo,
481 mut data_zbi: fidl::Vmo,
482 ) -> fidl::client::QueryResponseFut<
483 AdminMexecResult,
484 fidl::encoding::DefaultFuchsiaResourceDialect,
485 > {
486 AdminProxyInterface::r#mexec(self, kernel_zbi, data_zbi)
487 }
488
489 pub fn r#suspend_to_ram(
494 &self,
495 ) -> fidl::client::QueryResponseFut<
496 AdminSuspendToRamResult,
497 fidl::encoding::DefaultFuchsiaResourceDialect,
498 > {
499 AdminProxyInterface::r#suspend_to_ram(self)
500 }
501}
502
503impl AdminProxyInterface for AdminProxy {
504 type PowerFullyOnResponseFut = fidl::client::QueryResponseFut<
505 AdminPowerFullyOnResult,
506 fidl::encoding::DefaultFuchsiaResourceDialect,
507 >;
508 fn r#power_fully_on(&self) -> Self::PowerFullyOnResponseFut {
509 fn _decode(
510 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
511 ) -> Result<AdminPowerFullyOnResult, fidl::Error> {
512 let _response = fidl::client::decode_transaction_body::<
513 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
514 fidl::encoding::DefaultFuchsiaResourceDialect,
515 0xb3272d15e00712f,
516 >(_buf?)?;
517 Ok(_response.map(|x| x))
518 }
519 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AdminPowerFullyOnResult>(
520 (),
521 0xb3272d15e00712f,
522 fidl::encoding::DynamicFlags::empty(),
523 _decode,
524 )
525 }
526
527 type ShutdownResponseFut = fidl::client::QueryResponseFut<
528 AdminShutdownResult,
529 fidl::encoding::DefaultFuchsiaResourceDialect,
530 >;
531 fn r#shutdown(&self, mut options: &ShutdownOptions) -> Self::ShutdownResponseFut {
532 fn _decode(
533 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
534 ) -> Result<AdminShutdownResult, fidl::Error> {
535 let _response = fidl::client::decode_transaction_body::<
536 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
537 fidl::encoding::DefaultFuchsiaResourceDialect,
538 0x3722c53e45dc022f,
539 >(_buf?)?;
540 Ok(_response.map(|x| x))
541 }
542 self.client.send_query_and_decode::<AdminShutdownRequest, AdminShutdownResult>(
543 (options,),
544 0x3722c53e45dc022f,
545 fidl::encoding::DynamicFlags::empty(),
546 _decode,
547 )
548 }
549
550 type PerformRebootResponseFut = fidl::client::QueryResponseFut<
551 AdminPerformRebootResult,
552 fidl::encoding::DefaultFuchsiaResourceDialect,
553 >;
554 fn r#perform_reboot(&self, mut options: &RebootOptions) -> Self::PerformRebootResponseFut {
555 fn _decode(
556 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
557 ) -> Result<AdminPerformRebootResult, fidl::Error> {
558 let _response = fidl::client::decode_transaction_body::<
559 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
560 fidl::encoding::DefaultFuchsiaResourceDialect,
561 0x9416b4d36a80b4,
562 >(_buf?)?;
563 Ok(_response.map(|x| x))
564 }
565 self.client.send_query_and_decode::<AdminPerformRebootRequest, AdminPerformRebootResult>(
566 (options,),
567 0x9416b4d36a80b4,
568 fidl::encoding::DynamicFlags::empty(),
569 _decode,
570 )
571 }
572
573 type RebootToBootloaderResponseFut = fidl::client::QueryResponseFut<
574 AdminRebootToBootloaderResult,
575 fidl::encoding::DefaultFuchsiaResourceDialect,
576 >;
577 fn r#reboot_to_bootloader(&self) -> Self::RebootToBootloaderResponseFut {
578 fn _decode(
579 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
580 ) -> Result<AdminRebootToBootloaderResult, fidl::Error> {
581 let _response = fidl::client::decode_transaction_body::<
582 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
583 fidl::encoding::DefaultFuchsiaResourceDialect,
584 0x6dce331b33786aa,
585 >(_buf?)?;
586 Ok(_response.map(|x| x))
587 }
588 self.client
589 .send_query_and_decode::<fidl::encoding::EmptyPayload, AdminRebootToBootloaderResult>(
590 (),
591 0x6dce331b33786aa,
592 fidl::encoding::DynamicFlags::empty(),
593 _decode,
594 )
595 }
596
597 type RebootToRecoveryResponseFut = fidl::client::QueryResponseFut<
598 AdminRebootToRecoveryResult,
599 fidl::encoding::DefaultFuchsiaResourceDialect,
600 >;
601 fn r#reboot_to_recovery(&self) -> Self::RebootToRecoveryResponseFut {
602 fn _decode(
603 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
604 ) -> Result<AdminRebootToRecoveryResult, fidl::Error> {
605 let _response = fidl::client::decode_transaction_body::<
606 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
607 fidl::encoding::DefaultFuchsiaResourceDialect,
608 0x1575c566be54f505,
609 >(_buf?)?;
610 Ok(_response.map(|x| x))
611 }
612 self.client
613 .send_query_and_decode::<fidl::encoding::EmptyPayload, AdminRebootToRecoveryResult>(
614 (),
615 0x1575c566be54f505,
616 fidl::encoding::DynamicFlags::empty(),
617 _decode,
618 )
619 }
620
621 type PoweroffResponseFut = fidl::client::QueryResponseFut<
622 AdminPoweroffResult,
623 fidl::encoding::DefaultFuchsiaResourceDialect,
624 >;
625 fn r#poweroff(&self) -> Self::PoweroffResponseFut {
626 fn _decode(
627 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
628 ) -> Result<AdminPoweroffResult, fidl::Error> {
629 let _response = fidl::client::decode_transaction_body::<
630 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
631 fidl::encoding::DefaultFuchsiaResourceDialect,
632 0x24101c5d0b439748,
633 >(_buf?)?;
634 Ok(_response.map(|x| x))
635 }
636 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AdminPoweroffResult>(
637 (),
638 0x24101c5d0b439748,
639 fidl::encoding::DynamicFlags::empty(),
640 _decode,
641 )
642 }
643
644 type MexecResponseFut = fidl::client::QueryResponseFut<
645 AdminMexecResult,
646 fidl::encoding::DefaultFuchsiaResourceDialect,
647 >;
648 fn r#mexec(
649 &self,
650 mut kernel_zbi: fidl::Vmo,
651 mut data_zbi: fidl::Vmo,
652 ) -> Self::MexecResponseFut {
653 fn _decode(
654 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
655 ) -> Result<AdminMexecResult, fidl::Error> {
656 let _response = fidl::client::decode_transaction_body::<
657 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
658 fidl::encoding::DefaultFuchsiaResourceDialect,
659 0x1f91e77ec781a4c6,
660 >(_buf?)?;
661 Ok(_response.map(|x| x))
662 }
663 self.client.send_query_and_decode::<AdminMexecRequest, AdminMexecResult>(
664 (kernel_zbi, data_zbi),
665 0x1f91e77ec781a4c6,
666 fidl::encoding::DynamicFlags::empty(),
667 _decode,
668 )
669 }
670
671 type SuspendToRamResponseFut = fidl::client::QueryResponseFut<
672 AdminSuspendToRamResult,
673 fidl::encoding::DefaultFuchsiaResourceDialect,
674 >;
675 fn r#suspend_to_ram(&self) -> Self::SuspendToRamResponseFut {
676 fn _decode(
677 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
678 ) -> Result<AdminSuspendToRamResult, fidl::Error> {
679 let _response = fidl::client::decode_transaction_body::<
680 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
681 fidl::encoding::DefaultFuchsiaResourceDialect,
682 0x3b0e356782e7620e,
683 >(_buf?)?;
684 Ok(_response.map(|x| x))
685 }
686 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AdminSuspendToRamResult>(
687 (),
688 0x3b0e356782e7620e,
689 fidl::encoding::DynamicFlags::empty(),
690 _decode,
691 )
692 }
693}
694
695pub struct AdminEventStream {
696 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
697}
698
699impl std::marker::Unpin for AdminEventStream {}
700
701impl futures::stream::FusedStream for AdminEventStream {
702 fn is_terminated(&self) -> bool {
703 self.event_receiver.is_terminated()
704 }
705}
706
707impl futures::Stream for AdminEventStream {
708 type Item = Result<AdminEvent, fidl::Error>;
709
710 fn poll_next(
711 mut self: std::pin::Pin<&mut Self>,
712 cx: &mut std::task::Context<'_>,
713 ) -> std::task::Poll<Option<Self::Item>> {
714 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
715 &mut self.event_receiver,
716 cx
717 )?) {
718 Some(buf) => std::task::Poll::Ready(Some(AdminEvent::decode(buf))),
719 None => std::task::Poll::Ready(None),
720 }
721 }
722}
723
724#[derive(Debug)]
725pub enum AdminEvent {}
726
727impl AdminEvent {
728 fn decode(
730 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
731 ) -> Result<AdminEvent, fidl::Error> {
732 let (bytes, _handles) = buf.split_mut();
733 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
734 debug_assert_eq!(tx_header.tx_id, 0);
735 match tx_header.ordinal {
736 _ => Err(fidl::Error::UnknownOrdinal {
737 ordinal: tx_header.ordinal,
738 protocol_name: <AdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
739 }),
740 }
741 }
742}
743
744pub struct AdminRequestStream {
746 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
747 is_terminated: bool,
748}
749
750impl std::marker::Unpin for AdminRequestStream {}
751
752impl futures::stream::FusedStream for AdminRequestStream {
753 fn is_terminated(&self) -> bool {
754 self.is_terminated
755 }
756}
757
758impl fidl::endpoints::RequestStream for AdminRequestStream {
759 type Protocol = AdminMarker;
760 type ControlHandle = AdminControlHandle;
761
762 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
763 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
764 }
765
766 fn control_handle(&self) -> Self::ControlHandle {
767 AdminControlHandle { inner: self.inner.clone() }
768 }
769
770 fn into_inner(
771 self,
772 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
773 {
774 (self.inner, self.is_terminated)
775 }
776
777 fn from_inner(
778 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
779 is_terminated: bool,
780 ) -> Self {
781 Self { inner, is_terminated }
782 }
783}
784
785impl futures::Stream for AdminRequestStream {
786 type Item = Result<AdminRequest, fidl::Error>;
787
788 fn poll_next(
789 mut self: std::pin::Pin<&mut Self>,
790 cx: &mut std::task::Context<'_>,
791 ) -> std::task::Poll<Option<Self::Item>> {
792 let this = &mut *self;
793 if this.inner.check_shutdown(cx) {
794 this.is_terminated = true;
795 return std::task::Poll::Ready(None);
796 }
797 if this.is_terminated {
798 panic!("polled AdminRequestStream after completion");
799 }
800 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
801 |bytes, handles| {
802 match this.inner.channel().read_etc(cx, bytes, handles) {
803 std::task::Poll::Ready(Ok(())) => {}
804 std::task::Poll::Pending => return std::task::Poll::Pending,
805 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
806 this.is_terminated = true;
807 return std::task::Poll::Ready(None);
808 }
809 std::task::Poll::Ready(Err(e)) => {
810 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
811 e.into(),
812 ))));
813 }
814 }
815
816 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
818
819 std::task::Poll::Ready(Some(match header.ordinal {
820 0xb3272d15e00712f => {
821 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
822 let mut req = fidl::new_empty!(
823 fidl::encoding::EmptyPayload,
824 fidl::encoding::DefaultFuchsiaResourceDialect
825 );
826 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
827 let control_handle = AdminControlHandle { inner: this.inner.clone() };
828 Ok(AdminRequest::PowerFullyOn {
829 responder: AdminPowerFullyOnResponder {
830 control_handle: std::mem::ManuallyDrop::new(control_handle),
831 tx_id: header.tx_id,
832 },
833 })
834 }
835 0x3722c53e45dc022f => {
836 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
837 let mut req = fidl::new_empty!(
838 AdminShutdownRequest,
839 fidl::encoding::DefaultFuchsiaResourceDialect
840 );
841 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdminShutdownRequest>(&header, _body_bytes, handles, &mut req)?;
842 let control_handle = AdminControlHandle { inner: this.inner.clone() };
843 Ok(AdminRequest::Shutdown {
844 options: req.options,
845
846 responder: AdminShutdownResponder {
847 control_handle: std::mem::ManuallyDrop::new(control_handle),
848 tx_id: header.tx_id,
849 },
850 })
851 }
852 0x9416b4d36a80b4 => {
853 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
854 let mut req = fidl::new_empty!(
855 AdminPerformRebootRequest,
856 fidl::encoding::DefaultFuchsiaResourceDialect
857 );
858 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdminPerformRebootRequest>(&header, _body_bytes, handles, &mut req)?;
859 let control_handle = AdminControlHandle { inner: this.inner.clone() };
860 Ok(AdminRequest::PerformReboot {
861 options: req.options,
862
863 responder: AdminPerformRebootResponder {
864 control_handle: std::mem::ManuallyDrop::new(control_handle),
865 tx_id: header.tx_id,
866 },
867 })
868 }
869 0x6dce331b33786aa => {
870 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
871 let mut req = fidl::new_empty!(
872 fidl::encoding::EmptyPayload,
873 fidl::encoding::DefaultFuchsiaResourceDialect
874 );
875 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
876 let control_handle = AdminControlHandle { inner: this.inner.clone() };
877 Ok(AdminRequest::RebootToBootloader {
878 responder: AdminRebootToBootloaderResponder {
879 control_handle: std::mem::ManuallyDrop::new(control_handle),
880 tx_id: header.tx_id,
881 },
882 })
883 }
884 0x1575c566be54f505 => {
885 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
886 let mut req = fidl::new_empty!(
887 fidl::encoding::EmptyPayload,
888 fidl::encoding::DefaultFuchsiaResourceDialect
889 );
890 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
891 let control_handle = AdminControlHandle { inner: this.inner.clone() };
892 Ok(AdminRequest::RebootToRecovery {
893 responder: AdminRebootToRecoveryResponder {
894 control_handle: std::mem::ManuallyDrop::new(control_handle),
895 tx_id: header.tx_id,
896 },
897 })
898 }
899 0x24101c5d0b439748 => {
900 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
901 let mut req = fidl::new_empty!(
902 fidl::encoding::EmptyPayload,
903 fidl::encoding::DefaultFuchsiaResourceDialect
904 );
905 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
906 let control_handle = AdminControlHandle { inner: this.inner.clone() };
907 Ok(AdminRequest::Poweroff {
908 responder: AdminPoweroffResponder {
909 control_handle: std::mem::ManuallyDrop::new(control_handle),
910 tx_id: header.tx_id,
911 },
912 })
913 }
914 0x1f91e77ec781a4c6 => {
915 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
916 let mut req = fidl::new_empty!(
917 AdminMexecRequest,
918 fidl::encoding::DefaultFuchsiaResourceDialect
919 );
920 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdminMexecRequest>(&header, _body_bytes, handles, &mut req)?;
921 let control_handle = AdminControlHandle { inner: this.inner.clone() };
922 Ok(AdminRequest::Mexec {
923 kernel_zbi: req.kernel_zbi,
924 data_zbi: req.data_zbi,
925
926 responder: AdminMexecResponder {
927 control_handle: std::mem::ManuallyDrop::new(control_handle),
928 tx_id: header.tx_id,
929 },
930 })
931 }
932 0x3b0e356782e7620e => {
933 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
934 let mut req = fidl::new_empty!(
935 fidl::encoding::EmptyPayload,
936 fidl::encoding::DefaultFuchsiaResourceDialect
937 );
938 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
939 let control_handle = AdminControlHandle { inner: this.inner.clone() };
940 Ok(AdminRequest::SuspendToRam {
941 responder: AdminSuspendToRamResponder {
942 control_handle: std::mem::ManuallyDrop::new(control_handle),
943 tx_id: header.tx_id,
944 },
945 })
946 }
947 _ => Err(fidl::Error::UnknownOrdinal {
948 ordinal: header.ordinal,
949 protocol_name: <AdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
950 }),
951 }))
952 },
953 )
954 }
955}
956
957#[derive(Debug)]
972pub enum AdminRequest {
973 PowerFullyOn { responder: AdminPowerFullyOnResponder },
975 Shutdown { options: ShutdownOptions, responder: AdminShutdownResponder },
983 PerformReboot { options: RebootOptions, responder: AdminPerformRebootResponder },
995 RebootToBootloader { responder: AdminRebootToBootloaderResponder },
1002 RebootToRecovery { responder: AdminRebootToRecoveryResponder },
1009 Poweroff { responder: AdminPoweroffResponder },
1015 Mexec { kernel_zbi: fidl::Vmo, data_zbi: fidl::Vmo, responder: AdminMexecResponder },
1021 SuspendToRam { responder: AdminSuspendToRamResponder },
1026}
1027
1028impl AdminRequest {
1029 #[allow(irrefutable_let_patterns)]
1030 pub fn into_power_fully_on(self) -> Option<(AdminPowerFullyOnResponder)> {
1031 if let AdminRequest::PowerFullyOn { responder } = self { Some((responder)) } else { None }
1032 }
1033
1034 #[allow(irrefutable_let_patterns)]
1035 pub fn into_shutdown(self) -> Option<(ShutdownOptions, AdminShutdownResponder)> {
1036 if let AdminRequest::Shutdown { options, responder } = self {
1037 Some((options, responder))
1038 } else {
1039 None
1040 }
1041 }
1042
1043 #[allow(irrefutable_let_patterns)]
1044 pub fn into_perform_reboot(self) -> Option<(RebootOptions, AdminPerformRebootResponder)> {
1045 if let AdminRequest::PerformReboot { options, responder } = self {
1046 Some((options, responder))
1047 } else {
1048 None
1049 }
1050 }
1051
1052 #[allow(irrefutable_let_patterns)]
1053 pub fn into_reboot_to_bootloader(self) -> Option<(AdminRebootToBootloaderResponder)> {
1054 if let AdminRequest::RebootToBootloader { responder } = self {
1055 Some((responder))
1056 } else {
1057 None
1058 }
1059 }
1060
1061 #[allow(irrefutable_let_patterns)]
1062 pub fn into_reboot_to_recovery(self) -> Option<(AdminRebootToRecoveryResponder)> {
1063 if let AdminRequest::RebootToRecovery { responder } = self {
1064 Some((responder))
1065 } else {
1066 None
1067 }
1068 }
1069
1070 #[allow(irrefutable_let_patterns)]
1071 pub fn into_poweroff(self) -> Option<(AdminPoweroffResponder)> {
1072 if let AdminRequest::Poweroff { responder } = self { Some((responder)) } else { None }
1073 }
1074
1075 #[allow(irrefutable_let_patterns)]
1076 pub fn into_mexec(self) -> Option<(fidl::Vmo, fidl::Vmo, AdminMexecResponder)> {
1077 if let AdminRequest::Mexec { kernel_zbi, data_zbi, responder } = self {
1078 Some((kernel_zbi, data_zbi, responder))
1079 } else {
1080 None
1081 }
1082 }
1083
1084 #[allow(irrefutable_let_patterns)]
1085 pub fn into_suspend_to_ram(self) -> Option<(AdminSuspendToRamResponder)> {
1086 if let AdminRequest::SuspendToRam { responder } = self { Some((responder)) } else { None }
1087 }
1088
1089 pub fn method_name(&self) -> &'static str {
1091 match *self {
1092 AdminRequest::PowerFullyOn { .. } => "power_fully_on",
1093 AdminRequest::Shutdown { .. } => "shutdown",
1094 AdminRequest::PerformReboot { .. } => "perform_reboot",
1095 AdminRequest::RebootToBootloader { .. } => "reboot_to_bootloader",
1096 AdminRequest::RebootToRecovery { .. } => "reboot_to_recovery",
1097 AdminRequest::Poweroff { .. } => "poweroff",
1098 AdminRequest::Mexec { .. } => "mexec",
1099 AdminRequest::SuspendToRam { .. } => "suspend_to_ram",
1100 }
1101 }
1102}
1103
1104#[derive(Debug, Clone)]
1105pub struct AdminControlHandle {
1106 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1107}
1108
1109impl fidl::endpoints::ControlHandle for AdminControlHandle {
1110 fn shutdown(&self) {
1111 self.inner.shutdown()
1112 }
1113
1114 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1115 self.inner.shutdown_with_epitaph(status)
1116 }
1117
1118 fn is_closed(&self) -> bool {
1119 self.inner.channel().is_closed()
1120 }
1121 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1122 self.inner.channel().on_closed()
1123 }
1124
1125 #[cfg(target_os = "fuchsia")]
1126 fn signal_peer(
1127 &self,
1128 clear_mask: zx::Signals,
1129 set_mask: zx::Signals,
1130 ) -> Result<(), zx_status::Status> {
1131 use fidl::Peered;
1132 self.inner.channel().signal_peer(clear_mask, set_mask)
1133 }
1134}
1135
1136impl AdminControlHandle {}
1137
1138#[must_use = "FIDL methods require a response to be sent"]
1139#[derive(Debug)]
1140pub struct AdminPowerFullyOnResponder {
1141 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1142 tx_id: u32,
1143}
1144
1145impl std::ops::Drop for AdminPowerFullyOnResponder {
1149 fn drop(&mut self) {
1150 self.control_handle.shutdown();
1151 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1153 }
1154}
1155
1156impl fidl::endpoints::Responder for AdminPowerFullyOnResponder {
1157 type ControlHandle = AdminControlHandle;
1158
1159 fn control_handle(&self) -> &AdminControlHandle {
1160 &self.control_handle
1161 }
1162
1163 fn drop_without_shutdown(mut self) {
1164 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1166 std::mem::forget(self);
1168 }
1169}
1170
1171impl AdminPowerFullyOnResponder {
1172 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1176 let _result = self.send_raw(result);
1177 if _result.is_err() {
1178 self.control_handle.shutdown();
1179 }
1180 self.drop_without_shutdown();
1181 _result
1182 }
1183
1184 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1186 let _result = self.send_raw(result);
1187 self.drop_without_shutdown();
1188 _result
1189 }
1190
1191 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1192 self.control_handle
1193 .inner
1194 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1195 result,
1196 self.tx_id,
1197 0xb3272d15e00712f,
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 AdminShutdownResponder {
1206 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1207 tx_id: u32,
1208}
1209
1210impl std::ops::Drop for AdminShutdownResponder {
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 AdminShutdownResponder {
1222 type ControlHandle = AdminControlHandle;
1223
1224 fn control_handle(&self) -> &AdminControlHandle {
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 AdminShutdownResponder {
1237 pub fn send(self, mut result: Result<(), i32>) -> 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(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1251 let _result = self.send_raw(result);
1252 self.drop_without_shutdown();
1253 _result
1254 }
1255
1256 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1257 self.control_handle
1258 .inner
1259 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1260 result,
1261 self.tx_id,
1262 0x3722c53e45dc022f,
1263 fidl::encoding::DynamicFlags::empty(),
1264 )
1265 }
1266}
1267
1268#[must_use = "FIDL methods require a response to be sent"]
1269#[derive(Debug)]
1270pub struct AdminPerformRebootResponder {
1271 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1272 tx_id: u32,
1273}
1274
1275impl std::ops::Drop for AdminPerformRebootResponder {
1279 fn drop(&mut self) {
1280 self.control_handle.shutdown();
1281 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1283 }
1284}
1285
1286impl fidl::endpoints::Responder for AdminPerformRebootResponder {
1287 type ControlHandle = AdminControlHandle;
1288
1289 fn control_handle(&self) -> &AdminControlHandle {
1290 &self.control_handle
1291 }
1292
1293 fn drop_without_shutdown(mut self) {
1294 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1296 std::mem::forget(self);
1298 }
1299}
1300
1301impl AdminPerformRebootResponder {
1302 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1306 let _result = self.send_raw(result);
1307 if _result.is_err() {
1308 self.control_handle.shutdown();
1309 }
1310 self.drop_without_shutdown();
1311 _result
1312 }
1313
1314 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1316 let _result = self.send_raw(result);
1317 self.drop_without_shutdown();
1318 _result
1319 }
1320
1321 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1322 self.control_handle
1323 .inner
1324 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1325 result,
1326 self.tx_id,
1327 0x9416b4d36a80b4,
1328 fidl::encoding::DynamicFlags::empty(),
1329 )
1330 }
1331}
1332
1333#[must_use = "FIDL methods require a response to be sent"]
1334#[derive(Debug)]
1335pub struct AdminRebootToBootloaderResponder {
1336 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1337 tx_id: u32,
1338}
1339
1340impl std::ops::Drop for AdminRebootToBootloaderResponder {
1344 fn drop(&mut self) {
1345 self.control_handle.shutdown();
1346 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1348 }
1349}
1350
1351impl fidl::endpoints::Responder for AdminRebootToBootloaderResponder {
1352 type ControlHandle = AdminControlHandle;
1353
1354 fn control_handle(&self) -> &AdminControlHandle {
1355 &self.control_handle
1356 }
1357
1358 fn drop_without_shutdown(mut self) {
1359 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1361 std::mem::forget(self);
1363 }
1364}
1365
1366impl AdminRebootToBootloaderResponder {
1367 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1371 let _result = self.send_raw(result);
1372 if _result.is_err() {
1373 self.control_handle.shutdown();
1374 }
1375 self.drop_without_shutdown();
1376 _result
1377 }
1378
1379 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1381 let _result = self.send_raw(result);
1382 self.drop_without_shutdown();
1383 _result
1384 }
1385
1386 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1387 self.control_handle
1388 .inner
1389 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1390 result,
1391 self.tx_id,
1392 0x6dce331b33786aa,
1393 fidl::encoding::DynamicFlags::empty(),
1394 )
1395 }
1396}
1397
1398#[must_use = "FIDL methods require a response to be sent"]
1399#[derive(Debug)]
1400pub struct AdminRebootToRecoveryResponder {
1401 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1402 tx_id: u32,
1403}
1404
1405impl std::ops::Drop for AdminRebootToRecoveryResponder {
1409 fn drop(&mut self) {
1410 self.control_handle.shutdown();
1411 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1413 }
1414}
1415
1416impl fidl::endpoints::Responder for AdminRebootToRecoveryResponder {
1417 type ControlHandle = AdminControlHandle;
1418
1419 fn control_handle(&self) -> &AdminControlHandle {
1420 &self.control_handle
1421 }
1422
1423 fn drop_without_shutdown(mut self) {
1424 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1426 std::mem::forget(self);
1428 }
1429}
1430
1431impl AdminRebootToRecoveryResponder {
1432 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1436 let _result = self.send_raw(result);
1437 if _result.is_err() {
1438 self.control_handle.shutdown();
1439 }
1440 self.drop_without_shutdown();
1441 _result
1442 }
1443
1444 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1446 let _result = self.send_raw(result);
1447 self.drop_without_shutdown();
1448 _result
1449 }
1450
1451 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1452 self.control_handle
1453 .inner
1454 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1455 result,
1456 self.tx_id,
1457 0x1575c566be54f505,
1458 fidl::encoding::DynamicFlags::empty(),
1459 )
1460 }
1461}
1462
1463#[must_use = "FIDL methods require a response to be sent"]
1464#[derive(Debug)]
1465pub struct AdminPoweroffResponder {
1466 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1467 tx_id: u32,
1468}
1469
1470impl std::ops::Drop for AdminPoweroffResponder {
1474 fn drop(&mut self) {
1475 self.control_handle.shutdown();
1476 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1478 }
1479}
1480
1481impl fidl::endpoints::Responder for AdminPoweroffResponder {
1482 type ControlHandle = AdminControlHandle;
1483
1484 fn control_handle(&self) -> &AdminControlHandle {
1485 &self.control_handle
1486 }
1487
1488 fn drop_without_shutdown(mut self) {
1489 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1491 std::mem::forget(self);
1493 }
1494}
1495
1496impl AdminPoweroffResponder {
1497 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1501 let _result = self.send_raw(result);
1502 if _result.is_err() {
1503 self.control_handle.shutdown();
1504 }
1505 self.drop_without_shutdown();
1506 _result
1507 }
1508
1509 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1511 let _result = self.send_raw(result);
1512 self.drop_without_shutdown();
1513 _result
1514 }
1515
1516 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1517 self.control_handle
1518 .inner
1519 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1520 result,
1521 self.tx_id,
1522 0x24101c5d0b439748,
1523 fidl::encoding::DynamicFlags::empty(),
1524 )
1525 }
1526}
1527
1528#[must_use = "FIDL methods require a response to be sent"]
1529#[derive(Debug)]
1530pub struct AdminMexecResponder {
1531 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1532 tx_id: u32,
1533}
1534
1535impl std::ops::Drop for AdminMexecResponder {
1539 fn drop(&mut self) {
1540 self.control_handle.shutdown();
1541 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1543 }
1544}
1545
1546impl fidl::endpoints::Responder for AdminMexecResponder {
1547 type ControlHandle = AdminControlHandle;
1548
1549 fn control_handle(&self) -> &AdminControlHandle {
1550 &self.control_handle
1551 }
1552
1553 fn drop_without_shutdown(mut self) {
1554 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1556 std::mem::forget(self);
1558 }
1559}
1560
1561impl AdminMexecResponder {
1562 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1566 let _result = self.send_raw(result);
1567 if _result.is_err() {
1568 self.control_handle.shutdown();
1569 }
1570 self.drop_without_shutdown();
1571 _result
1572 }
1573
1574 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1576 let _result = self.send_raw(result);
1577 self.drop_without_shutdown();
1578 _result
1579 }
1580
1581 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1582 self.control_handle
1583 .inner
1584 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1585 result,
1586 self.tx_id,
1587 0x1f91e77ec781a4c6,
1588 fidl::encoding::DynamicFlags::empty(),
1589 )
1590 }
1591}
1592
1593#[must_use = "FIDL methods require a response to be sent"]
1594#[derive(Debug)]
1595pub struct AdminSuspendToRamResponder {
1596 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1597 tx_id: u32,
1598}
1599
1600impl std::ops::Drop for AdminSuspendToRamResponder {
1604 fn drop(&mut self) {
1605 self.control_handle.shutdown();
1606 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1608 }
1609}
1610
1611impl fidl::endpoints::Responder for AdminSuspendToRamResponder {
1612 type ControlHandle = AdminControlHandle;
1613
1614 fn control_handle(&self) -> &AdminControlHandle {
1615 &self.control_handle
1616 }
1617
1618 fn drop_without_shutdown(mut self) {
1619 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1621 std::mem::forget(self);
1623 }
1624}
1625
1626impl AdminSuspendToRamResponder {
1627 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1631 let _result = self.send_raw(result);
1632 if _result.is_err() {
1633 self.control_handle.shutdown();
1634 }
1635 self.drop_without_shutdown();
1636 _result
1637 }
1638
1639 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1641 let _result = self.send_raw(result);
1642 self.drop_without_shutdown();
1643 _result
1644 }
1645
1646 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1647 self.control_handle
1648 .inner
1649 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1650 result,
1651 self.tx_id,
1652 0x3b0e356782e7620e,
1653 fidl::encoding::DynamicFlags::empty(),
1654 )
1655 }
1656}
1657
1658#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1659pub struct RebootMethodsWatcherRegisterMarker;
1660
1661impl fidl::endpoints::ProtocolMarker for RebootMethodsWatcherRegisterMarker {
1662 type Proxy = RebootMethodsWatcherRegisterProxy;
1663 type RequestStream = RebootMethodsWatcherRegisterRequestStream;
1664 #[cfg(target_os = "fuchsia")]
1665 type SynchronousProxy = RebootMethodsWatcherRegisterSynchronousProxy;
1666
1667 const DEBUG_NAME: &'static str =
1668 "fuchsia.hardware.power.statecontrol.RebootMethodsWatcherRegister";
1669}
1670impl fidl::endpoints::DiscoverableProtocolMarker for RebootMethodsWatcherRegisterMarker {}
1671
1672pub trait RebootMethodsWatcherRegisterProxyInterface: Send + Sync {
1673 type RegisterWatcherResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1674 fn r#register_watcher(
1675 &self,
1676 watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
1677 ) -> Self::RegisterWatcherResponseFut;
1678}
1679#[derive(Debug)]
1680#[cfg(target_os = "fuchsia")]
1681pub struct RebootMethodsWatcherRegisterSynchronousProxy {
1682 client: fidl::client::sync::Client,
1683}
1684
1685#[cfg(target_os = "fuchsia")]
1686impl fidl::endpoints::SynchronousProxy for RebootMethodsWatcherRegisterSynchronousProxy {
1687 type Proxy = RebootMethodsWatcherRegisterProxy;
1688 type Protocol = RebootMethodsWatcherRegisterMarker;
1689
1690 fn from_channel(inner: fidl::Channel) -> Self {
1691 Self::new(inner)
1692 }
1693
1694 fn into_channel(self) -> fidl::Channel {
1695 self.client.into_channel()
1696 }
1697
1698 fn as_channel(&self) -> &fidl::Channel {
1699 self.client.as_channel()
1700 }
1701}
1702
1703#[cfg(target_os = "fuchsia")]
1704impl RebootMethodsWatcherRegisterSynchronousProxy {
1705 pub fn new(channel: fidl::Channel) -> Self {
1706 let protocol_name =
1707 <RebootMethodsWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1708 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1709 }
1710
1711 pub fn into_channel(self) -> fidl::Channel {
1712 self.client.into_channel()
1713 }
1714
1715 pub fn wait_for_event(
1718 &self,
1719 deadline: zx::MonotonicInstant,
1720 ) -> Result<RebootMethodsWatcherRegisterEvent, fidl::Error> {
1721 RebootMethodsWatcherRegisterEvent::decode(self.client.wait_for_event(deadline)?)
1722 }
1723
1724 pub fn r#register_watcher(
1740 &self,
1741 mut watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
1742 ___deadline: zx::MonotonicInstant,
1743 ) -> Result<(), fidl::Error> {
1744 let _response = self.client.send_query::<
1745 RebootMethodsWatcherRegisterRegisterWatcherRequest,
1746 fidl::encoding::EmptyPayload,
1747 >(
1748 (watcher,),
1749 0x3e6610e78471238,
1750 fidl::encoding::DynamicFlags::empty(),
1751 ___deadline,
1752 )?;
1753 Ok(_response)
1754 }
1755}
1756
1757#[cfg(target_os = "fuchsia")]
1758impl From<RebootMethodsWatcherRegisterSynchronousProxy> for zx::NullableHandle {
1759 fn from(value: RebootMethodsWatcherRegisterSynchronousProxy) -> Self {
1760 value.into_channel().into()
1761 }
1762}
1763
1764#[cfg(target_os = "fuchsia")]
1765impl From<fidl::Channel> for RebootMethodsWatcherRegisterSynchronousProxy {
1766 fn from(value: fidl::Channel) -> Self {
1767 Self::new(value)
1768 }
1769}
1770
1771#[cfg(target_os = "fuchsia")]
1772impl fidl::endpoints::FromClient for RebootMethodsWatcherRegisterSynchronousProxy {
1773 type Protocol = RebootMethodsWatcherRegisterMarker;
1774
1775 fn from_client(value: fidl::endpoints::ClientEnd<RebootMethodsWatcherRegisterMarker>) -> Self {
1776 Self::new(value.into_channel())
1777 }
1778}
1779
1780#[derive(Debug, Clone)]
1781pub struct RebootMethodsWatcherRegisterProxy {
1782 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1783}
1784
1785impl fidl::endpoints::Proxy for RebootMethodsWatcherRegisterProxy {
1786 type Protocol = RebootMethodsWatcherRegisterMarker;
1787
1788 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1789 Self::new(inner)
1790 }
1791
1792 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1793 self.client.into_channel().map_err(|client| Self { client })
1794 }
1795
1796 fn as_channel(&self) -> &::fidl::AsyncChannel {
1797 self.client.as_channel()
1798 }
1799}
1800
1801impl RebootMethodsWatcherRegisterProxy {
1802 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1804 let protocol_name =
1805 <RebootMethodsWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1806 Self { client: fidl::client::Client::new(channel, protocol_name) }
1807 }
1808
1809 pub fn take_event_stream(&self) -> RebootMethodsWatcherRegisterEventStream {
1815 RebootMethodsWatcherRegisterEventStream {
1816 event_receiver: self.client.take_event_receiver(),
1817 }
1818 }
1819
1820 pub fn r#register_watcher(
1836 &self,
1837 mut watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
1838 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1839 RebootMethodsWatcherRegisterProxyInterface::r#register_watcher(self, watcher)
1840 }
1841}
1842
1843impl RebootMethodsWatcherRegisterProxyInterface for RebootMethodsWatcherRegisterProxy {
1844 type RegisterWatcherResponseFut =
1845 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1846 fn r#register_watcher(
1847 &self,
1848 mut watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
1849 ) -> Self::RegisterWatcherResponseFut {
1850 fn _decode(
1851 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1852 ) -> Result<(), fidl::Error> {
1853 let _response = fidl::client::decode_transaction_body::<
1854 fidl::encoding::EmptyPayload,
1855 fidl::encoding::DefaultFuchsiaResourceDialect,
1856 0x3e6610e78471238,
1857 >(_buf?)?;
1858 Ok(_response)
1859 }
1860 self.client.send_query_and_decode::<RebootMethodsWatcherRegisterRegisterWatcherRequest, ()>(
1861 (watcher,),
1862 0x3e6610e78471238,
1863 fidl::encoding::DynamicFlags::empty(),
1864 _decode,
1865 )
1866 }
1867}
1868
1869pub struct RebootMethodsWatcherRegisterEventStream {
1870 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1871}
1872
1873impl std::marker::Unpin for RebootMethodsWatcherRegisterEventStream {}
1874
1875impl futures::stream::FusedStream for RebootMethodsWatcherRegisterEventStream {
1876 fn is_terminated(&self) -> bool {
1877 self.event_receiver.is_terminated()
1878 }
1879}
1880
1881impl futures::Stream for RebootMethodsWatcherRegisterEventStream {
1882 type Item = Result<RebootMethodsWatcherRegisterEvent, fidl::Error>;
1883
1884 fn poll_next(
1885 mut self: std::pin::Pin<&mut Self>,
1886 cx: &mut std::task::Context<'_>,
1887 ) -> std::task::Poll<Option<Self::Item>> {
1888 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1889 &mut self.event_receiver,
1890 cx
1891 )?) {
1892 Some(buf) => {
1893 std::task::Poll::Ready(Some(RebootMethodsWatcherRegisterEvent::decode(buf)))
1894 }
1895 None => std::task::Poll::Ready(None),
1896 }
1897 }
1898}
1899
1900#[derive(Debug)]
1901pub enum RebootMethodsWatcherRegisterEvent {}
1902
1903impl RebootMethodsWatcherRegisterEvent {
1904 fn decode(
1906 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1907 ) -> Result<RebootMethodsWatcherRegisterEvent, fidl::Error> {
1908 let (bytes, _handles) = buf.split_mut();
1909 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1910 debug_assert_eq!(tx_header.tx_id, 0);
1911 match tx_header.ordinal {
1912 _ => Err(fidl::Error::UnknownOrdinal {
1913 ordinal: tx_header.ordinal,
1914 protocol_name: <RebootMethodsWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1915 })
1916 }
1917 }
1918}
1919
1920pub struct RebootMethodsWatcherRegisterRequestStream {
1922 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1923 is_terminated: bool,
1924}
1925
1926impl std::marker::Unpin for RebootMethodsWatcherRegisterRequestStream {}
1927
1928impl futures::stream::FusedStream for RebootMethodsWatcherRegisterRequestStream {
1929 fn is_terminated(&self) -> bool {
1930 self.is_terminated
1931 }
1932}
1933
1934impl fidl::endpoints::RequestStream for RebootMethodsWatcherRegisterRequestStream {
1935 type Protocol = RebootMethodsWatcherRegisterMarker;
1936 type ControlHandle = RebootMethodsWatcherRegisterControlHandle;
1937
1938 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1939 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1940 }
1941
1942 fn control_handle(&self) -> Self::ControlHandle {
1943 RebootMethodsWatcherRegisterControlHandle { inner: self.inner.clone() }
1944 }
1945
1946 fn into_inner(
1947 self,
1948 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1949 {
1950 (self.inner, self.is_terminated)
1951 }
1952
1953 fn from_inner(
1954 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1955 is_terminated: bool,
1956 ) -> Self {
1957 Self { inner, is_terminated }
1958 }
1959}
1960
1961impl futures::Stream for RebootMethodsWatcherRegisterRequestStream {
1962 type Item = Result<RebootMethodsWatcherRegisterRequest, fidl::Error>;
1963
1964 fn poll_next(
1965 mut self: std::pin::Pin<&mut Self>,
1966 cx: &mut std::task::Context<'_>,
1967 ) -> std::task::Poll<Option<Self::Item>> {
1968 let this = &mut *self;
1969 if this.inner.check_shutdown(cx) {
1970 this.is_terminated = true;
1971 return std::task::Poll::Ready(None);
1972 }
1973 if this.is_terminated {
1974 panic!("polled RebootMethodsWatcherRegisterRequestStream after completion");
1975 }
1976 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1977 |bytes, handles| {
1978 match this.inner.channel().read_etc(cx, bytes, handles) {
1979 std::task::Poll::Ready(Ok(())) => {}
1980 std::task::Poll::Pending => return std::task::Poll::Pending,
1981 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1982 this.is_terminated = true;
1983 return std::task::Poll::Ready(None);
1984 }
1985 std::task::Poll::Ready(Err(e)) => {
1986 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1987 e.into(),
1988 ))));
1989 }
1990 }
1991
1992 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1994
1995 std::task::Poll::Ready(Some(match header.ordinal {
1996 0x3e6610e78471238 => {
1997 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1998 let mut req = fidl::new_empty!(RebootMethodsWatcherRegisterRegisterWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1999 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RebootMethodsWatcherRegisterRegisterWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
2000 let control_handle = RebootMethodsWatcherRegisterControlHandle {
2001 inner: this.inner.clone(),
2002 };
2003 Ok(RebootMethodsWatcherRegisterRequest::RegisterWatcher {watcher: req.watcher,
2004
2005 responder: RebootMethodsWatcherRegisterRegisterWatcherResponder {
2006 control_handle: std::mem::ManuallyDrop::new(control_handle),
2007 tx_id: header.tx_id,
2008 },
2009 })
2010 }
2011 _ => Err(fidl::Error::UnknownOrdinal {
2012 ordinal: header.ordinal,
2013 protocol_name: <RebootMethodsWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2014 }),
2015 }))
2016 },
2017 )
2018 }
2019}
2020
2021#[derive(Debug)]
2026pub enum RebootMethodsWatcherRegisterRequest {
2027 RegisterWatcher {
2043 watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
2044 responder: RebootMethodsWatcherRegisterRegisterWatcherResponder,
2045 },
2046}
2047
2048impl RebootMethodsWatcherRegisterRequest {
2049 #[allow(irrefutable_let_patterns)]
2050 pub fn into_register_watcher(
2051 self,
2052 ) -> Option<(
2053 fidl::endpoints::ClientEnd<RebootWatcherMarker>,
2054 RebootMethodsWatcherRegisterRegisterWatcherResponder,
2055 )> {
2056 if let RebootMethodsWatcherRegisterRequest::RegisterWatcher { watcher, responder } = self {
2057 Some((watcher, responder))
2058 } else {
2059 None
2060 }
2061 }
2062
2063 pub fn method_name(&self) -> &'static str {
2065 match *self {
2066 RebootMethodsWatcherRegisterRequest::RegisterWatcher { .. } => "register_watcher",
2067 }
2068 }
2069}
2070
2071#[derive(Debug, Clone)]
2072pub struct RebootMethodsWatcherRegisterControlHandle {
2073 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2074}
2075
2076impl fidl::endpoints::ControlHandle for RebootMethodsWatcherRegisterControlHandle {
2077 fn shutdown(&self) {
2078 self.inner.shutdown()
2079 }
2080
2081 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2082 self.inner.shutdown_with_epitaph(status)
2083 }
2084
2085 fn is_closed(&self) -> bool {
2086 self.inner.channel().is_closed()
2087 }
2088 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2089 self.inner.channel().on_closed()
2090 }
2091
2092 #[cfg(target_os = "fuchsia")]
2093 fn signal_peer(
2094 &self,
2095 clear_mask: zx::Signals,
2096 set_mask: zx::Signals,
2097 ) -> Result<(), zx_status::Status> {
2098 use fidl::Peered;
2099 self.inner.channel().signal_peer(clear_mask, set_mask)
2100 }
2101}
2102
2103impl RebootMethodsWatcherRegisterControlHandle {}
2104
2105#[must_use = "FIDL methods require a response to be sent"]
2106#[derive(Debug)]
2107pub struct RebootMethodsWatcherRegisterRegisterWatcherResponder {
2108 control_handle: std::mem::ManuallyDrop<RebootMethodsWatcherRegisterControlHandle>,
2109 tx_id: u32,
2110}
2111
2112impl std::ops::Drop for RebootMethodsWatcherRegisterRegisterWatcherResponder {
2116 fn drop(&mut self) {
2117 self.control_handle.shutdown();
2118 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2120 }
2121}
2122
2123impl fidl::endpoints::Responder for RebootMethodsWatcherRegisterRegisterWatcherResponder {
2124 type ControlHandle = RebootMethodsWatcherRegisterControlHandle;
2125
2126 fn control_handle(&self) -> &RebootMethodsWatcherRegisterControlHandle {
2127 &self.control_handle
2128 }
2129
2130 fn drop_without_shutdown(mut self) {
2131 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2133 std::mem::forget(self);
2135 }
2136}
2137
2138impl RebootMethodsWatcherRegisterRegisterWatcherResponder {
2139 pub fn send(self) -> Result<(), fidl::Error> {
2143 let _result = self.send_raw();
2144 if _result.is_err() {
2145 self.control_handle.shutdown();
2146 }
2147 self.drop_without_shutdown();
2148 _result
2149 }
2150
2151 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2153 let _result = self.send_raw();
2154 self.drop_without_shutdown();
2155 _result
2156 }
2157
2158 fn send_raw(&self) -> Result<(), fidl::Error> {
2159 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2160 (),
2161 self.tx_id,
2162 0x3e6610e78471238,
2163 fidl::encoding::DynamicFlags::empty(),
2164 )
2165 }
2166}
2167
2168#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2169pub struct RebootWatcherMarker;
2170
2171impl fidl::endpoints::ProtocolMarker for RebootWatcherMarker {
2172 type Proxy = RebootWatcherProxy;
2173 type RequestStream = RebootWatcherRequestStream;
2174 #[cfg(target_os = "fuchsia")]
2175 type SynchronousProxy = RebootWatcherSynchronousProxy;
2176
2177 const DEBUG_NAME: &'static str = "(anonymous) RebootWatcher";
2178}
2179
2180pub trait RebootWatcherProxyInterface: Send + Sync {
2181 type OnRebootResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2182 fn r#on_reboot(&self, options: &RebootOptions) -> Self::OnRebootResponseFut;
2183}
2184#[derive(Debug)]
2185#[cfg(target_os = "fuchsia")]
2186pub struct RebootWatcherSynchronousProxy {
2187 client: fidl::client::sync::Client,
2188}
2189
2190#[cfg(target_os = "fuchsia")]
2191impl fidl::endpoints::SynchronousProxy for RebootWatcherSynchronousProxy {
2192 type Proxy = RebootWatcherProxy;
2193 type Protocol = RebootWatcherMarker;
2194
2195 fn from_channel(inner: fidl::Channel) -> Self {
2196 Self::new(inner)
2197 }
2198
2199 fn into_channel(self) -> fidl::Channel {
2200 self.client.into_channel()
2201 }
2202
2203 fn as_channel(&self) -> &fidl::Channel {
2204 self.client.as_channel()
2205 }
2206}
2207
2208#[cfg(target_os = "fuchsia")]
2209impl RebootWatcherSynchronousProxy {
2210 pub fn new(channel: fidl::Channel) -> Self {
2211 let protocol_name = <RebootWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2212 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2213 }
2214
2215 pub fn into_channel(self) -> fidl::Channel {
2216 self.client.into_channel()
2217 }
2218
2219 pub fn wait_for_event(
2222 &self,
2223 deadline: zx::MonotonicInstant,
2224 ) -> Result<RebootWatcherEvent, fidl::Error> {
2225 RebootWatcherEvent::decode(self.client.wait_for_event(deadline)?)
2226 }
2227
2228 pub fn r#on_reboot(
2229 &self,
2230 mut options: &RebootOptions,
2231 ___deadline: zx::MonotonicInstant,
2232 ) -> Result<(), fidl::Error> {
2233 let _response =
2234 self.client.send_query::<RebootWatcherOnRebootRequest, fidl::encoding::EmptyPayload>(
2235 (options,),
2236 0x5334bbbe774f13c3,
2237 fidl::encoding::DynamicFlags::empty(),
2238 ___deadline,
2239 )?;
2240 Ok(_response)
2241 }
2242}
2243
2244#[cfg(target_os = "fuchsia")]
2245impl From<RebootWatcherSynchronousProxy> for zx::NullableHandle {
2246 fn from(value: RebootWatcherSynchronousProxy) -> Self {
2247 value.into_channel().into()
2248 }
2249}
2250
2251#[cfg(target_os = "fuchsia")]
2252impl From<fidl::Channel> for RebootWatcherSynchronousProxy {
2253 fn from(value: fidl::Channel) -> Self {
2254 Self::new(value)
2255 }
2256}
2257
2258#[cfg(target_os = "fuchsia")]
2259impl fidl::endpoints::FromClient for RebootWatcherSynchronousProxy {
2260 type Protocol = RebootWatcherMarker;
2261
2262 fn from_client(value: fidl::endpoints::ClientEnd<RebootWatcherMarker>) -> Self {
2263 Self::new(value.into_channel())
2264 }
2265}
2266
2267#[derive(Debug, Clone)]
2268pub struct RebootWatcherProxy {
2269 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2270}
2271
2272impl fidl::endpoints::Proxy for RebootWatcherProxy {
2273 type Protocol = RebootWatcherMarker;
2274
2275 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2276 Self::new(inner)
2277 }
2278
2279 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2280 self.client.into_channel().map_err(|client| Self { client })
2281 }
2282
2283 fn as_channel(&self) -> &::fidl::AsyncChannel {
2284 self.client.as_channel()
2285 }
2286}
2287
2288impl RebootWatcherProxy {
2289 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2291 let protocol_name = <RebootWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2292 Self { client: fidl::client::Client::new(channel, protocol_name) }
2293 }
2294
2295 pub fn take_event_stream(&self) -> RebootWatcherEventStream {
2301 RebootWatcherEventStream { event_receiver: self.client.take_event_receiver() }
2302 }
2303
2304 pub fn r#on_reboot(
2305 &self,
2306 mut options: &RebootOptions,
2307 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2308 RebootWatcherProxyInterface::r#on_reboot(self, options)
2309 }
2310}
2311
2312impl RebootWatcherProxyInterface for RebootWatcherProxy {
2313 type OnRebootResponseFut =
2314 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2315 fn r#on_reboot(&self, mut options: &RebootOptions) -> Self::OnRebootResponseFut {
2316 fn _decode(
2317 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2318 ) -> Result<(), fidl::Error> {
2319 let _response = fidl::client::decode_transaction_body::<
2320 fidl::encoding::EmptyPayload,
2321 fidl::encoding::DefaultFuchsiaResourceDialect,
2322 0x5334bbbe774f13c3,
2323 >(_buf?)?;
2324 Ok(_response)
2325 }
2326 self.client.send_query_and_decode::<RebootWatcherOnRebootRequest, ()>(
2327 (options,),
2328 0x5334bbbe774f13c3,
2329 fidl::encoding::DynamicFlags::empty(),
2330 _decode,
2331 )
2332 }
2333}
2334
2335pub struct RebootWatcherEventStream {
2336 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2337}
2338
2339impl std::marker::Unpin for RebootWatcherEventStream {}
2340
2341impl futures::stream::FusedStream for RebootWatcherEventStream {
2342 fn is_terminated(&self) -> bool {
2343 self.event_receiver.is_terminated()
2344 }
2345}
2346
2347impl futures::Stream for RebootWatcherEventStream {
2348 type Item = Result<RebootWatcherEvent, fidl::Error>;
2349
2350 fn poll_next(
2351 mut self: std::pin::Pin<&mut Self>,
2352 cx: &mut std::task::Context<'_>,
2353 ) -> std::task::Poll<Option<Self::Item>> {
2354 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2355 &mut self.event_receiver,
2356 cx
2357 )?) {
2358 Some(buf) => std::task::Poll::Ready(Some(RebootWatcherEvent::decode(buf))),
2359 None => std::task::Poll::Ready(None),
2360 }
2361 }
2362}
2363
2364#[derive(Debug)]
2365pub enum RebootWatcherEvent {}
2366
2367impl RebootWatcherEvent {
2368 fn decode(
2370 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2371 ) -> Result<RebootWatcherEvent, fidl::Error> {
2372 let (bytes, _handles) = buf.split_mut();
2373 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2374 debug_assert_eq!(tx_header.tx_id, 0);
2375 match tx_header.ordinal {
2376 _ => Err(fidl::Error::UnknownOrdinal {
2377 ordinal: tx_header.ordinal,
2378 protocol_name: <RebootWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2379 }),
2380 }
2381 }
2382}
2383
2384pub struct RebootWatcherRequestStream {
2386 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2387 is_terminated: bool,
2388}
2389
2390impl std::marker::Unpin for RebootWatcherRequestStream {}
2391
2392impl futures::stream::FusedStream for RebootWatcherRequestStream {
2393 fn is_terminated(&self) -> bool {
2394 self.is_terminated
2395 }
2396}
2397
2398impl fidl::endpoints::RequestStream for RebootWatcherRequestStream {
2399 type Protocol = RebootWatcherMarker;
2400 type ControlHandle = RebootWatcherControlHandle;
2401
2402 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2403 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2404 }
2405
2406 fn control_handle(&self) -> Self::ControlHandle {
2407 RebootWatcherControlHandle { inner: self.inner.clone() }
2408 }
2409
2410 fn into_inner(
2411 self,
2412 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2413 {
2414 (self.inner, self.is_terminated)
2415 }
2416
2417 fn from_inner(
2418 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2419 is_terminated: bool,
2420 ) -> Self {
2421 Self { inner, is_terminated }
2422 }
2423}
2424
2425impl futures::Stream for RebootWatcherRequestStream {
2426 type Item = Result<RebootWatcherRequest, fidl::Error>;
2427
2428 fn poll_next(
2429 mut self: std::pin::Pin<&mut Self>,
2430 cx: &mut std::task::Context<'_>,
2431 ) -> std::task::Poll<Option<Self::Item>> {
2432 let this = &mut *self;
2433 if this.inner.check_shutdown(cx) {
2434 this.is_terminated = true;
2435 return std::task::Poll::Ready(None);
2436 }
2437 if this.is_terminated {
2438 panic!("polled RebootWatcherRequestStream after completion");
2439 }
2440 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2441 |bytes, handles| {
2442 match this.inner.channel().read_etc(cx, bytes, handles) {
2443 std::task::Poll::Ready(Ok(())) => {}
2444 std::task::Poll::Pending => return std::task::Poll::Pending,
2445 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2446 this.is_terminated = true;
2447 return std::task::Poll::Ready(None);
2448 }
2449 std::task::Poll::Ready(Err(e)) => {
2450 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2451 e.into(),
2452 ))));
2453 }
2454 }
2455
2456 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2458
2459 std::task::Poll::Ready(Some(match header.ordinal {
2460 0x5334bbbe774f13c3 => {
2461 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2462 let mut req = fidl::new_empty!(
2463 RebootWatcherOnRebootRequest,
2464 fidl::encoding::DefaultFuchsiaResourceDialect
2465 );
2466 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RebootWatcherOnRebootRequest>(&header, _body_bytes, handles, &mut req)?;
2467 let control_handle =
2468 RebootWatcherControlHandle { inner: this.inner.clone() };
2469 Ok(RebootWatcherRequest::OnReboot {
2470 options: req.options,
2471
2472 responder: RebootWatcherOnRebootResponder {
2473 control_handle: std::mem::ManuallyDrop::new(control_handle),
2474 tx_id: header.tx_id,
2475 },
2476 })
2477 }
2478 _ => Err(fidl::Error::UnknownOrdinal {
2479 ordinal: header.ordinal,
2480 protocol_name:
2481 <RebootWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2482 }),
2483 }))
2484 },
2485 )
2486 }
2487}
2488
2489#[derive(Debug)]
2495pub enum RebootWatcherRequest {
2496 OnReboot { options: RebootOptions, responder: RebootWatcherOnRebootResponder },
2497}
2498
2499impl RebootWatcherRequest {
2500 #[allow(irrefutable_let_patterns)]
2501 pub fn into_on_reboot(self) -> Option<(RebootOptions, RebootWatcherOnRebootResponder)> {
2502 if let RebootWatcherRequest::OnReboot { options, responder } = self {
2503 Some((options, responder))
2504 } else {
2505 None
2506 }
2507 }
2508
2509 pub fn method_name(&self) -> &'static str {
2511 match *self {
2512 RebootWatcherRequest::OnReboot { .. } => "on_reboot",
2513 }
2514 }
2515}
2516
2517#[derive(Debug, Clone)]
2518pub struct RebootWatcherControlHandle {
2519 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2520}
2521
2522impl fidl::endpoints::ControlHandle for RebootWatcherControlHandle {
2523 fn shutdown(&self) {
2524 self.inner.shutdown()
2525 }
2526
2527 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2528 self.inner.shutdown_with_epitaph(status)
2529 }
2530
2531 fn is_closed(&self) -> bool {
2532 self.inner.channel().is_closed()
2533 }
2534 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2535 self.inner.channel().on_closed()
2536 }
2537
2538 #[cfg(target_os = "fuchsia")]
2539 fn signal_peer(
2540 &self,
2541 clear_mask: zx::Signals,
2542 set_mask: zx::Signals,
2543 ) -> Result<(), zx_status::Status> {
2544 use fidl::Peered;
2545 self.inner.channel().signal_peer(clear_mask, set_mask)
2546 }
2547}
2548
2549impl RebootWatcherControlHandle {}
2550
2551#[must_use = "FIDL methods require a response to be sent"]
2552#[derive(Debug)]
2553pub struct RebootWatcherOnRebootResponder {
2554 control_handle: std::mem::ManuallyDrop<RebootWatcherControlHandle>,
2555 tx_id: u32,
2556}
2557
2558impl std::ops::Drop for RebootWatcherOnRebootResponder {
2562 fn drop(&mut self) {
2563 self.control_handle.shutdown();
2564 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2566 }
2567}
2568
2569impl fidl::endpoints::Responder for RebootWatcherOnRebootResponder {
2570 type ControlHandle = RebootWatcherControlHandle;
2571
2572 fn control_handle(&self) -> &RebootWatcherControlHandle {
2573 &self.control_handle
2574 }
2575
2576 fn drop_without_shutdown(mut self) {
2577 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2579 std::mem::forget(self);
2581 }
2582}
2583
2584impl RebootWatcherOnRebootResponder {
2585 pub fn send(self) -> Result<(), fidl::Error> {
2589 let _result = self.send_raw();
2590 if _result.is_err() {
2591 self.control_handle.shutdown();
2592 }
2593 self.drop_without_shutdown();
2594 _result
2595 }
2596
2597 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2599 let _result = self.send_raw();
2600 self.drop_without_shutdown();
2601 _result
2602 }
2603
2604 fn send_raw(&self) -> Result<(), fidl::Error> {
2605 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2606 (),
2607 self.tx_id,
2608 0x5334bbbe774f13c3,
2609 fidl::encoding::DynamicFlags::empty(),
2610 )
2611 }
2612}
2613
2614#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2615pub struct ShutdownWatcherMarker;
2616
2617impl fidl::endpoints::ProtocolMarker for ShutdownWatcherMarker {
2618 type Proxy = ShutdownWatcherProxy;
2619 type RequestStream = ShutdownWatcherRequestStream;
2620 #[cfg(target_os = "fuchsia")]
2621 type SynchronousProxy = ShutdownWatcherSynchronousProxy;
2622
2623 const DEBUG_NAME: &'static str = "(anonymous) ShutdownWatcher";
2624}
2625
2626pub trait ShutdownWatcherProxyInterface: Send + Sync {
2627 type OnShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2628 fn r#on_shutdown(&self, options: &ShutdownOptions) -> Self::OnShutdownResponseFut;
2629}
2630#[derive(Debug)]
2631#[cfg(target_os = "fuchsia")]
2632pub struct ShutdownWatcherSynchronousProxy {
2633 client: fidl::client::sync::Client,
2634}
2635
2636#[cfg(target_os = "fuchsia")]
2637impl fidl::endpoints::SynchronousProxy for ShutdownWatcherSynchronousProxy {
2638 type Proxy = ShutdownWatcherProxy;
2639 type Protocol = ShutdownWatcherMarker;
2640
2641 fn from_channel(inner: fidl::Channel) -> Self {
2642 Self::new(inner)
2643 }
2644
2645 fn into_channel(self) -> fidl::Channel {
2646 self.client.into_channel()
2647 }
2648
2649 fn as_channel(&self) -> &fidl::Channel {
2650 self.client.as_channel()
2651 }
2652}
2653
2654#[cfg(target_os = "fuchsia")]
2655impl ShutdownWatcherSynchronousProxy {
2656 pub fn new(channel: fidl::Channel) -> Self {
2657 let protocol_name = <ShutdownWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2658 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2659 }
2660
2661 pub fn into_channel(self) -> fidl::Channel {
2662 self.client.into_channel()
2663 }
2664
2665 pub fn wait_for_event(
2668 &self,
2669 deadline: zx::MonotonicInstant,
2670 ) -> Result<ShutdownWatcherEvent, fidl::Error> {
2671 ShutdownWatcherEvent::decode(self.client.wait_for_event(deadline)?)
2672 }
2673
2674 pub fn r#on_shutdown(
2675 &self,
2676 mut options: &ShutdownOptions,
2677 ___deadline: zx::MonotonicInstant,
2678 ) -> Result<(), fidl::Error> {
2679 let _response = self.client.send_query::<
2680 ShutdownWatcherOnShutdownRequest,
2681 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2682 >(
2683 (options,),
2684 0x1d9467990d7dc6db,
2685 fidl::encoding::DynamicFlags::FLEXIBLE,
2686 ___deadline,
2687 )?
2688 .into_result::<ShutdownWatcherMarker>("on_shutdown")?;
2689 Ok(_response)
2690 }
2691}
2692
2693#[cfg(target_os = "fuchsia")]
2694impl From<ShutdownWatcherSynchronousProxy> for zx::NullableHandle {
2695 fn from(value: ShutdownWatcherSynchronousProxy) -> Self {
2696 value.into_channel().into()
2697 }
2698}
2699
2700#[cfg(target_os = "fuchsia")]
2701impl From<fidl::Channel> for ShutdownWatcherSynchronousProxy {
2702 fn from(value: fidl::Channel) -> Self {
2703 Self::new(value)
2704 }
2705}
2706
2707#[cfg(target_os = "fuchsia")]
2708impl fidl::endpoints::FromClient for ShutdownWatcherSynchronousProxy {
2709 type Protocol = ShutdownWatcherMarker;
2710
2711 fn from_client(value: fidl::endpoints::ClientEnd<ShutdownWatcherMarker>) -> Self {
2712 Self::new(value.into_channel())
2713 }
2714}
2715
2716#[derive(Debug, Clone)]
2717pub struct ShutdownWatcherProxy {
2718 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2719}
2720
2721impl fidl::endpoints::Proxy for ShutdownWatcherProxy {
2722 type Protocol = ShutdownWatcherMarker;
2723
2724 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2725 Self::new(inner)
2726 }
2727
2728 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2729 self.client.into_channel().map_err(|client| Self { client })
2730 }
2731
2732 fn as_channel(&self) -> &::fidl::AsyncChannel {
2733 self.client.as_channel()
2734 }
2735}
2736
2737impl ShutdownWatcherProxy {
2738 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2740 let protocol_name = <ShutdownWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2741 Self { client: fidl::client::Client::new(channel, protocol_name) }
2742 }
2743
2744 pub fn take_event_stream(&self) -> ShutdownWatcherEventStream {
2750 ShutdownWatcherEventStream { event_receiver: self.client.take_event_receiver() }
2751 }
2752
2753 pub fn r#on_shutdown(
2754 &self,
2755 mut options: &ShutdownOptions,
2756 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2757 ShutdownWatcherProxyInterface::r#on_shutdown(self, options)
2758 }
2759}
2760
2761impl ShutdownWatcherProxyInterface for ShutdownWatcherProxy {
2762 type OnShutdownResponseFut =
2763 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2764 fn r#on_shutdown(&self, mut options: &ShutdownOptions) -> Self::OnShutdownResponseFut {
2765 fn _decode(
2766 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2767 ) -> Result<(), fidl::Error> {
2768 let _response = fidl::client::decode_transaction_body::<
2769 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2770 fidl::encoding::DefaultFuchsiaResourceDialect,
2771 0x1d9467990d7dc6db,
2772 >(_buf?)?
2773 .into_result::<ShutdownWatcherMarker>("on_shutdown")?;
2774 Ok(_response)
2775 }
2776 self.client.send_query_and_decode::<ShutdownWatcherOnShutdownRequest, ()>(
2777 (options,),
2778 0x1d9467990d7dc6db,
2779 fidl::encoding::DynamicFlags::FLEXIBLE,
2780 _decode,
2781 )
2782 }
2783}
2784
2785pub struct ShutdownWatcherEventStream {
2786 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2787}
2788
2789impl std::marker::Unpin for ShutdownWatcherEventStream {}
2790
2791impl futures::stream::FusedStream for ShutdownWatcherEventStream {
2792 fn is_terminated(&self) -> bool {
2793 self.event_receiver.is_terminated()
2794 }
2795}
2796
2797impl futures::Stream for ShutdownWatcherEventStream {
2798 type Item = Result<ShutdownWatcherEvent, fidl::Error>;
2799
2800 fn poll_next(
2801 mut self: std::pin::Pin<&mut Self>,
2802 cx: &mut std::task::Context<'_>,
2803 ) -> std::task::Poll<Option<Self::Item>> {
2804 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2805 &mut self.event_receiver,
2806 cx
2807 )?) {
2808 Some(buf) => std::task::Poll::Ready(Some(ShutdownWatcherEvent::decode(buf))),
2809 None => std::task::Poll::Ready(None),
2810 }
2811 }
2812}
2813
2814#[derive(Debug)]
2815pub enum ShutdownWatcherEvent {
2816 #[non_exhaustive]
2817 _UnknownEvent {
2818 ordinal: u64,
2820 },
2821}
2822
2823impl ShutdownWatcherEvent {
2824 fn decode(
2826 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2827 ) -> Result<ShutdownWatcherEvent, fidl::Error> {
2828 let (bytes, _handles) = buf.split_mut();
2829 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2830 debug_assert_eq!(tx_header.tx_id, 0);
2831 match tx_header.ordinal {
2832 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2833 Ok(ShutdownWatcherEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2834 }
2835 _ => Err(fidl::Error::UnknownOrdinal {
2836 ordinal: tx_header.ordinal,
2837 protocol_name:
2838 <ShutdownWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2839 }),
2840 }
2841 }
2842}
2843
2844pub struct ShutdownWatcherRequestStream {
2846 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2847 is_terminated: bool,
2848}
2849
2850impl std::marker::Unpin for ShutdownWatcherRequestStream {}
2851
2852impl futures::stream::FusedStream for ShutdownWatcherRequestStream {
2853 fn is_terminated(&self) -> bool {
2854 self.is_terminated
2855 }
2856}
2857
2858impl fidl::endpoints::RequestStream for ShutdownWatcherRequestStream {
2859 type Protocol = ShutdownWatcherMarker;
2860 type ControlHandle = ShutdownWatcherControlHandle;
2861
2862 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2863 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2864 }
2865
2866 fn control_handle(&self) -> Self::ControlHandle {
2867 ShutdownWatcherControlHandle { inner: self.inner.clone() }
2868 }
2869
2870 fn into_inner(
2871 self,
2872 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2873 {
2874 (self.inner, self.is_terminated)
2875 }
2876
2877 fn from_inner(
2878 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2879 is_terminated: bool,
2880 ) -> Self {
2881 Self { inner, is_terminated }
2882 }
2883}
2884
2885impl futures::Stream for ShutdownWatcherRequestStream {
2886 type Item = Result<ShutdownWatcherRequest, fidl::Error>;
2887
2888 fn poll_next(
2889 mut self: std::pin::Pin<&mut Self>,
2890 cx: &mut std::task::Context<'_>,
2891 ) -> std::task::Poll<Option<Self::Item>> {
2892 let this = &mut *self;
2893 if this.inner.check_shutdown(cx) {
2894 this.is_terminated = true;
2895 return std::task::Poll::Ready(None);
2896 }
2897 if this.is_terminated {
2898 panic!("polled ShutdownWatcherRequestStream after completion");
2899 }
2900 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2901 |bytes, handles| {
2902 match this.inner.channel().read_etc(cx, bytes, handles) {
2903 std::task::Poll::Ready(Ok(())) => {}
2904 std::task::Poll::Pending => return std::task::Poll::Pending,
2905 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2906 this.is_terminated = true;
2907 return std::task::Poll::Ready(None);
2908 }
2909 std::task::Poll::Ready(Err(e)) => {
2910 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2911 e.into(),
2912 ))));
2913 }
2914 }
2915
2916 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2918
2919 std::task::Poll::Ready(Some(match header.ordinal {
2920 0x1d9467990d7dc6db => {
2921 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2922 let mut req = fidl::new_empty!(
2923 ShutdownWatcherOnShutdownRequest,
2924 fidl::encoding::DefaultFuchsiaResourceDialect
2925 );
2926 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ShutdownWatcherOnShutdownRequest>(&header, _body_bytes, handles, &mut req)?;
2927 let control_handle =
2928 ShutdownWatcherControlHandle { inner: this.inner.clone() };
2929 Ok(ShutdownWatcherRequest::OnShutdown {
2930 options: req.options,
2931
2932 responder: ShutdownWatcherOnShutdownResponder {
2933 control_handle: std::mem::ManuallyDrop::new(control_handle),
2934 tx_id: header.tx_id,
2935 },
2936 })
2937 }
2938 _ if header.tx_id == 0
2939 && header
2940 .dynamic_flags()
2941 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2942 {
2943 Ok(ShutdownWatcherRequest::_UnknownMethod {
2944 ordinal: header.ordinal,
2945 control_handle: ShutdownWatcherControlHandle {
2946 inner: this.inner.clone(),
2947 },
2948 method_type: fidl::MethodType::OneWay,
2949 })
2950 }
2951 _ if header
2952 .dynamic_flags()
2953 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2954 {
2955 this.inner.send_framework_err(
2956 fidl::encoding::FrameworkErr::UnknownMethod,
2957 header.tx_id,
2958 header.ordinal,
2959 header.dynamic_flags(),
2960 (bytes, handles),
2961 )?;
2962 Ok(ShutdownWatcherRequest::_UnknownMethod {
2963 ordinal: header.ordinal,
2964 control_handle: ShutdownWatcherControlHandle {
2965 inner: this.inner.clone(),
2966 },
2967 method_type: fidl::MethodType::TwoWay,
2968 })
2969 }
2970 _ => Err(fidl::Error::UnknownOrdinal {
2971 ordinal: header.ordinal,
2972 protocol_name:
2973 <ShutdownWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2974 }),
2975 }))
2976 },
2977 )
2978 }
2979}
2980
2981#[derive(Debug)]
2987pub enum ShutdownWatcherRequest {
2988 OnShutdown {
2989 options: ShutdownOptions,
2990 responder: ShutdownWatcherOnShutdownResponder,
2991 },
2992 #[non_exhaustive]
2994 _UnknownMethod {
2995 ordinal: u64,
2997 control_handle: ShutdownWatcherControlHandle,
2998 method_type: fidl::MethodType,
2999 },
3000}
3001
3002impl ShutdownWatcherRequest {
3003 #[allow(irrefutable_let_patterns)]
3004 pub fn into_on_shutdown(self) -> Option<(ShutdownOptions, ShutdownWatcherOnShutdownResponder)> {
3005 if let ShutdownWatcherRequest::OnShutdown { options, responder } = self {
3006 Some((options, responder))
3007 } else {
3008 None
3009 }
3010 }
3011
3012 pub fn method_name(&self) -> &'static str {
3014 match *self {
3015 ShutdownWatcherRequest::OnShutdown { .. } => "on_shutdown",
3016 ShutdownWatcherRequest::_UnknownMethod {
3017 method_type: fidl::MethodType::OneWay,
3018 ..
3019 } => "unknown one-way method",
3020 ShutdownWatcherRequest::_UnknownMethod {
3021 method_type: fidl::MethodType::TwoWay,
3022 ..
3023 } => "unknown two-way method",
3024 }
3025 }
3026}
3027
3028#[derive(Debug, Clone)]
3029pub struct ShutdownWatcherControlHandle {
3030 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3031}
3032
3033impl fidl::endpoints::ControlHandle for ShutdownWatcherControlHandle {
3034 fn shutdown(&self) {
3035 self.inner.shutdown()
3036 }
3037
3038 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3039 self.inner.shutdown_with_epitaph(status)
3040 }
3041
3042 fn is_closed(&self) -> bool {
3043 self.inner.channel().is_closed()
3044 }
3045 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3046 self.inner.channel().on_closed()
3047 }
3048
3049 #[cfg(target_os = "fuchsia")]
3050 fn signal_peer(
3051 &self,
3052 clear_mask: zx::Signals,
3053 set_mask: zx::Signals,
3054 ) -> Result<(), zx_status::Status> {
3055 use fidl::Peered;
3056 self.inner.channel().signal_peer(clear_mask, set_mask)
3057 }
3058}
3059
3060impl ShutdownWatcherControlHandle {}
3061
3062#[must_use = "FIDL methods require a response to be sent"]
3063#[derive(Debug)]
3064pub struct ShutdownWatcherOnShutdownResponder {
3065 control_handle: std::mem::ManuallyDrop<ShutdownWatcherControlHandle>,
3066 tx_id: u32,
3067}
3068
3069impl std::ops::Drop for ShutdownWatcherOnShutdownResponder {
3073 fn drop(&mut self) {
3074 self.control_handle.shutdown();
3075 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3077 }
3078}
3079
3080impl fidl::endpoints::Responder for ShutdownWatcherOnShutdownResponder {
3081 type ControlHandle = ShutdownWatcherControlHandle;
3082
3083 fn control_handle(&self) -> &ShutdownWatcherControlHandle {
3084 &self.control_handle
3085 }
3086
3087 fn drop_without_shutdown(mut self) {
3088 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3090 std::mem::forget(self);
3092 }
3093}
3094
3095impl ShutdownWatcherOnShutdownResponder {
3096 pub fn send(self) -> Result<(), fidl::Error> {
3100 let _result = self.send_raw();
3101 if _result.is_err() {
3102 self.control_handle.shutdown();
3103 }
3104 self.drop_without_shutdown();
3105 _result
3106 }
3107
3108 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3110 let _result = self.send_raw();
3111 self.drop_without_shutdown();
3112 _result
3113 }
3114
3115 fn send_raw(&self) -> Result<(), fidl::Error> {
3116 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3117 fidl::encoding::Flexible::new(()),
3118 self.tx_id,
3119 0x1d9467990d7dc6db,
3120 fidl::encoding::DynamicFlags::FLEXIBLE,
3121 )
3122 }
3123}
3124
3125#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3126pub struct ShutdownWatcherRegisterMarker;
3127
3128impl fidl::endpoints::ProtocolMarker for ShutdownWatcherRegisterMarker {
3129 type Proxy = ShutdownWatcherRegisterProxy;
3130 type RequestStream = ShutdownWatcherRegisterRequestStream;
3131 #[cfg(target_os = "fuchsia")]
3132 type SynchronousProxy = ShutdownWatcherRegisterSynchronousProxy;
3133
3134 const DEBUG_NAME: &'static str = "fuchsia.hardware.power.statecontrol.ShutdownWatcherRegister";
3135}
3136impl fidl::endpoints::DiscoverableProtocolMarker for ShutdownWatcherRegisterMarker {}
3137
3138pub trait ShutdownWatcherRegisterProxyInterface: Send + Sync {
3139 type RegisterWatcherResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3140 fn r#register_watcher(
3141 &self,
3142 watcher: fidl::endpoints::ClientEnd<ShutdownWatcherMarker>,
3143 ) -> Self::RegisterWatcherResponseFut;
3144 type RegisterTerminalStateWatcherResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
3145 + Send;
3146 fn r#register_terminal_state_watcher(
3147 &self,
3148 watcher: fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>,
3149 ) -> Self::RegisterTerminalStateWatcherResponseFut;
3150}
3151#[derive(Debug)]
3152#[cfg(target_os = "fuchsia")]
3153pub struct ShutdownWatcherRegisterSynchronousProxy {
3154 client: fidl::client::sync::Client,
3155}
3156
3157#[cfg(target_os = "fuchsia")]
3158impl fidl::endpoints::SynchronousProxy for ShutdownWatcherRegisterSynchronousProxy {
3159 type Proxy = ShutdownWatcherRegisterProxy;
3160 type Protocol = ShutdownWatcherRegisterMarker;
3161
3162 fn from_channel(inner: fidl::Channel) -> Self {
3163 Self::new(inner)
3164 }
3165
3166 fn into_channel(self) -> fidl::Channel {
3167 self.client.into_channel()
3168 }
3169
3170 fn as_channel(&self) -> &fidl::Channel {
3171 self.client.as_channel()
3172 }
3173}
3174
3175#[cfg(target_os = "fuchsia")]
3176impl ShutdownWatcherRegisterSynchronousProxy {
3177 pub fn new(channel: fidl::Channel) -> Self {
3178 let protocol_name =
3179 <ShutdownWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3180 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3181 }
3182
3183 pub fn into_channel(self) -> fidl::Channel {
3184 self.client.into_channel()
3185 }
3186
3187 pub fn wait_for_event(
3190 &self,
3191 deadline: zx::MonotonicInstant,
3192 ) -> Result<ShutdownWatcherRegisterEvent, fidl::Error> {
3193 ShutdownWatcherRegisterEvent::decode(self.client.wait_for_event(deadline)?)
3194 }
3195
3196 pub fn r#register_watcher(
3212 &self,
3213 mut watcher: fidl::endpoints::ClientEnd<ShutdownWatcherMarker>,
3214 ___deadline: zx::MonotonicInstant,
3215 ) -> Result<(), fidl::Error> {
3216 let _response = self.client.send_query::<
3217 ShutdownWatcherRegisterRegisterWatcherRequest,
3218 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3219 >(
3220 (watcher,),
3221 0x3db6ce5d34810aff,
3222 fidl::encoding::DynamicFlags::FLEXIBLE,
3223 ___deadline,
3224 )?
3225 .into_result::<ShutdownWatcherRegisterMarker>("register_watcher")?;
3226 Ok(_response)
3227 }
3228
3229 pub fn r#register_terminal_state_watcher(
3249 &self,
3250 mut watcher: fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>,
3251 ___deadline: zx::MonotonicInstant,
3252 ) -> Result<(), fidl::Error> {
3253 let _response = self.client.send_query::<
3254 ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest,
3255 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3256 >(
3257 (watcher,),
3258 0x1cce7216bb7869fc,
3259 fidl::encoding::DynamicFlags::FLEXIBLE,
3260 ___deadline,
3261 )?
3262 .into_result::<ShutdownWatcherRegisterMarker>("register_terminal_state_watcher")?;
3263 Ok(_response)
3264 }
3265}
3266
3267#[cfg(target_os = "fuchsia")]
3268impl From<ShutdownWatcherRegisterSynchronousProxy> for zx::NullableHandle {
3269 fn from(value: ShutdownWatcherRegisterSynchronousProxy) -> Self {
3270 value.into_channel().into()
3271 }
3272}
3273
3274#[cfg(target_os = "fuchsia")]
3275impl From<fidl::Channel> for ShutdownWatcherRegisterSynchronousProxy {
3276 fn from(value: fidl::Channel) -> Self {
3277 Self::new(value)
3278 }
3279}
3280
3281#[cfg(target_os = "fuchsia")]
3282impl fidl::endpoints::FromClient for ShutdownWatcherRegisterSynchronousProxy {
3283 type Protocol = ShutdownWatcherRegisterMarker;
3284
3285 fn from_client(value: fidl::endpoints::ClientEnd<ShutdownWatcherRegisterMarker>) -> Self {
3286 Self::new(value.into_channel())
3287 }
3288}
3289
3290#[derive(Debug, Clone)]
3291pub struct ShutdownWatcherRegisterProxy {
3292 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3293}
3294
3295impl fidl::endpoints::Proxy for ShutdownWatcherRegisterProxy {
3296 type Protocol = ShutdownWatcherRegisterMarker;
3297
3298 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3299 Self::new(inner)
3300 }
3301
3302 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3303 self.client.into_channel().map_err(|client| Self { client })
3304 }
3305
3306 fn as_channel(&self) -> &::fidl::AsyncChannel {
3307 self.client.as_channel()
3308 }
3309}
3310
3311impl ShutdownWatcherRegisterProxy {
3312 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3314 let protocol_name =
3315 <ShutdownWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3316 Self { client: fidl::client::Client::new(channel, protocol_name) }
3317 }
3318
3319 pub fn take_event_stream(&self) -> ShutdownWatcherRegisterEventStream {
3325 ShutdownWatcherRegisterEventStream { event_receiver: self.client.take_event_receiver() }
3326 }
3327
3328 pub fn r#register_watcher(
3344 &self,
3345 mut watcher: fidl::endpoints::ClientEnd<ShutdownWatcherMarker>,
3346 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3347 ShutdownWatcherRegisterProxyInterface::r#register_watcher(self, watcher)
3348 }
3349
3350 pub fn r#register_terminal_state_watcher(
3370 &self,
3371 mut watcher: fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>,
3372 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3373 ShutdownWatcherRegisterProxyInterface::r#register_terminal_state_watcher(self, watcher)
3374 }
3375}
3376
3377impl ShutdownWatcherRegisterProxyInterface for ShutdownWatcherRegisterProxy {
3378 type RegisterWatcherResponseFut =
3379 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3380 fn r#register_watcher(
3381 &self,
3382 mut watcher: fidl::endpoints::ClientEnd<ShutdownWatcherMarker>,
3383 ) -> Self::RegisterWatcherResponseFut {
3384 fn _decode(
3385 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3386 ) -> Result<(), fidl::Error> {
3387 let _response = fidl::client::decode_transaction_body::<
3388 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3389 fidl::encoding::DefaultFuchsiaResourceDialect,
3390 0x3db6ce5d34810aff,
3391 >(_buf?)?
3392 .into_result::<ShutdownWatcherRegisterMarker>("register_watcher")?;
3393 Ok(_response)
3394 }
3395 self.client.send_query_and_decode::<ShutdownWatcherRegisterRegisterWatcherRequest, ()>(
3396 (watcher,),
3397 0x3db6ce5d34810aff,
3398 fidl::encoding::DynamicFlags::FLEXIBLE,
3399 _decode,
3400 )
3401 }
3402
3403 type RegisterTerminalStateWatcherResponseFut =
3404 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3405 fn r#register_terminal_state_watcher(
3406 &self,
3407 mut watcher: fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>,
3408 ) -> Self::RegisterTerminalStateWatcherResponseFut {
3409 fn _decode(
3410 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3411 ) -> Result<(), fidl::Error> {
3412 let _response = fidl::client::decode_transaction_body::<
3413 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3414 fidl::encoding::DefaultFuchsiaResourceDialect,
3415 0x1cce7216bb7869fc,
3416 >(_buf?)?
3417 .into_result::<ShutdownWatcherRegisterMarker>("register_terminal_state_watcher")?;
3418 Ok(_response)
3419 }
3420 self.client.send_query_and_decode::<
3421 ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest,
3422 (),
3423 >(
3424 (watcher,),
3425 0x1cce7216bb7869fc,
3426 fidl::encoding::DynamicFlags::FLEXIBLE,
3427 _decode,
3428 )
3429 }
3430}
3431
3432pub struct ShutdownWatcherRegisterEventStream {
3433 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3434}
3435
3436impl std::marker::Unpin for ShutdownWatcherRegisterEventStream {}
3437
3438impl futures::stream::FusedStream for ShutdownWatcherRegisterEventStream {
3439 fn is_terminated(&self) -> bool {
3440 self.event_receiver.is_terminated()
3441 }
3442}
3443
3444impl futures::Stream for ShutdownWatcherRegisterEventStream {
3445 type Item = Result<ShutdownWatcherRegisterEvent, fidl::Error>;
3446
3447 fn poll_next(
3448 mut self: std::pin::Pin<&mut Self>,
3449 cx: &mut std::task::Context<'_>,
3450 ) -> std::task::Poll<Option<Self::Item>> {
3451 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3452 &mut self.event_receiver,
3453 cx
3454 )?) {
3455 Some(buf) => std::task::Poll::Ready(Some(ShutdownWatcherRegisterEvent::decode(buf))),
3456 None => std::task::Poll::Ready(None),
3457 }
3458 }
3459}
3460
3461#[derive(Debug)]
3462pub enum ShutdownWatcherRegisterEvent {
3463 #[non_exhaustive]
3464 _UnknownEvent {
3465 ordinal: u64,
3467 },
3468}
3469
3470impl ShutdownWatcherRegisterEvent {
3471 fn decode(
3473 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3474 ) -> Result<ShutdownWatcherRegisterEvent, fidl::Error> {
3475 let (bytes, _handles) = buf.split_mut();
3476 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3477 debug_assert_eq!(tx_header.tx_id, 0);
3478 match tx_header.ordinal {
3479 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3480 Ok(ShutdownWatcherRegisterEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3481 }
3482 _ => Err(fidl::Error::UnknownOrdinal {
3483 ordinal: tx_header.ordinal,
3484 protocol_name:
3485 <ShutdownWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3486 }),
3487 }
3488 }
3489}
3490
3491pub struct ShutdownWatcherRegisterRequestStream {
3493 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3494 is_terminated: bool,
3495}
3496
3497impl std::marker::Unpin for ShutdownWatcherRegisterRequestStream {}
3498
3499impl futures::stream::FusedStream for ShutdownWatcherRegisterRequestStream {
3500 fn is_terminated(&self) -> bool {
3501 self.is_terminated
3502 }
3503}
3504
3505impl fidl::endpoints::RequestStream for ShutdownWatcherRegisterRequestStream {
3506 type Protocol = ShutdownWatcherRegisterMarker;
3507 type ControlHandle = ShutdownWatcherRegisterControlHandle;
3508
3509 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3510 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3511 }
3512
3513 fn control_handle(&self) -> Self::ControlHandle {
3514 ShutdownWatcherRegisterControlHandle { inner: self.inner.clone() }
3515 }
3516
3517 fn into_inner(
3518 self,
3519 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3520 {
3521 (self.inner, self.is_terminated)
3522 }
3523
3524 fn from_inner(
3525 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3526 is_terminated: bool,
3527 ) -> Self {
3528 Self { inner, is_terminated }
3529 }
3530}
3531
3532impl futures::Stream for ShutdownWatcherRegisterRequestStream {
3533 type Item = Result<ShutdownWatcherRegisterRequest, fidl::Error>;
3534
3535 fn poll_next(
3536 mut self: std::pin::Pin<&mut Self>,
3537 cx: &mut std::task::Context<'_>,
3538 ) -> std::task::Poll<Option<Self::Item>> {
3539 let this = &mut *self;
3540 if this.inner.check_shutdown(cx) {
3541 this.is_terminated = true;
3542 return std::task::Poll::Ready(None);
3543 }
3544 if this.is_terminated {
3545 panic!("polled ShutdownWatcherRegisterRequestStream after completion");
3546 }
3547 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3548 |bytes, handles| {
3549 match this.inner.channel().read_etc(cx, bytes, handles) {
3550 std::task::Poll::Ready(Ok(())) => {}
3551 std::task::Poll::Pending => return std::task::Poll::Pending,
3552 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3553 this.is_terminated = true;
3554 return std::task::Poll::Ready(None);
3555 }
3556 std::task::Poll::Ready(Err(e)) => {
3557 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3558 e.into(),
3559 ))));
3560 }
3561 }
3562
3563 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3565
3566 std::task::Poll::Ready(Some(match header.ordinal {
3567 0x3db6ce5d34810aff => {
3568 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3569 let mut req = fidl::new_empty!(ShutdownWatcherRegisterRegisterWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3570 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ShutdownWatcherRegisterRegisterWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
3571 let control_handle = ShutdownWatcherRegisterControlHandle {
3572 inner: this.inner.clone(),
3573 };
3574 Ok(ShutdownWatcherRegisterRequest::RegisterWatcher {watcher: req.watcher,
3575
3576 responder: ShutdownWatcherRegisterRegisterWatcherResponder {
3577 control_handle: std::mem::ManuallyDrop::new(control_handle),
3578 tx_id: header.tx_id,
3579 },
3580 })
3581 }
3582 0x1cce7216bb7869fc => {
3583 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3584 let mut req = fidl::new_empty!(ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3585 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
3586 let control_handle = ShutdownWatcherRegisterControlHandle {
3587 inner: this.inner.clone(),
3588 };
3589 Ok(ShutdownWatcherRegisterRequest::RegisterTerminalStateWatcher {watcher: req.watcher,
3590
3591 responder: ShutdownWatcherRegisterRegisterTerminalStateWatcherResponder {
3592 control_handle: std::mem::ManuallyDrop::new(control_handle),
3593 tx_id: header.tx_id,
3594 },
3595 })
3596 }
3597 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3598 Ok(ShutdownWatcherRegisterRequest::_UnknownMethod {
3599 ordinal: header.ordinal,
3600 control_handle: ShutdownWatcherRegisterControlHandle { inner: this.inner.clone() },
3601 method_type: fidl::MethodType::OneWay,
3602 })
3603 }
3604 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3605 this.inner.send_framework_err(
3606 fidl::encoding::FrameworkErr::UnknownMethod,
3607 header.tx_id,
3608 header.ordinal,
3609 header.dynamic_flags(),
3610 (bytes, handles),
3611 )?;
3612 Ok(ShutdownWatcherRegisterRequest::_UnknownMethod {
3613 ordinal: header.ordinal,
3614 control_handle: ShutdownWatcherRegisterControlHandle { inner: this.inner.clone() },
3615 method_type: fidl::MethodType::TwoWay,
3616 })
3617 }
3618 _ => Err(fidl::Error::UnknownOrdinal {
3619 ordinal: header.ordinal,
3620 protocol_name: <ShutdownWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3621 }),
3622 }))
3623 },
3624 )
3625 }
3626}
3627
3628#[derive(Debug)]
3634pub enum ShutdownWatcherRegisterRequest {
3635 RegisterWatcher {
3651 watcher: fidl::endpoints::ClientEnd<ShutdownWatcherMarker>,
3652 responder: ShutdownWatcherRegisterRegisterWatcherResponder,
3653 },
3654 RegisterTerminalStateWatcher {
3674 watcher: fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>,
3675 responder: ShutdownWatcherRegisterRegisterTerminalStateWatcherResponder,
3676 },
3677 #[non_exhaustive]
3679 _UnknownMethod {
3680 ordinal: u64,
3682 control_handle: ShutdownWatcherRegisterControlHandle,
3683 method_type: fidl::MethodType,
3684 },
3685}
3686
3687impl ShutdownWatcherRegisterRequest {
3688 #[allow(irrefutable_let_patterns)]
3689 pub fn into_register_watcher(
3690 self,
3691 ) -> Option<(
3692 fidl::endpoints::ClientEnd<ShutdownWatcherMarker>,
3693 ShutdownWatcherRegisterRegisterWatcherResponder,
3694 )> {
3695 if let ShutdownWatcherRegisterRequest::RegisterWatcher { watcher, responder } = self {
3696 Some((watcher, responder))
3697 } else {
3698 None
3699 }
3700 }
3701
3702 #[allow(irrefutable_let_patterns)]
3703 pub fn into_register_terminal_state_watcher(
3704 self,
3705 ) -> Option<(
3706 fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>,
3707 ShutdownWatcherRegisterRegisterTerminalStateWatcherResponder,
3708 )> {
3709 if let ShutdownWatcherRegisterRequest::RegisterTerminalStateWatcher { watcher, responder } =
3710 self
3711 {
3712 Some((watcher, responder))
3713 } else {
3714 None
3715 }
3716 }
3717
3718 pub fn method_name(&self) -> &'static str {
3720 match *self {
3721 ShutdownWatcherRegisterRequest::RegisterWatcher { .. } => "register_watcher",
3722 ShutdownWatcherRegisterRequest::RegisterTerminalStateWatcher { .. } => {
3723 "register_terminal_state_watcher"
3724 }
3725 ShutdownWatcherRegisterRequest::_UnknownMethod {
3726 method_type: fidl::MethodType::OneWay,
3727 ..
3728 } => "unknown one-way method",
3729 ShutdownWatcherRegisterRequest::_UnknownMethod {
3730 method_type: fidl::MethodType::TwoWay,
3731 ..
3732 } => "unknown two-way method",
3733 }
3734 }
3735}
3736
3737#[derive(Debug, Clone)]
3738pub struct ShutdownWatcherRegisterControlHandle {
3739 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3740}
3741
3742impl fidl::endpoints::ControlHandle for ShutdownWatcherRegisterControlHandle {
3743 fn shutdown(&self) {
3744 self.inner.shutdown()
3745 }
3746
3747 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3748 self.inner.shutdown_with_epitaph(status)
3749 }
3750
3751 fn is_closed(&self) -> bool {
3752 self.inner.channel().is_closed()
3753 }
3754 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3755 self.inner.channel().on_closed()
3756 }
3757
3758 #[cfg(target_os = "fuchsia")]
3759 fn signal_peer(
3760 &self,
3761 clear_mask: zx::Signals,
3762 set_mask: zx::Signals,
3763 ) -> Result<(), zx_status::Status> {
3764 use fidl::Peered;
3765 self.inner.channel().signal_peer(clear_mask, set_mask)
3766 }
3767}
3768
3769impl ShutdownWatcherRegisterControlHandle {}
3770
3771#[must_use = "FIDL methods require a response to be sent"]
3772#[derive(Debug)]
3773pub struct ShutdownWatcherRegisterRegisterWatcherResponder {
3774 control_handle: std::mem::ManuallyDrop<ShutdownWatcherRegisterControlHandle>,
3775 tx_id: u32,
3776}
3777
3778impl std::ops::Drop for ShutdownWatcherRegisterRegisterWatcherResponder {
3782 fn drop(&mut self) {
3783 self.control_handle.shutdown();
3784 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3786 }
3787}
3788
3789impl fidl::endpoints::Responder for ShutdownWatcherRegisterRegisterWatcherResponder {
3790 type ControlHandle = ShutdownWatcherRegisterControlHandle;
3791
3792 fn control_handle(&self) -> &ShutdownWatcherRegisterControlHandle {
3793 &self.control_handle
3794 }
3795
3796 fn drop_without_shutdown(mut self) {
3797 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3799 std::mem::forget(self);
3801 }
3802}
3803
3804impl ShutdownWatcherRegisterRegisterWatcherResponder {
3805 pub fn send(self) -> Result<(), fidl::Error> {
3809 let _result = self.send_raw();
3810 if _result.is_err() {
3811 self.control_handle.shutdown();
3812 }
3813 self.drop_without_shutdown();
3814 _result
3815 }
3816
3817 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3819 let _result = self.send_raw();
3820 self.drop_without_shutdown();
3821 _result
3822 }
3823
3824 fn send_raw(&self) -> Result<(), fidl::Error> {
3825 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3826 fidl::encoding::Flexible::new(()),
3827 self.tx_id,
3828 0x3db6ce5d34810aff,
3829 fidl::encoding::DynamicFlags::FLEXIBLE,
3830 )
3831 }
3832}
3833
3834#[must_use = "FIDL methods require a response to be sent"]
3835#[derive(Debug)]
3836pub struct ShutdownWatcherRegisterRegisterTerminalStateWatcherResponder {
3837 control_handle: std::mem::ManuallyDrop<ShutdownWatcherRegisterControlHandle>,
3838 tx_id: u32,
3839}
3840
3841impl std::ops::Drop for ShutdownWatcherRegisterRegisterTerminalStateWatcherResponder {
3845 fn drop(&mut self) {
3846 self.control_handle.shutdown();
3847 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3849 }
3850}
3851
3852impl fidl::endpoints::Responder for ShutdownWatcherRegisterRegisterTerminalStateWatcherResponder {
3853 type ControlHandle = ShutdownWatcherRegisterControlHandle;
3854
3855 fn control_handle(&self) -> &ShutdownWatcherRegisterControlHandle {
3856 &self.control_handle
3857 }
3858
3859 fn drop_without_shutdown(mut self) {
3860 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3862 std::mem::forget(self);
3864 }
3865}
3866
3867impl ShutdownWatcherRegisterRegisterTerminalStateWatcherResponder {
3868 pub fn send(self) -> Result<(), fidl::Error> {
3872 let _result = self.send_raw();
3873 if _result.is_err() {
3874 self.control_handle.shutdown();
3875 }
3876 self.drop_without_shutdown();
3877 _result
3878 }
3879
3880 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3882 let _result = self.send_raw();
3883 self.drop_without_shutdown();
3884 _result
3885 }
3886
3887 fn send_raw(&self) -> Result<(), fidl::Error> {
3888 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3889 fidl::encoding::Flexible::new(()),
3890 self.tx_id,
3891 0x1cce7216bb7869fc,
3892 fidl::encoding::DynamicFlags::FLEXIBLE,
3893 )
3894 }
3895}
3896
3897#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3898pub struct TerminalStateWatcherMarker;
3899
3900impl fidl::endpoints::ProtocolMarker for TerminalStateWatcherMarker {
3901 type Proxy = TerminalStateWatcherProxy;
3902 type RequestStream = TerminalStateWatcherRequestStream;
3903 #[cfg(target_os = "fuchsia")]
3904 type SynchronousProxy = TerminalStateWatcherSynchronousProxy;
3905
3906 const DEBUG_NAME: &'static str = "(anonymous) TerminalStateWatcher";
3907}
3908
3909pub trait TerminalStateWatcherProxyInterface: Send + Sync {
3910 type OnTerminalStateTransitionStartedResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
3911 + Send;
3912 fn r#on_terminal_state_transition_started(
3913 &self,
3914 ) -> Self::OnTerminalStateTransitionStartedResponseFut;
3915}
3916#[derive(Debug)]
3917#[cfg(target_os = "fuchsia")]
3918pub struct TerminalStateWatcherSynchronousProxy {
3919 client: fidl::client::sync::Client,
3920}
3921
3922#[cfg(target_os = "fuchsia")]
3923impl fidl::endpoints::SynchronousProxy for TerminalStateWatcherSynchronousProxy {
3924 type Proxy = TerminalStateWatcherProxy;
3925 type Protocol = TerminalStateWatcherMarker;
3926
3927 fn from_channel(inner: fidl::Channel) -> Self {
3928 Self::new(inner)
3929 }
3930
3931 fn into_channel(self) -> fidl::Channel {
3932 self.client.into_channel()
3933 }
3934
3935 fn as_channel(&self) -> &fidl::Channel {
3936 self.client.as_channel()
3937 }
3938}
3939
3940#[cfg(target_os = "fuchsia")]
3941impl TerminalStateWatcherSynchronousProxy {
3942 pub fn new(channel: fidl::Channel) -> Self {
3943 let protocol_name =
3944 <TerminalStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3945 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3946 }
3947
3948 pub fn into_channel(self) -> fidl::Channel {
3949 self.client.into_channel()
3950 }
3951
3952 pub fn wait_for_event(
3955 &self,
3956 deadline: zx::MonotonicInstant,
3957 ) -> Result<TerminalStateWatcherEvent, fidl::Error> {
3958 TerminalStateWatcherEvent::decode(self.client.wait_for_event(deadline)?)
3959 }
3960
3961 pub fn r#on_terminal_state_transition_started(
3962 &self,
3963 ___deadline: zx::MonotonicInstant,
3964 ) -> Result<(), fidl::Error> {
3965 let _response = self.client.send_query::<
3966 fidl::encoding::EmptyPayload,
3967 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3968 >(
3969 (),
3970 0x25d95d9d1ae60f10,
3971 fidl::encoding::DynamicFlags::FLEXIBLE,
3972 ___deadline,
3973 )?
3974 .into_result::<TerminalStateWatcherMarker>("on_terminal_state_transition_started")?;
3975 Ok(_response)
3976 }
3977}
3978
3979#[cfg(target_os = "fuchsia")]
3980impl From<TerminalStateWatcherSynchronousProxy> for zx::NullableHandle {
3981 fn from(value: TerminalStateWatcherSynchronousProxy) -> Self {
3982 value.into_channel().into()
3983 }
3984}
3985
3986#[cfg(target_os = "fuchsia")]
3987impl From<fidl::Channel> for TerminalStateWatcherSynchronousProxy {
3988 fn from(value: fidl::Channel) -> Self {
3989 Self::new(value)
3990 }
3991}
3992
3993#[cfg(target_os = "fuchsia")]
3994impl fidl::endpoints::FromClient for TerminalStateWatcherSynchronousProxy {
3995 type Protocol = TerminalStateWatcherMarker;
3996
3997 fn from_client(value: fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>) -> Self {
3998 Self::new(value.into_channel())
3999 }
4000}
4001
4002#[derive(Debug, Clone)]
4003pub struct TerminalStateWatcherProxy {
4004 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4005}
4006
4007impl fidl::endpoints::Proxy for TerminalStateWatcherProxy {
4008 type Protocol = TerminalStateWatcherMarker;
4009
4010 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4011 Self::new(inner)
4012 }
4013
4014 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4015 self.client.into_channel().map_err(|client| Self { client })
4016 }
4017
4018 fn as_channel(&self) -> &::fidl::AsyncChannel {
4019 self.client.as_channel()
4020 }
4021}
4022
4023impl TerminalStateWatcherProxy {
4024 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4026 let protocol_name =
4027 <TerminalStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4028 Self { client: fidl::client::Client::new(channel, protocol_name) }
4029 }
4030
4031 pub fn take_event_stream(&self) -> TerminalStateWatcherEventStream {
4037 TerminalStateWatcherEventStream { event_receiver: self.client.take_event_receiver() }
4038 }
4039
4040 pub fn r#on_terminal_state_transition_started(
4041 &self,
4042 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4043 TerminalStateWatcherProxyInterface::r#on_terminal_state_transition_started(self)
4044 }
4045}
4046
4047impl TerminalStateWatcherProxyInterface for TerminalStateWatcherProxy {
4048 type OnTerminalStateTransitionStartedResponseFut =
4049 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4050 fn r#on_terminal_state_transition_started(
4051 &self,
4052 ) -> Self::OnTerminalStateTransitionStartedResponseFut {
4053 fn _decode(
4054 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4055 ) -> Result<(), fidl::Error> {
4056 let _response = fidl::client::decode_transaction_body::<
4057 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
4058 fidl::encoding::DefaultFuchsiaResourceDialect,
4059 0x25d95d9d1ae60f10,
4060 >(_buf?)?
4061 .into_result::<TerminalStateWatcherMarker>("on_terminal_state_transition_started")?;
4062 Ok(_response)
4063 }
4064 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
4065 (),
4066 0x25d95d9d1ae60f10,
4067 fidl::encoding::DynamicFlags::FLEXIBLE,
4068 _decode,
4069 )
4070 }
4071}
4072
4073pub struct TerminalStateWatcherEventStream {
4074 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4075}
4076
4077impl std::marker::Unpin for TerminalStateWatcherEventStream {}
4078
4079impl futures::stream::FusedStream for TerminalStateWatcherEventStream {
4080 fn is_terminated(&self) -> bool {
4081 self.event_receiver.is_terminated()
4082 }
4083}
4084
4085impl futures::Stream for TerminalStateWatcherEventStream {
4086 type Item = Result<TerminalStateWatcherEvent, fidl::Error>;
4087
4088 fn poll_next(
4089 mut self: std::pin::Pin<&mut Self>,
4090 cx: &mut std::task::Context<'_>,
4091 ) -> std::task::Poll<Option<Self::Item>> {
4092 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4093 &mut self.event_receiver,
4094 cx
4095 )?) {
4096 Some(buf) => std::task::Poll::Ready(Some(TerminalStateWatcherEvent::decode(buf))),
4097 None => std::task::Poll::Ready(None),
4098 }
4099 }
4100}
4101
4102#[derive(Debug)]
4103pub enum TerminalStateWatcherEvent {
4104 #[non_exhaustive]
4105 _UnknownEvent {
4106 ordinal: u64,
4108 },
4109}
4110
4111impl TerminalStateWatcherEvent {
4112 fn decode(
4114 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4115 ) -> Result<TerminalStateWatcherEvent, fidl::Error> {
4116 let (bytes, _handles) = buf.split_mut();
4117 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4118 debug_assert_eq!(tx_header.tx_id, 0);
4119 match tx_header.ordinal {
4120 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4121 Ok(TerminalStateWatcherEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4122 }
4123 _ => Err(fidl::Error::UnknownOrdinal {
4124 ordinal: tx_header.ordinal,
4125 protocol_name:
4126 <TerminalStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4127 }),
4128 }
4129 }
4130}
4131
4132pub struct TerminalStateWatcherRequestStream {
4134 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4135 is_terminated: bool,
4136}
4137
4138impl std::marker::Unpin for TerminalStateWatcherRequestStream {}
4139
4140impl futures::stream::FusedStream for TerminalStateWatcherRequestStream {
4141 fn is_terminated(&self) -> bool {
4142 self.is_terminated
4143 }
4144}
4145
4146impl fidl::endpoints::RequestStream for TerminalStateWatcherRequestStream {
4147 type Protocol = TerminalStateWatcherMarker;
4148 type ControlHandle = TerminalStateWatcherControlHandle;
4149
4150 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4151 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4152 }
4153
4154 fn control_handle(&self) -> Self::ControlHandle {
4155 TerminalStateWatcherControlHandle { inner: self.inner.clone() }
4156 }
4157
4158 fn into_inner(
4159 self,
4160 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4161 {
4162 (self.inner, self.is_terminated)
4163 }
4164
4165 fn from_inner(
4166 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4167 is_terminated: bool,
4168 ) -> Self {
4169 Self { inner, is_terminated }
4170 }
4171}
4172
4173impl futures::Stream for TerminalStateWatcherRequestStream {
4174 type Item = Result<TerminalStateWatcherRequest, fidl::Error>;
4175
4176 fn poll_next(
4177 mut self: std::pin::Pin<&mut Self>,
4178 cx: &mut std::task::Context<'_>,
4179 ) -> std::task::Poll<Option<Self::Item>> {
4180 let this = &mut *self;
4181 if this.inner.check_shutdown(cx) {
4182 this.is_terminated = true;
4183 return std::task::Poll::Ready(None);
4184 }
4185 if this.is_terminated {
4186 panic!("polled TerminalStateWatcherRequestStream after completion");
4187 }
4188 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4189 |bytes, handles| {
4190 match this.inner.channel().read_etc(cx, bytes, handles) {
4191 std::task::Poll::Ready(Ok(())) => {}
4192 std::task::Poll::Pending => return std::task::Poll::Pending,
4193 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4194 this.is_terminated = true;
4195 return std::task::Poll::Ready(None);
4196 }
4197 std::task::Poll::Ready(Err(e)) => {
4198 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4199 e.into(),
4200 ))));
4201 }
4202 }
4203
4204 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4206
4207 std::task::Poll::Ready(Some(match header.ordinal {
4208 0x25d95d9d1ae60f10 => {
4209 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4210 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
4211 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4212 let control_handle = TerminalStateWatcherControlHandle {
4213 inner: this.inner.clone(),
4214 };
4215 Ok(TerminalStateWatcherRequest::OnTerminalStateTransitionStarted {
4216 responder: TerminalStateWatcherOnTerminalStateTransitionStartedResponder {
4217 control_handle: std::mem::ManuallyDrop::new(control_handle),
4218 tx_id: header.tx_id,
4219 },
4220 })
4221 }
4222 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4223 Ok(TerminalStateWatcherRequest::_UnknownMethod {
4224 ordinal: header.ordinal,
4225 control_handle: TerminalStateWatcherControlHandle { inner: this.inner.clone() },
4226 method_type: fidl::MethodType::OneWay,
4227 })
4228 }
4229 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4230 this.inner.send_framework_err(
4231 fidl::encoding::FrameworkErr::UnknownMethod,
4232 header.tx_id,
4233 header.ordinal,
4234 header.dynamic_flags(),
4235 (bytes, handles),
4236 )?;
4237 Ok(TerminalStateWatcherRequest::_UnknownMethod {
4238 ordinal: header.ordinal,
4239 control_handle: TerminalStateWatcherControlHandle { inner: this.inner.clone() },
4240 method_type: fidl::MethodType::TwoWay,
4241 })
4242 }
4243 _ => Err(fidl::Error::UnknownOrdinal {
4244 ordinal: header.ordinal,
4245 protocol_name: <TerminalStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4246 }),
4247 }))
4248 },
4249 )
4250 }
4251}
4252
4253#[derive(Debug)]
4259pub enum TerminalStateWatcherRequest {
4260 OnTerminalStateTransitionStarted {
4261 responder: TerminalStateWatcherOnTerminalStateTransitionStartedResponder,
4262 },
4263 #[non_exhaustive]
4265 _UnknownMethod {
4266 ordinal: u64,
4268 control_handle: TerminalStateWatcherControlHandle,
4269 method_type: fidl::MethodType,
4270 },
4271}
4272
4273impl TerminalStateWatcherRequest {
4274 #[allow(irrefutable_let_patterns)]
4275 pub fn into_on_terminal_state_transition_started(
4276 self,
4277 ) -> Option<(TerminalStateWatcherOnTerminalStateTransitionStartedResponder)> {
4278 if let TerminalStateWatcherRequest::OnTerminalStateTransitionStarted { responder } = self {
4279 Some((responder))
4280 } else {
4281 None
4282 }
4283 }
4284
4285 pub fn method_name(&self) -> &'static str {
4287 match *self {
4288 TerminalStateWatcherRequest::OnTerminalStateTransitionStarted { .. } => {
4289 "on_terminal_state_transition_started"
4290 }
4291 TerminalStateWatcherRequest::_UnknownMethod {
4292 method_type: fidl::MethodType::OneWay,
4293 ..
4294 } => "unknown one-way method",
4295 TerminalStateWatcherRequest::_UnknownMethod {
4296 method_type: fidl::MethodType::TwoWay,
4297 ..
4298 } => "unknown two-way method",
4299 }
4300 }
4301}
4302
4303#[derive(Debug, Clone)]
4304pub struct TerminalStateWatcherControlHandle {
4305 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4306}
4307
4308impl fidl::endpoints::ControlHandle for TerminalStateWatcherControlHandle {
4309 fn shutdown(&self) {
4310 self.inner.shutdown()
4311 }
4312
4313 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4314 self.inner.shutdown_with_epitaph(status)
4315 }
4316
4317 fn is_closed(&self) -> bool {
4318 self.inner.channel().is_closed()
4319 }
4320 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4321 self.inner.channel().on_closed()
4322 }
4323
4324 #[cfg(target_os = "fuchsia")]
4325 fn signal_peer(
4326 &self,
4327 clear_mask: zx::Signals,
4328 set_mask: zx::Signals,
4329 ) -> Result<(), zx_status::Status> {
4330 use fidl::Peered;
4331 self.inner.channel().signal_peer(clear_mask, set_mask)
4332 }
4333}
4334
4335impl TerminalStateWatcherControlHandle {}
4336
4337#[must_use = "FIDL methods require a response to be sent"]
4338#[derive(Debug)]
4339pub struct TerminalStateWatcherOnTerminalStateTransitionStartedResponder {
4340 control_handle: std::mem::ManuallyDrop<TerminalStateWatcherControlHandle>,
4341 tx_id: u32,
4342}
4343
4344impl std::ops::Drop for TerminalStateWatcherOnTerminalStateTransitionStartedResponder {
4348 fn drop(&mut self) {
4349 self.control_handle.shutdown();
4350 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4352 }
4353}
4354
4355impl fidl::endpoints::Responder for TerminalStateWatcherOnTerminalStateTransitionStartedResponder {
4356 type ControlHandle = TerminalStateWatcherControlHandle;
4357
4358 fn control_handle(&self) -> &TerminalStateWatcherControlHandle {
4359 &self.control_handle
4360 }
4361
4362 fn drop_without_shutdown(mut self) {
4363 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4365 std::mem::forget(self);
4367 }
4368}
4369
4370impl TerminalStateWatcherOnTerminalStateTransitionStartedResponder {
4371 pub fn send(self) -> Result<(), fidl::Error> {
4375 let _result = self.send_raw();
4376 if _result.is_err() {
4377 self.control_handle.shutdown();
4378 }
4379 self.drop_without_shutdown();
4380 _result
4381 }
4382
4383 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4385 let _result = self.send_raw();
4386 self.drop_without_shutdown();
4387 _result
4388 }
4389
4390 fn send_raw(&self) -> Result<(), fidl::Error> {
4391 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
4392 fidl::encoding::Flexible::new(()),
4393 self.tx_id,
4394 0x25d95d9d1ae60f10,
4395 fidl::encoding::DynamicFlags::FLEXIBLE,
4396 )
4397 }
4398}
4399
4400mod internal {
4401 use super::*;
4402
4403 impl fidl::encoding::ResourceTypeMarker for AdminMexecRequest {
4404 type Borrowed<'a> = &'a mut Self;
4405 fn take_or_borrow<'a>(
4406 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4407 ) -> Self::Borrowed<'a> {
4408 value
4409 }
4410 }
4411
4412 unsafe impl fidl::encoding::TypeMarker for AdminMexecRequest {
4413 type Owned = Self;
4414
4415 #[inline(always)]
4416 fn inline_align(_context: fidl::encoding::Context) -> usize {
4417 4
4418 }
4419
4420 #[inline(always)]
4421 fn inline_size(_context: fidl::encoding::Context) -> usize {
4422 8
4423 }
4424 }
4425
4426 unsafe impl
4427 fidl::encoding::Encode<AdminMexecRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4428 for &mut AdminMexecRequest
4429 {
4430 #[inline]
4431 unsafe fn encode(
4432 self,
4433 encoder: &mut fidl::encoding::Encoder<
4434 '_,
4435 fidl::encoding::DefaultFuchsiaResourceDialect,
4436 >,
4437 offset: usize,
4438 _depth: fidl::encoding::Depth,
4439 ) -> fidl::Result<()> {
4440 encoder.debug_check_bounds::<AdminMexecRequest>(offset);
4441 fidl::encoding::Encode::<AdminMexecRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4443 (
4444 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.kernel_zbi),
4445 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.data_zbi),
4446 ),
4447 encoder, offset, _depth
4448 )
4449 }
4450 }
4451 unsafe impl<
4452 T0: fidl::encoding::Encode<
4453 fidl::encoding::HandleType<
4454 fidl::Vmo,
4455 { fidl::ObjectType::VMO.into_raw() },
4456 2147483648,
4457 >,
4458 fidl::encoding::DefaultFuchsiaResourceDialect,
4459 >,
4460 T1: fidl::encoding::Encode<
4461 fidl::encoding::HandleType<
4462 fidl::Vmo,
4463 { fidl::ObjectType::VMO.into_raw() },
4464 2147483648,
4465 >,
4466 fidl::encoding::DefaultFuchsiaResourceDialect,
4467 >,
4468 > fidl::encoding::Encode<AdminMexecRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4469 for (T0, T1)
4470 {
4471 #[inline]
4472 unsafe fn encode(
4473 self,
4474 encoder: &mut fidl::encoding::Encoder<
4475 '_,
4476 fidl::encoding::DefaultFuchsiaResourceDialect,
4477 >,
4478 offset: usize,
4479 depth: fidl::encoding::Depth,
4480 ) -> fidl::Result<()> {
4481 encoder.debug_check_bounds::<AdminMexecRequest>(offset);
4482 self.0.encode(encoder, offset + 0, depth)?;
4486 self.1.encode(encoder, offset + 4, depth)?;
4487 Ok(())
4488 }
4489 }
4490
4491 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4492 for AdminMexecRequest
4493 {
4494 #[inline(always)]
4495 fn new_empty() -> Self {
4496 Self {
4497 kernel_zbi: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4498 data_zbi: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4499 }
4500 }
4501
4502 #[inline]
4503 unsafe fn decode(
4504 &mut self,
4505 decoder: &mut fidl::encoding::Decoder<
4506 '_,
4507 fidl::encoding::DefaultFuchsiaResourceDialect,
4508 >,
4509 offset: usize,
4510 _depth: fidl::encoding::Depth,
4511 ) -> fidl::Result<()> {
4512 decoder.debug_check_bounds::<Self>(offset);
4513 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.kernel_zbi, decoder, offset + 0, _depth)?;
4515 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.data_zbi, decoder, offset + 4, _depth)?;
4516 Ok(())
4517 }
4518 }
4519
4520 impl fidl::encoding::ResourceTypeMarker for RebootMethodsWatcherRegisterRegisterWatcherRequest {
4521 type Borrowed<'a> = &'a mut Self;
4522 fn take_or_borrow<'a>(
4523 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4524 ) -> Self::Borrowed<'a> {
4525 value
4526 }
4527 }
4528
4529 unsafe impl fidl::encoding::TypeMarker for RebootMethodsWatcherRegisterRegisterWatcherRequest {
4530 type Owned = Self;
4531
4532 #[inline(always)]
4533 fn inline_align(_context: fidl::encoding::Context) -> usize {
4534 4
4535 }
4536
4537 #[inline(always)]
4538 fn inline_size(_context: fidl::encoding::Context) -> usize {
4539 4
4540 }
4541 }
4542
4543 unsafe impl
4544 fidl::encoding::Encode<
4545 RebootMethodsWatcherRegisterRegisterWatcherRequest,
4546 fidl::encoding::DefaultFuchsiaResourceDialect,
4547 > for &mut RebootMethodsWatcherRegisterRegisterWatcherRequest
4548 {
4549 #[inline]
4550 unsafe fn encode(
4551 self,
4552 encoder: &mut fidl::encoding::Encoder<
4553 '_,
4554 fidl::encoding::DefaultFuchsiaResourceDialect,
4555 >,
4556 offset: usize,
4557 _depth: fidl::encoding::Depth,
4558 ) -> fidl::Result<()> {
4559 encoder
4560 .debug_check_bounds::<RebootMethodsWatcherRegisterRegisterWatcherRequest>(offset);
4561 fidl::encoding::Encode::<RebootMethodsWatcherRegisterRegisterWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4563 (
4564 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
4565 ),
4566 encoder, offset, _depth
4567 )
4568 }
4569 }
4570 unsafe impl<
4571 T0: fidl::encoding::Encode<
4572 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootWatcherMarker>>,
4573 fidl::encoding::DefaultFuchsiaResourceDialect,
4574 >,
4575 >
4576 fidl::encoding::Encode<
4577 RebootMethodsWatcherRegisterRegisterWatcherRequest,
4578 fidl::encoding::DefaultFuchsiaResourceDialect,
4579 > for (T0,)
4580 {
4581 #[inline]
4582 unsafe fn encode(
4583 self,
4584 encoder: &mut fidl::encoding::Encoder<
4585 '_,
4586 fidl::encoding::DefaultFuchsiaResourceDialect,
4587 >,
4588 offset: usize,
4589 depth: fidl::encoding::Depth,
4590 ) -> fidl::Result<()> {
4591 encoder
4592 .debug_check_bounds::<RebootMethodsWatcherRegisterRegisterWatcherRequest>(offset);
4593 self.0.encode(encoder, offset + 0, depth)?;
4597 Ok(())
4598 }
4599 }
4600
4601 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4602 for RebootMethodsWatcherRegisterRegisterWatcherRequest
4603 {
4604 #[inline(always)]
4605 fn new_empty() -> Self {
4606 Self {
4607 watcher: fidl::new_empty!(
4608 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootWatcherMarker>>,
4609 fidl::encoding::DefaultFuchsiaResourceDialect
4610 ),
4611 }
4612 }
4613
4614 #[inline]
4615 unsafe fn decode(
4616 &mut self,
4617 decoder: &mut fidl::encoding::Decoder<
4618 '_,
4619 fidl::encoding::DefaultFuchsiaResourceDialect,
4620 >,
4621 offset: usize,
4622 _depth: fidl::encoding::Depth,
4623 ) -> fidl::Result<()> {
4624 decoder.debug_check_bounds::<Self>(offset);
4625 fidl::decode!(
4627 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootWatcherMarker>>,
4628 fidl::encoding::DefaultFuchsiaResourceDialect,
4629 &mut self.watcher,
4630 decoder,
4631 offset + 0,
4632 _depth
4633 )?;
4634 Ok(())
4635 }
4636 }
4637
4638 impl fidl::encoding::ResourceTypeMarker
4639 for ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest
4640 {
4641 type Borrowed<'a> = &'a mut Self;
4642 fn take_or_borrow<'a>(
4643 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4644 ) -> Self::Borrowed<'a> {
4645 value
4646 }
4647 }
4648
4649 unsafe impl fidl::encoding::TypeMarker
4650 for ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest
4651 {
4652 type Owned = Self;
4653
4654 #[inline(always)]
4655 fn inline_align(_context: fidl::encoding::Context) -> usize {
4656 4
4657 }
4658
4659 #[inline(always)]
4660 fn inline_size(_context: fidl::encoding::Context) -> usize {
4661 4
4662 }
4663 }
4664
4665 unsafe impl
4666 fidl::encoding::Encode<
4667 ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest,
4668 fidl::encoding::DefaultFuchsiaResourceDialect,
4669 > for &mut ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest
4670 {
4671 #[inline]
4672 unsafe fn encode(
4673 self,
4674 encoder: &mut fidl::encoding::Encoder<
4675 '_,
4676 fidl::encoding::DefaultFuchsiaResourceDialect,
4677 >,
4678 offset: usize,
4679 _depth: fidl::encoding::Depth,
4680 ) -> fidl::Result<()> {
4681 encoder
4682 .debug_check_bounds::<ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest>(
4683 offset,
4684 );
4685 fidl::encoding::Encode::<
4687 ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest,
4688 fidl::encoding::DefaultFuchsiaResourceDialect,
4689 >::encode(
4690 (
4691 <fidl::encoding::Endpoint<
4692 fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>,
4693 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4694 &mut self.watcher
4695 ),
4696 ),
4697 encoder,
4698 offset,
4699 _depth,
4700 )
4701 }
4702 }
4703 unsafe impl<
4704 T0: fidl::encoding::Encode<
4705 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>>,
4706 fidl::encoding::DefaultFuchsiaResourceDialect,
4707 >,
4708 >
4709 fidl::encoding::Encode<
4710 ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest,
4711 fidl::encoding::DefaultFuchsiaResourceDialect,
4712 > for (T0,)
4713 {
4714 #[inline]
4715 unsafe fn encode(
4716 self,
4717 encoder: &mut fidl::encoding::Encoder<
4718 '_,
4719 fidl::encoding::DefaultFuchsiaResourceDialect,
4720 >,
4721 offset: usize,
4722 depth: fidl::encoding::Depth,
4723 ) -> fidl::Result<()> {
4724 encoder
4725 .debug_check_bounds::<ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest>(
4726 offset,
4727 );
4728 self.0.encode(encoder, offset + 0, depth)?;
4732 Ok(())
4733 }
4734 }
4735
4736 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4737 for ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest
4738 {
4739 #[inline(always)]
4740 fn new_empty() -> Self {
4741 Self {
4742 watcher: fidl::new_empty!(
4743 fidl::encoding::Endpoint<
4744 fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>,
4745 >,
4746 fidl::encoding::DefaultFuchsiaResourceDialect
4747 ),
4748 }
4749 }
4750
4751 #[inline]
4752 unsafe fn decode(
4753 &mut self,
4754 decoder: &mut fidl::encoding::Decoder<
4755 '_,
4756 fidl::encoding::DefaultFuchsiaResourceDialect,
4757 >,
4758 offset: usize,
4759 _depth: fidl::encoding::Depth,
4760 ) -> fidl::Result<()> {
4761 decoder.debug_check_bounds::<Self>(offset);
4762 fidl::decode!(
4764 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>>,
4765 fidl::encoding::DefaultFuchsiaResourceDialect,
4766 &mut self.watcher,
4767 decoder,
4768 offset + 0,
4769 _depth
4770 )?;
4771 Ok(())
4772 }
4773 }
4774
4775 impl fidl::encoding::ResourceTypeMarker for ShutdownWatcherRegisterRegisterWatcherRequest {
4776 type Borrowed<'a> = &'a mut Self;
4777 fn take_or_borrow<'a>(
4778 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4779 ) -> Self::Borrowed<'a> {
4780 value
4781 }
4782 }
4783
4784 unsafe impl fidl::encoding::TypeMarker for ShutdownWatcherRegisterRegisterWatcherRequest {
4785 type Owned = Self;
4786
4787 #[inline(always)]
4788 fn inline_align(_context: fidl::encoding::Context) -> usize {
4789 4
4790 }
4791
4792 #[inline(always)]
4793 fn inline_size(_context: fidl::encoding::Context) -> usize {
4794 4
4795 }
4796 }
4797
4798 unsafe impl
4799 fidl::encoding::Encode<
4800 ShutdownWatcherRegisterRegisterWatcherRequest,
4801 fidl::encoding::DefaultFuchsiaResourceDialect,
4802 > for &mut ShutdownWatcherRegisterRegisterWatcherRequest
4803 {
4804 #[inline]
4805 unsafe fn encode(
4806 self,
4807 encoder: &mut fidl::encoding::Encoder<
4808 '_,
4809 fidl::encoding::DefaultFuchsiaResourceDialect,
4810 >,
4811 offset: usize,
4812 _depth: fidl::encoding::Depth,
4813 ) -> fidl::Result<()> {
4814 encoder.debug_check_bounds::<ShutdownWatcherRegisterRegisterWatcherRequest>(offset);
4815 fidl::encoding::Encode::<ShutdownWatcherRegisterRegisterWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4817 (
4818 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ShutdownWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
4819 ),
4820 encoder, offset, _depth
4821 )
4822 }
4823 }
4824 unsafe impl<
4825 T0: fidl::encoding::Encode<
4826 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ShutdownWatcherMarker>>,
4827 fidl::encoding::DefaultFuchsiaResourceDialect,
4828 >,
4829 >
4830 fidl::encoding::Encode<
4831 ShutdownWatcherRegisterRegisterWatcherRequest,
4832 fidl::encoding::DefaultFuchsiaResourceDialect,
4833 > for (T0,)
4834 {
4835 #[inline]
4836 unsafe fn encode(
4837 self,
4838 encoder: &mut fidl::encoding::Encoder<
4839 '_,
4840 fidl::encoding::DefaultFuchsiaResourceDialect,
4841 >,
4842 offset: usize,
4843 depth: fidl::encoding::Depth,
4844 ) -> fidl::Result<()> {
4845 encoder.debug_check_bounds::<ShutdownWatcherRegisterRegisterWatcherRequest>(offset);
4846 self.0.encode(encoder, offset + 0, depth)?;
4850 Ok(())
4851 }
4852 }
4853
4854 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4855 for ShutdownWatcherRegisterRegisterWatcherRequest
4856 {
4857 #[inline(always)]
4858 fn new_empty() -> Self {
4859 Self {
4860 watcher: fidl::new_empty!(
4861 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ShutdownWatcherMarker>>,
4862 fidl::encoding::DefaultFuchsiaResourceDialect
4863 ),
4864 }
4865 }
4866
4867 #[inline]
4868 unsafe fn decode(
4869 &mut self,
4870 decoder: &mut fidl::encoding::Decoder<
4871 '_,
4872 fidl::encoding::DefaultFuchsiaResourceDialect,
4873 >,
4874 offset: usize,
4875 _depth: fidl::encoding::Depth,
4876 ) -> fidl::Result<()> {
4877 decoder.debug_check_bounds::<Self>(offset);
4878 fidl::decode!(
4880 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ShutdownWatcherMarker>>,
4881 fidl::encoding::DefaultFuchsiaResourceDialect,
4882 &mut self.watcher,
4883 decoder,
4884 offset + 0,
4885 _depth
4886 )?;
4887 Ok(())
4888 }
4889 }
4890}