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 RebootMethodsWatcherRegisterRegisterRequest {
24 pub watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
25}
26
27impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
28 for RebootMethodsWatcherRegisterRegisterRequest
29{
30}
31
32#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
33pub struct RebootMethodsWatcherRegisterRegisterWatcherRequest {
34 pub watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
35}
36
37impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
38 for RebootMethodsWatcherRegisterRegisterWatcherRequest
39{
40}
41
42#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
43pub struct RebootMethodsWatcherRegisterRegisterWithAckRequest {
44 pub watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
45}
46
47impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
48 for RebootMethodsWatcherRegisterRegisterWithAckRequest
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 AdminRebootResult = 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 RebootResponseFut: std::future::Future<Output = Result<AdminRebootResult, fidl::Error>>
78 + Send;
79 fn r#reboot(&self, reason: RebootReason) -> Self::RebootResponseFut;
80 type PerformRebootResponseFut: std::future::Future<Output = Result<AdminPerformRebootResult, fidl::Error>>
81 + Send;
82 fn r#perform_reboot(&self, options: &RebootOptions) -> Self::PerformRebootResponseFut;
83 type RebootToBootloaderResponseFut: std::future::Future<Output = Result<AdminRebootToBootloaderResult, fidl::Error>>
84 + Send;
85 fn r#reboot_to_bootloader(&self) -> Self::RebootToBootloaderResponseFut;
86 type RebootToRecoveryResponseFut: std::future::Future<Output = Result<AdminRebootToRecoveryResult, fidl::Error>>
87 + Send;
88 fn r#reboot_to_recovery(&self) -> Self::RebootToRecoveryResponseFut;
89 type PoweroffResponseFut: std::future::Future<Output = Result<AdminPoweroffResult, fidl::Error>>
90 + Send;
91 fn r#poweroff(&self) -> Self::PoweroffResponseFut;
92 type MexecResponseFut: std::future::Future<Output = Result<AdminMexecResult, fidl::Error>>
93 + Send;
94 fn r#mexec(&self, kernel_zbi: fidl::Vmo, data_zbi: fidl::Vmo) -> Self::MexecResponseFut;
95 type SuspendToRamResponseFut: std::future::Future<Output = Result<AdminSuspendToRamResult, fidl::Error>>
96 + Send;
97 fn r#suspend_to_ram(&self) -> Self::SuspendToRamResponseFut;
98}
99#[derive(Debug)]
100#[cfg(target_os = "fuchsia")]
101pub struct AdminSynchronousProxy {
102 client: fidl::client::sync::Client,
103}
104
105#[cfg(target_os = "fuchsia")]
106impl fidl::endpoints::SynchronousProxy for AdminSynchronousProxy {
107 type Proxy = AdminProxy;
108 type Protocol = AdminMarker;
109
110 fn from_channel(inner: fidl::Channel) -> Self {
111 Self::new(inner)
112 }
113
114 fn into_channel(self) -> fidl::Channel {
115 self.client.into_channel()
116 }
117
118 fn as_channel(&self) -> &fidl::Channel {
119 self.client.as_channel()
120 }
121}
122
123#[cfg(target_os = "fuchsia")]
124impl AdminSynchronousProxy {
125 pub fn new(channel: fidl::Channel) -> Self {
126 let protocol_name = <AdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
127 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
128 }
129
130 pub fn into_channel(self) -> fidl::Channel {
131 self.client.into_channel()
132 }
133
134 pub fn wait_for_event(
137 &self,
138 deadline: zx::MonotonicInstant,
139 ) -> Result<AdminEvent, fidl::Error> {
140 AdminEvent::decode(self.client.wait_for_event(deadline)?)
141 }
142
143 pub fn r#power_fully_on(
145 &self,
146 ___deadline: zx::MonotonicInstant,
147 ) -> Result<AdminPowerFullyOnResult, fidl::Error> {
148 let _response = self.client.send_query::<
149 fidl::encoding::EmptyPayload,
150 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
151 >(
152 (),
153 0xb3272d15e00712f,
154 fidl::encoding::DynamicFlags::empty(),
155 ___deadline,
156 )?;
157 Ok(_response.map(|x| x))
158 }
159
160 pub fn r#reboot(
164 &self,
165 mut reason: RebootReason,
166 ___deadline: zx::MonotonicInstant,
167 ) -> Result<AdminRebootResult, fidl::Error> {
168 let _response = self.client.send_query::<
169 AdminRebootRequest,
170 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
171 >(
172 (reason,),
173 0x21f258bd20297368,
174 fidl::encoding::DynamicFlags::empty(),
175 ___deadline,
176 )?;
177 Ok(_response.map(|x| x))
178 }
179
180 pub fn r#perform_reboot(
187 &self,
188 mut options: &RebootOptions,
189 ___deadline: zx::MonotonicInstant,
190 ) -> Result<AdminPerformRebootResult, fidl::Error> {
191 let _response = self.client.send_query::<
192 AdminPerformRebootRequest,
193 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
194 >(
195 (options,),
196 0x9416b4d36a80b4,
197 fidl::encoding::DynamicFlags::empty(),
198 ___deadline,
199 )?;
200 Ok(_response.map(|x| x))
201 }
202
203 pub fn r#reboot_to_bootloader(
205 &self,
206 ___deadline: zx::MonotonicInstant,
207 ) -> Result<AdminRebootToBootloaderResult, fidl::Error> {
208 let _response = self.client.send_query::<
209 fidl::encoding::EmptyPayload,
210 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
211 >(
212 (),
213 0x6dce331b33786aa,
214 fidl::encoding::DynamicFlags::empty(),
215 ___deadline,
216 )?;
217 Ok(_response.map(|x| x))
218 }
219
220 pub fn r#reboot_to_recovery(
222 &self,
223 ___deadline: zx::MonotonicInstant,
224 ) -> Result<AdminRebootToRecoveryResult, fidl::Error> {
225 let _response = self.client.send_query::<
226 fidl::encoding::EmptyPayload,
227 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
228 >(
229 (),
230 0x1575c566be54f505,
231 fidl::encoding::DynamicFlags::empty(),
232 ___deadline,
233 )?;
234 Ok(_response.map(|x| x))
235 }
236
237 pub fn r#poweroff(
239 &self,
240 ___deadline: zx::MonotonicInstant,
241 ) -> Result<AdminPoweroffResult, fidl::Error> {
242 let _response = self.client.send_query::<
243 fidl::encoding::EmptyPayload,
244 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
245 >(
246 (),
247 0x24101c5d0b439748,
248 fidl::encoding::DynamicFlags::empty(),
249 ___deadline,
250 )?;
251 Ok(_response.map(|x| x))
252 }
253
254 pub fn r#mexec(
260 &self,
261 mut kernel_zbi: fidl::Vmo,
262 mut data_zbi: fidl::Vmo,
263 ___deadline: zx::MonotonicInstant,
264 ) -> Result<AdminMexecResult, fidl::Error> {
265 let _response = self.client.send_query::<
266 AdminMexecRequest,
267 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
268 >(
269 (kernel_zbi, data_zbi,),
270 0x1f91e77ec781a4c6,
271 fidl::encoding::DynamicFlags::empty(),
272 ___deadline,
273 )?;
274 Ok(_response.map(|x| x))
275 }
276
277 pub fn r#suspend_to_ram(
282 &self,
283 ___deadline: zx::MonotonicInstant,
284 ) -> Result<AdminSuspendToRamResult, fidl::Error> {
285 let _response = self.client.send_query::<
286 fidl::encoding::EmptyPayload,
287 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
288 >(
289 (),
290 0x3b0e356782e7620e,
291 fidl::encoding::DynamicFlags::empty(),
292 ___deadline,
293 )?;
294 Ok(_response.map(|x| x))
295 }
296}
297
298#[cfg(target_os = "fuchsia")]
299impl From<AdminSynchronousProxy> for zx::Handle {
300 fn from(value: AdminSynchronousProxy) -> Self {
301 value.into_channel().into()
302 }
303}
304
305#[cfg(target_os = "fuchsia")]
306impl From<fidl::Channel> for AdminSynchronousProxy {
307 fn from(value: fidl::Channel) -> Self {
308 Self::new(value)
309 }
310}
311
312#[derive(Debug, Clone)]
313pub struct AdminProxy {
314 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
315}
316
317impl fidl::endpoints::Proxy for AdminProxy {
318 type Protocol = AdminMarker;
319
320 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
321 Self::new(inner)
322 }
323
324 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
325 self.client.into_channel().map_err(|client| Self { client })
326 }
327
328 fn as_channel(&self) -> &::fidl::AsyncChannel {
329 self.client.as_channel()
330 }
331}
332
333impl AdminProxy {
334 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
336 let protocol_name = <AdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
337 Self { client: fidl::client::Client::new(channel, protocol_name) }
338 }
339
340 pub fn take_event_stream(&self) -> AdminEventStream {
346 AdminEventStream { event_receiver: self.client.take_event_receiver() }
347 }
348
349 pub fn r#power_fully_on(
351 &self,
352 ) -> fidl::client::QueryResponseFut<
353 AdminPowerFullyOnResult,
354 fidl::encoding::DefaultFuchsiaResourceDialect,
355 > {
356 AdminProxyInterface::r#power_fully_on(self)
357 }
358
359 pub fn r#reboot(
363 &self,
364 mut reason: RebootReason,
365 ) -> fidl::client::QueryResponseFut<
366 AdminRebootResult,
367 fidl::encoding::DefaultFuchsiaResourceDialect,
368 > {
369 AdminProxyInterface::r#reboot(self, reason)
370 }
371
372 pub fn r#perform_reboot(
379 &self,
380 mut options: &RebootOptions,
381 ) -> fidl::client::QueryResponseFut<
382 AdminPerformRebootResult,
383 fidl::encoding::DefaultFuchsiaResourceDialect,
384 > {
385 AdminProxyInterface::r#perform_reboot(self, options)
386 }
387
388 pub fn r#reboot_to_bootloader(
390 &self,
391 ) -> fidl::client::QueryResponseFut<
392 AdminRebootToBootloaderResult,
393 fidl::encoding::DefaultFuchsiaResourceDialect,
394 > {
395 AdminProxyInterface::r#reboot_to_bootloader(self)
396 }
397
398 pub fn r#reboot_to_recovery(
400 &self,
401 ) -> fidl::client::QueryResponseFut<
402 AdminRebootToRecoveryResult,
403 fidl::encoding::DefaultFuchsiaResourceDialect,
404 > {
405 AdminProxyInterface::r#reboot_to_recovery(self)
406 }
407
408 pub fn r#poweroff(
410 &self,
411 ) -> fidl::client::QueryResponseFut<
412 AdminPoweroffResult,
413 fidl::encoding::DefaultFuchsiaResourceDialect,
414 > {
415 AdminProxyInterface::r#poweroff(self)
416 }
417
418 pub fn r#mexec(
424 &self,
425 mut kernel_zbi: fidl::Vmo,
426 mut data_zbi: fidl::Vmo,
427 ) -> fidl::client::QueryResponseFut<
428 AdminMexecResult,
429 fidl::encoding::DefaultFuchsiaResourceDialect,
430 > {
431 AdminProxyInterface::r#mexec(self, kernel_zbi, data_zbi)
432 }
433
434 pub fn r#suspend_to_ram(
439 &self,
440 ) -> fidl::client::QueryResponseFut<
441 AdminSuspendToRamResult,
442 fidl::encoding::DefaultFuchsiaResourceDialect,
443 > {
444 AdminProxyInterface::r#suspend_to_ram(self)
445 }
446}
447
448impl AdminProxyInterface for AdminProxy {
449 type PowerFullyOnResponseFut = fidl::client::QueryResponseFut<
450 AdminPowerFullyOnResult,
451 fidl::encoding::DefaultFuchsiaResourceDialect,
452 >;
453 fn r#power_fully_on(&self) -> Self::PowerFullyOnResponseFut {
454 fn _decode(
455 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
456 ) -> Result<AdminPowerFullyOnResult, fidl::Error> {
457 let _response = fidl::client::decode_transaction_body::<
458 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
459 fidl::encoding::DefaultFuchsiaResourceDialect,
460 0xb3272d15e00712f,
461 >(_buf?)?;
462 Ok(_response.map(|x| x))
463 }
464 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AdminPowerFullyOnResult>(
465 (),
466 0xb3272d15e00712f,
467 fidl::encoding::DynamicFlags::empty(),
468 _decode,
469 )
470 }
471
472 type RebootResponseFut = fidl::client::QueryResponseFut<
473 AdminRebootResult,
474 fidl::encoding::DefaultFuchsiaResourceDialect,
475 >;
476 fn r#reboot(&self, mut reason: RebootReason) -> Self::RebootResponseFut {
477 fn _decode(
478 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
479 ) -> Result<AdminRebootResult, fidl::Error> {
480 let _response = fidl::client::decode_transaction_body::<
481 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
482 fidl::encoding::DefaultFuchsiaResourceDialect,
483 0x21f258bd20297368,
484 >(_buf?)?;
485 Ok(_response.map(|x| x))
486 }
487 self.client.send_query_and_decode::<AdminRebootRequest, AdminRebootResult>(
488 (reason,),
489 0x21f258bd20297368,
490 fidl::encoding::DynamicFlags::empty(),
491 _decode,
492 )
493 }
494
495 type PerformRebootResponseFut = fidl::client::QueryResponseFut<
496 AdminPerformRebootResult,
497 fidl::encoding::DefaultFuchsiaResourceDialect,
498 >;
499 fn r#perform_reboot(&self, mut options: &RebootOptions) -> Self::PerformRebootResponseFut {
500 fn _decode(
501 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
502 ) -> Result<AdminPerformRebootResult, fidl::Error> {
503 let _response = fidl::client::decode_transaction_body::<
504 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
505 fidl::encoding::DefaultFuchsiaResourceDialect,
506 0x9416b4d36a80b4,
507 >(_buf?)?;
508 Ok(_response.map(|x| x))
509 }
510 self.client.send_query_and_decode::<AdminPerformRebootRequest, AdminPerformRebootResult>(
511 (options,),
512 0x9416b4d36a80b4,
513 fidl::encoding::DynamicFlags::empty(),
514 _decode,
515 )
516 }
517
518 type RebootToBootloaderResponseFut = fidl::client::QueryResponseFut<
519 AdminRebootToBootloaderResult,
520 fidl::encoding::DefaultFuchsiaResourceDialect,
521 >;
522 fn r#reboot_to_bootloader(&self) -> Self::RebootToBootloaderResponseFut {
523 fn _decode(
524 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
525 ) -> Result<AdminRebootToBootloaderResult, fidl::Error> {
526 let _response = fidl::client::decode_transaction_body::<
527 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
528 fidl::encoding::DefaultFuchsiaResourceDialect,
529 0x6dce331b33786aa,
530 >(_buf?)?;
531 Ok(_response.map(|x| x))
532 }
533 self.client
534 .send_query_and_decode::<fidl::encoding::EmptyPayload, AdminRebootToBootloaderResult>(
535 (),
536 0x6dce331b33786aa,
537 fidl::encoding::DynamicFlags::empty(),
538 _decode,
539 )
540 }
541
542 type RebootToRecoveryResponseFut = fidl::client::QueryResponseFut<
543 AdminRebootToRecoveryResult,
544 fidl::encoding::DefaultFuchsiaResourceDialect,
545 >;
546 fn r#reboot_to_recovery(&self) -> Self::RebootToRecoveryResponseFut {
547 fn _decode(
548 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
549 ) -> Result<AdminRebootToRecoveryResult, fidl::Error> {
550 let _response = fidl::client::decode_transaction_body::<
551 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
552 fidl::encoding::DefaultFuchsiaResourceDialect,
553 0x1575c566be54f505,
554 >(_buf?)?;
555 Ok(_response.map(|x| x))
556 }
557 self.client
558 .send_query_and_decode::<fidl::encoding::EmptyPayload, AdminRebootToRecoveryResult>(
559 (),
560 0x1575c566be54f505,
561 fidl::encoding::DynamicFlags::empty(),
562 _decode,
563 )
564 }
565
566 type PoweroffResponseFut = fidl::client::QueryResponseFut<
567 AdminPoweroffResult,
568 fidl::encoding::DefaultFuchsiaResourceDialect,
569 >;
570 fn r#poweroff(&self) -> Self::PoweroffResponseFut {
571 fn _decode(
572 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
573 ) -> Result<AdminPoweroffResult, fidl::Error> {
574 let _response = fidl::client::decode_transaction_body::<
575 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
576 fidl::encoding::DefaultFuchsiaResourceDialect,
577 0x24101c5d0b439748,
578 >(_buf?)?;
579 Ok(_response.map(|x| x))
580 }
581 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AdminPoweroffResult>(
582 (),
583 0x24101c5d0b439748,
584 fidl::encoding::DynamicFlags::empty(),
585 _decode,
586 )
587 }
588
589 type MexecResponseFut = fidl::client::QueryResponseFut<
590 AdminMexecResult,
591 fidl::encoding::DefaultFuchsiaResourceDialect,
592 >;
593 fn r#mexec(
594 &self,
595 mut kernel_zbi: fidl::Vmo,
596 mut data_zbi: fidl::Vmo,
597 ) -> Self::MexecResponseFut {
598 fn _decode(
599 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
600 ) -> Result<AdminMexecResult, fidl::Error> {
601 let _response = fidl::client::decode_transaction_body::<
602 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
603 fidl::encoding::DefaultFuchsiaResourceDialect,
604 0x1f91e77ec781a4c6,
605 >(_buf?)?;
606 Ok(_response.map(|x| x))
607 }
608 self.client.send_query_and_decode::<AdminMexecRequest, AdminMexecResult>(
609 (kernel_zbi, data_zbi),
610 0x1f91e77ec781a4c6,
611 fidl::encoding::DynamicFlags::empty(),
612 _decode,
613 )
614 }
615
616 type SuspendToRamResponseFut = fidl::client::QueryResponseFut<
617 AdminSuspendToRamResult,
618 fidl::encoding::DefaultFuchsiaResourceDialect,
619 >;
620 fn r#suspend_to_ram(&self) -> Self::SuspendToRamResponseFut {
621 fn _decode(
622 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
623 ) -> Result<AdminSuspendToRamResult, fidl::Error> {
624 let _response = fidl::client::decode_transaction_body::<
625 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
626 fidl::encoding::DefaultFuchsiaResourceDialect,
627 0x3b0e356782e7620e,
628 >(_buf?)?;
629 Ok(_response.map(|x| x))
630 }
631 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AdminSuspendToRamResult>(
632 (),
633 0x3b0e356782e7620e,
634 fidl::encoding::DynamicFlags::empty(),
635 _decode,
636 )
637 }
638}
639
640pub struct AdminEventStream {
641 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
642}
643
644impl std::marker::Unpin for AdminEventStream {}
645
646impl futures::stream::FusedStream for AdminEventStream {
647 fn is_terminated(&self) -> bool {
648 self.event_receiver.is_terminated()
649 }
650}
651
652impl futures::Stream for AdminEventStream {
653 type Item = Result<AdminEvent, fidl::Error>;
654
655 fn poll_next(
656 mut self: std::pin::Pin<&mut Self>,
657 cx: &mut std::task::Context<'_>,
658 ) -> std::task::Poll<Option<Self::Item>> {
659 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
660 &mut self.event_receiver,
661 cx
662 )?) {
663 Some(buf) => std::task::Poll::Ready(Some(AdminEvent::decode(buf))),
664 None => std::task::Poll::Ready(None),
665 }
666 }
667}
668
669#[derive(Debug)]
670pub enum AdminEvent {}
671
672impl AdminEvent {
673 fn decode(
675 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
676 ) -> Result<AdminEvent, fidl::Error> {
677 let (bytes, _handles) = buf.split_mut();
678 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
679 debug_assert_eq!(tx_header.tx_id, 0);
680 match tx_header.ordinal {
681 _ => Err(fidl::Error::UnknownOrdinal {
682 ordinal: tx_header.ordinal,
683 protocol_name: <AdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
684 }),
685 }
686 }
687}
688
689pub struct AdminRequestStream {
691 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
692 is_terminated: bool,
693}
694
695impl std::marker::Unpin for AdminRequestStream {}
696
697impl futures::stream::FusedStream for AdminRequestStream {
698 fn is_terminated(&self) -> bool {
699 self.is_terminated
700 }
701}
702
703impl fidl::endpoints::RequestStream for AdminRequestStream {
704 type Protocol = AdminMarker;
705 type ControlHandle = AdminControlHandle;
706
707 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
708 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
709 }
710
711 fn control_handle(&self) -> Self::ControlHandle {
712 AdminControlHandle { inner: self.inner.clone() }
713 }
714
715 fn into_inner(
716 self,
717 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
718 {
719 (self.inner, self.is_terminated)
720 }
721
722 fn from_inner(
723 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
724 is_terminated: bool,
725 ) -> Self {
726 Self { inner, is_terminated }
727 }
728}
729
730impl futures::Stream for AdminRequestStream {
731 type Item = Result<AdminRequest, fidl::Error>;
732
733 fn poll_next(
734 mut self: std::pin::Pin<&mut Self>,
735 cx: &mut std::task::Context<'_>,
736 ) -> std::task::Poll<Option<Self::Item>> {
737 let this = &mut *self;
738 if this.inner.check_shutdown(cx) {
739 this.is_terminated = true;
740 return std::task::Poll::Ready(None);
741 }
742 if this.is_terminated {
743 panic!("polled AdminRequestStream after completion");
744 }
745 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
746 |bytes, handles| {
747 match this.inner.channel().read_etc(cx, bytes, handles) {
748 std::task::Poll::Ready(Ok(())) => {}
749 std::task::Poll::Pending => return std::task::Poll::Pending,
750 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
751 this.is_terminated = true;
752 return std::task::Poll::Ready(None);
753 }
754 std::task::Poll::Ready(Err(e)) => {
755 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
756 e.into(),
757 ))))
758 }
759 }
760
761 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
763
764 std::task::Poll::Ready(Some(match header.ordinal {
765 0xb3272d15e00712f => {
766 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
767 let mut req = fidl::new_empty!(
768 fidl::encoding::EmptyPayload,
769 fidl::encoding::DefaultFuchsiaResourceDialect
770 );
771 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
772 let control_handle = AdminControlHandle { inner: this.inner.clone() };
773 Ok(AdminRequest::PowerFullyOn {
774 responder: AdminPowerFullyOnResponder {
775 control_handle: std::mem::ManuallyDrop::new(control_handle),
776 tx_id: header.tx_id,
777 },
778 })
779 }
780 0x21f258bd20297368 => {
781 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
782 let mut req = fidl::new_empty!(
783 AdminRebootRequest,
784 fidl::encoding::DefaultFuchsiaResourceDialect
785 );
786 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdminRebootRequest>(&header, _body_bytes, handles, &mut req)?;
787 let control_handle = AdminControlHandle { inner: this.inner.clone() };
788 Ok(AdminRequest::Reboot {
789 reason: req.reason,
790
791 responder: AdminRebootResponder {
792 control_handle: std::mem::ManuallyDrop::new(control_handle),
793 tx_id: header.tx_id,
794 },
795 })
796 }
797 0x9416b4d36a80b4 => {
798 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
799 let mut req = fidl::new_empty!(
800 AdminPerformRebootRequest,
801 fidl::encoding::DefaultFuchsiaResourceDialect
802 );
803 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdminPerformRebootRequest>(&header, _body_bytes, handles, &mut req)?;
804 let control_handle = AdminControlHandle { inner: this.inner.clone() };
805 Ok(AdminRequest::PerformReboot {
806 options: req.options,
807
808 responder: AdminPerformRebootResponder {
809 control_handle: std::mem::ManuallyDrop::new(control_handle),
810 tx_id: header.tx_id,
811 },
812 })
813 }
814 0x6dce331b33786aa => {
815 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
816 let mut req = fidl::new_empty!(
817 fidl::encoding::EmptyPayload,
818 fidl::encoding::DefaultFuchsiaResourceDialect
819 );
820 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
821 let control_handle = AdminControlHandle { inner: this.inner.clone() };
822 Ok(AdminRequest::RebootToBootloader {
823 responder: AdminRebootToBootloaderResponder {
824 control_handle: std::mem::ManuallyDrop::new(control_handle),
825 tx_id: header.tx_id,
826 },
827 })
828 }
829 0x1575c566be54f505 => {
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::RebootToRecovery {
838 responder: AdminRebootToRecoveryResponder {
839 control_handle: std::mem::ManuallyDrop::new(control_handle),
840 tx_id: header.tx_id,
841 },
842 })
843 }
844 0x24101c5d0b439748 => {
845 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
846 let mut req = fidl::new_empty!(
847 fidl::encoding::EmptyPayload,
848 fidl::encoding::DefaultFuchsiaResourceDialect
849 );
850 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
851 let control_handle = AdminControlHandle { inner: this.inner.clone() };
852 Ok(AdminRequest::Poweroff {
853 responder: AdminPoweroffResponder {
854 control_handle: std::mem::ManuallyDrop::new(control_handle),
855 tx_id: header.tx_id,
856 },
857 })
858 }
859 0x1f91e77ec781a4c6 => {
860 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
861 let mut req = fidl::new_empty!(
862 AdminMexecRequest,
863 fidl::encoding::DefaultFuchsiaResourceDialect
864 );
865 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdminMexecRequest>(&header, _body_bytes, handles, &mut req)?;
866 let control_handle = AdminControlHandle { inner: this.inner.clone() };
867 Ok(AdminRequest::Mexec {
868 kernel_zbi: req.kernel_zbi,
869 data_zbi: req.data_zbi,
870
871 responder: AdminMexecResponder {
872 control_handle: std::mem::ManuallyDrop::new(control_handle),
873 tx_id: header.tx_id,
874 },
875 })
876 }
877 0x3b0e356782e7620e => {
878 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
879 let mut req = fidl::new_empty!(
880 fidl::encoding::EmptyPayload,
881 fidl::encoding::DefaultFuchsiaResourceDialect
882 );
883 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
884 let control_handle = AdminControlHandle { inner: this.inner.clone() };
885 Ok(AdminRequest::SuspendToRam {
886 responder: AdminSuspendToRamResponder {
887 control_handle: std::mem::ManuallyDrop::new(control_handle),
888 tx_id: header.tx_id,
889 },
890 })
891 }
892 _ => Err(fidl::Error::UnknownOrdinal {
893 ordinal: header.ordinal,
894 protocol_name: <AdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
895 }),
896 }))
897 },
898 )
899 }
900}
901
902#[derive(Debug)]
917pub enum AdminRequest {
918 PowerFullyOn { responder: AdminPowerFullyOnResponder },
920 Reboot { reason: RebootReason, responder: AdminRebootResponder },
924 PerformReboot { options: RebootOptions, responder: AdminPerformRebootResponder },
931 RebootToBootloader { responder: AdminRebootToBootloaderResponder },
933 RebootToRecovery { responder: AdminRebootToRecoveryResponder },
935 Poweroff { responder: AdminPoweroffResponder },
937 Mexec { kernel_zbi: fidl::Vmo, data_zbi: fidl::Vmo, responder: AdminMexecResponder },
943 SuspendToRam { responder: AdminSuspendToRamResponder },
948}
949
950impl AdminRequest {
951 #[allow(irrefutable_let_patterns)]
952 pub fn into_power_fully_on(self) -> Option<(AdminPowerFullyOnResponder)> {
953 if let AdminRequest::PowerFullyOn { responder } = self {
954 Some((responder))
955 } else {
956 None
957 }
958 }
959
960 #[allow(irrefutable_let_patterns)]
961 pub fn into_reboot(self) -> Option<(RebootReason, AdminRebootResponder)> {
962 if let AdminRequest::Reboot { reason, responder } = self {
963 Some((reason, responder))
964 } else {
965 None
966 }
967 }
968
969 #[allow(irrefutable_let_patterns)]
970 pub fn into_perform_reboot(self) -> Option<(RebootOptions, AdminPerformRebootResponder)> {
971 if let AdminRequest::PerformReboot { options, responder } = self {
972 Some((options, responder))
973 } else {
974 None
975 }
976 }
977
978 #[allow(irrefutable_let_patterns)]
979 pub fn into_reboot_to_bootloader(self) -> Option<(AdminRebootToBootloaderResponder)> {
980 if let AdminRequest::RebootToBootloader { responder } = self {
981 Some((responder))
982 } else {
983 None
984 }
985 }
986
987 #[allow(irrefutable_let_patterns)]
988 pub fn into_reboot_to_recovery(self) -> Option<(AdminRebootToRecoveryResponder)> {
989 if let AdminRequest::RebootToRecovery { responder } = self {
990 Some((responder))
991 } else {
992 None
993 }
994 }
995
996 #[allow(irrefutable_let_patterns)]
997 pub fn into_poweroff(self) -> Option<(AdminPoweroffResponder)> {
998 if let AdminRequest::Poweroff { responder } = self {
999 Some((responder))
1000 } else {
1001 None
1002 }
1003 }
1004
1005 #[allow(irrefutable_let_patterns)]
1006 pub fn into_mexec(self) -> Option<(fidl::Vmo, fidl::Vmo, AdminMexecResponder)> {
1007 if let AdminRequest::Mexec { kernel_zbi, data_zbi, responder } = self {
1008 Some((kernel_zbi, data_zbi, responder))
1009 } else {
1010 None
1011 }
1012 }
1013
1014 #[allow(irrefutable_let_patterns)]
1015 pub fn into_suspend_to_ram(self) -> Option<(AdminSuspendToRamResponder)> {
1016 if let AdminRequest::SuspendToRam { responder } = self {
1017 Some((responder))
1018 } else {
1019 None
1020 }
1021 }
1022
1023 pub fn method_name(&self) -> &'static str {
1025 match *self {
1026 AdminRequest::PowerFullyOn { .. } => "power_fully_on",
1027 AdminRequest::Reboot { .. } => "reboot",
1028 AdminRequest::PerformReboot { .. } => "perform_reboot",
1029 AdminRequest::RebootToBootloader { .. } => "reboot_to_bootloader",
1030 AdminRequest::RebootToRecovery { .. } => "reboot_to_recovery",
1031 AdminRequest::Poweroff { .. } => "poweroff",
1032 AdminRequest::Mexec { .. } => "mexec",
1033 AdminRequest::SuspendToRam { .. } => "suspend_to_ram",
1034 }
1035 }
1036}
1037
1038#[derive(Debug, Clone)]
1039pub struct AdminControlHandle {
1040 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1041}
1042
1043impl fidl::endpoints::ControlHandle for AdminControlHandle {
1044 fn shutdown(&self) {
1045 self.inner.shutdown()
1046 }
1047 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1048 self.inner.shutdown_with_epitaph(status)
1049 }
1050
1051 fn is_closed(&self) -> bool {
1052 self.inner.channel().is_closed()
1053 }
1054 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1055 self.inner.channel().on_closed()
1056 }
1057
1058 #[cfg(target_os = "fuchsia")]
1059 fn signal_peer(
1060 &self,
1061 clear_mask: zx::Signals,
1062 set_mask: zx::Signals,
1063 ) -> Result<(), zx_status::Status> {
1064 use fidl::Peered;
1065 self.inner.channel().signal_peer(clear_mask, set_mask)
1066 }
1067}
1068
1069impl AdminControlHandle {}
1070
1071#[must_use = "FIDL methods require a response to be sent"]
1072#[derive(Debug)]
1073pub struct AdminPowerFullyOnResponder {
1074 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1075 tx_id: u32,
1076}
1077
1078impl std::ops::Drop for AdminPowerFullyOnResponder {
1082 fn drop(&mut self) {
1083 self.control_handle.shutdown();
1084 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1086 }
1087}
1088
1089impl fidl::endpoints::Responder for AdminPowerFullyOnResponder {
1090 type ControlHandle = AdminControlHandle;
1091
1092 fn control_handle(&self) -> &AdminControlHandle {
1093 &self.control_handle
1094 }
1095
1096 fn drop_without_shutdown(mut self) {
1097 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1099 std::mem::forget(self);
1101 }
1102}
1103
1104impl AdminPowerFullyOnResponder {
1105 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1109 let _result = self.send_raw(result);
1110 if _result.is_err() {
1111 self.control_handle.shutdown();
1112 }
1113 self.drop_without_shutdown();
1114 _result
1115 }
1116
1117 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1119 let _result = self.send_raw(result);
1120 self.drop_without_shutdown();
1121 _result
1122 }
1123
1124 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1125 self.control_handle
1126 .inner
1127 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1128 result,
1129 self.tx_id,
1130 0xb3272d15e00712f,
1131 fidl::encoding::DynamicFlags::empty(),
1132 )
1133 }
1134}
1135
1136#[must_use = "FIDL methods require a response to be sent"]
1137#[derive(Debug)]
1138pub struct AdminRebootResponder {
1139 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1140 tx_id: u32,
1141}
1142
1143impl std::ops::Drop for AdminRebootResponder {
1147 fn drop(&mut self) {
1148 self.control_handle.shutdown();
1149 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1151 }
1152}
1153
1154impl fidl::endpoints::Responder for AdminRebootResponder {
1155 type ControlHandle = AdminControlHandle;
1156
1157 fn control_handle(&self) -> &AdminControlHandle {
1158 &self.control_handle
1159 }
1160
1161 fn drop_without_shutdown(mut self) {
1162 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1164 std::mem::forget(self);
1166 }
1167}
1168
1169impl AdminRebootResponder {
1170 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1174 let _result = self.send_raw(result);
1175 if _result.is_err() {
1176 self.control_handle.shutdown();
1177 }
1178 self.drop_without_shutdown();
1179 _result
1180 }
1181
1182 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1184 let _result = self.send_raw(result);
1185 self.drop_without_shutdown();
1186 _result
1187 }
1188
1189 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1190 self.control_handle
1191 .inner
1192 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1193 result,
1194 self.tx_id,
1195 0x21f258bd20297368,
1196 fidl::encoding::DynamicFlags::empty(),
1197 )
1198 }
1199}
1200
1201#[must_use = "FIDL methods require a response to be sent"]
1202#[derive(Debug)]
1203pub struct AdminPerformRebootResponder {
1204 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1205 tx_id: u32,
1206}
1207
1208impl std::ops::Drop for AdminPerformRebootResponder {
1212 fn drop(&mut self) {
1213 self.control_handle.shutdown();
1214 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1216 }
1217}
1218
1219impl fidl::endpoints::Responder for AdminPerformRebootResponder {
1220 type ControlHandle = AdminControlHandle;
1221
1222 fn control_handle(&self) -> &AdminControlHandle {
1223 &self.control_handle
1224 }
1225
1226 fn drop_without_shutdown(mut self) {
1227 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1229 std::mem::forget(self);
1231 }
1232}
1233
1234impl AdminPerformRebootResponder {
1235 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1239 let _result = self.send_raw(result);
1240 if _result.is_err() {
1241 self.control_handle.shutdown();
1242 }
1243 self.drop_without_shutdown();
1244 _result
1245 }
1246
1247 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1249 let _result = self.send_raw(result);
1250 self.drop_without_shutdown();
1251 _result
1252 }
1253
1254 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1255 self.control_handle
1256 .inner
1257 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1258 result,
1259 self.tx_id,
1260 0x9416b4d36a80b4,
1261 fidl::encoding::DynamicFlags::empty(),
1262 )
1263 }
1264}
1265
1266#[must_use = "FIDL methods require a response to be sent"]
1267#[derive(Debug)]
1268pub struct AdminRebootToBootloaderResponder {
1269 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1270 tx_id: u32,
1271}
1272
1273impl std::ops::Drop for AdminRebootToBootloaderResponder {
1277 fn drop(&mut self) {
1278 self.control_handle.shutdown();
1279 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1281 }
1282}
1283
1284impl fidl::endpoints::Responder for AdminRebootToBootloaderResponder {
1285 type ControlHandle = AdminControlHandle;
1286
1287 fn control_handle(&self) -> &AdminControlHandle {
1288 &self.control_handle
1289 }
1290
1291 fn drop_without_shutdown(mut self) {
1292 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1294 std::mem::forget(self);
1296 }
1297}
1298
1299impl AdminRebootToBootloaderResponder {
1300 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1304 let _result = self.send_raw(result);
1305 if _result.is_err() {
1306 self.control_handle.shutdown();
1307 }
1308 self.drop_without_shutdown();
1309 _result
1310 }
1311
1312 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1314 let _result = self.send_raw(result);
1315 self.drop_without_shutdown();
1316 _result
1317 }
1318
1319 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1320 self.control_handle
1321 .inner
1322 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1323 result,
1324 self.tx_id,
1325 0x6dce331b33786aa,
1326 fidl::encoding::DynamicFlags::empty(),
1327 )
1328 }
1329}
1330
1331#[must_use = "FIDL methods require a response to be sent"]
1332#[derive(Debug)]
1333pub struct AdminRebootToRecoveryResponder {
1334 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1335 tx_id: u32,
1336}
1337
1338impl std::ops::Drop for AdminRebootToRecoveryResponder {
1342 fn drop(&mut self) {
1343 self.control_handle.shutdown();
1344 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1346 }
1347}
1348
1349impl fidl::endpoints::Responder for AdminRebootToRecoveryResponder {
1350 type ControlHandle = AdminControlHandle;
1351
1352 fn control_handle(&self) -> &AdminControlHandle {
1353 &self.control_handle
1354 }
1355
1356 fn drop_without_shutdown(mut self) {
1357 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1359 std::mem::forget(self);
1361 }
1362}
1363
1364impl AdminRebootToRecoveryResponder {
1365 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1369 let _result = self.send_raw(result);
1370 if _result.is_err() {
1371 self.control_handle.shutdown();
1372 }
1373 self.drop_without_shutdown();
1374 _result
1375 }
1376
1377 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1379 let _result = self.send_raw(result);
1380 self.drop_without_shutdown();
1381 _result
1382 }
1383
1384 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1385 self.control_handle
1386 .inner
1387 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1388 result,
1389 self.tx_id,
1390 0x1575c566be54f505,
1391 fidl::encoding::DynamicFlags::empty(),
1392 )
1393 }
1394}
1395
1396#[must_use = "FIDL methods require a response to be sent"]
1397#[derive(Debug)]
1398pub struct AdminPoweroffResponder {
1399 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1400 tx_id: u32,
1401}
1402
1403impl std::ops::Drop for AdminPoweroffResponder {
1407 fn drop(&mut self) {
1408 self.control_handle.shutdown();
1409 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1411 }
1412}
1413
1414impl fidl::endpoints::Responder for AdminPoweroffResponder {
1415 type ControlHandle = AdminControlHandle;
1416
1417 fn control_handle(&self) -> &AdminControlHandle {
1418 &self.control_handle
1419 }
1420
1421 fn drop_without_shutdown(mut self) {
1422 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1424 std::mem::forget(self);
1426 }
1427}
1428
1429impl AdminPoweroffResponder {
1430 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1434 let _result = self.send_raw(result);
1435 if _result.is_err() {
1436 self.control_handle.shutdown();
1437 }
1438 self.drop_without_shutdown();
1439 _result
1440 }
1441
1442 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1444 let _result = self.send_raw(result);
1445 self.drop_without_shutdown();
1446 _result
1447 }
1448
1449 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1450 self.control_handle
1451 .inner
1452 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1453 result,
1454 self.tx_id,
1455 0x24101c5d0b439748,
1456 fidl::encoding::DynamicFlags::empty(),
1457 )
1458 }
1459}
1460
1461#[must_use = "FIDL methods require a response to be sent"]
1462#[derive(Debug)]
1463pub struct AdminMexecResponder {
1464 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1465 tx_id: u32,
1466}
1467
1468impl std::ops::Drop for AdminMexecResponder {
1472 fn drop(&mut self) {
1473 self.control_handle.shutdown();
1474 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1476 }
1477}
1478
1479impl fidl::endpoints::Responder for AdminMexecResponder {
1480 type ControlHandle = AdminControlHandle;
1481
1482 fn control_handle(&self) -> &AdminControlHandle {
1483 &self.control_handle
1484 }
1485
1486 fn drop_without_shutdown(mut self) {
1487 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1489 std::mem::forget(self);
1491 }
1492}
1493
1494impl AdminMexecResponder {
1495 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1499 let _result = self.send_raw(result);
1500 if _result.is_err() {
1501 self.control_handle.shutdown();
1502 }
1503 self.drop_without_shutdown();
1504 _result
1505 }
1506
1507 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1509 let _result = self.send_raw(result);
1510 self.drop_without_shutdown();
1511 _result
1512 }
1513
1514 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1515 self.control_handle
1516 .inner
1517 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1518 result,
1519 self.tx_id,
1520 0x1f91e77ec781a4c6,
1521 fidl::encoding::DynamicFlags::empty(),
1522 )
1523 }
1524}
1525
1526#[must_use = "FIDL methods require a response to be sent"]
1527#[derive(Debug)]
1528pub struct AdminSuspendToRamResponder {
1529 control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
1530 tx_id: u32,
1531}
1532
1533impl std::ops::Drop for AdminSuspendToRamResponder {
1537 fn drop(&mut self) {
1538 self.control_handle.shutdown();
1539 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1541 }
1542}
1543
1544impl fidl::endpoints::Responder for AdminSuspendToRamResponder {
1545 type ControlHandle = AdminControlHandle;
1546
1547 fn control_handle(&self) -> &AdminControlHandle {
1548 &self.control_handle
1549 }
1550
1551 fn drop_without_shutdown(mut self) {
1552 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1554 std::mem::forget(self);
1556 }
1557}
1558
1559impl AdminSuspendToRamResponder {
1560 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1564 let _result = self.send_raw(result);
1565 if _result.is_err() {
1566 self.control_handle.shutdown();
1567 }
1568 self.drop_without_shutdown();
1569 _result
1570 }
1571
1572 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1574 let _result = self.send_raw(result);
1575 self.drop_without_shutdown();
1576 _result
1577 }
1578
1579 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1580 self.control_handle
1581 .inner
1582 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1583 result,
1584 self.tx_id,
1585 0x3b0e356782e7620e,
1586 fidl::encoding::DynamicFlags::empty(),
1587 )
1588 }
1589}
1590
1591#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1592pub struct RebootMethodsWatcherMarker;
1593
1594impl fidl::endpoints::ProtocolMarker for RebootMethodsWatcherMarker {
1595 type Proxy = RebootMethodsWatcherProxy;
1596 type RequestStream = RebootMethodsWatcherRequestStream;
1597 #[cfg(target_os = "fuchsia")]
1598 type SynchronousProxy = RebootMethodsWatcherSynchronousProxy;
1599
1600 const DEBUG_NAME: &'static str = "(anonymous) RebootMethodsWatcher";
1601}
1602
1603pub trait RebootMethodsWatcherProxyInterface: Send + Sync {
1604 type OnRebootResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1605 fn r#on_reboot(&self, reason: RebootReason) -> Self::OnRebootResponseFut;
1606}
1607#[derive(Debug)]
1608#[cfg(target_os = "fuchsia")]
1609pub struct RebootMethodsWatcherSynchronousProxy {
1610 client: fidl::client::sync::Client,
1611}
1612
1613#[cfg(target_os = "fuchsia")]
1614impl fidl::endpoints::SynchronousProxy for RebootMethodsWatcherSynchronousProxy {
1615 type Proxy = RebootMethodsWatcherProxy;
1616 type Protocol = RebootMethodsWatcherMarker;
1617
1618 fn from_channel(inner: fidl::Channel) -> Self {
1619 Self::new(inner)
1620 }
1621
1622 fn into_channel(self) -> fidl::Channel {
1623 self.client.into_channel()
1624 }
1625
1626 fn as_channel(&self) -> &fidl::Channel {
1627 self.client.as_channel()
1628 }
1629}
1630
1631#[cfg(target_os = "fuchsia")]
1632impl RebootMethodsWatcherSynchronousProxy {
1633 pub fn new(channel: fidl::Channel) -> Self {
1634 let protocol_name =
1635 <RebootMethodsWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1636 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1637 }
1638
1639 pub fn into_channel(self) -> fidl::Channel {
1640 self.client.into_channel()
1641 }
1642
1643 pub fn wait_for_event(
1646 &self,
1647 deadline: zx::MonotonicInstant,
1648 ) -> Result<RebootMethodsWatcherEvent, fidl::Error> {
1649 RebootMethodsWatcherEvent::decode(self.client.wait_for_event(deadline)?)
1650 }
1651
1652 pub fn r#on_reboot(
1653 &self,
1654 mut reason: RebootReason,
1655 ___deadline: zx::MonotonicInstant,
1656 ) -> Result<(), fidl::Error> {
1657 let _response = self
1658 .client
1659 .send_query::<RebootMethodsWatcherOnRebootRequest, fidl::encoding::EmptyPayload>(
1660 (reason,),
1661 0x225a5f32436a1b13,
1662 fidl::encoding::DynamicFlags::empty(),
1663 ___deadline,
1664 )?;
1665 Ok(_response)
1666 }
1667}
1668
1669#[cfg(target_os = "fuchsia")]
1670impl From<RebootMethodsWatcherSynchronousProxy> for zx::Handle {
1671 fn from(value: RebootMethodsWatcherSynchronousProxy) -> Self {
1672 value.into_channel().into()
1673 }
1674}
1675
1676#[cfg(target_os = "fuchsia")]
1677impl From<fidl::Channel> for RebootMethodsWatcherSynchronousProxy {
1678 fn from(value: fidl::Channel) -> Self {
1679 Self::new(value)
1680 }
1681}
1682
1683#[derive(Debug, Clone)]
1684pub struct RebootMethodsWatcherProxy {
1685 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1686}
1687
1688impl fidl::endpoints::Proxy for RebootMethodsWatcherProxy {
1689 type Protocol = RebootMethodsWatcherMarker;
1690
1691 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1692 Self::new(inner)
1693 }
1694
1695 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1696 self.client.into_channel().map_err(|client| Self { client })
1697 }
1698
1699 fn as_channel(&self) -> &::fidl::AsyncChannel {
1700 self.client.as_channel()
1701 }
1702}
1703
1704impl RebootMethodsWatcherProxy {
1705 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1707 let protocol_name =
1708 <RebootMethodsWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1709 Self { client: fidl::client::Client::new(channel, protocol_name) }
1710 }
1711
1712 pub fn take_event_stream(&self) -> RebootMethodsWatcherEventStream {
1718 RebootMethodsWatcherEventStream { event_receiver: self.client.take_event_receiver() }
1719 }
1720
1721 pub fn r#on_reboot(
1722 &self,
1723 mut reason: RebootReason,
1724 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1725 RebootMethodsWatcherProxyInterface::r#on_reboot(self, reason)
1726 }
1727}
1728
1729impl RebootMethodsWatcherProxyInterface for RebootMethodsWatcherProxy {
1730 type OnRebootResponseFut =
1731 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1732 fn r#on_reboot(&self, mut reason: RebootReason) -> Self::OnRebootResponseFut {
1733 fn _decode(
1734 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1735 ) -> Result<(), fidl::Error> {
1736 let _response = fidl::client::decode_transaction_body::<
1737 fidl::encoding::EmptyPayload,
1738 fidl::encoding::DefaultFuchsiaResourceDialect,
1739 0x225a5f32436a1b13,
1740 >(_buf?)?;
1741 Ok(_response)
1742 }
1743 self.client.send_query_and_decode::<RebootMethodsWatcherOnRebootRequest, ()>(
1744 (reason,),
1745 0x225a5f32436a1b13,
1746 fidl::encoding::DynamicFlags::empty(),
1747 _decode,
1748 )
1749 }
1750}
1751
1752pub struct RebootMethodsWatcherEventStream {
1753 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1754}
1755
1756impl std::marker::Unpin for RebootMethodsWatcherEventStream {}
1757
1758impl futures::stream::FusedStream for RebootMethodsWatcherEventStream {
1759 fn is_terminated(&self) -> bool {
1760 self.event_receiver.is_terminated()
1761 }
1762}
1763
1764impl futures::Stream for RebootMethodsWatcherEventStream {
1765 type Item = Result<RebootMethodsWatcherEvent, fidl::Error>;
1766
1767 fn poll_next(
1768 mut self: std::pin::Pin<&mut Self>,
1769 cx: &mut std::task::Context<'_>,
1770 ) -> std::task::Poll<Option<Self::Item>> {
1771 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1772 &mut self.event_receiver,
1773 cx
1774 )?) {
1775 Some(buf) => std::task::Poll::Ready(Some(RebootMethodsWatcherEvent::decode(buf))),
1776 None => std::task::Poll::Ready(None),
1777 }
1778 }
1779}
1780
1781#[derive(Debug)]
1782pub enum RebootMethodsWatcherEvent {}
1783
1784impl RebootMethodsWatcherEvent {
1785 fn decode(
1787 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1788 ) -> Result<RebootMethodsWatcherEvent, fidl::Error> {
1789 let (bytes, _handles) = buf.split_mut();
1790 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1791 debug_assert_eq!(tx_header.tx_id, 0);
1792 match tx_header.ordinal {
1793 _ => Err(fidl::Error::UnknownOrdinal {
1794 ordinal: tx_header.ordinal,
1795 protocol_name:
1796 <RebootMethodsWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1797 }),
1798 }
1799 }
1800}
1801
1802pub struct RebootMethodsWatcherRequestStream {
1804 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1805 is_terminated: bool,
1806}
1807
1808impl std::marker::Unpin for RebootMethodsWatcherRequestStream {}
1809
1810impl futures::stream::FusedStream for RebootMethodsWatcherRequestStream {
1811 fn is_terminated(&self) -> bool {
1812 self.is_terminated
1813 }
1814}
1815
1816impl fidl::endpoints::RequestStream for RebootMethodsWatcherRequestStream {
1817 type Protocol = RebootMethodsWatcherMarker;
1818 type ControlHandle = RebootMethodsWatcherControlHandle;
1819
1820 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1821 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1822 }
1823
1824 fn control_handle(&self) -> Self::ControlHandle {
1825 RebootMethodsWatcherControlHandle { inner: self.inner.clone() }
1826 }
1827
1828 fn into_inner(
1829 self,
1830 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1831 {
1832 (self.inner, self.is_terminated)
1833 }
1834
1835 fn from_inner(
1836 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1837 is_terminated: bool,
1838 ) -> Self {
1839 Self { inner, is_terminated }
1840 }
1841}
1842
1843impl futures::Stream for RebootMethodsWatcherRequestStream {
1844 type Item = Result<RebootMethodsWatcherRequest, fidl::Error>;
1845
1846 fn poll_next(
1847 mut self: std::pin::Pin<&mut Self>,
1848 cx: &mut std::task::Context<'_>,
1849 ) -> std::task::Poll<Option<Self::Item>> {
1850 let this = &mut *self;
1851 if this.inner.check_shutdown(cx) {
1852 this.is_terminated = true;
1853 return std::task::Poll::Ready(None);
1854 }
1855 if this.is_terminated {
1856 panic!("polled RebootMethodsWatcherRequestStream after completion");
1857 }
1858 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1859 |bytes, handles| {
1860 match this.inner.channel().read_etc(cx, bytes, handles) {
1861 std::task::Poll::Ready(Ok(())) => {}
1862 std::task::Poll::Pending => return std::task::Poll::Pending,
1863 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1864 this.is_terminated = true;
1865 return std::task::Poll::Ready(None);
1866 }
1867 std::task::Poll::Ready(Err(e)) => {
1868 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1869 e.into(),
1870 ))))
1871 }
1872 }
1873
1874 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1876
1877 std::task::Poll::Ready(Some(match header.ordinal {
1878 0x225a5f32436a1b13 => {
1879 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1880 let mut req = fidl::new_empty!(RebootMethodsWatcherOnRebootRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1881 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RebootMethodsWatcherOnRebootRequest>(&header, _body_bytes, handles, &mut req)?;
1882 let control_handle = RebootMethodsWatcherControlHandle {
1883 inner: this.inner.clone(),
1884 };
1885 Ok(RebootMethodsWatcherRequest::OnReboot {reason: req.reason,
1886
1887 responder: RebootMethodsWatcherOnRebootResponder {
1888 control_handle: std::mem::ManuallyDrop::new(control_handle),
1889 tx_id: header.tx_id,
1890 },
1891 })
1892 }
1893 _ => Err(fidl::Error::UnknownOrdinal {
1894 ordinal: header.ordinal,
1895 protocol_name: <RebootMethodsWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1896 }),
1897 }))
1898 },
1899 )
1900 }
1901}
1902
1903#[derive(Debug)]
1911pub enum RebootMethodsWatcherRequest {
1912 OnReboot { reason: RebootReason, responder: RebootMethodsWatcherOnRebootResponder },
1913}
1914
1915impl RebootMethodsWatcherRequest {
1916 #[allow(irrefutable_let_patterns)]
1917 pub fn into_on_reboot(self) -> Option<(RebootReason, RebootMethodsWatcherOnRebootResponder)> {
1918 if let RebootMethodsWatcherRequest::OnReboot { reason, responder } = self {
1919 Some((reason, responder))
1920 } else {
1921 None
1922 }
1923 }
1924
1925 pub fn method_name(&self) -> &'static str {
1927 match *self {
1928 RebootMethodsWatcherRequest::OnReboot { .. } => "on_reboot",
1929 }
1930 }
1931}
1932
1933#[derive(Debug, Clone)]
1934pub struct RebootMethodsWatcherControlHandle {
1935 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1936}
1937
1938impl fidl::endpoints::ControlHandle for RebootMethodsWatcherControlHandle {
1939 fn shutdown(&self) {
1940 self.inner.shutdown()
1941 }
1942 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1943 self.inner.shutdown_with_epitaph(status)
1944 }
1945
1946 fn is_closed(&self) -> bool {
1947 self.inner.channel().is_closed()
1948 }
1949 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1950 self.inner.channel().on_closed()
1951 }
1952
1953 #[cfg(target_os = "fuchsia")]
1954 fn signal_peer(
1955 &self,
1956 clear_mask: zx::Signals,
1957 set_mask: zx::Signals,
1958 ) -> Result<(), zx_status::Status> {
1959 use fidl::Peered;
1960 self.inner.channel().signal_peer(clear_mask, set_mask)
1961 }
1962}
1963
1964impl RebootMethodsWatcherControlHandle {}
1965
1966#[must_use = "FIDL methods require a response to be sent"]
1967#[derive(Debug)]
1968pub struct RebootMethodsWatcherOnRebootResponder {
1969 control_handle: std::mem::ManuallyDrop<RebootMethodsWatcherControlHandle>,
1970 tx_id: u32,
1971}
1972
1973impl std::ops::Drop for RebootMethodsWatcherOnRebootResponder {
1977 fn drop(&mut self) {
1978 self.control_handle.shutdown();
1979 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1981 }
1982}
1983
1984impl fidl::endpoints::Responder for RebootMethodsWatcherOnRebootResponder {
1985 type ControlHandle = RebootMethodsWatcherControlHandle;
1986
1987 fn control_handle(&self) -> &RebootMethodsWatcherControlHandle {
1988 &self.control_handle
1989 }
1990
1991 fn drop_without_shutdown(mut self) {
1992 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1994 std::mem::forget(self);
1996 }
1997}
1998
1999impl RebootMethodsWatcherOnRebootResponder {
2000 pub fn send(self) -> Result<(), fidl::Error> {
2004 let _result = self.send_raw();
2005 if _result.is_err() {
2006 self.control_handle.shutdown();
2007 }
2008 self.drop_without_shutdown();
2009 _result
2010 }
2011
2012 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2014 let _result = self.send_raw();
2015 self.drop_without_shutdown();
2016 _result
2017 }
2018
2019 fn send_raw(&self) -> Result<(), fidl::Error> {
2020 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2021 (),
2022 self.tx_id,
2023 0x225a5f32436a1b13,
2024 fidl::encoding::DynamicFlags::empty(),
2025 )
2026 }
2027}
2028
2029#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2030pub struct RebootMethodsWatcherRegisterMarker;
2031
2032impl fidl::endpoints::ProtocolMarker for RebootMethodsWatcherRegisterMarker {
2033 type Proxy = RebootMethodsWatcherRegisterProxy;
2034 type RequestStream = RebootMethodsWatcherRegisterRequestStream;
2035 #[cfg(target_os = "fuchsia")]
2036 type SynchronousProxy = RebootMethodsWatcherRegisterSynchronousProxy;
2037
2038 const DEBUG_NAME: &'static str =
2039 "fuchsia.hardware.power.statecontrol.RebootMethodsWatcherRegister";
2040}
2041impl fidl::endpoints::DiscoverableProtocolMarker for RebootMethodsWatcherRegisterMarker {}
2042
2043pub trait RebootMethodsWatcherRegisterProxyInterface: Send + Sync {
2044 fn r#register(
2045 &self,
2046 watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
2047 ) -> Result<(), fidl::Error>;
2048 type RegisterWithAckResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2049 fn r#register_with_ack(
2050 &self,
2051 watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
2052 ) -> Self::RegisterWithAckResponseFut;
2053 type RegisterWatcherResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2054 fn r#register_watcher(
2055 &self,
2056 watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
2057 ) -> Self::RegisterWatcherResponseFut;
2058}
2059#[derive(Debug)]
2060#[cfg(target_os = "fuchsia")]
2061pub struct RebootMethodsWatcherRegisterSynchronousProxy {
2062 client: fidl::client::sync::Client,
2063}
2064
2065#[cfg(target_os = "fuchsia")]
2066impl fidl::endpoints::SynchronousProxy for RebootMethodsWatcherRegisterSynchronousProxy {
2067 type Proxy = RebootMethodsWatcherRegisterProxy;
2068 type Protocol = RebootMethodsWatcherRegisterMarker;
2069
2070 fn from_channel(inner: fidl::Channel) -> Self {
2071 Self::new(inner)
2072 }
2073
2074 fn into_channel(self) -> fidl::Channel {
2075 self.client.into_channel()
2076 }
2077
2078 fn as_channel(&self) -> &fidl::Channel {
2079 self.client.as_channel()
2080 }
2081}
2082
2083#[cfg(target_os = "fuchsia")]
2084impl RebootMethodsWatcherRegisterSynchronousProxy {
2085 pub fn new(channel: fidl::Channel) -> Self {
2086 let protocol_name =
2087 <RebootMethodsWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2088 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2089 }
2090
2091 pub fn into_channel(self) -> fidl::Channel {
2092 self.client.into_channel()
2093 }
2094
2095 pub fn wait_for_event(
2098 &self,
2099 deadline: zx::MonotonicInstant,
2100 ) -> Result<RebootMethodsWatcherRegisterEvent, fidl::Error> {
2101 RebootMethodsWatcherRegisterEvent::decode(self.client.wait_for_event(deadline)?)
2102 }
2103
2104 pub fn r#register(
2112 &self,
2113 mut watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
2114 ) -> Result<(), fidl::Error> {
2115 self.client.send::<RebootMethodsWatcherRegisterRegisterRequest>(
2116 (watcher,),
2117 0x1fd793df8385f937,
2118 fidl::encoding::DynamicFlags::empty(),
2119 )
2120 }
2121
2122 pub fn r#register_with_ack(
2140 &self,
2141 mut watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
2142 ___deadline: zx::MonotonicInstant,
2143 ) -> Result<(), fidl::Error> {
2144 let _response = self.client.send_query::<
2145 RebootMethodsWatcherRegisterRegisterWithAckRequest,
2146 fidl::encoding::EmptyPayload,
2147 >(
2148 (watcher,),
2149 0x243cbccabdac17ec,
2150 fidl::encoding::DynamicFlags::empty(),
2151 ___deadline,
2152 )?;
2153 Ok(_response)
2154 }
2155
2156 pub fn r#register_watcher(
2172 &self,
2173 mut watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
2174 ___deadline: zx::MonotonicInstant,
2175 ) -> Result<(), fidl::Error> {
2176 let _response = self.client.send_query::<
2177 RebootMethodsWatcherRegisterRegisterWatcherRequest,
2178 fidl::encoding::EmptyPayload,
2179 >(
2180 (watcher,),
2181 0x3e6610e78471238,
2182 fidl::encoding::DynamicFlags::empty(),
2183 ___deadline,
2184 )?;
2185 Ok(_response)
2186 }
2187}
2188
2189#[cfg(target_os = "fuchsia")]
2190impl From<RebootMethodsWatcherRegisterSynchronousProxy> for zx::Handle {
2191 fn from(value: RebootMethodsWatcherRegisterSynchronousProxy) -> Self {
2192 value.into_channel().into()
2193 }
2194}
2195
2196#[cfg(target_os = "fuchsia")]
2197impl From<fidl::Channel> for RebootMethodsWatcherRegisterSynchronousProxy {
2198 fn from(value: fidl::Channel) -> Self {
2199 Self::new(value)
2200 }
2201}
2202
2203#[derive(Debug, Clone)]
2204pub struct RebootMethodsWatcherRegisterProxy {
2205 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2206}
2207
2208impl fidl::endpoints::Proxy for RebootMethodsWatcherRegisterProxy {
2209 type Protocol = RebootMethodsWatcherRegisterMarker;
2210
2211 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2212 Self::new(inner)
2213 }
2214
2215 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2216 self.client.into_channel().map_err(|client| Self { client })
2217 }
2218
2219 fn as_channel(&self) -> &::fidl::AsyncChannel {
2220 self.client.as_channel()
2221 }
2222}
2223
2224impl RebootMethodsWatcherRegisterProxy {
2225 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2227 let protocol_name =
2228 <RebootMethodsWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2229 Self { client: fidl::client::Client::new(channel, protocol_name) }
2230 }
2231
2232 pub fn take_event_stream(&self) -> RebootMethodsWatcherRegisterEventStream {
2238 RebootMethodsWatcherRegisterEventStream {
2239 event_receiver: self.client.take_event_receiver(),
2240 }
2241 }
2242
2243 pub fn r#register(
2251 &self,
2252 mut watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
2253 ) -> Result<(), fidl::Error> {
2254 RebootMethodsWatcherRegisterProxyInterface::r#register(self, watcher)
2255 }
2256
2257 pub fn r#register_with_ack(
2275 &self,
2276 mut watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
2277 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2278 RebootMethodsWatcherRegisterProxyInterface::r#register_with_ack(self, watcher)
2279 }
2280
2281 pub fn r#register_watcher(
2297 &self,
2298 mut watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
2299 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2300 RebootMethodsWatcherRegisterProxyInterface::r#register_watcher(self, watcher)
2301 }
2302}
2303
2304impl RebootMethodsWatcherRegisterProxyInterface for RebootMethodsWatcherRegisterProxy {
2305 fn r#register(
2306 &self,
2307 mut watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
2308 ) -> Result<(), fidl::Error> {
2309 self.client.send::<RebootMethodsWatcherRegisterRegisterRequest>(
2310 (watcher,),
2311 0x1fd793df8385f937,
2312 fidl::encoding::DynamicFlags::empty(),
2313 )
2314 }
2315
2316 type RegisterWithAckResponseFut =
2317 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2318 fn r#register_with_ack(
2319 &self,
2320 mut watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
2321 ) -> Self::RegisterWithAckResponseFut {
2322 fn _decode(
2323 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2324 ) -> Result<(), fidl::Error> {
2325 let _response = fidl::client::decode_transaction_body::<
2326 fidl::encoding::EmptyPayload,
2327 fidl::encoding::DefaultFuchsiaResourceDialect,
2328 0x243cbccabdac17ec,
2329 >(_buf?)?;
2330 Ok(_response)
2331 }
2332 self.client.send_query_and_decode::<RebootMethodsWatcherRegisterRegisterWithAckRequest, ()>(
2333 (watcher,),
2334 0x243cbccabdac17ec,
2335 fidl::encoding::DynamicFlags::empty(),
2336 _decode,
2337 )
2338 }
2339
2340 type RegisterWatcherResponseFut =
2341 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2342 fn r#register_watcher(
2343 &self,
2344 mut watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
2345 ) -> Self::RegisterWatcherResponseFut {
2346 fn _decode(
2347 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2348 ) -> Result<(), fidl::Error> {
2349 let _response = fidl::client::decode_transaction_body::<
2350 fidl::encoding::EmptyPayload,
2351 fidl::encoding::DefaultFuchsiaResourceDialect,
2352 0x3e6610e78471238,
2353 >(_buf?)?;
2354 Ok(_response)
2355 }
2356 self.client.send_query_and_decode::<RebootMethodsWatcherRegisterRegisterWatcherRequest, ()>(
2357 (watcher,),
2358 0x3e6610e78471238,
2359 fidl::encoding::DynamicFlags::empty(),
2360 _decode,
2361 )
2362 }
2363}
2364
2365pub struct RebootMethodsWatcherRegisterEventStream {
2366 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2367}
2368
2369impl std::marker::Unpin for RebootMethodsWatcherRegisterEventStream {}
2370
2371impl futures::stream::FusedStream for RebootMethodsWatcherRegisterEventStream {
2372 fn is_terminated(&self) -> bool {
2373 self.event_receiver.is_terminated()
2374 }
2375}
2376
2377impl futures::Stream for RebootMethodsWatcherRegisterEventStream {
2378 type Item = Result<RebootMethodsWatcherRegisterEvent, fidl::Error>;
2379
2380 fn poll_next(
2381 mut self: std::pin::Pin<&mut Self>,
2382 cx: &mut std::task::Context<'_>,
2383 ) -> std::task::Poll<Option<Self::Item>> {
2384 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2385 &mut self.event_receiver,
2386 cx
2387 )?) {
2388 Some(buf) => {
2389 std::task::Poll::Ready(Some(RebootMethodsWatcherRegisterEvent::decode(buf)))
2390 }
2391 None => std::task::Poll::Ready(None),
2392 }
2393 }
2394}
2395
2396#[derive(Debug)]
2397pub enum RebootMethodsWatcherRegisterEvent {}
2398
2399impl RebootMethodsWatcherRegisterEvent {
2400 fn decode(
2402 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2403 ) -> Result<RebootMethodsWatcherRegisterEvent, fidl::Error> {
2404 let (bytes, _handles) = buf.split_mut();
2405 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2406 debug_assert_eq!(tx_header.tx_id, 0);
2407 match tx_header.ordinal {
2408 _ => Err(fidl::Error::UnknownOrdinal {
2409 ordinal: tx_header.ordinal,
2410 protocol_name: <RebootMethodsWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2411 })
2412 }
2413 }
2414}
2415
2416pub struct RebootMethodsWatcherRegisterRequestStream {
2418 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2419 is_terminated: bool,
2420}
2421
2422impl std::marker::Unpin for RebootMethodsWatcherRegisterRequestStream {}
2423
2424impl futures::stream::FusedStream for RebootMethodsWatcherRegisterRequestStream {
2425 fn is_terminated(&self) -> bool {
2426 self.is_terminated
2427 }
2428}
2429
2430impl fidl::endpoints::RequestStream for RebootMethodsWatcherRegisterRequestStream {
2431 type Protocol = RebootMethodsWatcherRegisterMarker;
2432 type ControlHandle = RebootMethodsWatcherRegisterControlHandle;
2433
2434 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2435 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2436 }
2437
2438 fn control_handle(&self) -> Self::ControlHandle {
2439 RebootMethodsWatcherRegisterControlHandle { inner: self.inner.clone() }
2440 }
2441
2442 fn into_inner(
2443 self,
2444 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2445 {
2446 (self.inner, self.is_terminated)
2447 }
2448
2449 fn from_inner(
2450 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2451 is_terminated: bool,
2452 ) -> Self {
2453 Self { inner, is_terminated }
2454 }
2455}
2456
2457impl futures::Stream for RebootMethodsWatcherRegisterRequestStream {
2458 type Item = Result<RebootMethodsWatcherRegisterRequest, fidl::Error>;
2459
2460 fn poll_next(
2461 mut self: std::pin::Pin<&mut Self>,
2462 cx: &mut std::task::Context<'_>,
2463 ) -> std::task::Poll<Option<Self::Item>> {
2464 let this = &mut *self;
2465 if this.inner.check_shutdown(cx) {
2466 this.is_terminated = true;
2467 return std::task::Poll::Ready(None);
2468 }
2469 if this.is_terminated {
2470 panic!("polled RebootMethodsWatcherRegisterRequestStream after completion");
2471 }
2472 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2473 |bytes, handles| {
2474 match this.inner.channel().read_etc(cx, bytes, handles) {
2475 std::task::Poll::Ready(Ok(())) => {}
2476 std::task::Poll::Pending => return std::task::Poll::Pending,
2477 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2478 this.is_terminated = true;
2479 return std::task::Poll::Ready(None);
2480 }
2481 std::task::Poll::Ready(Err(e)) => {
2482 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2483 e.into(),
2484 ))))
2485 }
2486 }
2487
2488 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2490
2491 std::task::Poll::Ready(Some(match header.ordinal {
2492 0x1fd793df8385f937 => {
2493 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2494 let mut req = fidl::new_empty!(RebootMethodsWatcherRegisterRegisterRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2495 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RebootMethodsWatcherRegisterRegisterRequest>(&header, _body_bytes, handles, &mut req)?;
2496 let control_handle = RebootMethodsWatcherRegisterControlHandle {
2497 inner: this.inner.clone(),
2498 };
2499 Ok(RebootMethodsWatcherRegisterRequest::Register {watcher: req.watcher,
2500
2501 control_handle,
2502 })
2503 }
2504 0x243cbccabdac17ec => {
2505 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2506 let mut req = fidl::new_empty!(RebootMethodsWatcherRegisterRegisterWithAckRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2507 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RebootMethodsWatcherRegisterRegisterWithAckRequest>(&header, _body_bytes, handles, &mut req)?;
2508 let control_handle = RebootMethodsWatcherRegisterControlHandle {
2509 inner: this.inner.clone(),
2510 };
2511 Ok(RebootMethodsWatcherRegisterRequest::RegisterWithAck {watcher: req.watcher,
2512
2513 responder: RebootMethodsWatcherRegisterRegisterWithAckResponder {
2514 control_handle: std::mem::ManuallyDrop::new(control_handle),
2515 tx_id: header.tx_id,
2516 },
2517 })
2518 }
2519 0x3e6610e78471238 => {
2520 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2521 let mut req = fidl::new_empty!(RebootMethodsWatcherRegisterRegisterWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2522 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RebootMethodsWatcherRegisterRegisterWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
2523 let control_handle = RebootMethodsWatcherRegisterControlHandle {
2524 inner: this.inner.clone(),
2525 };
2526 Ok(RebootMethodsWatcherRegisterRequest::RegisterWatcher {watcher: req.watcher,
2527
2528 responder: RebootMethodsWatcherRegisterRegisterWatcherResponder {
2529 control_handle: std::mem::ManuallyDrop::new(control_handle),
2530 tx_id: header.tx_id,
2531 },
2532 })
2533 }
2534 _ => Err(fidl::Error::UnknownOrdinal {
2535 ordinal: header.ordinal,
2536 protocol_name: <RebootMethodsWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2537 }),
2538 }))
2539 },
2540 )
2541 }
2542}
2543
2544#[derive(Debug)]
2549pub enum RebootMethodsWatcherRegisterRequest {
2550 Register {
2558 watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
2559 control_handle: RebootMethodsWatcherRegisterControlHandle,
2560 },
2561 RegisterWithAck {
2579 watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
2580 responder: RebootMethodsWatcherRegisterRegisterWithAckResponder,
2581 },
2582 RegisterWatcher {
2598 watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
2599 responder: RebootMethodsWatcherRegisterRegisterWatcherResponder,
2600 },
2601}
2602
2603impl RebootMethodsWatcherRegisterRequest {
2604 #[allow(irrefutable_let_patterns)]
2605 pub fn into_register(
2606 self,
2607 ) -> Option<(
2608 fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
2609 RebootMethodsWatcherRegisterControlHandle,
2610 )> {
2611 if let RebootMethodsWatcherRegisterRequest::Register { watcher, control_handle } = self {
2612 Some((watcher, control_handle))
2613 } else {
2614 None
2615 }
2616 }
2617
2618 #[allow(irrefutable_let_patterns)]
2619 pub fn into_register_with_ack(
2620 self,
2621 ) -> Option<(
2622 fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
2623 RebootMethodsWatcherRegisterRegisterWithAckResponder,
2624 )> {
2625 if let RebootMethodsWatcherRegisterRequest::RegisterWithAck { watcher, responder } = self {
2626 Some((watcher, responder))
2627 } else {
2628 None
2629 }
2630 }
2631
2632 #[allow(irrefutable_let_patterns)]
2633 pub fn into_register_watcher(
2634 self,
2635 ) -> Option<(
2636 fidl::endpoints::ClientEnd<RebootWatcherMarker>,
2637 RebootMethodsWatcherRegisterRegisterWatcherResponder,
2638 )> {
2639 if let RebootMethodsWatcherRegisterRequest::RegisterWatcher { watcher, responder } = self {
2640 Some((watcher, responder))
2641 } else {
2642 None
2643 }
2644 }
2645
2646 pub fn method_name(&self) -> &'static str {
2648 match *self {
2649 RebootMethodsWatcherRegisterRequest::Register { .. } => "register",
2650 RebootMethodsWatcherRegisterRequest::RegisterWithAck { .. } => "register_with_ack",
2651 RebootMethodsWatcherRegisterRequest::RegisterWatcher { .. } => "register_watcher",
2652 }
2653 }
2654}
2655
2656#[derive(Debug, Clone)]
2657pub struct RebootMethodsWatcherRegisterControlHandle {
2658 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2659}
2660
2661impl fidl::endpoints::ControlHandle for RebootMethodsWatcherRegisterControlHandle {
2662 fn shutdown(&self) {
2663 self.inner.shutdown()
2664 }
2665 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2666 self.inner.shutdown_with_epitaph(status)
2667 }
2668
2669 fn is_closed(&self) -> bool {
2670 self.inner.channel().is_closed()
2671 }
2672 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2673 self.inner.channel().on_closed()
2674 }
2675
2676 #[cfg(target_os = "fuchsia")]
2677 fn signal_peer(
2678 &self,
2679 clear_mask: zx::Signals,
2680 set_mask: zx::Signals,
2681 ) -> Result<(), zx_status::Status> {
2682 use fidl::Peered;
2683 self.inner.channel().signal_peer(clear_mask, set_mask)
2684 }
2685}
2686
2687impl RebootMethodsWatcherRegisterControlHandle {}
2688
2689#[must_use = "FIDL methods require a response to be sent"]
2690#[derive(Debug)]
2691pub struct RebootMethodsWatcherRegisterRegisterWithAckResponder {
2692 control_handle: std::mem::ManuallyDrop<RebootMethodsWatcherRegisterControlHandle>,
2693 tx_id: u32,
2694}
2695
2696impl std::ops::Drop for RebootMethodsWatcherRegisterRegisterWithAckResponder {
2700 fn drop(&mut self) {
2701 self.control_handle.shutdown();
2702 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2704 }
2705}
2706
2707impl fidl::endpoints::Responder for RebootMethodsWatcherRegisterRegisterWithAckResponder {
2708 type ControlHandle = RebootMethodsWatcherRegisterControlHandle;
2709
2710 fn control_handle(&self) -> &RebootMethodsWatcherRegisterControlHandle {
2711 &self.control_handle
2712 }
2713
2714 fn drop_without_shutdown(mut self) {
2715 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2717 std::mem::forget(self);
2719 }
2720}
2721
2722impl RebootMethodsWatcherRegisterRegisterWithAckResponder {
2723 pub fn send(self) -> Result<(), fidl::Error> {
2727 let _result = self.send_raw();
2728 if _result.is_err() {
2729 self.control_handle.shutdown();
2730 }
2731 self.drop_without_shutdown();
2732 _result
2733 }
2734
2735 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2737 let _result = self.send_raw();
2738 self.drop_without_shutdown();
2739 _result
2740 }
2741
2742 fn send_raw(&self) -> Result<(), fidl::Error> {
2743 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2744 (),
2745 self.tx_id,
2746 0x243cbccabdac17ec,
2747 fidl::encoding::DynamicFlags::empty(),
2748 )
2749 }
2750}
2751
2752#[must_use = "FIDL methods require a response to be sent"]
2753#[derive(Debug)]
2754pub struct RebootMethodsWatcherRegisterRegisterWatcherResponder {
2755 control_handle: std::mem::ManuallyDrop<RebootMethodsWatcherRegisterControlHandle>,
2756 tx_id: u32,
2757}
2758
2759impl std::ops::Drop for RebootMethodsWatcherRegisterRegisterWatcherResponder {
2763 fn drop(&mut self) {
2764 self.control_handle.shutdown();
2765 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2767 }
2768}
2769
2770impl fidl::endpoints::Responder for RebootMethodsWatcherRegisterRegisterWatcherResponder {
2771 type ControlHandle = RebootMethodsWatcherRegisterControlHandle;
2772
2773 fn control_handle(&self) -> &RebootMethodsWatcherRegisterControlHandle {
2774 &self.control_handle
2775 }
2776
2777 fn drop_without_shutdown(mut self) {
2778 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2780 std::mem::forget(self);
2782 }
2783}
2784
2785impl RebootMethodsWatcherRegisterRegisterWatcherResponder {
2786 pub fn send(self) -> Result<(), fidl::Error> {
2790 let _result = self.send_raw();
2791 if _result.is_err() {
2792 self.control_handle.shutdown();
2793 }
2794 self.drop_without_shutdown();
2795 _result
2796 }
2797
2798 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2800 let _result = self.send_raw();
2801 self.drop_without_shutdown();
2802 _result
2803 }
2804
2805 fn send_raw(&self) -> Result<(), fidl::Error> {
2806 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2807 (),
2808 self.tx_id,
2809 0x3e6610e78471238,
2810 fidl::encoding::DynamicFlags::empty(),
2811 )
2812 }
2813}
2814
2815#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2816pub struct RebootWatcherMarker;
2817
2818impl fidl::endpoints::ProtocolMarker for RebootWatcherMarker {
2819 type Proxy = RebootWatcherProxy;
2820 type RequestStream = RebootWatcherRequestStream;
2821 #[cfg(target_os = "fuchsia")]
2822 type SynchronousProxy = RebootWatcherSynchronousProxy;
2823
2824 const DEBUG_NAME: &'static str = "(anonymous) RebootWatcher";
2825}
2826
2827pub trait RebootWatcherProxyInterface: Send + Sync {
2828 type OnRebootResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2829 fn r#on_reboot(&self, options: &RebootOptions) -> Self::OnRebootResponseFut;
2830}
2831#[derive(Debug)]
2832#[cfg(target_os = "fuchsia")]
2833pub struct RebootWatcherSynchronousProxy {
2834 client: fidl::client::sync::Client,
2835}
2836
2837#[cfg(target_os = "fuchsia")]
2838impl fidl::endpoints::SynchronousProxy for RebootWatcherSynchronousProxy {
2839 type Proxy = RebootWatcherProxy;
2840 type Protocol = RebootWatcherMarker;
2841
2842 fn from_channel(inner: fidl::Channel) -> Self {
2843 Self::new(inner)
2844 }
2845
2846 fn into_channel(self) -> fidl::Channel {
2847 self.client.into_channel()
2848 }
2849
2850 fn as_channel(&self) -> &fidl::Channel {
2851 self.client.as_channel()
2852 }
2853}
2854
2855#[cfg(target_os = "fuchsia")]
2856impl RebootWatcherSynchronousProxy {
2857 pub fn new(channel: fidl::Channel) -> Self {
2858 let protocol_name = <RebootWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2859 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2860 }
2861
2862 pub fn into_channel(self) -> fidl::Channel {
2863 self.client.into_channel()
2864 }
2865
2866 pub fn wait_for_event(
2869 &self,
2870 deadline: zx::MonotonicInstant,
2871 ) -> Result<RebootWatcherEvent, fidl::Error> {
2872 RebootWatcherEvent::decode(self.client.wait_for_event(deadline)?)
2873 }
2874
2875 pub fn r#on_reboot(
2876 &self,
2877 mut options: &RebootOptions,
2878 ___deadline: zx::MonotonicInstant,
2879 ) -> Result<(), fidl::Error> {
2880 let _response =
2881 self.client.send_query::<RebootWatcherOnRebootRequest, fidl::encoding::EmptyPayload>(
2882 (options,),
2883 0x5334bbbe774f13c3,
2884 fidl::encoding::DynamicFlags::empty(),
2885 ___deadline,
2886 )?;
2887 Ok(_response)
2888 }
2889}
2890
2891#[cfg(target_os = "fuchsia")]
2892impl From<RebootWatcherSynchronousProxy> for zx::Handle {
2893 fn from(value: RebootWatcherSynchronousProxy) -> Self {
2894 value.into_channel().into()
2895 }
2896}
2897
2898#[cfg(target_os = "fuchsia")]
2899impl From<fidl::Channel> for RebootWatcherSynchronousProxy {
2900 fn from(value: fidl::Channel) -> Self {
2901 Self::new(value)
2902 }
2903}
2904
2905#[derive(Debug, Clone)]
2906pub struct RebootWatcherProxy {
2907 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2908}
2909
2910impl fidl::endpoints::Proxy for RebootWatcherProxy {
2911 type Protocol = RebootWatcherMarker;
2912
2913 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2914 Self::new(inner)
2915 }
2916
2917 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2918 self.client.into_channel().map_err(|client| Self { client })
2919 }
2920
2921 fn as_channel(&self) -> &::fidl::AsyncChannel {
2922 self.client.as_channel()
2923 }
2924}
2925
2926impl RebootWatcherProxy {
2927 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2929 let protocol_name = <RebootWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2930 Self { client: fidl::client::Client::new(channel, protocol_name) }
2931 }
2932
2933 pub fn take_event_stream(&self) -> RebootWatcherEventStream {
2939 RebootWatcherEventStream { event_receiver: self.client.take_event_receiver() }
2940 }
2941
2942 pub fn r#on_reboot(
2943 &self,
2944 mut options: &RebootOptions,
2945 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2946 RebootWatcherProxyInterface::r#on_reboot(self, options)
2947 }
2948}
2949
2950impl RebootWatcherProxyInterface for RebootWatcherProxy {
2951 type OnRebootResponseFut =
2952 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2953 fn r#on_reboot(&self, mut options: &RebootOptions) -> Self::OnRebootResponseFut {
2954 fn _decode(
2955 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2956 ) -> Result<(), fidl::Error> {
2957 let _response = fidl::client::decode_transaction_body::<
2958 fidl::encoding::EmptyPayload,
2959 fidl::encoding::DefaultFuchsiaResourceDialect,
2960 0x5334bbbe774f13c3,
2961 >(_buf?)?;
2962 Ok(_response)
2963 }
2964 self.client.send_query_and_decode::<RebootWatcherOnRebootRequest, ()>(
2965 (options,),
2966 0x5334bbbe774f13c3,
2967 fidl::encoding::DynamicFlags::empty(),
2968 _decode,
2969 )
2970 }
2971}
2972
2973pub struct RebootWatcherEventStream {
2974 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2975}
2976
2977impl std::marker::Unpin for RebootWatcherEventStream {}
2978
2979impl futures::stream::FusedStream for RebootWatcherEventStream {
2980 fn is_terminated(&self) -> bool {
2981 self.event_receiver.is_terminated()
2982 }
2983}
2984
2985impl futures::Stream for RebootWatcherEventStream {
2986 type Item = Result<RebootWatcherEvent, fidl::Error>;
2987
2988 fn poll_next(
2989 mut self: std::pin::Pin<&mut Self>,
2990 cx: &mut std::task::Context<'_>,
2991 ) -> std::task::Poll<Option<Self::Item>> {
2992 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2993 &mut self.event_receiver,
2994 cx
2995 )?) {
2996 Some(buf) => std::task::Poll::Ready(Some(RebootWatcherEvent::decode(buf))),
2997 None => std::task::Poll::Ready(None),
2998 }
2999 }
3000}
3001
3002#[derive(Debug)]
3003pub enum RebootWatcherEvent {}
3004
3005impl RebootWatcherEvent {
3006 fn decode(
3008 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3009 ) -> Result<RebootWatcherEvent, fidl::Error> {
3010 let (bytes, _handles) = buf.split_mut();
3011 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3012 debug_assert_eq!(tx_header.tx_id, 0);
3013 match tx_header.ordinal {
3014 _ => Err(fidl::Error::UnknownOrdinal {
3015 ordinal: tx_header.ordinal,
3016 protocol_name: <RebootWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3017 }),
3018 }
3019 }
3020}
3021
3022pub struct RebootWatcherRequestStream {
3024 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3025 is_terminated: bool,
3026}
3027
3028impl std::marker::Unpin for RebootWatcherRequestStream {}
3029
3030impl futures::stream::FusedStream for RebootWatcherRequestStream {
3031 fn is_terminated(&self) -> bool {
3032 self.is_terminated
3033 }
3034}
3035
3036impl fidl::endpoints::RequestStream for RebootWatcherRequestStream {
3037 type Protocol = RebootWatcherMarker;
3038 type ControlHandle = RebootWatcherControlHandle;
3039
3040 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3041 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3042 }
3043
3044 fn control_handle(&self) -> Self::ControlHandle {
3045 RebootWatcherControlHandle { inner: self.inner.clone() }
3046 }
3047
3048 fn into_inner(
3049 self,
3050 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3051 {
3052 (self.inner, self.is_terminated)
3053 }
3054
3055 fn from_inner(
3056 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3057 is_terminated: bool,
3058 ) -> Self {
3059 Self { inner, is_terminated }
3060 }
3061}
3062
3063impl futures::Stream for RebootWatcherRequestStream {
3064 type Item = Result<RebootWatcherRequest, fidl::Error>;
3065
3066 fn poll_next(
3067 mut self: std::pin::Pin<&mut Self>,
3068 cx: &mut std::task::Context<'_>,
3069 ) -> std::task::Poll<Option<Self::Item>> {
3070 let this = &mut *self;
3071 if this.inner.check_shutdown(cx) {
3072 this.is_terminated = true;
3073 return std::task::Poll::Ready(None);
3074 }
3075 if this.is_terminated {
3076 panic!("polled RebootWatcherRequestStream after completion");
3077 }
3078 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3079 |bytes, handles| {
3080 match this.inner.channel().read_etc(cx, bytes, handles) {
3081 std::task::Poll::Ready(Ok(())) => {}
3082 std::task::Poll::Pending => return std::task::Poll::Pending,
3083 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3084 this.is_terminated = true;
3085 return std::task::Poll::Ready(None);
3086 }
3087 std::task::Poll::Ready(Err(e)) => {
3088 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3089 e.into(),
3090 ))))
3091 }
3092 }
3093
3094 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3096
3097 std::task::Poll::Ready(Some(match header.ordinal {
3098 0x5334bbbe774f13c3 => {
3099 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3100 let mut req = fidl::new_empty!(
3101 RebootWatcherOnRebootRequest,
3102 fidl::encoding::DefaultFuchsiaResourceDialect
3103 );
3104 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RebootWatcherOnRebootRequest>(&header, _body_bytes, handles, &mut req)?;
3105 let control_handle =
3106 RebootWatcherControlHandle { inner: this.inner.clone() };
3107 Ok(RebootWatcherRequest::OnReboot {
3108 options: req.options,
3109
3110 responder: RebootWatcherOnRebootResponder {
3111 control_handle: std::mem::ManuallyDrop::new(control_handle),
3112 tx_id: header.tx_id,
3113 },
3114 })
3115 }
3116 _ => Err(fidl::Error::UnknownOrdinal {
3117 ordinal: header.ordinal,
3118 protocol_name:
3119 <RebootWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3120 }),
3121 }))
3122 },
3123 )
3124 }
3125}
3126
3127#[derive(Debug)]
3133pub enum RebootWatcherRequest {
3134 OnReboot { options: RebootOptions, responder: RebootWatcherOnRebootResponder },
3135}
3136
3137impl RebootWatcherRequest {
3138 #[allow(irrefutable_let_patterns)]
3139 pub fn into_on_reboot(self) -> Option<(RebootOptions, RebootWatcherOnRebootResponder)> {
3140 if let RebootWatcherRequest::OnReboot { options, responder } = self {
3141 Some((options, responder))
3142 } else {
3143 None
3144 }
3145 }
3146
3147 pub fn method_name(&self) -> &'static str {
3149 match *self {
3150 RebootWatcherRequest::OnReboot { .. } => "on_reboot",
3151 }
3152 }
3153}
3154
3155#[derive(Debug, Clone)]
3156pub struct RebootWatcherControlHandle {
3157 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3158}
3159
3160impl fidl::endpoints::ControlHandle for RebootWatcherControlHandle {
3161 fn shutdown(&self) {
3162 self.inner.shutdown()
3163 }
3164 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3165 self.inner.shutdown_with_epitaph(status)
3166 }
3167
3168 fn is_closed(&self) -> bool {
3169 self.inner.channel().is_closed()
3170 }
3171 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3172 self.inner.channel().on_closed()
3173 }
3174
3175 #[cfg(target_os = "fuchsia")]
3176 fn signal_peer(
3177 &self,
3178 clear_mask: zx::Signals,
3179 set_mask: zx::Signals,
3180 ) -> Result<(), zx_status::Status> {
3181 use fidl::Peered;
3182 self.inner.channel().signal_peer(clear_mask, set_mask)
3183 }
3184}
3185
3186impl RebootWatcherControlHandle {}
3187
3188#[must_use = "FIDL methods require a response to be sent"]
3189#[derive(Debug)]
3190pub struct RebootWatcherOnRebootResponder {
3191 control_handle: std::mem::ManuallyDrop<RebootWatcherControlHandle>,
3192 tx_id: u32,
3193}
3194
3195impl std::ops::Drop for RebootWatcherOnRebootResponder {
3199 fn drop(&mut self) {
3200 self.control_handle.shutdown();
3201 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3203 }
3204}
3205
3206impl fidl::endpoints::Responder for RebootWatcherOnRebootResponder {
3207 type ControlHandle = RebootWatcherControlHandle;
3208
3209 fn control_handle(&self) -> &RebootWatcherControlHandle {
3210 &self.control_handle
3211 }
3212
3213 fn drop_without_shutdown(mut self) {
3214 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3216 std::mem::forget(self);
3218 }
3219}
3220
3221impl RebootWatcherOnRebootResponder {
3222 pub fn send(self) -> Result<(), fidl::Error> {
3226 let _result = self.send_raw();
3227 if _result.is_err() {
3228 self.control_handle.shutdown();
3229 }
3230 self.drop_without_shutdown();
3231 _result
3232 }
3233
3234 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3236 let _result = self.send_raw();
3237 self.drop_without_shutdown();
3238 _result
3239 }
3240
3241 fn send_raw(&self) -> Result<(), fidl::Error> {
3242 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3243 (),
3244 self.tx_id,
3245 0x5334bbbe774f13c3,
3246 fidl::encoding::DynamicFlags::empty(),
3247 )
3248 }
3249}
3250
3251mod internal {
3252 use super::*;
3253
3254 impl fidl::encoding::ResourceTypeMarker for AdminMexecRequest {
3255 type Borrowed<'a> = &'a mut Self;
3256 fn take_or_borrow<'a>(
3257 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3258 ) -> Self::Borrowed<'a> {
3259 value
3260 }
3261 }
3262
3263 unsafe impl fidl::encoding::TypeMarker for AdminMexecRequest {
3264 type Owned = Self;
3265
3266 #[inline(always)]
3267 fn inline_align(_context: fidl::encoding::Context) -> usize {
3268 4
3269 }
3270
3271 #[inline(always)]
3272 fn inline_size(_context: fidl::encoding::Context) -> usize {
3273 8
3274 }
3275 }
3276
3277 unsafe impl
3278 fidl::encoding::Encode<AdminMexecRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
3279 for &mut AdminMexecRequest
3280 {
3281 #[inline]
3282 unsafe fn encode(
3283 self,
3284 encoder: &mut fidl::encoding::Encoder<
3285 '_,
3286 fidl::encoding::DefaultFuchsiaResourceDialect,
3287 >,
3288 offset: usize,
3289 _depth: fidl::encoding::Depth,
3290 ) -> fidl::Result<()> {
3291 encoder.debug_check_bounds::<AdminMexecRequest>(offset);
3292 fidl::encoding::Encode::<AdminMexecRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3294 (
3295 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.kernel_zbi),
3296 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.data_zbi),
3297 ),
3298 encoder, offset, _depth
3299 )
3300 }
3301 }
3302 unsafe impl<
3303 T0: fidl::encoding::Encode<
3304 fidl::encoding::HandleType<
3305 fidl::Vmo,
3306 { fidl::ObjectType::VMO.into_raw() },
3307 2147483648,
3308 >,
3309 fidl::encoding::DefaultFuchsiaResourceDialect,
3310 >,
3311 T1: fidl::encoding::Encode<
3312 fidl::encoding::HandleType<
3313 fidl::Vmo,
3314 { fidl::ObjectType::VMO.into_raw() },
3315 2147483648,
3316 >,
3317 fidl::encoding::DefaultFuchsiaResourceDialect,
3318 >,
3319 >
3320 fidl::encoding::Encode<AdminMexecRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
3321 for (T0, T1)
3322 {
3323 #[inline]
3324 unsafe fn encode(
3325 self,
3326 encoder: &mut fidl::encoding::Encoder<
3327 '_,
3328 fidl::encoding::DefaultFuchsiaResourceDialect,
3329 >,
3330 offset: usize,
3331 depth: fidl::encoding::Depth,
3332 ) -> fidl::Result<()> {
3333 encoder.debug_check_bounds::<AdminMexecRequest>(offset);
3334 self.0.encode(encoder, offset + 0, depth)?;
3338 self.1.encode(encoder, offset + 4, depth)?;
3339 Ok(())
3340 }
3341 }
3342
3343 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3344 for AdminMexecRequest
3345 {
3346 #[inline(always)]
3347 fn new_empty() -> Self {
3348 Self {
3349 kernel_zbi: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3350 data_zbi: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3351 }
3352 }
3353
3354 #[inline]
3355 unsafe fn decode(
3356 &mut self,
3357 decoder: &mut fidl::encoding::Decoder<
3358 '_,
3359 fidl::encoding::DefaultFuchsiaResourceDialect,
3360 >,
3361 offset: usize,
3362 _depth: fidl::encoding::Depth,
3363 ) -> fidl::Result<()> {
3364 decoder.debug_check_bounds::<Self>(offset);
3365 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.kernel_zbi, decoder, offset + 0, _depth)?;
3367 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.data_zbi, decoder, offset + 4, _depth)?;
3368 Ok(())
3369 }
3370 }
3371
3372 impl fidl::encoding::ResourceTypeMarker for RebootMethodsWatcherRegisterRegisterRequest {
3373 type Borrowed<'a> = &'a mut Self;
3374 fn take_or_borrow<'a>(
3375 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3376 ) -> Self::Borrowed<'a> {
3377 value
3378 }
3379 }
3380
3381 unsafe impl fidl::encoding::TypeMarker for RebootMethodsWatcherRegisterRegisterRequest {
3382 type Owned = Self;
3383
3384 #[inline(always)]
3385 fn inline_align(_context: fidl::encoding::Context) -> usize {
3386 4
3387 }
3388
3389 #[inline(always)]
3390 fn inline_size(_context: fidl::encoding::Context) -> usize {
3391 4
3392 }
3393 }
3394
3395 unsafe impl
3396 fidl::encoding::Encode<
3397 RebootMethodsWatcherRegisterRegisterRequest,
3398 fidl::encoding::DefaultFuchsiaResourceDialect,
3399 > for &mut RebootMethodsWatcherRegisterRegisterRequest
3400 {
3401 #[inline]
3402 unsafe fn encode(
3403 self,
3404 encoder: &mut fidl::encoding::Encoder<
3405 '_,
3406 fidl::encoding::DefaultFuchsiaResourceDialect,
3407 >,
3408 offset: usize,
3409 _depth: fidl::encoding::Depth,
3410 ) -> fidl::Result<()> {
3411 encoder.debug_check_bounds::<RebootMethodsWatcherRegisterRegisterRequest>(offset);
3412 fidl::encoding::Encode::<
3414 RebootMethodsWatcherRegisterRegisterRequest,
3415 fidl::encoding::DefaultFuchsiaResourceDialect,
3416 >::encode(
3417 (
3418 <fidl::encoding::Endpoint<
3419 fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
3420 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3421 &mut self.watcher
3422 ),
3423 ),
3424 encoder,
3425 offset,
3426 _depth,
3427 )
3428 }
3429 }
3430 unsafe impl<
3431 T0: fidl::encoding::Encode<
3432 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>>,
3433 fidl::encoding::DefaultFuchsiaResourceDialect,
3434 >,
3435 >
3436 fidl::encoding::Encode<
3437 RebootMethodsWatcherRegisterRegisterRequest,
3438 fidl::encoding::DefaultFuchsiaResourceDialect,
3439 > for (T0,)
3440 {
3441 #[inline]
3442 unsafe fn encode(
3443 self,
3444 encoder: &mut fidl::encoding::Encoder<
3445 '_,
3446 fidl::encoding::DefaultFuchsiaResourceDialect,
3447 >,
3448 offset: usize,
3449 depth: fidl::encoding::Depth,
3450 ) -> fidl::Result<()> {
3451 encoder.debug_check_bounds::<RebootMethodsWatcherRegisterRegisterRequest>(offset);
3452 self.0.encode(encoder, offset + 0, depth)?;
3456 Ok(())
3457 }
3458 }
3459
3460 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3461 for RebootMethodsWatcherRegisterRegisterRequest
3462 {
3463 #[inline(always)]
3464 fn new_empty() -> Self {
3465 Self {
3466 watcher: fidl::new_empty!(
3467 fidl::encoding::Endpoint<
3468 fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
3469 >,
3470 fidl::encoding::DefaultFuchsiaResourceDialect
3471 ),
3472 }
3473 }
3474
3475 #[inline]
3476 unsafe fn decode(
3477 &mut self,
3478 decoder: &mut fidl::encoding::Decoder<
3479 '_,
3480 fidl::encoding::DefaultFuchsiaResourceDialect,
3481 >,
3482 offset: usize,
3483 _depth: fidl::encoding::Depth,
3484 ) -> fidl::Result<()> {
3485 decoder.debug_check_bounds::<Self>(offset);
3486 fidl::decode!(
3488 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>>,
3489 fidl::encoding::DefaultFuchsiaResourceDialect,
3490 &mut self.watcher,
3491 decoder,
3492 offset + 0,
3493 _depth
3494 )?;
3495 Ok(())
3496 }
3497 }
3498
3499 impl fidl::encoding::ResourceTypeMarker for RebootMethodsWatcherRegisterRegisterWatcherRequest {
3500 type Borrowed<'a> = &'a mut Self;
3501 fn take_or_borrow<'a>(
3502 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3503 ) -> Self::Borrowed<'a> {
3504 value
3505 }
3506 }
3507
3508 unsafe impl fidl::encoding::TypeMarker for RebootMethodsWatcherRegisterRegisterWatcherRequest {
3509 type Owned = Self;
3510
3511 #[inline(always)]
3512 fn inline_align(_context: fidl::encoding::Context) -> usize {
3513 4
3514 }
3515
3516 #[inline(always)]
3517 fn inline_size(_context: fidl::encoding::Context) -> usize {
3518 4
3519 }
3520 }
3521
3522 unsafe impl
3523 fidl::encoding::Encode<
3524 RebootMethodsWatcherRegisterRegisterWatcherRequest,
3525 fidl::encoding::DefaultFuchsiaResourceDialect,
3526 > for &mut RebootMethodsWatcherRegisterRegisterWatcherRequest
3527 {
3528 #[inline]
3529 unsafe fn encode(
3530 self,
3531 encoder: &mut fidl::encoding::Encoder<
3532 '_,
3533 fidl::encoding::DefaultFuchsiaResourceDialect,
3534 >,
3535 offset: usize,
3536 _depth: fidl::encoding::Depth,
3537 ) -> fidl::Result<()> {
3538 encoder
3539 .debug_check_bounds::<RebootMethodsWatcherRegisterRegisterWatcherRequest>(offset);
3540 fidl::encoding::Encode::<RebootMethodsWatcherRegisterRegisterWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3542 (
3543 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
3544 ),
3545 encoder, offset, _depth
3546 )
3547 }
3548 }
3549 unsafe impl<
3550 T0: fidl::encoding::Encode<
3551 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootWatcherMarker>>,
3552 fidl::encoding::DefaultFuchsiaResourceDialect,
3553 >,
3554 >
3555 fidl::encoding::Encode<
3556 RebootMethodsWatcherRegisterRegisterWatcherRequest,
3557 fidl::encoding::DefaultFuchsiaResourceDialect,
3558 > for (T0,)
3559 {
3560 #[inline]
3561 unsafe fn encode(
3562 self,
3563 encoder: &mut fidl::encoding::Encoder<
3564 '_,
3565 fidl::encoding::DefaultFuchsiaResourceDialect,
3566 >,
3567 offset: usize,
3568 depth: fidl::encoding::Depth,
3569 ) -> fidl::Result<()> {
3570 encoder
3571 .debug_check_bounds::<RebootMethodsWatcherRegisterRegisterWatcherRequest>(offset);
3572 self.0.encode(encoder, offset + 0, depth)?;
3576 Ok(())
3577 }
3578 }
3579
3580 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3581 for RebootMethodsWatcherRegisterRegisterWatcherRequest
3582 {
3583 #[inline(always)]
3584 fn new_empty() -> Self {
3585 Self {
3586 watcher: fidl::new_empty!(
3587 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootWatcherMarker>>,
3588 fidl::encoding::DefaultFuchsiaResourceDialect
3589 ),
3590 }
3591 }
3592
3593 #[inline]
3594 unsafe fn decode(
3595 &mut self,
3596 decoder: &mut fidl::encoding::Decoder<
3597 '_,
3598 fidl::encoding::DefaultFuchsiaResourceDialect,
3599 >,
3600 offset: usize,
3601 _depth: fidl::encoding::Depth,
3602 ) -> fidl::Result<()> {
3603 decoder.debug_check_bounds::<Self>(offset);
3604 fidl::decode!(
3606 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootWatcherMarker>>,
3607 fidl::encoding::DefaultFuchsiaResourceDialect,
3608 &mut self.watcher,
3609 decoder,
3610 offset + 0,
3611 _depth
3612 )?;
3613 Ok(())
3614 }
3615 }
3616
3617 impl fidl::encoding::ResourceTypeMarker for RebootMethodsWatcherRegisterRegisterWithAckRequest {
3618 type Borrowed<'a> = &'a mut Self;
3619 fn take_or_borrow<'a>(
3620 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3621 ) -> Self::Borrowed<'a> {
3622 value
3623 }
3624 }
3625
3626 unsafe impl fidl::encoding::TypeMarker for RebootMethodsWatcherRegisterRegisterWithAckRequest {
3627 type Owned = Self;
3628
3629 #[inline(always)]
3630 fn inline_align(_context: fidl::encoding::Context) -> usize {
3631 4
3632 }
3633
3634 #[inline(always)]
3635 fn inline_size(_context: fidl::encoding::Context) -> usize {
3636 4
3637 }
3638 }
3639
3640 unsafe impl
3641 fidl::encoding::Encode<
3642 RebootMethodsWatcherRegisterRegisterWithAckRequest,
3643 fidl::encoding::DefaultFuchsiaResourceDialect,
3644 > for &mut RebootMethodsWatcherRegisterRegisterWithAckRequest
3645 {
3646 #[inline]
3647 unsafe fn encode(
3648 self,
3649 encoder: &mut fidl::encoding::Encoder<
3650 '_,
3651 fidl::encoding::DefaultFuchsiaResourceDialect,
3652 >,
3653 offset: usize,
3654 _depth: fidl::encoding::Depth,
3655 ) -> fidl::Result<()> {
3656 encoder
3657 .debug_check_bounds::<RebootMethodsWatcherRegisterRegisterWithAckRequest>(offset);
3658 fidl::encoding::Encode::<
3660 RebootMethodsWatcherRegisterRegisterWithAckRequest,
3661 fidl::encoding::DefaultFuchsiaResourceDialect,
3662 >::encode(
3663 (
3664 <fidl::encoding::Endpoint<
3665 fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
3666 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3667 &mut self.watcher
3668 ),
3669 ),
3670 encoder,
3671 offset,
3672 _depth,
3673 )
3674 }
3675 }
3676 unsafe impl<
3677 T0: fidl::encoding::Encode<
3678 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>>,
3679 fidl::encoding::DefaultFuchsiaResourceDialect,
3680 >,
3681 >
3682 fidl::encoding::Encode<
3683 RebootMethodsWatcherRegisterRegisterWithAckRequest,
3684 fidl::encoding::DefaultFuchsiaResourceDialect,
3685 > for (T0,)
3686 {
3687 #[inline]
3688 unsafe fn encode(
3689 self,
3690 encoder: &mut fidl::encoding::Encoder<
3691 '_,
3692 fidl::encoding::DefaultFuchsiaResourceDialect,
3693 >,
3694 offset: usize,
3695 depth: fidl::encoding::Depth,
3696 ) -> fidl::Result<()> {
3697 encoder
3698 .debug_check_bounds::<RebootMethodsWatcherRegisterRegisterWithAckRequest>(offset);
3699 self.0.encode(encoder, offset + 0, depth)?;
3703 Ok(())
3704 }
3705 }
3706
3707 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3708 for RebootMethodsWatcherRegisterRegisterWithAckRequest
3709 {
3710 #[inline(always)]
3711 fn new_empty() -> Self {
3712 Self {
3713 watcher: fidl::new_empty!(
3714 fidl::encoding::Endpoint<
3715 fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
3716 >,
3717 fidl::encoding::DefaultFuchsiaResourceDialect
3718 ),
3719 }
3720 }
3721
3722 #[inline]
3723 unsafe fn decode(
3724 &mut self,
3725 decoder: &mut fidl::encoding::Decoder<
3726 '_,
3727 fidl::encoding::DefaultFuchsiaResourceDialect,
3728 >,
3729 offset: usize,
3730 _depth: fidl::encoding::Depth,
3731 ) -> fidl::Result<()> {
3732 decoder.debug_check_bounds::<Self>(offset);
3733 fidl::decode!(
3735 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>>,
3736 fidl::encoding::DefaultFuchsiaResourceDialect,
3737 &mut self.watcher,
3738 decoder,
3739 offset + 0,
3740 _depth
3741 )?;
3742 Ok(())
3743 }
3744 }
3745}