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