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 AdminControlHandle {
1117 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1118 self.inner.shutdown_with_epitaph(status.into())
1119 }
1120}
1121
1122impl fidl::endpoints::ControlHandle for AdminControlHandle {
1123 fn shutdown(&self) {
1124 self.inner.shutdown()
1125 }
1126
1127 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1128 self.inner.shutdown_with_epitaph(status)
1129 }
1130
1131 fn is_closed(&self) -> bool {
1132 self.inner.channel().is_closed()
1133 }
1134 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1135 self.inner.channel().on_closed()
1136 }
1137
1138 #[cfg(target_os = "fuchsia")]
1139 fn signal_peer(
1140 &self,
1141 clear_mask: zx::Signals,
1142 set_mask: zx::Signals,
1143 ) -> Result<(), zx_status::Status> {
1144 use fidl::Peered;
1145 self.inner.channel().signal_peer(clear_mask, set_mask)
1146 }
1147}
1148
1149impl AdminControlHandle {}
1150
1151#[must_use = "FIDL methods require a response to be sent"]
1152#[derive(Debug)]
1153pub struct AdminPowerFullyOnResponder {
1154 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1155 tx_id: u32,
1156}
1157
1158impl std::ops::Drop for AdminPowerFullyOnResponder {
1162 fn drop(&mut self) {
1163 self.control_handle.shutdown();
1164 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1166 }
1167}
1168
1169impl fidl::endpoints::Responder for AdminPowerFullyOnResponder {
1170 type ControlHandle = AdminControlHandle;
1171
1172 fn control_handle(&self) -> &AdminControlHandle {
1173 &self.control_handle
1174 }
1175
1176 fn drop_without_shutdown(mut self) {
1177 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1179 std::mem::forget(self);
1181 }
1182}
1183
1184impl AdminPowerFullyOnResponder {
1185 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1189 let _result = self.send_raw(result);
1190 if _result.is_err() {
1191 self.control_handle.shutdown();
1192 }
1193 self.drop_without_shutdown();
1194 _result
1195 }
1196
1197 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1199 let _result = self.send_raw(result);
1200 self.drop_without_shutdown();
1201 _result
1202 }
1203
1204 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1205 self.control_handle
1206 .inner
1207 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1208 result,
1209 self.tx_id,
1210 0xb3272d15e00712f,
1211 fidl::encoding::DynamicFlags::empty(),
1212 )
1213 }
1214}
1215
1216#[must_use = "FIDL methods require a response to be sent"]
1217#[derive(Debug)]
1218pub struct AdminShutdownResponder {
1219 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1220 tx_id: u32,
1221}
1222
1223impl std::ops::Drop for AdminShutdownResponder {
1227 fn drop(&mut self) {
1228 self.control_handle.shutdown();
1229 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1231 }
1232}
1233
1234impl fidl::endpoints::Responder for AdminShutdownResponder {
1235 type ControlHandle = AdminControlHandle;
1236
1237 fn control_handle(&self) -> &AdminControlHandle {
1238 &self.control_handle
1239 }
1240
1241 fn drop_without_shutdown(mut self) {
1242 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1244 std::mem::forget(self);
1246 }
1247}
1248
1249impl AdminShutdownResponder {
1250 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1254 let _result = self.send_raw(result);
1255 if _result.is_err() {
1256 self.control_handle.shutdown();
1257 }
1258 self.drop_without_shutdown();
1259 _result
1260 }
1261
1262 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1264 let _result = self.send_raw(result);
1265 self.drop_without_shutdown();
1266 _result
1267 }
1268
1269 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1270 self.control_handle
1271 .inner
1272 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1273 result,
1274 self.tx_id,
1275 0x3722c53e45dc022f,
1276 fidl::encoding::DynamicFlags::empty(),
1277 )
1278 }
1279}
1280
1281#[must_use = "FIDL methods require a response to be sent"]
1282#[derive(Debug)]
1283pub struct AdminPerformRebootResponder {
1284 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1285 tx_id: u32,
1286}
1287
1288impl std::ops::Drop for AdminPerformRebootResponder {
1292 fn drop(&mut self) {
1293 self.control_handle.shutdown();
1294 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1296 }
1297}
1298
1299impl fidl::endpoints::Responder for AdminPerformRebootResponder {
1300 type ControlHandle = AdminControlHandle;
1301
1302 fn control_handle(&self) -> &AdminControlHandle {
1303 &self.control_handle
1304 }
1305
1306 fn drop_without_shutdown(mut self) {
1307 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1309 std::mem::forget(self);
1311 }
1312}
1313
1314impl AdminPerformRebootResponder {
1315 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1319 let _result = self.send_raw(result);
1320 if _result.is_err() {
1321 self.control_handle.shutdown();
1322 }
1323 self.drop_without_shutdown();
1324 _result
1325 }
1326
1327 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1329 let _result = self.send_raw(result);
1330 self.drop_without_shutdown();
1331 _result
1332 }
1333
1334 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1335 self.control_handle
1336 .inner
1337 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1338 result,
1339 self.tx_id,
1340 0x9416b4d36a80b4,
1341 fidl::encoding::DynamicFlags::empty(),
1342 )
1343 }
1344}
1345
1346#[must_use = "FIDL methods require a response to be sent"]
1347#[derive(Debug)]
1348pub struct AdminRebootToBootloaderResponder {
1349 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1350 tx_id: u32,
1351}
1352
1353impl std::ops::Drop for AdminRebootToBootloaderResponder {
1357 fn drop(&mut self) {
1358 self.control_handle.shutdown();
1359 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1361 }
1362}
1363
1364impl fidl::endpoints::Responder for AdminRebootToBootloaderResponder {
1365 type ControlHandle = AdminControlHandle;
1366
1367 fn control_handle(&self) -> &AdminControlHandle {
1368 &self.control_handle
1369 }
1370
1371 fn drop_without_shutdown(mut self) {
1372 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1374 std::mem::forget(self);
1376 }
1377}
1378
1379impl AdminRebootToBootloaderResponder {
1380 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1384 let _result = self.send_raw(result);
1385 if _result.is_err() {
1386 self.control_handle.shutdown();
1387 }
1388 self.drop_without_shutdown();
1389 _result
1390 }
1391
1392 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1394 let _result = self.send_raw(result);
1395 self.drop_without_shutdown();
1396 _result
1397 }
1398
1399 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1400 self.control_handle
1401 .inner
1402 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1403 result,
1404 self.tx_id,
1405 0x6dce331b33786aa,
1406 fidl::encoding::DynamicFlags::empty(),
1407 )
1408 }
1409}
1410
1411#[must_use = "FIDL methods require a response to be sent"]
1412#[derive(Debug)]
1413pub struct AdminRebootToRecoveryResponder {
1414 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1415 tx_id: u32,
1416}
1417
1418impl std::ops::Drop for AdminRebootToRecoveryResponder {
1422 fn drop(&mut self) {
1423 self.control_handle.shutdown();
1424 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1426 }
1427}
1428
1429impl fidl::endpoints::Responder for AdminRebootToRecoveryResponder {
1430 type ControlHandle = AdminControlHandle;
1431
1432 fn control_handle(&self) -> &AdminControlHandle {
1433 &self.control_handle
1434 }
1435
1436 fn drop_without_shutdown(mut self) {
1437 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1439 std::mem::forget(self);
1441 }
1442}
1443
1444impl AdminRebootToRecoveryResponder {
1445 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1449 let _result = self.send_raw(result);
1450 if _result.is_err() {
1451 self.control_handle.shutdown();
1452 }
1453 self.drop_without_shutdown();
1454 _result
1455 }
1456
1457 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1459 let _result = self.send_raw(result);
1460 self.drop_without_shutdown();
1461 _result
1462 }
1463
1464 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1465 self.control_handle
1466 .inner
1467 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1468 result,
1469 self.tx_id,
1470 0x1575c566be54f505,
1471 fidl::encoding::DynamicFlags::empty(),
1472 )
1473 }
1474}
1475
1476#[must_use = "FIDL methods require a response to be sent"]
1477#[derive(Debug)]
1478pub struct AdminPoweroffResponder {
1479 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1480 tx_id: u32,
1481}
1482
1483impl std::ops::Drop for AdminPoweroffResponder {
1487 fn drop(&mut self) {
1488 self.control_handle.shutdown();
1489 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1491 }
1492}
1493
1494impl fidl::endpoints::Responder for AdminPoweroffResponder {
1495 type ControlHandle = AdminControlHandle;
1496
1497 fn control_handle(&self) -> &AdminControlHandle {
1498 &self.control_handle
1499 }
1500
1501 fn drop_without_shutdown(mut self) {
1502 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1504 std::mem::forget(self);
1506 }
1507}
1508
1509impl AdminPoweroffResponder {
1510 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1514 let _result = self.send_raw(result);
1515 if _result.is_err() {
1516 self.control_handle.shutdown();
1517 }
1518 self.drop_without_shutdown();
1519 _result
1520 }
1521
1522 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1524 let _result = self.send_raw(result);
1525 self.drop_without_shutdown();
1526 _result
1527 }
1528
1529 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1530 self.control_handle
1531 .inner
1532 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1533 result,
1534 self.tx_id,
1535 0x24101c5d0b439748,
1536 fidl::encoding::DynamicFlags::empty(),
1537 )
1538 }
1539}
1540
1541#[must_use = "FIDL methods require a response to be sent"]
1542#[derive(Debug)]
1543pub struct AdminMexecResponder {
1544 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1545 tx_id: u32,
1546}
1547
1548impl std::ops::Drop for AdminMexecResponder {
1552 fn drop(&mut self) {
1553 self.control_handle.shutdown();
1554 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1556 }
1557}
1558
1559impl fidl::endpoints::Responder for AdminMexecResponder {
1560 type ControlHandle = AdminControlHandle;
1561
1562 fn control_handle(&self) -> &AdminControlHandle {
1563 &self.control_handle
1564 }
1565
1566 fn drop_without_shutdown(mut self) {
1567 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1569 std::mem::forget(self);
1571 }
1572}
1573
1574impl AdminMexecResponder {
1575 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1579 let _result = self.send_raw(result);
1580 if _result.is_err() {
1581 self.control_handle.shutdown();
1582 }
1583 self.drop_without_shutdown();
1584 _result
1585 }
1586
1587 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1589 let _result = self.send_raw(result);
1590 self.drop_without_shutdown();
1591 _result
1592 }
1593
1594 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1595 self.control_handle
1596 .inner
1597 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1598 result,
1599 self.tx_id,
1600 0x1f91e77ec781a4c6,
1601 fidl::encoding::DynamicFlags::empty(),
1602 )
1603 }
1604}
1605
1606#[must_use = "FIDL methods require a response to be sent"]
1607#[derive(Debug)]
1608pub struct AdminSuspendToRamResponder {
1609 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1610 tx_id: u32,
1611}
1612
1613impl std::ops::Drop for AdminSuspendToRamResponder {
1617 fn drop(&mut self) {
1618 self.control_handle.shutdown();
1619 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1621 }
1622}
1623
1624impl fidl::endpoints::Responder for AdminSuspendToRamResponder {
1625 type ControlHandle = AdminControlHandle;
1626
1627 fn control_handle(&self) -> &AdminControlHandle {
1628 &self.control_handle
1629 }
1630
1631 fn drop_without_shutdown(mut self) {
1632 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1634 std::mem::forget(self);
1636 }
1637}
1638
1639impl AdminSuspendToRamResponder {
1640 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1644 let _result = self.send_raw(result);
1645 if _result.is_err() {
1646 self.control_handle.shutdown();
1647 }
1648 self.drop_without_shutdown();
1649 _result
1650 }
1651
1652 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1654 let _result = self.send_raw(result);
1655 self.drop_without_shutdown();
1656 _result
1657 }
1658
1659 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1660 self.control_handle
1661 .inner
1662 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1663 result,
1664 self.tx_id,
1665 0x3b0e356782e7620e,
1666 fidl::encoding::DynamicFlags::empty(),
1667 )
1668 }
1669}
1670
1671#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1672pub struct RebootMethodsWatcherRegisterMarker;
1673
1674impl fidl::endpoints::ProtocolMarker for RebootMethodsWatcherRegisterMarker {
1675 type Proxy = RebootMethodsWatcherRegisterProxy;
1676 type RequestStream = RebootMethodsWatcherRegisterRequestStream;
1677 #[cfg(target_os = "fuchsia")]
1678 type SynchronousProxy = RebootMethodsWatcherRegisterSynchronousProxy;
1679
1680 const DEBUG_NAME: &'static str =
1681 "fuchsia.hardware.power.statecontrol.RebootMethodsWatcherRegister";
1682}
1683impl fidl::endpoints::DiscoverableProtocolMarker for RebootMethodsWatcherRegisterMarker {}
1684
1685pub trait RebootMethodsWatcherRegisterProxyInterface: Send + Sync {
1686 type RegisterWatcherResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1687 fn r#register_watcher(
1688 &self,
1689 watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
1690 ) -> Self::RegisterWatcherResponseFut;
1691}
1692#[derive(Debug)]
1693#[cfg(target_os = "fuchsia")]
1694pub struct RebootMethodsWatcherRegisterSynchronousProxy {
1695 client: fidl::client::sync::Client,
1696}
1697
1698#[cfg(target_os = "fuchsia")]
1699impl fidl::endpoints::SynchronousProxy for RebootMethodsWatcherRegisterSynchronousProxy {
1700 type Proxy = RebootMethodsWatcherRegisterProxy;
1701 type Protocol = RebootMethodsWatcherRegisterMarker;
1702
1703 fn from_channel(inner: fidl::Channel) -> Self {
1704 Self::new(inner)
1705 }
1706
1707 fn into_channel(self) -> fidl::Channel {
1708 self.client.into_channel()
1709 }
1710
1711 fn as_channel(&self) -> &fidl::Channel {
1712 self.client.as_channel()
1713 }
1714}
1715
1716#[cfg(target_os = "fuchsia")]
1717impl RebootMethodsWatcherRegisterSynchronousProxy {
1718 pub fn new(channel: fidl::Channel) -> Self {
1719 Self { client: fidl::client::sync::Client::new(channel) }
1720 }
1721
1722 pub fn into_channel(self) -> fidl::Channel {
1723 self.client.into_channel()
1724 }
1725
1726 pub fn wait_for_event(
1729 &self,
1730 deadline: zx::MonotonicInstant,
1731 ) -> Result<RebootMethodsWatcherRegisterEvent, fidl::Error> {
1732 RebootMethodsWatcherRegisterEvent::decode(
1733 self.client.wait_for_event::<RebootMethodsWatcherRegisterMarker>(deadline)?,
1734 )
1735 }
1736
1737 pub fn r#register_watcher(
1753 &self,
1754 mut watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
1755 ___deadline: zx::MonotonicInstant,
1756 ) -> Result<(), fidl::Error> {
1757 let _response = self.client.send_query::<
1758 RebootMethodsWatcherRegisterRegisterWatcherRequest,
1759 fidl::encoding::EmptyPayload,
1760 RebootMethodsWatcherRegisterMarker,
1761 >(
1762 (watcher,),
1763 0x3e6610e78471238,
1764 fidl::encoding::DynamicFlags::empty(),
1765 ___deadline,
1766 )?;
1767 Ok(_response)
1768 }
1769}
1770
1771#[cfg(target_os = "fuchsia")]
1772impl From<RebootMethodsWatcherRegisterSynchronousProxy> for zx::NullableHandle {
1773 fn from(value: RebootMethodsWatcherRegisterSynchronousProxy) -> Self {
1774 value.into_channel().into()
1775 }
1776}
1777
1778#[cfg(target_os = "fuchsia")]
1779impl From<fidl::Channel> for RebootMethodsWatcherRegisterSynchronousProxy {
1780 fn from(value: fidl::Channel) -> Self {
1781 Self::new(value)
1782 }
1783}
1784
1785#[cfg(target_os = "fuchsia")]
1786impl fidl::endpoints::FromClient for RebootMethodsWatcherRegisterSynchronousProxy {
1787 type Protocol = RebootMethodsWatcherRegisterMarker;
1788
1789 fn from_client(value: fidl::endpoints::ClientEnd<RebootMethodsWatcherRegisterMarker>) -> Self {
1790 Self::new(value.into_channel())
1791 }
1792}
1793
1794#[derive(Debug, Clone)]
1795pub struct RebootMethodsWatcherRegisterProxy {
1796 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1797}
1798
1799impl fidl::endpoints::Proxy for RebootMethodsWatcherRegisterProxy {
1800 type Protocol = RebootMethodsWatcherRegisterMarker;
1801
1802 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1803 Self::new(inner)
1804 }
1805
1806 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1807 self.client.into_channel().map_err(|client| Self { client })
1808 }
1809
1810 fn as_channel(&self) -> &::fidl::AsyncChannel {
1811 self.client.as_channel()
1812 }
1813}
1814
1815impl RebootMethodsWatcherRegisterProxy {
1816 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1818 let protocol_name =
1819 <RebootMethodsWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1820 Self { client: fidl::client::Client::new(channel, protocol_name) }
1821 }
1822
1823 pub fn take_event_stream(&self) -> RebootMethodsWatcherRegisterEventStream {
1829 RebootMethodsWatcherRegisterEventStream {
1830 event_receiver: self.client.take_event_receiver(),
1831 }
1832 }
1833
1834 pub fn r#register_watcher(
1850 &self,
1851 mut watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
1852 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1853 RebootMethodsWatcherRegisterProxyInterface::r#register_watcher(self, watcher)
1854 }
1855}
1856
1857impl RebootMethodsWatcherRegisterProxyInterface for RebootMethodsWatcherRegisterProxy {
1858 type RegisterWatcherResponseFut =
1859 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1860 fn r#register_watcher(
1861 &self,
1862 mut watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
1863 ) -> Self::RegisterWatcherResponseFut {
1864 fn _decode(
1865 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1866 ) -> Result<(), fidl::Error> {
1867 let _response = fidl::client::decode_transaction_body::<
1868 fidl::encoding::EmptyPayload,
1869 fidl::encoding::DefaultFuchsiaResourceDialect,
1870 0x3e6610e78471238,
1871 >(_buf?)?;
1872 Ok(_response)
1873 }
1874 self.client.send_query_and_decode::<RebootMethodsWatcherRegisterRegisterWatcherRequest, ()>(
1875 (watcher,),
1876 0x3e6610e78471238,
1877 fidl::encoding::DynamicFlags::empty(),
1878 _decode,
1879 )
1880 }
1881}
1882
1883pub struct RebootMethodsWatcherRegisterEventStream {
1884 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1885}
1886
1887impl std::marker::Unpin for RebootMethodsWatcherRegisterEventStream {}
1888
1889impl futures::stream::FusedStream for RebootMethodsWatcherRegisterEventStream {
1890 fn is_terminated(&self) -> bool {
1891 self.event_receiver.is_terminated()
1892 }
1893}
1894
1895impl futures::Stream for RebootMethodsWatcherRegisterEventStream {
1896 type Item = Result<RebootMethodsWatcherRegisterEvent, fidl::Error>;
1897
1898 fn poll_next(
1899 mut self: std::pin::Pin<&mut Self>,
1900 cx: &mut std::task::Context<'_>,
1901 ) -> std::task::Poll<Option<Self::Item>> {
1902 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1903 &mut self.event_receiver,
1904 cx
1905 )?) {
1906 Some(buf) => {
1907 std::task::Poll::Ready(Some(RebootMethodsWatcherRegisterEvent::decode(buf)))
1908 }
1909 None => std::task::Poll::Ready(None),
1910 }
1911 }
1912}
1913
1914#[derive(Debug)]
1915pub enum RebootMethodsWatcherRegisterEvent {}
1916
1917impl RebootMethodsWatcherRegisterEvent {
1918 fn decode(
1920 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1921 ) -> Result<RebootMethodsWatcherRegisterEvent, fidl::Error> {
1922 let (bytes, _handles) = buf.split_mut();
1923 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1924 debug_assert_eq!(tx_header.tx_id, 0);
1925 match tx_header.ordinal {
1926 _ => Err(fidl::Error::UnknownOrdinal {
1927 ordinal: tx_header.ordinal,
1928 protocol_name: <RebootMethodsWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1929 })
1930 }
1931 }
1932}
1933
1934pub struct RebootMethodsWatcherRegisterRequestStream {
1936 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1937 is_terminated: bool,
1938}
1939
1940impl std::marker::Unpin for RebootMethodsWatcherRegisterRequestStream {}
1941
1942impl futures::stream::FusedStream for RebootMethodsWatcherRegisterRequestStream {
1943 fn is_terminated(&self) -> bool {
1944 self.is_terminated
1945 }
1946}
1947
1948impl fidl::endpoints::RequestStream for RebootMethodsWatcherRegisterRequestStream {
1949 type Protocol = RebootMethodsWatcherRegisterMarker;
1950 type ControlHandle = RebootMethodsWatcherRegisterControlHandle;
1951
1952 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1953 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1954 }
1955
1956 fn control_handle(&self) -> Self::ControlHandle {
1957 RebootMethodsWatcherRegisterControlHandle { inner: self.inner.clone() }
1958 }
1959
1960 fn into_inner(
1961 self,
1962 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1963 {
1964 (self.inner, self.is_terminated)
1965 }
1966
1967 fn from_inner(
1968 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1969 is_terminated: bool,
1970 ) -> Self {
1971 Self { inner, is_terminated }
1972 }
1973}
1974
1975impl futures::Stream for RebootMethodsWatcherRegisterRequestStream {
1976 type Item = Result<RebootMethodsWatcherRegisterRequest, fidl::Error>;
1977
1978 fn poll_next(
1979 mut self: std::pin::Pin<&mut Self>,
1980 cx: &mut std::task::Context<'_>,
1981 ) -> std::task::Poll<Option<Self::Item>> {
1982 let this = &mut *self;
1983 if this.inner.check_shutdown(cx) {
1984 this.is_terminated = true;
1985 return std::task::Poll::Ready(None);
1986 }
1987 if this.is_terminated {
1988 panic!("polled RebootMethodsWatcherRegisterRequestStream after completion");
1989 }
1990 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1991 |bytes, handles| {
1992 match this.inner.channel().read_etc(cx, bytes, handles) {
1993 std::task::Poll::Ready(Ok(())) => {}
1994 std::task::Poll::Pending => return std::task::Poll::Pending,
1995 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1996 this.is_terminated = true;
1997 return std::task::Poll::Ready(None);
1998 }
1999 std::task::Poll::Ready(Err(e)) => {
2000 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2001 e.into(),
2002 ))));
2003 }
2004 }
2005
2006 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2008
2009 std::task::Poll::Ready(Some(match header.ordinal {
2010 0x3e6610e78471238 => {
2011 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2012 let mut req = fidl::new_empty!(RebootMethodsWatcherRegisterRegisterWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2013 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RebootMethodsWatcherRegisterRegisterWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
2014 let control_handle = RebootMethodsWatcherRegisterControlHandle {
2015 inner: this.inner.clone(),
2016 };
2017 Ok(RebootMethodsWatcherRegisterRequest::RegisterWatcher {watcher: req.watcher,
2018
2019 responder: RebootMethodsWatcherRegisterRegisterWatcherResponder {
2020 control_handle: std::mem::ManuallyDrop::new(control_handle),
2021 tx_id: header.tx_id,
2022 },
2023 })
2024 }
2025 _ => Err(fidl::Error::UnknownOrdinal {
2026 ordinal: header.ordinal,
2027 protocol_name: <RebootMethodsWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2028 }),
2029 }))
2030 },
2031 )
2032 }
2033}
2034
2035#[derive(Debug)]
2040pub enum RebootMethodsWatcherRegisterRequest {
2041 RegisterWatcher {
2057 watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
2058 responder: RebootMethodsWatcherRegisterRegisterWatcherResponder,
2059 },
2060}
2061
2062impl RebootMethodsWatcherRegisterRequest {
2063 #[allow(irrefutable_let_patterns)]
2064 pub fn into_register_watcher(
2065 self,
2066 ) -> Option<(
2067 fidl::endpoints::ClientEnd<RebootWatcherMarker>,
2068 RebootMethodsWatcherRegisterRegisterWatcherResponder,
2069 )> {
2070 if let RebootMethodsWatcherRegisterRequest::RegisterWatcher { watcher, responder } = self {
2071 Some((watcher, responder))
2072 } else {
2073 None
2074 }
2075 }
2076
2077 pub fn method_name(&self) -> &'static str {
2079 match *self {
2080 RebootMethodsWatcherRegisterRequest::RegisterWatcher { .. } => "register_watcher",
2081 }
2082 }
2083}
2084
2085#[derive(Debug, Clone)]
2086pub struct RebootMethodsWatcherRegisterControlHandle {
2087 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2088}
2089
2090impl RebootMethodsWatcherRegisterControlHandle {
2091 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2092 self.inner.shutdown_with_epitaph(status.into())
2093 }
2094}
2095
2096impl fidl::endpoints::ControlHandle for RebootMethodsWatcherRegisterControlHandle {
2097 fn shutdown(&self) {
2098 self.inner.shutdown()
2099 }
2100
2101 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2102 self.inner.shutdown_with_epitaph(status)
2103 }
2104
2105 fn is_closed(&self) -> bool {
2106 self.inner.channel().is_closed()
2107 }
2108 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2109 self.inner.channel().on_closed()
2110 }
2111
2112 #[cfg(target_os = "fuchsia")]
2113 fn signal_peer(
2114 &self,
2115 clear_mask: zx::Signals,
2116 set_mask: zx::Signals,
2117 ) -> Result<(), zx_status::Status> {
2118 use fidl::Peered;
2119 self.inner.channel().signal_peer(clear_mask, set_mask)
2120 }
2121}
2122
2123impl RebootMethodsWatcherRegisterControlHandle {}
2124
2125#[must_use = "FIDL methods require a response to be sent"]
2126#[derive(Debug)]
2127pub struct RebootMethodsWatcherRegisterRegisterWatcherResponder {
2128 control_handle: std::mem::ManuallyDrop<RebootMethodsWatcherRegisterControlHandle>,
2129 tx_id: u32,
2130}
2131
2132impl std::ops::Drop for RebootMethodsWatcherRegisterRegisterWatcherResponder {
2136 fn drop(&mut self) {
2137 self.control_handle.shutdown();
2138 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2140 }
2141}
2142
2143impl fidl::endpoints::Responder for RebootMethodsWatcherRegisterRegisterWatcherResponder {
2144 type ControlHandle = RebootMethodsWatcherRegisterControlHandle;
2145
2146 fn control_handle(&self) -> &RebootMethodsWatcherRegisterControlHandle {
2147 &self.control_handle
2148 }
2149
2150 fn drop_without_shutdown(mut self) {
2151 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2153 std::mem::forget(self);
2155 }
2156}
2157
2158impl RebootMethodsWatcherRegisterRegisterWatcherResponder {
2159 pub fn send(self) -> Result<(), fidl::Error> {
2163 let _result = self.send_raw();
2164 if _result.is_err() {
2165 self.control_handle.shutdown();
2166 }
2167 self.drop_without_shutdown();
2168 _result
2169 }
2170
2171 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2173 let _result = self.send_raw();
2174 self.drop_without_shutdown();
2175 _result
2176 }
2177
2178 fn send_raw(&self) -> Result<(), fidl::Error> {
2179 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2180 (),
2181 self.tx_id,
2182 0x3e6610e78471238,
2183 fidl::encoding::DynamicFlags::empty(),
2184 )
2185 }
2186}
2187
2188#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2189pub struct RebootWatcherMarker;
2190
2191impl fidl::endpoints::ProtocolMarker for RebootWatcherMarker {
2192 type Proxy = RebootWatcherProxy;
2193 type RequestStream = RebootWatcherRequestStream;
2194 #[cfg(target_os = "fuchsia")]
2195 type SynchronousProxy = RebootWatcherSynchronousProxy;
2196
2197 const DEBUG_NAME: &'static str = "(anonymous) RebootWatcher";
2198}
2199
2200pub trait RebootWatcherProxyInterface: Send + Sync {
2201 type OnRebootResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2202 fn r#on_reboot(&self, options: &RebootOptions) -> Self::OnRebootResponseFut;
2203}
2204#[derive(Debug)]
2205#[cfg(target_os = "fuchsia")]
2206pub struct RebootWatcherSynchronousProxy {
2207 client: fidl::client::sync::Client,
2208}
2209
2210#[cfg(target_os = "fuchsia")]
2211impl fidl::endpoints::SynchronousProxy for RebootWatcherSynchronousProxy {
2212 type Proxy = RebootWatcherProxy;
2213 type Protocol = RebootWatcherMarker;
2214
2215 fn from_channel(inner: fidl::Channel) -> Self {
2216 Self::new(inner)
2217 }
2218
2219 fn into_channel(self) -> fidl::Channel {
2220 self.client.into_channel()
2221 }
2222
2223 fn as_channel(&self) -> &fidl::Channel {
2224 self.client.as_channel()
2225 }
2226}
2227
2228#[cfg(target_os = "fuchsia")]
2229impl RebootWatcherSynchronousProxy {
2230 pub fn new(channel: fidl::Channel) -> Self {
2231 Self { client: fidl::client::sync::Client::new(channel) }
2232 }
2233
2234 pub fn into_channel(self) -> fidl::Channel {
2235 self.client.into_channel()
2236 }
2237
2238 pub fn wait_for_event(
2241 &self,
2242 deadline: zx::MonotonicInstant,
2243 ) -> Result<RebootWatcherEvent, fidl::Error> {
2244 RebootWatcherEvent::decode(self.client.wait_for_event::<RebootWatcherMarker>(deadline)?)
2245 }
2246
2247 pub fn r#on_reboot(
2248 &self,
2249 mut options: &RebootOptions,
2250 ___deadline: zx::MonotonicInstant,
2251 ) -> Result<(), fidl::Error> {
2252 let _response = self.client.send_query::<
2253 RebootWatcherOnRebootRequest,
2254 fidl::encoding::EmptyPayload,
2255 RebootWatcherMarker,
2256 >(
2257 (options,),
2258 0x5334bbbe774f13c3,
2259 fidl::encoding::DynamicFlags::empty(),
2260 ___deadline,
2261 )?;
2262 Ok(_response)
2263 }
2264}
2265
2266#[cfg(target_os = "fuchsia")]
2267impl From<RebootWatcherSynchronousProxy> for zx::NullableHandle {
2268 fn from(value: RebootWatcherSynchronousProxy) -> Self {
2269 value.into_channel().into()
2270 }
2271}
2272
2273#[cfg(target_os = "fuchsia")]
2274impl From<fidl::Channel> for RebootWatcherSynchronousProxy {
2275 fn from(value: fidl::Channel) -> Self {
2276 Self::new(value)
2277 }
2278}
2279
2280#[cfg(target_os = "fuchsia")]
2281impl fidl::endpoints::FromClient for RebootWatcherSynchronousProxy {
2282 type Protocol = RebootWatcherMarker;
2283
2284 fn from_client(value: fidl::endpoints::ClientEnd<RebootWatcherMarker>) -> Self {
2285 Self::new(value.into_channel())
2286 }
2287}
2288
2289#[derive(Debug, Clone)]
2290pub struct RebootWatcherProxy {
2291 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2292}
2293
2294impl fidl::endpoints::Proxy for RebootWatcherProxy {
2295 type Protocol = RebootWatcherMarker;
2296
2297 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2298 Self::new(inner)
2299 }
2300
2301 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2302 self.client.into_channel().map_err(|client| Self { client })
2303 }
2304
2305 fn as_channel(&self) -> &::fidl::AsyncChannel {
2306 self.client.as_channel()
2307 }
2308}
2309
2310impl RebootWatcherProxy {
2311 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2313 let protocol_name = <RebootWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2314 Self { client: fidl::client::Client::new(channel, protocol_name) }
2315 }
2316
2317 pub fn take_event_stream(&self) -> RebootWatcherEventStream {
2323 RebootWatcherEventStream { event_receiver: self.client.take_event_receiver() }
2324 }
2325
2326 pub fn r#on_reboot(
2327 &self,
2328 mut options: &RebootOptions,
2329 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2330 RebootWatcherProxyInterface::r#on_reboot(self, options)
2331 }
2332}
2333
2334impl RebootWatcherProxyInterface for RebootWatcherProxy {
2335 type OnRebootResponseFut =
2336 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2337 fn r#on_reboot(&self, mut options: &RebootOptions) -> Self::OnRebootResponseFut {
2338 fn _decode(
2339 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2340 ) -> Result<(), fidl::Error> {
2341 let _response = fidl::client::decode_transaction_body::<
2342 fidl::encoding::EmptyPayload,
2343 fidl::encoding::DefaultFuchsiaResourceDialect,
2344 0x5334bbbe774f13c3,
2345 >(_buf?)?;
2346 Ok(_response)
2347 }
2348 self.client.send_query_and_decode::<RebootWatcherOnRebootRequest, ()>(
2349 (options,),
2350 0x5334bbbe774f13c3,
2351 fidl::encoding::DynamicFlags::empty(),
2352 _decode,
2353 )
2354 }
2355}
2356
2357pub struct RebootWatcherEventStream {
2358 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2359}
2360
2361impl std::marker::Unpin for RebootWatcherEventStream {}
2362
2363impl futures::stream::FusedStream for RebootWatcherEventStream {
2364 fn is_terminated(&self) -> bool {
2365 self.event_receiver.is_terminated()
2366 }
2367}
2368
2369impl futures::Stream for RebootWatcherEventStream {
2370 type Item = Result<RebootWatcherEvent, fidl::Error>;
2371
2372 fn poll_next(
2373 mut self: std::pin::Pin<&mut Self>,
2374 cx: &mut std::task::Context<'_>,
2375 ) -> std::task::Poll<Option<Self::Item>> {
2376 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2377 &mut self.event_receiver,
2378 cx
2379 )?) {
2380 Some(buf) => std::task::Poll::Ready(Some(RebootWatcherEvent::decode(buf))),
2381 None => std::task::Poll::Ready(None),
2382 }
2383 }
2384}
2385
2386#[derive(Debug)]
2387pub enum RebootWatcherEvent {}
2388
2389impl RebootWatcherEvent {
2390 fn decode(
2392 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2393 ) -> Result<RebootWatcherEvent, fidl::Error> {
2394 let (bytes, _handles) = buf.split_mut();
2395 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2396 debug_assert_eq!(tx_header.tx_id, 0);
2397 match tx_header.ordinal {
2398 _ => Err(fidl::Error::UnknownOrdinal {
2399 ordinal: tx_header.ordinal,
2400 protocol_name: <RebootWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2401 }),
2402 }
2403 }
2404}
2405
2406pub struct RebootWatcherRequestStream {
2408 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2409 is_terminated: bool,
2410}
2411
2412impl std::marker::Unpin for RebootWatcherRequestStream {}
2413
2414impl futures::stream::FusedStream for RebootWatcherRequestStream {
2415 fn is_terminated(&self) -> bool {
2416 self.is_terminated
2417 }
2418}
2419
2420impl fidl::endpoints::RequestStream for RebootWatcherRequestStream {
2421 type Protocol = RebootWatcherMarker;
2422 type ControlHandle = RebootWatcherControlHandle;
2423
2424 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2425 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2426 }
2427
2428 fn control_handle(&self) -> Self::ControlHandle {
2429 RebootWatcherControlHandle { inner: self.inner.clone() }
2430 }
2431
2432 fn into_inner(
2433 self,
2434 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2435 {
2436 (self.inner, self.is_terminated)
2437 }
2438
2439 fn from_inner(
2440 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2441 is_terminated: bool,
2442 ) -> Self {
2443 Self { inner, is_terminated }
2444 }
2445}
2446
2447impl futures::Stream for RebootWatcherRequestStream {
2448 type Item = Result<RebootWatcherRequest, fidl::Error>;
2449
2450 fn poll_next(
2451 mut self: std::pin::Pin<&mut Self>,
2452 cx: &mut std::task::Context<'_>,
2453 ) -> std::task::Poll<Option<Self::Item>> {
2454 let this = &mut *self;
2455 if this.inner.check_shutdown(cx) {
2456 this.is_terminated = true;
2457 return std::task::Poll::Ready(None);
2458 }
2459 if this.is_terminated {
2460 panic!("polled RebootWatcherRequestStream after completion");
2461 }
2462 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2463 |bytes, handles| {
2464 match this.inner.channel().read_etc(cx, bytes, handles) {
2465 std::task::Poll::Ready(Ok(())) => {}
2466 std::task::Poll::Pending => return std::task::Poll::Pending,
2467 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2468 this.is_terminated = true;
2469 return std::task::Poll::Ready(None);
2470 }
2471 std::task::Poll::Ready(Err(e)) => {
2472 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2473 e.into(),
2474 ))));
2475 }
2476 }
2477
2478 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2480
2481 std::task::Poll::Ready(Some(match header.ordinal {
2482 0x5334bbbe774f13c3 => {
2483 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2484 let mut req = fidl::new_empty!(
2485 RebootWatcherOnRebootRequest,
2486 fidl::encoding::DefaultFuchsiaResourceDialect
2487 );
2488 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RebootWatcherOnRebootRequest>(&header, _body_bytes, handles, &mut req)?;
2489 let control_handle =
2490 RebootWatcherControlHandle { inner: this.inner.clone() };
2491 Ok(RebootWatcherRequest::OnReboot {
2492 options: req.options,
2493
2494 responder: RebootWatcherOnRebootResponder {
2495 control_handle: std::mem::ManuallyDrop::new(control_handle),
2496 tx_id: header.tx_id,
2497 },
2498 })
2499 }
2500 _ => Err(fidl::Error::UnknownOrdinal {
2501 ordinal: header.ordinal,
2502 protocol_name:
2503 <RebootWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2504 }),
2505 }))
2506 },
2507 )
2508 }
2509}
2510
2511#[derive(Debug)]
2517pub enum RebootWatcherRequest {
2518 OnReboot { options: RebootOptions, responder: RebootWatcherOnRebootResponder },
2519}
2520
2521impl RebootWatcherRequest {
2522 #[allow(irrefutable_let_patterns)]
2523 pub fn into_on_reboot(self) -> Option<(RebootOptions, RebootWatcherOnRebootResponder)> {
2524 if let RebootWatcherRequest::OnReboot { options, responder } = self {
2525 Some((options, responder))
2526 } else {
2527 None
2528 }
2529 }
2530
2531 pub fn method_name(&self) -> &'static str {
2533 match *self {
2534 RebootWatcherRequest::OnReboot { .. } => "on_reboot",
2535 }
2536 }
2537}
2538
2539#[derive(Debug, Clone)]
2540pub struct RebootWatcherControlHandle {
2541 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2542}
2543
2544impl RebootWatcherControlHandle {
2545 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2546 self.inner.shutdown_with_epitaph(status.into())
2547 }
2548}
2549
2550impl fidl::endpoints::ControlHandle for RebootWatcherControlHandle {
2551 fn shutdown(&self) {
2552 self.inner.shutdown()
2553 }
2554
2555 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2556 self.inner.shutdown_with_epitaph(status)
2557 }
2558
2559 fn is_closed(&self) -> bool {
2560 self.inner.channel().is_closed()
2561 }
2562 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2563 self.inner.channel().on_closed()
2564 }
2565
2566 #[cfg(target_os = "fuchsia")]
2567 fn signal_peer(
2568 &self,
2569 clear_mask: zx::Signals,
2570 set_mask: zx::Signals,
2571 ) -> Result<(), zx_status::Status> {
2572 use fidl::Peered;
2573 self.inner.channel().signal_peer(clear_mask, set_mask)
2574 }
2575}
2576
2577impl RebootWatcherControlHandle {}
2578
2579#[must_use = "FIDL methods require a response to be sent"]
2580#[derive(Debug)]
2581pub struct RebootWatcherOnRebootResponder {
2582 control_handle: std::mem::ManuallyDrop<RebootWatcherControlHandle>,
2583 tx_id: u32,
2584}
2585
2586impl std::ops::Drop for RebootWatcherOnRebootResponder {
2590 fn drop(&mut self) {
2591 self.control_handle.shutdown();
2592 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2594 }
2595}
2596
2597impl fidl::endpoints::Responder for RebootWatcherOnRebootResponder {
2598 type ControlHandle = RebootWatcherControlHandle;
2599
2600 fn control_handle(&self) -> &RebootWatcherControlHandle {
2601 &self.control_handle
2602 }
2603
2604 fn drop_without_shutdown(mut self) {
2605 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2607 std::mem::forget(self);
2609 }
2610}
2611
2612impl RebootWatcherOnRebootResponder {
2613 pub fn send(self) -> Result<(), fidl::Error> {
2617 let _result = self.send_raw();
2618 if _result.is_err() {
2619 self.control_handle.shutdown();
2620 }
2621 self.drop_without_shutdown();
2622 _result
2623 }
2624
2625 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2627 let _result = self.send_raw();
2628 self.drop_without_shutdown();
2629 _result
2630 }
2631
2632 fn send_raw(&self) -> Result<(), fidl::Error> {
2633 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2634 (),
2635 self.tx_id,
2636 0x5334bbbe774f13c3,
2637 fidl::encoding::DynamicFlags::empty(),
2638 )
2639 }
2640}
2641
2642#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2643pub struct ShutdownWatcherMarker;
2644
2645impl fidl::endpoints::ProtocolMarker for ShutdownWatcherMarker {
2646 type Proxy = ShutdownWatcherProxy;
2647 type RequestStream = ShutdownWatcherRequestStream;
2648 #[cfg(target_os = "fuchsia")]
2649 type SynchronousProxy = ShutdownWatcherSynchronousProxy;
2650
2651 const DEBUG_NAME: &'static str = "(anonymous) ShutdownWatcher";
2652}
2653
2654pub trait ShutdownWatcherProxyInterface: Send + Sync {
2655 type OnShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2656 fn r#on_shutdown(&self, options: &ShutdownOptions) -> Self::OnShutdownResponseFut;
2657}
2658#[derive(Debug)]
2659#[cfg(target_os = "fuchsia")]
2660pub struct ShutdownWatcherSynchronousProxy {
2661 client: fidl::client::sync::Client,
2662}
2663
2664#[cfg(target_os = "fuchsia")]
2665impl fidl::endpoints::SynchronousProxy for ShutdownWatcherSynchronousProxy {
2666 type Proxy = ShutdownWatcherProxy;
2667 type Protocol = ShutdownWatcherMarker;
2668
2669 fn from_channel(inner: fidl::Channel) -> Self {
2670 Self::new(inner)
2671 }
2672
2673 fn into_channel(self) -> fidl::Channel {
2674 self.client.into_channel()
2675 }
2676
2677 fn as_channel(&self) -> &fidl::Channel {
2678 self.client.as_channel()
2679 }
2680}
2681
2682#[cfg(target_os = "fuchsia")]
2683impl ShutdownWatcherSynchronousProxy {
2684 pub fn new(channel: fidl::Channel) -> Self {
2685 Self { client: fidl::client::sync::Client::new(channel) }
2686 }
2687
2688 pub fn into_channel(self) -> fidl::Channel {
2689 self.client.into_channel()
2690 }
2691
2692 pub fn wait_for_event(
2695 &self,
2696 deadline: zx::MonotonicInstant,
2697 ) -> Result<ShutdownWatcherEvent, fidl::Error> {
2698 ShutdownWatcherEvent::decode(self.client.wait_for_event::<ShutdownWatcherMarker>(deadline)?)
2699 }
2700
2701 pub fn r#on_shutdown(
2702 &self,
2703 mut options: &ShutdownOptions,
2704 ___deadline: zx::MonotonicInstant,
2705 ) -> Result<(), fidl::Error> {
2706 let _response = self.client.send_query::<
2707 ShutdownWatcherOnShutdownRequest,
2708 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2709 ShutdownWatcherMarker,
2710 >(
2711 (options,),
2712 0x1d9467990d7dc6db,
2713 fidl::encoding::DynamicFlags::FLEXIBLE,
2714 ___deadline,
2715 )?
2716 .into_result::<ShutdownWatcherMarker>("on_shutdown")?;
2717 Ok(_response)
2718 }
2719}
2720
2721#[cfg(target_os = "fuchsia")]
2722impl From<ShutdownWatcherSynchronousProxy> for zx::NullableHandle {
2723 fn from(value: ShutdownWatcherSynchronousProxy) -> Self {
2724 value.into_channel().into()
2725 }
2726}
2727
2728#[cfg(target_os = "fuchsia")]
2729impl From<fidl::Channel> for ShutdownWatcherSynchronousProxy {
2730 fn from(value: fidl::Channel) -> Self {
2731 Self::new(value)
2732 }
2733}
2734
2735#[cfg(target_os = "fuchsia")]
2736impl fidl::endpoints::FromClient for ShutdownWatcherSynchronousProxy {
2737 type Protocol = ShutdownWatcherMarker;
2738
2739 fn from_client(value: fidl::endpoints::ClientEnd<ShutdownWatcherMarker>) -> Self {
2740 Self::new(value.into_channel())
2741 }
2742}
2743
2744#[derive(Debug, Clone)]
2745pub struct ShutdownWatcherProxy {
2746 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2747}
2748
2749impl fidl::endpoints::Proxy for ShutdownWatcherProxy {
2750 type Protocol = ShutdownWatcherMarker;
2751
2752 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2753 Self::new(inner)
2754 }
2755
2756 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2757 self.client.into_channel().map_err(|client| Self { client })
2758 }
2759
2760 fn as_channel(&self) -> &::fidl::AsyncChannel {
2761 self.client.as_channel()
2762 }
2763}
2764
2765impl ShutdownWatcherProxy {
2766 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2768 let protocol_name = <ShutdownWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2769 Self { client: fidl::client::Client::new(channel, protocol_name) }
2770 }
2771
2772 pub fn take_event_stream(&self) -> ShutdownWatcherEventStream {
2778 ShutdownWatcherEventStream { event_receiver: self.client.take_event_receiver() }
2779 }
2780
2781 pub fn r#on_shutdown(
2782 &self,
2783 mut options: &ShutdownOptions,
2784 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2785 ShutdownWatcherProxyInterface::r#on_shutdown(self, options)
2786 }
2787}
2788
2789impl ShutdownWatcherProxyInterface for ShutdownWatcherProxy {
2790 type OnShutdownResponseFut =
2791 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2792 fn r#on_shutdown(&self, mut options: &ShutdownOptions) -> Self::OnShutdownResponseFut {
2793 fn _decode(
2794 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2795 ) -> Result<(), fidl::Error> {
2796 let _response = fidl::client::decode_transaction_body::<
2797 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2798 fidl::encoding::DefaultFuchsiaResourceDialect,
2799 0x1d9467990d7dc6db,
2800 >(_buf?)?
2801 .into_result::<ShutdownWatcherMarker>("on_shutdown")?;
2802 Ok(_response)
2803 }
2804 self.client.send_query_and_decode::<ShutdownWatcherOnShutdownRequest, ()>(
2805 (options,),
2806 0x1d9467990d7dc6db,
2807 fidl::encoding::DynamicFlags::FLEXIBLE,
2808 _decode,
2809 )
2810 }
2811}
2812
2813pub struct ShutdownWatcherEventStream {
2814 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2815}
2816
2817impl std::marker::Unpin for ShutdownWatcherEventStream {}
2818
2819impl futures::stream::FusedStream for ShutdownWatcherEventStream {
2820 fn is_terminated(&self) -> bool {
2821 self.event_receiver.is_terminated()
2822 }
2823}
2824
2825impl futures::Stream for ShutdownWatcherEventStream {
2826 type Item = Result<ShutdownWatcherEvent, fidl::Error>;
2827
2828 fn poll_next(
2829 mut self: std::pin::Pin<&mut Self>,
2830 cx: &mut std::task::Context<'_>,
2831 ) -> std::task::Poll<Option<Self::Item>> {
2832 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2833 &mut self.event_receiver,
2834 cx
2835 )?) {
2836 Some(buf) => std::task::Poll::Ready(Some(ShutdownWatcherEvent::decode(buf))),
2837 None => std::task::Poll::Ready(None),
2838 }
2839 }
2840}
2841
2842#[derive(Debug)]
2843pub enum ShutdownWatcherEvent {
2844 #[non_exhaustive]
2845 _UnknownEvent {
2846 ordinal: u64,
2848 },
2849}
2850
2851impl ShutdownWatcherEvent {
2852 fn decode(
2854 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2855 ) -> Result<ShutdownWatcherEvent, fidl::Error> {
2856 let (bytes, _handles) = buf.split_mut();
2857 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2858 debug_assert_eq!(tx_header.tx_id, 0);
2859 match tx_header.ordinal {
2860 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2861 Ok(ShutdownWatcherEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2862 }
2863 _ => Err(fidl::Error::UnknownOrdinal {
2864 ordinal: tx_header.ordinal,
2865 protocol_name:
2866 <ShutdownWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2867 }),
2868 }
2869 }
2870}
2871
2872pub struct ShutdownWatcherRequestStream {
2874 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2875 is_terminated: bool,
2876}
2877
2878impl std::marker::Unpin for ShutdownWatcherRequestStream {}
2879
2880impl futures::stream::FusedStream for ShutdownWatcherRequestStream {
2881 fn is_terminated(&self) -> bool {
2882 self.is_terminated
2883 }
2884}
2885
2886impl fidl::endpoints::RequestStream for ShutdownWatcherRequestStream {
2887 type Protocol = ShutdownWatcherMarker;
2888 type ControlHandle = ShutdownWatcherControlHandle;
2889
2890 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2891 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2892 }
2893
2894 fn control_handle(&self) -> Self::ControlHandle {
2895 ShutdownWatcherControlHandle { inner: self.inner.clone() }
2896 }
2897
2898 fn into_inner(
2899 self,
2900 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2901 {
2902 (self.inner, self.is_terminated)
2903 }
2904
2905 fn from_inner(
2906 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2907 is_terminated: bool,
2908 ) -> Self {
2909 Self { inner, is_terminated }
2910 }
2911}
2912
2913impl futures::Stream for ShutdownWatcherRequestStream {
2914 type Item = Result<ShutdownWatcherRequest, fidl::Error>;
2915
2916 fn poll_next(
2917 mut self: std::pin::Pin<&mut Self>,
2918 cx: &mut std::task::Context<'_>,
2919 ) -> std::task::Poll<Option<Self::Item>> {
2920 let this = &mut *self;
2921 if this.inner.check_shutdown(cx) {
2922 this.is_terminated = true;
2923 return std::task::Poll::Ready(None);
2924 }
2925 if this.is_terminated {
2926 panic!("polled ShutdownWatcherRequestStream after completion");
2927 }
2928 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2929 |bytes, handles| {
2930 match this.inner.channel().read_etc(cx, bytes, handles) {
2931 std::task::Poll::Ready(Ok(())) => {}
2932 std::task::Poll::Pending => return std::task::Poll::Pending,
2933 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2934 this.is_terminated = true;
2935 return std::task::Poll::Ready(None);
2936 }
2937 std::task::Poll::Ready(Err(e)) => {
2938 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2939 e.into(),
2940 ))));
2941 }
2942 }
2943
2944 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2946
2947 std::task::Poll::Ready(Some(match header.ordinal {
2948 0x1d9467990d7dc6db => {
2949 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2950 let mut req = fidl::new_empty!(
2951 ShutdownWatcherOnShutdownRequest,
2952 fidl::encoding::DefaultFuchsiaResourceDialect
2953 );
2954 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ShutdownWatcherOnShutdownRequest>(&header, _body_bytes, handles, &mut req)?;
2955 let control_handle =
2956 ShutdownWatcherControlHandle { inner: this.inner.clone() };
2957 Ok(ShutdownWatcherRequest::OnShutdown {
2958 options: req.options,
2959
2960 responder: ShutdownWatcherOnShutdownResponder {
2961 control_handle: std::mem::ManuallyDrop::new(control_handle),
2962 tx_id: header.tx_id,
2963 },
2964 })
2965 }
2966 _ if header.tx_id == 0
2967 && header
2968 .dynamic_flags()
2969 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2970 {
2971 Ok(ShutdownWatcherRequest::_UnknownMethod {
2972 ordinal: header.ordinal,
2973 control_handle: ShutdownWatcherControlHandle {
2974 inner: this.inner.clone(),
2975 },
2976 method_type: fidl::MethodType::OneWay,
2977 })
2978 }
2979 _ if header
2980 .dynamic_flags()
2981 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2982 {
2983 this.inner.send_framework_err(
2984 fidl::encoding::FrameworkErr::UnknownMethod,
2985 header.tx_id,
2986 header.ordinal,
2987 header.dynamic_flags(),
2988 (bytes, handles),
2989 )?;
2990 Ok(ShutdownWatcherRequest::_UnknownMethod {
2991 ordinal: header.ordinal,
2992 control_handle: ShutdownWatcherControlHandle {
2993 inner: this.inner.clone(),
2994 },
2995 method_type: fidl::MethodType::TwoWay,
2996 })
2997 }
2998 _ => Err(fidl::Error::UnknownOrdinal {
2999 ordinal: header.ordinal,
3000 protocol_name:
3001 <ShutdownWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3002 }),
3003 }))
3004 },
3005 )
3006 }
3007}
3008
3009#[derive(Debug)]
3015pub enum ShutdownWatcherRequest {
3016 OnShutdown {
3017 options: ShutdownOptions,
3018 responder: ShutdownWatcherOnShutdownResponder,
3019 },
3020 #[non_exhaustive]
3022 _UnknownMethod {
3023 ordinal: u64,
3025 control_handle: ShutdownWatcherControlHandle,
3026 method_type: fidl::MethodType,
3027 },
3028}
3029
3030impl ShutdownWatcherRequest {
3031 #[allow(irrefutable_let_patterns)]
3032 pub fn into_on_shutdown(self) -> Option<(ShutdownOptions, ShutdownWatcherOnShutdownResponder)> {
3033 if let ShutdownWatcherRequest::OnShutdown { options, responder } = self {
3034 Some((options, responder))
3035 } else {
3036 None
3037 }
3038 }
3039
3040 pub fn method_name(&self) -> &'static str {
3042 match *self {
3043 ShutdownWatcherRequest::OnShutdown { .. } => "on_shutdown",
3044 ShutdownWatcherRequest::_UnknownMethod {
3045 method_type: fidl::MethodType::OneWay,
3046 ..
3047 } => "unknown one-way method",
3048 ShutdownWatcherRequest::_UnknownMethod {
3049 method_type: fidl::MethodType::TwoWay,
3050 ..
3051 } => "unknown two-way method",
3052 }
3053 }
3054}
3055
3056#[derive(Debug, Clone)]
3057pub struct ShutdownWatcherControlHandle {
3058 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3059}
3060
3061impl ShutdownWatcherControlHandle {
3062 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3063 self.inner.shutdown_with_epitaph(status.into())
3064 }
3065}
3066
3067impl fidl::endpoints::ControlHandle for ShutdownWatcherControlHandle {
3068 fn shutdown(&self) {
3069 self.inner.shutdown()
3070 }
3071
3072 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3073 self.inner.shutdown_with_epitaph(status)
3074 }
3075
3076 fn is_closed(&self) -> bool {
3077 self.inner.channel().is_closed()
3078 }
3079 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3080 self.inner.channel().on_closed()
3081 }
3082
3083 #[cfg(target_os = "fuchsia")]
3084 fn signal_peer(
3085 &self,
3086 clear_mask: zx::Signals,
3087 set_mask: zx::Signals,
3088 ) -> Result<(), zx_status::Status> {
3089 use fidl::Peered;
3090 self.inner.channel().signal_peer(clear_mask, set_mask)
3091 }
3092}
3093
3094impl ShutdownWatcherControlHandle {}
3095
3096#[must_use = "FIDL methods require a response to be sent"]
3097#[derive(Debug)]
3098pub struct ShutdownWatcherOnShutdownResponder {
3099 control_handle: std::mem::ManuallyDrop<ShutdownWatcherControlHandle>,
3100 tx_id: u32,
3101}
3102
3103impl std::ops::Drop for ShutdownWatcherOnShutdownResponder {
3107 fn drop(&mut self) {
3108 self.control_handle.shutdown();
3109 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3111 }
3112}
3113
3114impl fidl::endpoints::Responder for ShutdownWatcherOnShutdownResponder {
3115 type ControlHandle = ShutdownWatcherControlHandle;
3116
3117 fn control_handle(&self) -> &ShutdownWatcherControlHandle {
3118 &self.control_handle
3119 }
3120
3121 fn drop_without_shutdown(mut self) {
3122 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3124 std::mem::forget(self);
3126 }
3127}
3128
3129impl ShutdownWatcherOnShutdownResponder {
3130 pub fn send(self) -> Result<(), fidl::Error> {
3134 let _result = self.send_raw();
3135 if _result.is_err() {
3136 self.control_handle.shutdown();
3137 }
3138 self.drop_without_shutdown();
3139 _result
3140 }
3141
3142 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3144 let _result = self.send_raw();
3145 self.drop_without_shutdown();
3146 _result
3147 }
3148
3149 fn send_raw(&self) -> Result<(), fidl::Error> {
3150 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3151 fidl::encoding::Flexible::new(()),
3152 self.tx_id,
3153 0x1d9467990d7dc6db,
3154 fidl::encoding::DynamicFlags::FLEXIBLE,
3155 )
3156 }
3157}
3158
3159#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3160pub struct ShutdownWatcherRegisterMarker;
3161
3162impl fidl::endpoints::ProtocolMarker for ShutdownWatcherRegisterMarker {
3163 type Proxy = ShutdownWatcherRegisterProxy;
3164 type RequestStream = ShutdownWatcherRegisterRequestStream;
3165 #[cfg(target_os = "fuchsia")]
3166 type SynchronousProxy = ShutdownWatcherRegisterSynchronousProxy;
3167
3168 const DEBUG_NAME: &'static str = "fuchsia.hardware.power.statecontrol.ShutdownWatcherRegister";
3169}
3170impl fidl::endpoints::DiscoverableProtocolMarker for ShutdownWatcherRegisterMarker {}
3171
3172pub trait ShutdownWatcherRegisterProxyInterface: Send + Sync {
3173 type RegisterWatcherResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3174 fn r#register_watcher(
3175 &self,
3176 watcher: fidl::endpoints::ClientEnd<ShutdownWatcherMarker>,
3177 ) -> Self::RegisterWatcherResponseFut;
3178 type RegisterTerminalStateWatcherResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
3179 + Send;
3180 fn r#register_terminal_state_watcher(
3181 &self,
3182 watcher: fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>,
3183 ) -> Self::RegisterTerminalStateWatcherResponseFut;
3184}
3185#[derive(Debug)]
3186#[cfg(target_os = "fuchsia")]
3187pub struct ShutdownWatcherRegisterSynchronousProxy {
3188 client: fidl::client::sync::Client,
3189}
3190
3191#[cfg(target_os = "fuchsia")]
3192impl fidl::endpoints::SynchronousProxy for ShutdownWatcherRegisterSynchronousProxy {
3193 type Proxy = ShutdownWatcherRegisterProxy;
3194 type Protocol = ShutdownWatcherRegisterMarker;
3195
3196 fn from_channel(inner: fidl::Channel) -> Self {
3197 Self::new(inner)
3198 }
3199
3200 fn into_channel(self) -> fidl::Channel {
3201 self.client.into_channel()
3202 }
3203
3204 fn as_channel(&self) -> &fidl::Channel {
3205 self.client.as_channel()
3206 }
3207}
3208
3209#[cfg(target_os = "fuchsia")]
3210impl ShutdownWatcherRegisterSynchronousProxy {
3211 pub fn new(channel: fidl::Channel) -> Self {
3212 Self { client: fidl::client::sync::Client::new(channel) }
3213 }
3214
3215 pub fn into_channel(self) -> fidl::Channel {
3216 self.client.into_channel()
3217 }
3218
3219 pub fn wait_for_event(
3222 &self,
3223 deadline: zx::MonotonicInstant,
3224 ) -> Result<ShutdownWatcherRegisterEvent, fidl::Error> {
3225 ShutdownWatcherRegisterEvent::decode(
3226 self.client.wait_for_event::<ShutdownWatcherRegisterMarker>(deadline)?,
3227 )
3228 }
3229
3230 pub fn r#register_watcher(
3246 &self,
3247 mut watcher: fidl::endpoints::ClientEnd<ShutdownWatcherMarker>,
3248 ___deadline: zx::MonotonicInstant,
3249 ) -> Result<(), fidl::Error> {
3250 let _response = self.client.send_query::<
3251 ShutdownWatcherRegisterRegisterWatcherRequest,
3252 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3253 ShutdownWatcherRegisterMarker,
3254 >(
3255 (watcher,),
3256 0x3db6ce5d34810aff,
3257 fidl::encoding::DynamicFlags::FLEXIBLE,
3258 ___deadline,
3259 )?
3260 .into_result::<ShutdownWatcherRegisterMarker>("register_watcher")?;
3261 Ok(_response)
3262 }
3263
3264 pub fn r#register_terminal_state_watcher(
3284 &self,
3285 mut watcher: fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>,
3286 ___deadline: zx::MonotonicInstant,
3287 ) -> Result<(), fidl::Error> {
3288 let _response = self.client.send_query::<
3289 ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest,
3290 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3291 ShutdownWatcherRegisterMarker,
3292 >(
3293 (watcher,),
3294 0x1cce7216bb7869fc,
3295 fidl::encoding::DynamicFlags::FLEXIBLE,
3296 ___deadline,
3297 )?
3298 .into_result::<ShutdownWatcherRegisterMarker>("register_terminal_state_watcher")?;
3299 Ok(_response)
3300 }
3301}
3302
3303#[cfg(target_os = "fuchsia")]
3304impl From<ShutdownWatcherRegisterSynchronousProxy> for zx::NullableHandle {
3305 fn from(value: ShutdownWatcherRegisterSynchronousProxy) -> Self {
3306 value.into_channel().into()
3307 }
3308}
3309
3310#[cfg(target_os = "fuchsia")]
3311impl From<fidl::Channel> for ShutdownWatcherRegisterSynchronousProxy {
3312 fn from(value: fidl::Channel) -> Self {
3313 Self::new(value)
3314 }
3315}
3316
3317#[cfg(target_os = "fuchsia")]
3318impl fidl::endpoints::FromClient for ShutdownWatcherRegisterSynchronousProxy {
3319 type Protocol = ShutdownWatcherRegisterMarker;
3320
3321 fn from_client(value: fidl::endpoints::ClientEnd<ShutdownWatcherRegisterMarker>) -> Self {
3322 Self::new(value.into_channel())
3323 }
3324}
3325
3326#[derive(Debug, Clone)]
3327pub struct ShutdownWatcherRegisterProxy {
3328 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3329}
3330
3331impl fidl::endpoints::Proxy for ShutdownWatcherRegisterProxy {
3332 type Protocol = ShutdownWatcherRegisterMarker;
3333
3334 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3335 Self::new(inner)
3336 }
3337
3338 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3339 self.client.into_channel().map_err(|client| Self { client })
3340 }
3341
3342 fn as_channel(&self) -> &::fidl::AsyncChannel {
3343 self.client.as_channel()
3344 }
3345}
3346
3347impl ShutdownWatcherRegisterProxy {
3348 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3350 let protocol_name =
3351 <ShutdownWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3352 Self { client: fidl::client::Client::new(channel, protocol_name) }
3353 }
3354
3355 pub fn take_event_stream(&self) -> ShutdownWatcherRegisterEventStream {
3361 ShutdownWatcherRegisterEventStream { event_receiver: self.client.take_event_receiver() }
3362 }
3363
3364 pub fn r#register_watcher(
3380 &self,
3381 mut watcher: fidl::endpoints::ClientEnd<ShutdownWatcherMarker>,
3382 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3383 ShutdownWatcherRegisterProxyInterface::r#register_watcher(self, watcher)
3384 }
3385
3386 pub fn r#register_terminal_state_watcher(
3406 &self,
3407 mut watcher: fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>,
3408 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3409 ShutdownWatcherRegisterProxyInterface::r#register_terminal_state_watcher(self, watcher)
3410 }
3411}
3412
3413impl ShutdownWatcherRegisterProxyInterface for ShutdownWatcherRegisterProxy {
3414 type RegisterWatcherResponseFut =
3415 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3416 fn r#register_watcher(
3417 &self,
3418 mut watcher: fidl::endpoints::ClientEnd<ShutdownWatcherMarker>,
3419 ) -> Self::RegisterWatcherResponseFut {
3420 fn _decode(
3421 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3422 ) -> Result<(), fidl::Error> {
3423 let _response = fidl::client::decode_transaction_body::<
3424 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3425 fidl::encoding::DefaultFuchsiaResourceDialect,
3426 0x3db6ce5d34810aff,
3427 >(_buf?)?
3428 .into_result::<ShutdownWatcherRegisterMarker>("register_watcher")?;
3429 Ok(_response)
3430 }
3431 self.client.send_query_and_decode::<ShutdownWatcherRegisterRegisterWatcherRequest, ()>(
3432 (watcher,),
3433 0x3db6ce5d34810aff,
3434 fidl::encoding::DynamicFlags::FLEXIBLE,
3435 _decode,
3436 )
3437 }
3438
3439 type RegisterTerminalStateWatcherResponseFut =
3440 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3441 fn r#register_terminal_state_watcher(
3442 &self,
3443 mut watcher: fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>,
3444 ) -> Self::RegisterTerminalStateWatcherResponseFut {
3445 fn _decode(
3446 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3447 ) -> Result<(), fidl::Error> {
3448 let _response = fidl::client::decode_transaction_body::<
3449 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3450 fidl::encoding::DefaultFuchsiaResourceDialect,
3451 0x1cce7216bb7869fc,
3452 >(_buf?)?
3453 .into_result::<ShutdownWatcherRegisterMarker>("register_terminal_state_watcher")?;
3454 Ok(_response)
3455 }
3456 self.client.send_query_and_decode::<
3457 ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest,
3458 (),
3459 >(
3460 (watcher,),
3461 0x1cce7216bb7869fc,
3462 fidl::encoding::DynamicFlags::FLEXIBLE,
3463 _decode,
3464 )
3465 }
3466}
3467
3468pub struct ShutdownWatcherRegisterEventStream {
3469 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3470}
3471
3472impl std::marker::Unpin for ShutdownWatcherRegisterEventStream {}
3473
3474impl futures::stream::FusedStream for ShutdownWatcherRegisterEventStream {
3475 fn is_terminated(&self) -> bool {
3476 self.event_receiver.is_terminated()
3477 }
3478}
3479
3480impl futures::Stream for ShutdownWatcherRegisterEventStream {
3481 type Item = Result<ShutdownWatcherRegisterEvent, fidl::Error>;
3482
3483 fn poll_next(
3484 mut self: std::pin::Pin<&mut Self>,
3485 cx: &mut std::task::Context<'_>,
3486 ) -> std::task::Poll<Option<Self::Item>> {
3487 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3488 &mut self.event_receiver,
3489 cx
3490 )?) {
3491 Some(buf) => std::task::Poll::Ready(Some(ShutdownWatcherRegisterEvent::decode(buf))),
3492 None => std::task::Poll::Ready(None),
3493 }
3494 }
3495}
3496
3497#[derive(Debug)]
3498pub enum ShutdownWatcherRegisterEvent {
3499 #[non_exhaustive]
3500 _UnknownEvent {
3501 ordinal: u64,
3503 },
3504}
3505
3506impl ShutdownWatcherRegisterEvent {
3507 fn decode(
3509 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3510 ) -> Result<ShutdownWatcherRegisterEvent, fidl::Error> {
3511 let (bytes, _handles) = buf.split_mut();
3512 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3513 debug_assert_eq!(tx_header.tx_id, 0);
3514 match tx_header.ordinal {
3515 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3516 Ok(ShutdownWatcherRegisterEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3517 }
3518 _ => Err(fidl::Error::UnknownOrdinal {
3519 ordinal: tx_header.ordinal,
3520 protocol_name:
3521 <ShutdownWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3522 }),
3523 }
3524 }
3525}
3526
3527pub struct ShutdownWatcherRegisterRequestStream {
3529 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3530 is_terminated: bool,
3531}
3532
3533impl std::marker::Unpin for ShutdownWatcherRegisterRequestStream {}
3534
3535impl futures::stream::FusedStream for ShutdownWatcherRegisterRequestStream {
3536 fn is_terminated(&self) -> bool {
3537 self.is_terminated
3538 }
3539}
3540
3541impl fidl::endpoints::RequestStream for ShutdownWatcherRegisterRequestStream {
3542 type Protocol = ShutdownWatcherRegisterMarker;
3543 type ControlHandle = ShutdownWatcherRegisterControlHandle;
3544
3545 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3546 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3547 }
3548
3549 fn control_handle(&self) -> Self::ControlHandle {
3550 ShutdownWatcherRegisterControlHandle { inner: self.inner.clone() }
3551 }
3552
3553 fn into_inner(
3554 self,
3555 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3556 {
3557 (self.inner, self.is_terminated)
3558 }
3559
3560 fn from_inner(
3561 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3562 is_terminated: bool,
3563 ) -> Self {
3564 Self { inner, is_terminated }
3565 }
3566}
3567
3568impl futures::Stream for ShutdownWatcherRegisterRequestStream {
3569 type Item = Result<ShutdownWatcherRegisterRequest, fidl::Error>;
3570
3571 fn poll_next(
3572 mut self: std::pin::Pin<&mut Self>,
3573 cx: &mut std::task::Context<'_>,
3574 ) -> std::task::Poll<Option<Self::Item>> {
3575 let this = &mut *self;
3576 if this.inner.check_shutdown(cx) {
3577 this.is_terminated = true;
3578 return std::task::Poll::Ready(None);
3579 }
3580 if this.is_terminated {
3581 panic!("polled ShutdownWatcherRegisterRequestStream after completion");
3582 }
3583 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3584 |bytes, handles| {
3585 match this.inner.channel().read_etc(cx, bytes, handles) {
3586 std::task::Poll::Ready(Ok(())) => {}
3587 std::task::Poll::Pending => return std::task::Poll::Pending,
3588 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3589 this.is_terminated = true;
3590 return std::task::Poll::Ready(None);
3591 }
3592 std::task::Poll::Ready(Err(e)) => {
3593 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3594 e.into(),
3595 ))));
3596 }
3597 }
3598
3599 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3601
3602 std::task::Poll::Ready(Some(match header.ordinal {
3603 0x3db6ce5d34810aff => {
3604 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3605 let mut req = fidl::new_empty!(ShutdownWatcherRegisterRegisterWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3606 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ShutdownWatcherRegisterRegisterWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
3607 let control_handle = ShutdownWatcherRegisterControlHandle {
3608 inner: this.inner.clone(),
3609 };
3610 Ok(ShutdownWatcherRegisterRequest::RegisterWatcher {watcher: req.watcher,
3611
3612 responder: ShutdownWatcherRegisterRegisterWatcherResponder {
3613 control_handle: std::mem::ManuallyDrop::new(control_handle),
3614 tx_id: header.tx_id,
3615 },
3616 })
3617 }
3618 0x1cce7216bb7869fc => {
3619 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3620 let mut req = fidl::new_empty!(ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3621 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
3622 let control_handle = ShutdownWatcherRegisterControlHandle {
3623 inner: this.inner.clone(),
3624 };
3625 Ok(ShutdownWatcherRegisterRequest::RegisterTerminalStateWatcher {watcher: req.watcher,
3626
3627 responder: ShutdownWatcherRegisterRegisterTerminalStateWatcherResponder {
3628 control_handle: std::mem::ManuallyDrop::new(control_handle),
3629 tx_id: header.tx_id,
3630 },
3631 })
3632 }
3633 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3634 Ok(ShutdownWatcherRegisterRequest::_UnknownMethod {
3635 ordinal: header.ordinal,
3636 control_handle: ShutdownWatcherRegisterControlHandle { inner: this.inner.clone() },
3637 method_type: fidl::MethodType::OneWay,
3638 })
3639 }
3640 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3641 this.inner.send_framework_err(
3642 fidl::encoding::FrameworkErr::UnknownMethod,
3643 header.tx_id,
3644 header.ordinal,
3645 header.dynamic_flags(),
3646 (bytes, handles),
3647 )?;
3648 Ok(ShutdownWatcherRegisterRequest::_UnknownMethod {
3649 ordinal: header.ordinal,
3650 control_handle: ShutdownWatcherRegisterControlHandle { inner: this.inner.clone() },
3651 method_type: fidl::MethodType::TwoWay,
3652 })
3653 }
3654 _ => Err(fidl::Error::UnknownOrdinal {
3655 ordinal: header.ordinal,
3656 protocol_name: <ShutdownWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3657 }),
3658 }))
3659 },
3660 )
3661 }
3662}
3663
3664#[derive(Debug)]
3670pub enum ShutdownWatcherRegisterRequest {
3671 RegisterWatcher {
3687 watcher: fidl::endpoints::ClientEnd<ShutdownWatcherMarker>,
3688 responder: ShutdownWatcherRegisterRegisterWatcherResponder,
3689 },
3690 RegisterTerminalStateWatcher {
3710 watcher: fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>,
3711 responder: ShutdownWatcherRegisterRegisterTerminalStateWatcherResponder,
3712 },
3713 #[non_exhaustive]
3715 _UnknownMethod {
3716 ordinal: u64,
3718 control_handle: ShutdownWatcherRegisterControlHandle,
3719 method_type: fidl::MethodType,
3720 },
3721}
3722
3723impl ShutdownWatcherRegisterRequest {
3724 #[allow(irrefutable_let_patterns)]
3725 pub fn into_register_watcher(
3726 self,
3727 ) -> Option<(
3728 fidl::endpoints::ClientEnd<ShutdownWatcherMarker>,
3729 ShutdownWatcherRegisterRegisterWatcherResponder,
3730 )> {
3731 if let ShutdownWatcherRegisterRequest::RegisterWatcher { watcher, responder } = self {
3732 Some((watcher, responder))
3733 } else {
3734 None
3735 }
3736 }
3737
3738 #[allow(irrefutable_let_patterns)]
3739 pub fn into_register_terminal_state_watcher(
3740 self,
3741 ) -> Option<(
3742 fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>,
3743 ShutdownWatcherRegisterRegisterTerminalStateWatcherResponder,
3744 )> {
3745 if let ShutdownWatcherRegisterRequest::RegisterTerminalStateWatcher { watcher, responder } =
3746 self
3747 {
3748 Some((watcher, responder))
3749 } else {
3750 None
3751 }
3752 }
3753
3754 pub fn method_name(&self) -> &'static str {
3756 match *self {
3757 ShutdownWatcherRegisterRequest::RegisterWatcher { .. } => "register_watcher",
3758 ShutdownWatcherRegisterRequest::RegisterTerminalStateWatcher { .. } => {
3759 "register_terminal_state_watcher"
3760 }
3761 ShutdownWatcherRegisterRequest::_UnknownMethod {
3762 method_type: fidl::MethodType::OneWay,
3763 ..
3764 } => "unknown one-way method",
3765 ShutdownWatcherRegisterRequest::_UnknownMethod {
3766 method_type: fidl::MethodType::TwoWay,
3767 ..
3768 } => "unknown two-way method",
3769 }
3770 }
3771}
3772
3773#[derive(Debug, Clone)]
3774pub struct ShutdownWatcherRegisterControlHandle {
3775 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3776}
3777
3778impl ShutdownWatcherRegisterControlHandle {
3779 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3780 self.inner.shutdown_with_epitaph(status.into())
3781 }
3782}
3783
3784impl fidl::endpoints::ControlHandle for ShutdownWatcherRegisterControlHandle {
3785 fn shutdown(&self) {
3786 self.inner.shutdown()
3787 }
3788
3789 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3790 self.inner.shutdown_with_epitaph(status)
3791 }
3792
3793 fn is_closed(&self) -> bool {
3794 self.inner.channel().is_closed()
3795 }
3796 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3797 self.inner.channel().on_closed()
3798 }
3799
3800 #[cfg(target_os = "fuchsia")]
3801 fn signal_peer(
3802 &self,
3803 clear_mask: zx::Signals,
3804 set_mask: zx::Signals,
3805 ) -> Result<(), zx_status::Status> {
3806 use fidl::Peered;
3807 self.inner.channel().signal_peer(clear_mask, set_mask)
3808 }
3809}
3810
3811impl ShutdownWatcherRegisterControlHandle {}
3812
3813#[must_use = "FIDL methods require a response to be sent"]
3814#[derive(Debug)]
3815pub struct ShutdownWatcherRegisterRegisterWatcherResponder {
3816 control_handle: std::mem::ManuallyDrop<ShutdownWatcherRegisterControlHandle>,
3817 tx_id: u32,
3818}
3819
3820impl std::ops::Drop for ShutdownWatcherRegisterRegisterWatcherResponder {
3824 fn drop(&mut self) {
3825 self.control_handle.shutdown();
3826 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3828 }
3829}
3830
3831impl fidl::endpoints::Responder for ShutdownWatcherRegisterRegisterWatcherResponder {
3832 type ControlHandle = ShutdownWatcherRegisterControlHandle;
3833
3834 fn control_handle(&self) -> &ShutdownWatcherRegisterControlHandle {
3835 &self.control_handle
3836 }
3837
3838 fn drop_without_shutdown(mut self) {
3839 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3841 std::mem::forget(self);
3843 }
3844}
3845
3846impl ShutdownWatcherRegisterRegisterWatcherResponder {
3847 pub fn send(self) -> Result<(), fidl::Error> {
3851 let _result = self.send_raw();
3852 if _result.is_err() {
3853 self.control_handle.shutdown();
3854 }
3855 self.drop_without_shutdown();
3856 _result
3857 }
3858
3859 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3861 let _result = self.send_raw();
3862 self.drop_without_shutdown();
3863 _result
3864 }
3865
3866 fn send_raw(&self) -> Result<(), fidl::Error> {
3867 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3868 fidl::encoding::Flexible::new(()),
3869 self.tx_id,
3870 0x3db6ce5d34810aff,
3871 fidl::encoding::DynamicFlags::FLEXIBLE,
3872 )
3873 }
3874}
3875
3876#[must_use = "FIDL methods require a response to be sent"]
3877#[derive(Debug)]
3878pub struct ShutdownWatcherRegisterRegisterTerminalStateWatcherResponder {
3879 control_handle: std::mem::ManuallyDrop<ShutdownWatcherRegisterControlHandle>,
3880 tx_id: u32,
3881}
3882
3883impl std::ops::Drop for ShutdownWatcherRegisterRegisterTerminalStateWatcherResponder {
3887 fn drop(&mut self) {
3888 self.control_handle.shutdown();
3889 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3891 }
3892}
3893
3894impl fidl::endpoints::Responder for ShutdownWatcherRegisterRegisterTerminalStateWatcherResponder {
3895 type ControlHandle = ShutdownWatcherRegisterControlHandle;
3896
3897 fn control_handle(&self) -> &ShutdownWatcherRegisterControlHandle {
3898 &self.control_handle
3899 }
3900
3901 fn drop_without_shutdown(mut self) {
3902 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3904 std::mem::forget(self);
3906 }
3907}
3908
3909impl ShutdownWatcherRegisterRegisterTerminalStateWatcherResponder {
3910 pub fn send(self) -> Result<(), fidl::Error> {
3914 let _result = self.send_raw();
3915 if _result.is_err() {
3916 self.control_handle.shutdown();
3917 }
3918 self.drop_without_shutdown();
3919 _result
3920 }
3921
3922 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3924 let _result = self.send_raw();
3925 self.drop_without_shutdown();
3926 _result
3927 }
3928
3929 fn send_raw(&self) -> Result<(), fidl::Error> {
3930 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3931 fidl::encoding::Flexible::new(()),
3932 self.tx_id,
3933 0x1cce7216bb7869fc,
3934 fidl::encoding::DynamicFlags::FLEXIBLE,
3935 )
3936 }
3937}
3938
3939#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3940pub struct TerminalStateWatcherMarker;
3941
3942impl fidl::endpoints::ProtocolMarker for TerminalStateWatcherMarker {
3943 type Proxy = TerminalStateWatcherProxy;
3944 type RequestStream = TerminalStateWatcherRequestStream;
3945 #[cfg(target_os = "fuchsia")]
3946 type SynchronousProxy = TerminalStateWatcherSynchronousProxy;
3947
3948 const DEBUG_NAME: &'static str = "(anonymous) TerminalStateWatcher";
3949}
3950
3951pub trait TerminalStateWatcherProxyInterface: Send + Sync {
3952 type OnTerminalStateTransitionStartedResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
3953 + Send;
3954 fn r#on_terminal_state_transition_started(
3955 &self,
3956 ) -> Self::OnTerminalStateTransitionStartedResponseFut;
3957}
3958#[derive(Debug)]
3959#[cfg(target_os = "fuchsia")]
3960pub struct TerminalStateWatcherSynchronousProxy {
3961 client: fidl::client::sync::Client,
3962}
3963
3964#[cfg(target_os = "fuchsia")]
3965impl fidl::endpoints::SynchronousProxy for TerminalStateWatcherSynchronousProxy {
3966 type Proxy = TerminalStateWatcherProxy;
3967 type Protocol = TerminalStateWatcherMarker;
3968
3969 fn from_channel(inner: fidl::Channel) -> Self {
3970 Self::new(inner)
3971 }
3972
3973 fn into_channel(self) -> fidl::Channel {
3974 self.client.into_channel()
3975 }
3976
3977 fn as_channel(&self) -> &fidl::Channel {
3978 self.client.as_channel()
3979 }
3980}
3981
3982#[cfg(target_os = "fuchsia")]
3983impl TerminalStateWatcherSynchronousProxy {
3984 pub fn new(channel: fidl::Channel) -> Self {
3985 Self { client: fidl::client::sync::Client::new(channel) }
3986 }
3987
3988 pub fn into_channel(self) -> fidl::Channel {
3989 self.client.into_channel()
3990 }
3991
3992 pub fn wait_for_event(
3995 &self,
3996 deadline: zx::MonotonicInstant,
3997 ) -> Result<TerminalStateWatcherEvent, fidl::Error> {
3998 TerminalStateWatcherEvent::decode(
3999 self.client.wait_for_event::<TerminalStateWatcherMarker>(deadline)?,
4000 )
4001 }
4002
4003 pub fn r#on_terminal_state_transition_started(
4004 &self,
4005 ___deadline: zx::MonotonicInstant,
4006 ) -> Result<(), fidl::Error> {
4007 let _response = self.client.send_query::<
4008 fidl::encoding::EmptyPayload,
4009 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
4010 TerminalStateWatcherMarker,
4011 >(
4012 (),
4013 0x25d95d9d1ae60f10,
4014 fidl::encoding::DynamicFlags::FLEXIBLE,
4015 ___deadline,
4016 )?
4017 .into_result::<TerminalStateWatcherMarker>("on_terminal_state_transition_started")?;
4018 Ok(_response)
4019 }
4020}
4021
4022#[cfg(target_os = "fuchsia")]
4023impl From<TerminalStateWatcherSynchronousProxy> for zx::NullableHandle {
4024 fn from(value: TerminalStateWatcherSynchronousProxy) -> Self {
4025 value.into_channel().into()
4026 }
4027}
4028
4029#[cfg(target_os = "fuchsia")]
4030impl From<fidl::Channel> for TerminalStateWatcherSynchronousProxy {
4031 fn from(value: fidl::Channel) -> Self {
4032 Self::new(value)
4033 }
4034}
4035
4036#[cfg(target_os = "fuchsia")]
4037impl fidl::endpoints::FromClient for TerminalStateWatcherSynchronousProxy {
4038 type Protocol = TerminalStateWatcherMarker;
4039
4040 fn from_client(value: fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>) -> Self {
4041 Self::new(value.into_channel())
4042 }
4043}
4044
4045#[derive(Debug, Clone)]
4046pub struct TerminalStateWatcherProxy {
4047 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4048}
4049
4050impl fidl::endpoints::Proxy for TerminalStateWatcherProxy {
4051 type Protocol = TerminalStateWatcherMarker;
4052
4053 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4054 Self::new(inner)
4055 }
4056
4057 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4058 self.client.into_channel().map_err(|client| Self { client })
4059 }
4060
4061 fn as_channel(&self) -> &::fidl::AsyncChannel {
4062 self.client.as_channel()
4063 }
4064}
4065
4066impl TerminalStateWatcherProxy {
4067 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4069 let protocol_name =
4070 <TerminalStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4071 Self { client: fidl::client::Client::new(channel, protocol_name) }
4072 }
4073
4074 pub fn take_event_stream(&self) -> TerminalStateWatcherEventStream {
4080 TerminalStateWatcherEventStream { event_receiver: self.client.take_event_receiver() }
4081 }
4082
4083 pub fn r#on_terminal_state_transition_started(
4084 &self,
4085 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4086 TerminalStateWatcherProxyInterface::r#on_terminal_state_transition_started(self)
4087 }
4088}
4089
4090impl TerminalStateWatcherProxyInterface for TerminalStateWatcherProxy {
4091 type OnTerminalStateTransitionStartedResponseFut =
4092 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4093 fn r#on_terminal_state_transition_started(
4094 &self,
4095 ) -> Self::OnTerminalStateTransitionStartedResponseFut {
4096 fn _decode(
4097 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4098 ) -> Result<(), fidl::Error> {
4099 let _response = fidl::client::decode_transaction_body::<
4100 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
4101 fidl::encoding::DefaultFuchsiaResourceDialect,
4102 0x25d95d9d1ae60f10,
4103 >(_buf?)?
4104 .into_result::<TerminalStateWatcherMarker>("on_terminal_state_transition_started")?;
4105 Ok(_response)
4106 }
4107 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
4108 (),
4109 0x25d95d9d1ae60f10,
4110 fidl::encoding::DynamicFlags::FLEXIBLE,
4111 _decode,
4112 )
4113 }
4114}
4115
4116pub struct TerminalStateWatcherEventStream {
4117 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4118}
4119
4120impl std::marker::Unpin for TerminalStateWatcherEventStream {}
4121
4122impl futures::stream::FusedStream for TerminalStateWatcherEventStream {
4123 fn is_terminated(&self) -> bool {
4124 self.event_receiver.is_terminated()
4125 }
4126}
4127
4128impl futures::Stream for TerminalStateWatcherEventStream {
4129 type Item = Result<TerminalStateWatcherEvent, fidl::Error>;
4130
4131 fn poll_next(
4132 mut self: std::pin::Pin<&mut Self>,
4133 cx: &mut std::task::Context<'_>,
4134 ) -> std::task::Poll<Option<Self::Item>> {
4135 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4136 &mut self.event_receiver,
4137 cx
4138 )?) {
4139 Some(buf) => std::task::Poll::Ready(Some(TerminalStateWatcherEvent::decode(buf))),
4140 None => std::task::Poll::Ready(None),
4141 }
4142 }
4143}
4144
4145#[derive(Debug)]
4146pub enum TerminalStateWatcherEvent {
4147 #[non_exhaustive]
4148 _UnknownEvent {
4149 ordinal: u64,
4151 },
4152}
4153
4154impl TerminalStateWatcherEvent {
4155 fn decode(
4157 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4158 ) -> Result<TerminalStateWatcherEvent, fidl::Error> {
4159 let (bytes, _handles) = buf.split_mut();
4160 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4161 debug_assert_eq!(tx_header.tx_id, 0);
4162 match tx_header.ordinal {
4163 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4164 Ok(TerminalStateWatcherEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4165 }
4166 _ => Err(fidl::Error::UnknownOrdinal {
4167 ordinal: tx_header.ordinal,
4168 protocol_name:
4169 <TerminalStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4170 }),
4171 }
4172 }
4173}
4174
4175pub struct TerminalStateWatcherRequestStream {
4177 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4178 is_terminated: bool,
4179}
4180
4181impl std::marker::Unpin for TerminalStateWatcherRequestStream {}
4182
4183impl futures::stream::FusedStream for TerminalStateWatcherRequestStream {
4184 fn is_terminated(&self) -> bool {
4185 self.is_terminated
4186 }
4187}
4188
4189impl fidl::endpoints::RequestStream for TerminalStateWatcherRequestStream {
4190 type Protocol = TerminalStateWatcherMarker;
4191 type ControlHandle = TerminalStateWatcherControlHandle;
4192
4193 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4194 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4195 }
4196
4197 fn control_handle(&self) -> Self::ControlHandle {
4198 TerminalStateWatcherControlHandle { inner: self.inner.clone() }
4199 }
4200
4201 fn into_inner(
4202 self,
4203 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4204 {
4205 (self.inner, self.is_terminated)
4206 }
4207
4208 fn from_inner(
4209 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4210 is_terminated: bool,
4211 ) -> Self {
4212 Self { inner, is_terminated }
4213 }
4214}
4215
4216impl futures::Stream for TerminalStateWatcherRequestStream {
4217 type Item = Result<TerminalStateWatcherRequest, fidl::Error>;
4218
4219 fn poll_next(
4220 mut self: std::pin::Pin<&mut Self>,
4221 cx: &mut std::task::Context<'_>,
4222 ) -> std::task::Poll<Option<Self::Item>> {
4223 let this = &mut *self;
4224 if this.inner.check_shutdown(cx) {
4225 this.is_terminated = true;
4226 return std::task::Poll::Ready(None);
4227 }
4228 if this.is_terminated {
4229 panic!("polled TerminalStateWatcherRequestStream after completion");
4230 }
4231 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4232 |bytes, handles| {
4233 match this.inner.channel().read_etc(cx, bytes, handles) {
4234 std::task::Poll::Ready(Ok(())) => {}
4235 std::task::Poll::Pending => return std::task::Poll::Pending,
4236 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4237 this.is_terminated = true;
4238 return std::task::Poll::Ready(None);
4239 }
4240 std::task::Poll::Ready(Err(e)) => {
4241 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4242 e.into(),
4243 ))));
4244 }
4245 }
4246
4247 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4249
4250 std::task::Poll::Ready(Some(match header.ordinal {
4251 0x25d95d9d1ae60f10 => {
4252 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4253 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
4254 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4255 let control_handle = TerminalStateWatcherControlHandle {
4256 inner: this.inner.clone(),
4257 };
4258 Ok(TerminalStateWatcherRequest::OnTerminalStateTransitionStarted {
4259 responder: TerminalStateWatcherOnTerminalStateTransitionStartedResponder {
4260 control_handle: std::mem::ManuallyDrop::new(control_handle),
4261 tx_id: header.tx_id,
4262 },
4263 })
4264 }
4265 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4266 Ok(TerminalStateWatcherRequest::_UnknownMethod {
4267 ordinal: header.ordinal,
4268 control_handle: TerminalStateWatcherControlHandle { inner: this.inner.clone() },
4269 method_type: fidl::MethodType::OneWay,
4270 })
4271 }
4272 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4273 this.inner.send_framework_err(
4274 fidl::encoding::FrameworkErr::UnknownMethod,
4275 header.tx_id,
4276 header.ordinal,
4277 header.dynamic_flags(),
4278 (bytes, handles),
4279 )?;
4280 Ok(TerminalStateWatcherRequest::_UnknownMethod {
4281 ordinal: header.ordinal,
4282 control_handle: TerminalStateWatcherControlHandle { inner: this.inner.clone() },
4283 method_type: fidl::MethodType::TwoWay,
4284 })
4285 }
4286 _ => Err(fidl::Error::UnknownOrdinal {
4287 ordinal: header.ordinal,
4288 protocol_name: <TerminalStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4289 }),
4290 }))
4291 },
4292 )
4293 }
4294}
4295
4296#[derive(Debug)]
4302pub enum TerminalStateWatcherRequest {
4303 OnTerminalStateTransitionStarted {
4304 responder: TerminalStateWatcherOnTerminalStateTransitionStartedResponder,
4305 },
4306 #[non_exhaustive]
4308 _UnknownMethod {
4309 ordinal: u64,
4311 control_handle: TerminalStateWatcherControlHandle,
4312 method_type: fidl::MethodType,
4313 },
4314}
4315
4316impl TerminalStateWatcherRequest {
4317 #[allow(irrefutable_let_patterns)]
4318 pub fn into_on_terminal_state_transition_started(
4319 self,
4320 ) -> Option<(TerminalStateWatcherOnTerminalStateTransitionStartedResponder)> {
4321 if let TerminalStateWatcherRequest::OnTerminalStateTransitionStarted { responder } = self {
4322 Some((responder))
4323 } else {
4324 None
4325 }
4326 }
4327
4328 pub fn method_name(&self) -> &'static str {
4330 match *self {
4331 TerminalStateWatcherRequest::OnTerminalStateTransitionStarted { .. } => {
4332 "on_terminal_state_transition_started"
4333 }
4334 TerminalStateWatcherRequest::_UnknownMethod {
4335 method_type: fidl::MethodType::OneWay,
4336 ..
4337 } => "unknown one-way method",
4338 TerminalStateWatcherRequest::_UnknownMethod {
4339 method_type: fidl::MethodType::TwoWay,
4340 ..
4341 } => "unknown two-way method",
4342 }
4343 }
4344}
4345
4346#[derive(Debug, Clone)]
4347pub struct TerminalStateWatcherControlHandle {
4348 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4349}
4350
4351impl TerminalStateWatcherControlHandle {
4352 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4353 self.inner.shutdown_with_epitaph(status.into())
4354 }
4355}
4356
4357impl fidl::endpoints::ControlHandle for TerminalStateWatcherControlHandle {
4358 fn shutdown(&self) {
4359 self.inner.shutdown()
4360 }
4361
4362 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4363 self.inner.shutdown_with_epitaph(status)
4364 }
4365
4366 fn is_closed(&self) -> bool {
4367 self.inner.channel().is_closed()
4368 }
4369 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4370 self.inner.channel().on_closed()
4371 }
4372
4373 #[cfg(target_os = "fuchsia")]
4374 fn signal_peer(
4375 &self,
4376 clear_mask: zx::Signals,
4377 set_mask: zx::Signals,
4378 ) -> Result<(), zx_status::Status> {
4379 use fidl::Peered;
4380 self.inner.channel().signal_peer(clear_mask, set_mask)
4381 }
4382}
4383
4384impl TerminalStateWatcherControlHandle {}
4385
4386#[must_use = "FIDL methods require a response to be sent"]
4387#[derive(Debug)]
4388pub struct TerminalStateWatcherOnTerminalStateTransitionStartedResponder {
4389 control_handle: std::mem::ManuallyDrop<TerminalStateWatcherControlHandle>,
4390 tx_id: u32,
4391}
4392
4393impl std::ops::Drop for TerminalStateWatcherOnTerminalStateTransitionStartedResponder {
4397 fn drop(&mut self) {
4398 self.control_handle.shutdown();
4399 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4401 }
4402}
4403
4404impl fidl::endpoints::Responder for TerminalStateWatcherOnTerminalStateTransitionStartedResponder {
4405 type ControlHandle = TerminalStateWatcherControlHandle;
4406
4407 fn control_handle(&self) -> &TerminalStateWatcherControlHandle {
4408 &self.control_handle
4409 }
4410
4411 fn drop_without_shutdown(mut self) {
4412 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4414 std::mem::forget(self);
4416 }
4417}
4418
4419impl TerminalStateWatcherOnTerminalStateTransitionStartedResponder {
4420 pub fn send(self) -> Result<(), fidl::Error> {
4424 let _result = self.send_raw();
4425 if _result.is_err() {
4426 self.control_handle.shutdown();
4427 }
4428 self.drop_without_shutdown();
4429 _result
4430 }
4431
4432 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4434 let _result = self.send_raw();
4435 self.drop_without_shutdown();
4436 _result
4437 }
4438
4439 fn send_raw(&self) -> Result<(), fidl::Error> {
4440 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
4441 fidl::encoding::Flexible::new(()),
4442 self.tx_id,
4443 0x25d95d9d1ae60f10,
4444 fidl::encoding::DynamicFlags::FLEXIBLE,
4445 )
4446 }
4447}
4448
4449mod internal {
4450 use super::*;
4451
4452 impl fidl::encoding::ResourceTypeMarker for AdminMexecRequest {
4453 type Borrowed<'a> = &'a mut Self;
4454 fn take_or_borrow<'a>(
4455 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4456 ) -> Self::Borrowed<'a> {
4457 value
4458 }
4459 }
4460
4461 unsafe impl fidl::encoding::TypeMarker for AdminMexecRequest {
4462 type Owned = Self;
4463
4464 #[inline(always)]
4465 fn inline_align(_context: fidl::encoding::Context) -> usize {
4466 4
4467 }
4468
4469 #[inline(always)]
4470 fn inline_size(_context: fidl::encoding::Context) -> usize {
4471 8
4472 }
4473 }
4474
4475 unsafe impl
4476 fidl::encoding::Encode<AdminMexecRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4477 for &mut AdminMexecRequest
4478 {
4479 #[inline]
4480 unsafe fn encode(
4481 self,
4482 encoder: &mut fidl::encoding::Encoder<
4483 '_,
4484 fidl::encoding::DefaultFuchsiaResourceDialect,
4485 >,
4486 offset: usize,
4487 _depth: fidl::encoding::Depth,
4488 ) -> fidl::Result<()> {
4489 encoder.debug_check_bounds::<AdminMexecRequest>(offset);
4490 fidl::encoding::Encode::<AdminMexecRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4492 (
4493 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.kernel_zbi),
4494 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.data_zbi),
4495 ),
4496 encoder, offset, _depth
4497 )
4498 }
4499 }
4500 unsafe impl<
4501 T0: fidl::encoding::Encode<
4502 fidl::encoding::HandleType<
4503 fidl::Vmo,
4504 { fidl::ObjectType::VMO.into_raw() },
4505 2147483648,
4506 >,
4507 fidl::encoding::DefaultFuchsiaResourceDialect,
4508 >,
4509 T1: fidl::encoding::Encode<
4510 fidl::encoding::HandleType<
4511 fidl::Vmo,
4512 { fidl::ObjectType::VMO.into_raw() },
4513 2147483648,
4514 >,
4515 fidl::encoding::DefaultFuchsiaResourceDialect,
4516 >,
4517 > fidl::encoding::Encode<AdminMexecRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4518 for (T0, T1)
4519 {
4520 #[inline]
4521 unsafe fn encode(
4522 self,
4523 encoder: &mut fidl::encoding::Encoder<
4524 '_,
4525 fidl::encoding::DefaultFuchsiaResourceDialect,
4526 >,
4527 offset: usize,
4528 depth: fidl::encoding::Depth,
4529 ) -> fidl::Result<()> {
4530 encoder.debug_check_bounds::<AdminMexecRequest>(offset);
4531 self.0.encode(encoder, offset + 0, depth)?;
4535 self.1.encode(encoder, offset + 4, depth)?;
4536 Ok(())
4537 }
4538 }
4539
4540 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4541 for AdminMexecRequest
4542 {
4543 #[inline(always)]
4544 fn new_empty() -> Self {
4545 Self {
4546 kernel_zbi: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4547 data_zbi: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4548 }
4549 }
4550
4551 #[inline]
4552 unsafe fn decode(
4553 &mut self,
4554 decoder: &mut fidl::encoding::Decoder<
4555 '_,
4556 fidl::encoding::DefaultFuchsiaResourceDialect,
4557 >,
4558 offset: usize,
4559 _depth: fidl::encoding::Depth,
4560 ) -> fidl::Result<()> {
4561 decoder.debug_check_bounds::<Self>(offset);
4562 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.kernel_zbi, decoder, offset + 0, _depth)?;
4564 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.data_zbi, decoder, offset + 4, _depth)?;
4565 Ok(())
4566 }
4567 }
4568
4569 impl fidl::encoding::ResourceTypeMarker for RebootMethodsWatcherRegisterRegisterWatcherRequest {
4570 type Borrowed<'a> = &'a mut Self;
4571 fn take_or_borrow<'a>(
4572 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4573 ) -> Self::Borrowed<'a> {
4574 value
4575 }
4576 }
4577
4578 unsafe impl fidl::encoding::TypeMarker for RebootMethodsWatcherRegisterRegisterWatcherRequest {
4579 type Owned = Self;
4580
4581 #[inline(always)]
4582 fn inline_align(_context: fidl::encoding::Context) -> usize {
4583 4
4584 }
4585
4586 #[inline(always)]
4587 fn inline_size(_context: fidl::encoding::Context) -> usize {
4588 4
4589 }
4590 }
4591
4592 unsafe impl
4593 fidl::encoding::Encode<
4594 RebootMethodsWatcherRegisterRegisterWatcherRequest,
4595 fidl::encoding::DefaultFuchsiaResourceDialect,
4596 > for &mut RebootMethodsWatcherRegisterRegisterWatcherRequest
4597 {
4598 #[inline]
4599 unsafe fn encode(
4600 self,
4601 encoder: &mut fidl::encoding::Encoder<
4602 '_,
4603 fidl::encoding::DefaultFuchsiaResourceDialect,
4604 >,
4605 offset: usize,
4606 _depth: fidl::encoding::Depth,
4607 ) -> fidl::Result<()> {
4608 encoder
4609 .debug_check_bounds::<RebootMethodsWatcherRegisterRegisterWatcherRequest>(offset);
4610 fidl::encoding::Encode::<RebootMethodsWatcherRegisterRegisterWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4612 (
4613 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
4614 ),
4615 encoder, offset, _depth
4616 )
4617 }
4618 }
4619 unsafe impl<
4620 T0: fidl::encoding::Encode<
4621 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootWatcherMarker>>,
4622 fidl::encoding::DefaultFuchsiaResourceDialect,
4623 >,
4624 >
4625 fidl::encoding::Encode<
4626 RebootMethodsWatcherRegisterRegisterWatcherRequest,
4627 fidl::encoding::DefaultFuchsiaResourceDialect,
4628 > for (T0,)
4629 {
4630 #[inline]
4631 unsafe fn encode(
4632 self,
4633 encoder: &mut fidl::encoding::Encoder<
4634 '_,
4635 fidl::encoding::DefaultFuchsiaResourceDialect,
4636 >,
4637 offset: usize,
4638 depth: fidl::encoding::Depth,
4639 ) -> fidl::Result<()> {
4640 encoder
4641 .debug_check_bounds::<RebootMethodsWatcherRegisterRegisterWatcherRequest>(offset);
4642 self.0.encode(encoder, offset + 0, depth)?;
4646 Ok(())
4647 }
4648 }
4649
4650 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4651 for RebootMethodsWatcherRegisterRegisterWatcherRequest
4652 {
4653 #[inline(always)]
4654 fn new_empty() -> Self {
4655 Self {
4656 watcher: fidl::new_empty!(
4657 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootWatcherMarker>>,
4658 fidl::encoding::DefaultFuchsiaResourceDialect
4659 ),
4660 }
4661 }
4662
4663 #[inline]
4664 unsafe fn decode(
4665 &mut self,
4666 decoder: &mut fidl::encoding::Decoder<
4667 '_,
4668 fidl::encoding::DefaultFuchsiaResourceDialect,
4669 >,
4670 offset: usize,
4671 _depth: fidl::encoding::Depth,
4672 ) -> fidl::Result<()> {
4673 decoder.debug_check_bounds::<Self>(offset);
4674 fidl::decode!(
4676 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootWatcherMarker>>,
4677 fidl::encoding::DefaultFuchsiaResourceDialect,
4678 &mut self.watcher,
4679 decoder,
4680 offset + 0,
4681 _depth
4682 )?;
4683 Ok(())
4684 }
4685 }
4686
4687 impl fidl::encoding::ResourceTypeMarker
4688 for ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest
4689 {
4690 type Borrowed<'a> = &'a mut Self;
4691 fn take_or_borrow<'a>(
4692 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4693 ) -> Self::Borrowed<'a> {
4694 value
4695 }
4696 }
4697
4698 unsafe impl fidl::encoding::TypeMarker
4699 for ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest
4700 {
4701 type Owned = Self;
4702
4703 #[inline(always)]
4704 fn inline_align(_context: fidl::encoding::Context) -> usize {
4705 4
4706 }
4707
4708 #[inline(always)]
4709 fn inline_size(_context: fidl::encoding::Context) -> usize {
4710 4
4711 }
4712 }
4713
4714 unsafe impl
4715 fidl::encoding::Encode<
4716 ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest,
4717 fidl::encoding::DefaultFuchsiaResourceDialect,
4718 > for &mut ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest
4719 {
4720 #[inline]
4721 unsafe fn encode(
4722 self,
4723 encoder: &mut fidl::encoding::Encoder<
4724 '_,
4725 fidl::encoding::DefaultFuchsiaResourceDialect,
4726 >,
4727 offset: usize,
4728 _depth: fidl::encoding::Depth,
4729 ) -> fidl::Result<()> {
4730 encoder
4731 .debug_check_bounds::<ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest>(
4732 offset,
4733 );
4734 fidl::encoding::Encode::<
4736 ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest,
4737 fidl::encoding::DefaultFuchsiaResourceDialect,
4738 >::encode(
4739 (
4740 <fidl::encoding::Endpoint<
4741 fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>,
4742 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4743 &mut self.watcher
4744 ),
4745 ),
4746 encoder,
4747 offset,
4748 _depth,
4749 )
4750 }
4751 }
4752 unsafe impl<
4753 T0: fidl::encoding::Encode<
4754 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>>,
4755 fidl::encoding::DefaultFuchsiaResourceDialect,
4756 >,
4757 >
4758 fidl::encoding::Encode<
4759 ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest,
4760 fidl::encoding::DefaultFuchsiaResourceDialect,
4761 > for (T0,)
4762 {
4763 #[inline]
4764 unsafe fn encode(
4765 self,
4766 encoder: &mut fidl::encoding::Encoder<
4767 '_,
4768 fidl::encoding::DefaultFuchsiaResourceDialect,
4769 >,
4770 offset: usize,
4771 depth: fidl::encoding::Depth,
4772 ) -> fidl::Result<()> {
4773 encoder
4774 .debug_check_bounds::<ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest>(
4775 offset,
4776 );
4777 self.0.encode(encoder, offset + 0, depth)?;
4781 Ok(())
4782 }
4783 }
4784
4785 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4786 for ShutdownWatcherRegisterRegisterTerminalStateWatcherRequest
4787 {
4788 #[inline(always)]
4789 fn new_empty() -> Self {
4790 Self {
4791 watcher: fidl::new_empty!(
4792 fidl::encoding::Endpoint<
4793 fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>,
4794 >,
4795 fidl::encoding::DefaultFuchsiaResourceDialect
4796 ),
4797 }
4798 }
4799
4800 #[inline]
4801 unsafe fn decode(
4802 &mut self,
4803 decoder: &mut fidl::encoding::Decoder<
4804 '_,
4805 fidl::encoding::DefaultFuchsiaResourceDialect,
4806 >,
4807 offset: usize,
4808 _depth: fidl::encoding::Depth,
4809 ) -> fidl::Result<()> {
4810 decoder.debug_check_bounds::<Self>(offset);
4811 fidl::decode!(
4813 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TerminalStateWatcherMarker>>,
4814 fidl::encoding::DefaultFuchsiaResourceDialect,
4815 &mut self.watcher,
4816 decoder,
4817 offset + 0,
4818 _depth
4819 )?;
4820 Ok(())
4821 }
4822 }
4823
4824 impl fidl::encoding::ResourceTypeMarker for ShutdownWatcherRegisterRegisterWatcherRequest {
4825 type Borrowed<'a> = &'a mut Self;
4826 fn take_or_borrow<'a>(
4827 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4828 ) -> Self::Borrowed<'a> {
4829 value
4830 }
4831 }
4832
4833 unsafe impl fidl::encoding::TypeMarker for ShutdownWatcherRegisterRegisterWatcherRequest {
4834 type Owned = Self;
4835
4836 #[inline(always)]
4837 fn inline_align(_context: fidl::encoding::Context) -> usize {
4838 4
4839 }
4840
4841 #[inline(always)]
4842 fn inline_size(_context: fidl::encoding::Context) -> usize {
4843 4
4844 }
4845 }
4846
4847 unsafe impl
4848 fidl::encoding::Encode<
4849 ShutdownWatcherRegisterRegisterWatcherRequest,
4850 fidl::encoding::DefaultFuchsiaResourceDialect,
4851 > for &mut ShutdownWatcherRegisterRegisterWatcherRequest
4852 {
4853 #[inline]
4854 unsafe fn encode(
4855 self,
4856 encoder: &mut fidl::encoding::Encoder<
4857 '_,
4858 fidl::encoding::DefaultFuchsiaResourceDialect,
4859 >,
4860 offset: usize,
4861 _depth: fidl::encoding::Depth,
4862 ) -> fidl::Result<()> {
4863 encoder.debug_check_bounds::<ShutdownWatcherRegisterRegisterWatcherRequest>(offset);
4864 fidl::encoding::Encode::<ShutdownWatcherRegisterRegisterWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4866 (
4867 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ShutdownWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
4868 ),
4869 encoder, offset, _depth
4870 )
4871 }
4872 }
4873 unsafe impl<
4874 T0: fidl::encoding::Encode<
4875 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ShutdownWatcherMarker>>,
4876 fidl::encoding::DefaultFuchsiaResourceDialect,
4877 >,
4878 >
4879 fidl::encoding::Encode<
4880 ShutdownWatcherRegisterRegisterWatcherRequest,
4881 fidl::encoding::DefaultFuchsiaResourceDialect,
4882 > for (T0,)
4883 {
4884 #[inline]
4885 unsafe fn encode(
4886 self,
4887 encoder: &mut fidl::encoding::Encoder<
4888 '_,
4889 fidl::encoding::DefaultFuchsiaResourceDialect,
4890 >,
4891 offset: usize,
4892 depth: fidl::encoding::Depth,
4893 ) -> fidl::Result<()> {
4894 encoder.debug_check_bounds::<ShutdownWatcherRegisterRegisterWatcherRequest>(offset);
4895 self.0.encode(encoder, offset + 0, depth)?;
4899 Ok(())
4900 }
4901 }
4902
4903 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4904 for ShutdownWatcherRegisterRegisterWatcherRequest
4905 {
4906 #[inline(always)]
4907 fn new_empty() -> Self {
4908 Self {
4909 watcher: fidl::new_empty!(
4910 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ShutdownWatcherMarker>>,
4911 fidl::encoding::DefaultFuchsiaResourceDialect
4912 ),
4913 }
4914 }
4915
4916 #[inline]
4917 unsafe fn decode(
4918 &mut self,
4919 decoder: &mut fidl::encoding::Decoder<
4920 '_,
4921 fidl::encoding::DefaultFuchsiaResourceDialect,
4922 >,
4923 offset: usize,
4924 _depth: fidl::encoding::Depth,
4925 ) -> fidl::Result<()> {
4926 decoder.debug_check_bounds::<Self>(offset);
4927 fidl::decode!(
4929 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ShutdownWatcherMarker>>,
4930 fidl::encoding::DefaultFuchsiaResourceDialect,
4931 &mut self.watcher,
4932 decoder,
4933 offset + 0,
4934 _depth
4935 )?;
4936 Ok(())
4937 }
4938 }
4939}