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